00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "powerpoint.h"
00021 #include "presentation.h"
00022 #include "slide.h"
00023 #include "pole.h"
00024 #include "objects.h"
00025
00026 #include <iostream>
00027 #include <iomanip>
00028
00029 #include <vector>
00030 #include <map>
00031
00032 #include <kdebug.h>
00033 #include <stdio.h>
00034
00035
00036 namespace{
00037
00038 static inline unsigned long readU16( const void* p )
00039 {
00040 const unsigned char* ptr = (const unsigned char*) p;
00041 return ptr[0]+(ptr[1]<<8);
00042 }
00043
00044 static inline signed long readS16( const void* p )
00045 {
00046 const unsigned char* ptr = (const unsigned char*) p;
00047 return ptr[0]+(ptr[1]<<8);
00048 }
00049
00050 static inline unsigned long readU32( const void* p )
00051 {
00052 const unsigned char* ptr = (const unsigned char*) p;
00053 return ptr[0]+(ptr[1]<<8)+(ptr[2]<<16)+(ptr[3]<<24);
00054 }
00055
00056 static inline signed long readS32( const void* p )
00057 {
00058 const unsigned char* ptr = (const unsigned char*) p;
00059 return ptr[0]+(ptr[1]<<8)+(ptr[2]<<16)+(ptr[3]<<24);
00060 }
00061
00062 }
00063
00064 namespace Libppt
00065 {
00066 std::ostream& operator<<( std::ostream& s, UString ustring )
00067 {
00068 char* str = ustring.ascii();
00069 s << str;
00070 return s;
00071 }
00072
00073 }
00074
00075
00076 using namespace Libppt;
00077
00078
00079
00080
00081 const unsigned int Record::id = 0;
00082
00083 Record::Record()
00084 {
00085 stream_position = 0;
00086 record_instance = 0;
00087 record_parent = 0;
00088 }
00089
00090 Record::~Record()
00091 {
00092 }
00093
00094 Record* Record::create( unsigned type )
00095 {
00096 Record* record = 0;
00097
00098 if( type == BookmarkCollectionContainer::id )
00099 record = new BookmarkCollectionContainer();
00100
00101 else if( type == DocumentContainer::id )
00102 record = new DocumentContainer();
00103
00104 else if( type == EnvironmentContainer::id )
00105 record = new EnvironmentContainer();
00106
00107 else if( type == ExObjListContainer::id )
00108 record = new ExObjListContainer();
00109
00110 else if( type == ExOleObjStgContainer::id )
00111 record = new ExOleObjStgContainer();
00112
00113 else if( type == ExHyperlinkContainer::id )
00114 record = new ExHyperlinkContainer();
00115
00116 else if( type == ExEmbedContainer::id )
00117 record = new ExEmbedContainer();
00118
00119 else if( type == ExLinkContainer::id )
00120 record = new ExLinkContainer();
00121
00122 else if( type == FontCollectionContainer::id )
00123 record = new FontCollectionContainer();
00124
00125 else if( type == HandoutContainer::id )
00126 record = new HandoutContainer();
00127
00128 else if( type == HeadersFootersContainer::id )
00129 record = new HeadersFootersContainer();
00130
00131 else if( type == ListContainer::id )
00132 record = new ListContainer();
00133
00134 else if( type == SlideContainer::id )
00135 record = new SlideContainer();
00136
00137 else if( type == SlideBaseContainer::id )
00138 record = new SlideBaseContainer();
00139
00140 else if( type == MainMasterContainer::id )
00141 record = new MainMasterContainer();
00142
00143 else if( type == NotesContainer::id )
00144 record = new NotesContainer();
00145
00146 else if( type == RunArrayContainer::id )
00147 record = new RunArrayContainer();
00148
00149 else if( type == SlideListWithTextContainer::id )
00150 record = new SlideListWithTextContainer();
00151
00152 else if( type == SlideViewInfoContainer::id )
00153 record = new SlideViewInfoContainer();
00154
00155 else if( type == SorterViewInfoContainer::id )
00156 record = new SorterViewInfoContainer();
00157
00158 else if( type == SrKinsokuContainer::id )
00159 record = new SrKinsokuContainer();
00160
00161 else if( type == SummaryContainer::id )
00162 record = new SummaryContainer();
00163
00164 else if( type == OutlineViewInfoContainer::id )
00165 record = new OutlineViewInfoContainer();
00166
00167 else if( type == ProgStringTagContainer ::id )
00168 record = new ProgStringTagContainer ();
00169
00170 else if( type == PPDrawingGroupContainer ::id )
00171 record = new PPDrawingGroupContainer ();
00172
00173 else if( type == PPDrawingContainer ::id )
00174 record = new PPDrawingContainer ();
00175
00176 else if( type == ProgBinaryTagContainer ::id )
00177 record = new ProgBinaryTagContainer ();
00178
00179 else if( type == ProgTagsContainer ::id )
00180 record = new ProgTagsContainer ();
00181
00182 else if( type == VBAInfoContainer::id )
00183 record = new VBAInfoContainer();
00184
00185 else if( type == ViewInfoContainer::id )
00186 record = new ViewInfoContainer();
00187
00188
00189 else if( type == msofbtDgContainer::id )
00190 record = new msofbtDgContainer();
00191
00192 else if( type == msofbtSpgrContainer::id )
00193 record = new msofbtSpgrContainer();
00194
00195 else if( type == msofbtSpContainer::id )
00196 record = new msofbtSpContainer();
00197
00198 else if( type == msofbtDggContainer::id )
00199 record = new msofbtDggContainer();
00200
00201 else if( type == msofbtBstoreContainer::id )
00202 record = new msofbtBstoreContainer();
00203
00204 else if( type == msofbtSolverContainer::id )
00205 record = new msofbtSolverContainer();
00206
00207
00208 else if( type == BookmarkEntityAtom::id )
00209 record = new BookmarkEntityAtom();
00210
00211 else if( type == CStringAtom::id )
00212 record = new CStringAtom();
00213
00214 else if( type == ColorSchemeAtom::id )
00215 record = new ColorSchemeAtom();
00216
00217 else if( type == CurrentUserAtom::id )
00218 record = new CurrentUserAtom();
00219
00220 else if( type == DocumentAtom::id )
00221 record = new DocumentAtom();
00222
00223 else if( type == EndDocumentAtom::id )
00224 record = new EndDocumentAtom();
00225
00226 else if( type == ExEmbedAtom::id )
00227 record = new ExEmbedAtom();
00228
00229 else if( type == ExHyperlinkAtom::id )
00230 record = new ExHyperlinkAtom();
00231
00232 else if( type == ExLinkAtom::id )
00233 record = new ExLinkAtom();
00234
00235 else if( type == ExObjListAtom::id )
00236 record = new ExObjListAtom();
00237
00238 else if( type == ExOleObjAtom::id )
00239 record = new ExOleObjAtom();
00240
00241 else if( type == FontEntityAtom::id )
00242 record = new FontEntityAtom();
00243
00244 else if( type == GuideAtom::id )
00245 record = new GuideAtom();
00246
00247 else if( type == HeadersFootersAtom ::id )
00248 record = new HeadersFootersAtom ();
00249
00250 else if( type == NotesAtom::id )
00251 record = new NotesAtom();
00252
00253 else if( type == PersistIncrementalBlockAtom::id )
00254 record = new PersistIncrementalBlockAtom();
00255
00256 else if( type == Record1043::id )
00257 record = new Record1043 ();
00258
00259 else if( type == Record1044::id )
00260 record = new Record1044 ();
00261
00262 else if( type == SrKinsokuAtom::id )
00263 record = new SrKinsokuAtom();
00264
00265 else if( type == SlideAtom::id )
00266 record = new SlideAtom();
00267
00268 else if( type == SlidePersistAtom::id )
00269 record = new SlidePersistAtom();
00270
00271 else if( type == StyleTextPropAtom::id )
00272 record = new StyleTextPropAtom();
00273
00274 else if( type == SlideViewInfoAtom::id )
00275 record = new SlideViewInfoAtom();
00276
00277 else if( type == SSDocInfoAtom ::id )
00278 record = new SSDocInfoAtom();
00279
00280 else if( type == SSlideLayoutAtom ::id )
00281 record = new SSlideLayoutAtom();
00282
00283 else if( type == SSSlideInfoAtom ::id )
00284 record = new SSSlideInfoAtom();
00285
00286 else if( type == TextHeaderAtom ::id )
00287 record = new TextHeaderAtom();
00288
00289 else if( type == TextBookmarkAtom ::id )
00290 record = new TextBookmarkAtom();
00291
00292 else if( type == TextBytesAtom::id )
00293 record = new TextBytesAtom ();
00294
00295 else if( type == TextCharsAtom::id )
00296 record = new TextCharsAtom ();
00297
00298 else if( type == TextSpecInfoAtom ::id )
00299 record = new TextSpecInfoAtom();
00300
00301 else if( type == TxCFStyleAtom ::id )
00302 record = new TxCFStyleAtom();
00303
00304 else if( type == TxMasterStyleAtom ::id )
00305 record = new TxMasterStyleAtom();
00306
00307 else if( type == TxPFStyleAtom ::id )
00308 record = new TxPFStyleAtom();
00309
00310 else if( type == TxSIStyleAtom ::id )
00311 record = new TxSIStyleAtom();
00312
00313 else if( type == UserEditAtom::id )
00314 record = new UserEditAtom();
00315
00316 else if( type == ViewInfoAtom::id )
00317 record = new ViewInfoAtom();
00318
00319 else if( type == msofbtDgAtom::id )
00320 record = new msofbtDgAtom() ;
00321
00322 else if( type == msofbtSpgrAtom::id )
00323 record = new msofbtSpgrAtom() ;
00324
00325 else if( type == msofbtSpAtom::id )
00326 record = new msofbtSpAtom() ;
00327
00328 else if( type == msofbtOPTAtom::id )
00329 record = new msofbtOPTAtom() ;
00330
00331 else if( type == msofbtChildAnchorAtom::id )
00332 record = new msofbtChildAnchorAtom() ;
00333
00334 else if( type == msofbtClientAnchorAtom::id )
00335 record = new msofbtClientAnchorAtom() ;
00336
00337 else if( type == msofbtClientDataAtom::id )
00338 record = new msofbtClientDataAtom() ;
00339
00340 else if( type == msofbtClientTextboxAtom::id )
00341 record = new msofbtClientTextboxAtom() ;
00342
00343 else if( type == msofbtDggAtom::id )
00344 record = new msofbtDggAtom() ;
00345
00346 else if( type == msofbtColorMRUAtom::id )
00347 record = new msofbtColorMRUAtom() ;
00348
00349 else if( type == msofbtSplitMenuColorsAtom::id )
00350 record = new msofbtSplitMenuColorsAtom() ;
00351
00352 else if( type == msofbtBSEAtom::id )
00353 record = new msofbtBSEAtom() ;
00354
00355 else if( type == msofbtCLSIDAtom::id )
00356 record = new msofbtCLSIDAtom() ;
00357
00358 else if( type == msofbtRegroupItemsAtom::id )
00359 record = new msofbtRegroupItemsAtom() ;
00360
00361 else if( type == msofbtColorSchemeAtom::id )
00362 record = new msofbtColorSchemeAtom() ;
00363
00364 else if( type == msofbtClientTextboxAtom::id )
00365 record = new msofbtClientTextboxAtom() ;
00366
00367 else if( type == msofbtAnchorAtom::id )
00368 record = new msofbtAnchorAtom() ;
00369
00370 else if( type == msofbtOleObjectAtom::id )
00371 record = new msofbtOleObjectAtom() ;
00372
00373 else if( type == msofbtDeletedPsplAtom::id )
00374 record = new msofbtDeletedPsplAtom() ;
00375
00376 else if( type == msofbtConnectorRuleAtom::id )
00377 record = new msofbtConnectorRuleAtom() ;
00378
00379 else if( type == msofbtAlignRuleAtom::id )
00380 record = new msofbtAlignRuleAtom() ;
00381
00382 else if( type == msofbtArcRuleAtom::id )
00383 record = new msofbtArcRuleAtom() ;
00384
00385 else if( type == msofbtClientRuleAtom::id )
00386 record = new msofbtClientRuleAtom() ;
00387
00388 else if( type == msofbtCalloutRuleAtom::id )
00389 record = new msofbtCalloutRuleAtom() ;
00390
00391 else if( type == msofbtSelectionAtom::id )
00392 record = new msofbtSelectionAtom() ;
00393
00394 return record;
00395 }
00396
00397 void Record::setParent( Record* parent )
00398 {
00399 record_parent = parent;
00400 }
00401
00402 const Record* Record::parent() const
00403 {
00404 return record_parent;
00405 }
00406
00407 void Record::setPosition( unsigned pos )
00408 {
00409 stream_position = pos;
00410 }
00411
00412 unsigned Record::position() const
00413 {
00414 return stream_position;
00415 }
00416
00417 void Record::setInstance( unsigned instance )
00418 {
00419 record_instance = instance;
00420 }
00421
00422 unsigned Record::instance() const
00423 {
00424 return record_instance;
00425 }
00426
00427 void Record::setData( unsigned, const unsigned char* )
00428 {
00429 }
00430
00431 void Record::setData( unsigned, const unsigned char*, unsigned )
00432 {
00433 }
00434
00435 void Record::dump( std::ostream& ) const
00436 {
00437
00438 }
00439
00440
00441
00442 Container::Container()
00443 {
00444 }
00445
00446
00447
00448 const unsigned int BookmarkCollectionContainer::id = 2019;
00449
00450 BookmarkCollectionContainer::BookmarkCollectionContainer()
00451 {
00452 }
00453
00454
00455
00456 const unsigned int msofbtDggContainer::id = 61440;
00457
00458 msofbtDggContainer::msofbtDggContainer()
00459 {
00460 }
00461
00462
00463
00464 const unsigned int msofbtBstoreContainer::id = 61441;
00465
00466 msofbtBstoreContainer::msofbtBstoreContainer()
00467 {
00468 }
00469
00470
00471
00472 const unsigned int msofbtDgContainer::id = 61442;
00473
00474 msofbtDgContainer::msofbtDgContainer()
00475 {
00476 }
00477
00478
00479
00480 const unsigned int msofbtSpgrContainer::id = 61443;
00481
00482 msofbtSpgrContainer::msofbtSpgrContainer()
00483 {
00484 }
00485
00486
00487
00488 const unsigned int msofbtSpContainer::id = 61444;
00489
00490 msofbtSpContainer::msofbtSpContainer()
00491 {
00492 }
00493
00494
00495
00496 const unsigned int msofbtSolverContainer::id = 61445;
00497
00498 msofbtSolverContainer::msofbtSolverContainer()
00499 {
00500 }
00501
00502
00503
00504
00505 const unsigned int DocumentContainer::id = 1000;
00506
00507 DocumentContainer::DocumentContainer()
00508 {
00509 }
00510
00511
00512
00513 const unsigned int NotesContainer::id = 1008;
00514
00515 NotesContainer::NotesContainer()
00516 {
00517 }
00518
00519
00520
00521 const unsigned int ExOleObjStgContainer::id = 4113;
00522
00523 ExOleObjStgContainer::ExOleObjStgContainer()
00524 {
00525 }
00526
00527
00528
00529 const unsigned int FontCollectionContainer::id = 2005;
00530
00531 FontCollectionContainer::FontCollectionContainer()
00532 {
00533 }
00534
00535
00536
00537
00538 const unsigned int ExObjListContainer::id = 1033;
00539
00540 ExObjListContainer::ExObjListContainer()
00541 {
00542 }
00543
00544
00545
00546 const unsigned int SlideContainer::id = 1006;
00547
00548 SlideContainer::SlideContainer()
00549 {
00550 }
00551
00552
00553
00554 const unsigned int SlideBaseContainer::id = 1004;
00555
00556 SlideBaseContainer::SlideBaseContainer()
00557 {
00558 }
00559
00560
00561
00562 const unsigned int SlideListWithTextContainer::id = 4080;
00563
00564 SlideListWithTextContainer::SlideListWithTextContainer()
00565 {
00566 }
00567
00568
00569
00570 const unsigned int SlideViewInfoContainer::id = 1018;
00571
00572 SlideViewInfoContainer::SlideViewInfoContainer()
00573 {
00574 }
00575
00576
00577
00578 const unsigned int OutlineViewInfoContainer::id = 1031;
00579
00580 OutlineViewInfoContainer::OutlineViewInfoContainer()
00581 {
00582 }
00583
00584
00585
00586 const unsigned int SorterViewInfoContainer::id = 1032;
00587
00588 SorterViewInfoContainer::SorterViewInfoContainer()
00589 {
00590 }
00591
00592
00593
00594 const unsigned int HandoutContainer::id = 4041;
00595
00596 HandoutContainer::HandoutContainer()
00597 {
00598 }
00599
00600
00601
00602 const unsigned int ListContainer::id = 2000;
00603
00604 ListContainer::ListContainer()
00605 {
00606 }
00607
00608
00609
00610 const unsigned int ExEmbedContainer::id = 4044;
00611
00612 ExEmbedContainer::ExEmbedContainer()
00613 {
00614 }
00615
00616
00617
00618 const unsigned int ExLinkContainer::id = 4046;
00619
00620 ExLinkContainer::ExLinkContainer()
00621 {
00622 }
00623
00624
00625
00626 const unsigned int ExHyperlinkContainer::id = 4055;
00627
00628 ExHyperlinkContainer::ExHyperlinkContainer()
00629 {
00630 }
00631
00632
00633
00634 const unsigned int MainMasterContainer::id = 1016;
00635
00636 MainMasterContainer::MainMasterContainer()
00637 {
00638 }
00639
00640
00641
00642 const unsigned int EnvironmentContainer::id = 1010;
00643
00644 EnvironmentContainer::EnvironmentContainer()
00645 {
00646 }
00647
00648
00649
00650 const unsigned int HeadersFootersContainer::id = 4057;
00651
00652 HeadersFootersContainer::HeadersFootersContainer()
00653 {
00654 }
00655
00656
00657
00658 const unsigned int RunArrayContainer::id = 2028;
00659
00660 RunArrayContainer::RunArrayContainer()
00661 {
00662 }
00663
00664
00665
00666 const unsigned int SrKinsokuContainer::id = 4040;
00667
00668 SrKinsokuContainer::SrKinsokuContainer()
00669 {
00670 }
00671
00672
00673
00674 const unsigned int ProgTagsContainer::id = 5000;
00675
00676 ProgTagsContainer::ProgTagsContainer()
00677 {
00678 }
00679
00680
00681
00682 const unsigned int ProgBinaryTagContainer::id = 5002;
00683
00684 ProgBinaryTagContainer::ProgBinaryTagContainer()
00685 {
00686 }
00687
00688
00689
00690 const unsigned int ProgStringTagContainer::id = 5001;
00691
00692 ProgStringTagContainer::ProgStringTagContainer()
00693 {
00694 }
00695
00696
00697
00698 const unsigned int PPDrawingGroupContainer::id = 1035;
00699
00700 PPDrawingGroupContainer::PPDrawingGroupContainer()
00701 {
00702 }
00703
00704
00705
00706 const unsigned int PPDrawingContainer::id = 1036;
00707
00708 PPDrawingContainer::PPDrawingContainer()
00709 {
00710 }
00711
00712
00713
00714 const unsigned int SummaryContainer::id = 1026;
00715
00716 SummaryContainer::SummaryContainer()
00717 {
00718 }
00719
00720
00721
00722 const unsigned int VBAInfoContainer::id = 1023;
00723
00724 VBAInfoContainer::VBAInfoContainer()
00725 {
00726 }
00727
00728
00729
00730 const unsigned int ViewInfoContainer::id = 1020;
00731
00732 ViewInfoContainer::ViewInfoContainer()
00733 {
00734 }
00735
00736
00737
00738 const unsigned int CStringAtom::id = 4026;
00739
00740 class CStringAtom::Private
00741 {
00742 public:
00743 UString ustring;
00744 };
00745
00746
00747 CStringAtom::CStringAtom()
00748 {
00749 d = new Private;
00750 }
00751
00752 CStringAtom::~CStringAtom()
00753 {
00754 delete d;
00755 }
00756
00757 UString CStringAtom::ustring() const
00758 {
00759 return d->ustring;
00760 }
00761
00762 void CStringAtom::setUString( const UString& ustr )
00763 {
00764 d->ustring = ustr;
00765 }
00766
00767 void CStringAtom::setData( unsigned size, const unsigned char* data )
00768 {
00769 UString str;
00770 for( unsigned k=0; k<(size/2); k++ )
00771 {
00772 unsigned uchar = readU16( data + k*2 );
00773 if (uchar == 0x0d)
00774 {
00775 uchar = 0x0b;
00776
00777 }
00778 str.append( UString(uchar) );
00779 }
00780 setUString( str );
00781 }
00782
00783 void CStringAtom::dump( std::ostream& out ) const
00784 {
00785 out << "CStringAtom" << std::endl;
00786 out << "String : [" << ustring() << "]" << std::endl;
00787 }
00788
00789
00790
00791 const unsigned int DocumentAtom::id = 1001;
00792
00793 class DocumentAtom::Private
00794 {
00795 public:
00796 int slideWidth;
00797 int slideHeight;
00798 int notesWidth;
00799 int notesHeight;
00800 int zoomNumer;
00801 int zoomDenom;
00802 int notesMasterPersist;
00803 int handoutMasterPersist;
00804 int firstSlideNum;
00805 int slideSizeType;
00806 int saveWithFonts;
00807 int omitTitlePlace;
00808 int rightToLeft;
00809 int showComments;
00810 };
00811
00812 DocumentAtom::DocumentAtom()
00813 {
00814 d = new Private;
00815 d->slideWidth = 5760;
00816 d->slideHeight = 4320;
00817 d->notesWidth = 4320;
00818 d->notesHeight = 5760;
00819 d->zoomNumer = 1;
00820 d->zoomDenom = 2;
00821 d->notesMasterPersist = 0;
00822 d->handoutMasterPersist = 0;
00823 d->firstSlideNum = 0;
00824 d->slideSizeType = 0;
00825 d->saveWithFonts = 0;
00826 d->omitTitlePlace = 0;
00827 d->rightToLeft = 0 ;
00828 d->showComments = 0;
00829 }
00830
00831 DocumentAtom::~DocumentAtom()
00832 {
00833 delete d;
00834 }
00835
00836 int DocumentAtom::slideWidth() const
00837 {
00838 return d->slideWidth;
00839 }
00840
00841 void DocumentAtom::setSlideWidth( int w )
00842 {
00843 d->slideWidth = w;
00844 }
00845
00846 int DocumentAtom::slideHeight() const
00847 {
00848 return d->slideHeight;
00849 }
00850
00851 void DocumentAtom::setSlideHeight( int h )
00852 {
00853 d->slideHeight = h;
00854 }
00855
00856 int DocumentAtom::notesWidth() const
00857 {
00858 return d->notesWidth;
00859 }
00860
00861 void DocumentAtom::setNotesWidth( int nw )
00862 {
00863 d->notesWidth = nw;
00864 }
00865
00866 int DocumentAtom::notesHeight() const
00867 {
00868 return d->notesHeight;
00869 }
00870
00871 void DocumentAtom::setNotesHeight( int nh )
00872 {
00873 d->notesHeight = nh;
00874 }
00875
00876 int DocumentAtom::zoomNumer () const
00877 {
00878 return d->zoomNumer;
00879 }
00880
00881 void DocumentAtom::setZoomNumer( int numer )
00882 {
00883 d->zoomNumer = numer;
00884 }
00885
00886 int DocumentAtom::zoomDenom() const
00887 {
00888 return d->zoomDenom;
00889 }
00890
00891 void DocumentAtom::setZoomDenom( int denom )
00892 {
00893 d->zoomDenom = denom;
00894 }
00895
00896 int DocumentAtom::notesMasterPersist() const
00897 {
00898 return d->notesMasterPersist;
00899 }
00900
00901 void DocumentAtom::setNotesMasterPersist( int notesMasterPersist )
00902 {
00903 d->notesMasterPersist = notesMasterPersist;
00904 }
00905
00906 int DocumentAtom::handoutMasterPersist() const
00907 {
00908 return d->handoutMasterPersist;
00909 }
00910
00911 void DocumentAtom::setHandoutMasterPersist(int handoutMasterPersist)
00912 {
00913 d->handoutMasterPersist = handoutMasterPersist;
00914 }
00915
00916 int DocumentAtom::firstSlideNum() const
00917 {
00918 return d->firstSlideNum;
00919 }
00920
00921 void DocumentAtom::setFirstSlideNum( int firstSlideNum )
00922 {
00923 d->firstSlideNum = firstSlideNum;
00924 }
00925
00926 int DocumentAtom::slideSizeType() const
00927 {
00928 return d->slideSizeType;
00929 }
00930
00931 void DocumentAtom::setSlideSizeType( int slideSizeType )
00932 {
00933 d->slideSizeType = slideSizeType;
00934 }
00935
00936 int DocumentAtom::saveWithFonts() const
00937 {
00938 return d->saveWithFonts;
00939 }
00940
00941 void DocumentAtom::setSaveWithFonts( int saveWithFonts )
00942 {
00943 d->saveWithFonts = saveWithFonts;
00944 }
00945
00946 int DocumentAtom::omitTitlePlace() const
00947 {
00948 return d->omitTitlePlace;
00949 }
00950
00951 void DocumentAtom::setOmitTitlePlace( int omitTitlePlace )
00952 {
00953 d->omitTitlePlace = omitTitlePlace;
00954 }
00955
00956 int DocumentAtom::rightToLeft() const
00957 {
00958 return d->rightToLeft;
00959 }
00960
00961 void DocumentAtom::setRightToLeft( int rightToLeft )
00962 {
00963 d->rightToLeft = rightToLeft;
00964 }
00965
00966 int DocumentAtom::showComments() const
00967 {
00968 return d->showComments;
00969 }
00970
00971 void DocumentAtom::setShowComments( int showComments)
00972 {
00973 d->showComments = showComments;
00974 }
00975
00976 void DocumentAtom::setData( unsigned , const unsigned char* data )
00977 {
00978 setSlideWidth( readU32( data+0 ) );
00979 setSlideHeight( readU32( data+4 ) );
00980 setNotesWidth( readU32( data+8 ) );
00981 setNotesHeight( readU32( data+12 ) );
00982 setZoomNumer( readS32( data+16 ) );
00983 setZoomDenom( readS32( data+20) );
00984 setNotesMasterPersist( readU32( data+24 ) );
00985 setHandoutMasterPersist ( readU32( data+28 ) );
00986 setFirstSlideNum( readU16( data+32 ) );
00987 setSlideSizeType( readS16( data+34 ) );
00988 setSaveWithFonts(data[36]);
00989 setOmitTitlePlace(data[37]);
00990 setRightToLeft(data[38]);
00991 setShowComments(data[39]);
00992 }
00993
00994 void DocumentAtom::dump( std::ostream& out ) const
00995 {
00996 out << "DocumentAtom" << std::endl;
00997 out << "slide width " << slideWidth() << std::endl;
00998 out << "slide height " << slideHeight() << std::endl;
00999 out << "notes width " << notesWidth() << std::endl;
01000 out << "notes height " << notesHeight() << std::endl;
01001 out << "zoom numer " << zoomNumer() << std::endl;
01002 out << "zoom denum " << zoomDenom() << std::endl;
01003 out << "notesMasterPersist " << notesMasterPersist() << std::endl;
01004 out << "handoutMasterPersist " << handoutMasterPersist() << std::endl;
01005 out << "firstSlideNum " << firstSlideNum() << std::endl;
01006 out << "slideSizeType " << slideSizeType() << std::endl;
01007 out << "saveWithFonts " << saveWithFonts() << std::endl;
01008 out << "omitTitlePlace " << omitTitlePlace() << std::endl;
01009 out << "rightToLeft " << rightToLeft() << std::endl;
01010 out << "showComments " << showComments() << std::endl;
01011 }
01012
01013
01014
01015 const unsigned int EndDocumentAtom::id = 1002;
01016
01017 EndDocumentAtom::EndDocumentAtom()
01018 {
01019 }
01020
01021 void EndDocumentAtom::dump( std::ostream& out ) const
01022 {
01023 out << "EndDocumentAtom" << std::endl;
01024 }
01025
01026
01027
01028
01029 const unsigned int FontEntityAtom::id = 4023;
01030
01031 class FontEntityAtom::Private
01032 {
01033 public:
01034 UString ustring;
01035 int charset;
01036 int clipPrecision;
01037 int quality;
01038 int pitchAndFamily;
01039
01040 };
01041
01042 FontEntityAtom::FontEntityAtom()
01043 {
01044 d = new Private;
01045 d->charset = 0;
01046 d->clipPrecision = 0;
01047 d->quality = 0;
01048 d->pitchAndFamily = 0;
01049 }
01050
01051 FontEntityAtom::~FontEntityAtom()
01052 {
01053 delete d;
01054 }
01055
01056 UString FontEntityAtom::ustring() const
01057 {
01058 return d->ustring;
01059 }
01060
01061 void FontEntityAtom::setUString( const UString& ustring )
01062 {
01063 d->ustring = ustring;
01064 }
01065
01066 int FontEntityAtom::charset() const
01067 {
01068 return d->charset;
01069 }
01070
01071 void FontEntityAtom::setCharset( int charset )
01072 {
01073 d->charset = charset;
01074 }
01075
01076 int FontEntityAtom::clipPrecision() const
01077 {
01078 return d->clipPrecision;
01079 }
01080
01081 void FontEntityAtom::setClipPrecision( int clipPrecision)
01082 {
01083 d->clipPrecision = clipPrecision ;
01084 }
01085
01086 int FontEntityAtom::quality() const
01087 {
01088 return d->quality;
01089 }
01090
01091 void FontEntityAtom::setQuality( int quality )
01092 {
01093 d->quality = quality;
01094 }
01095
01096 int FontEntityAtom::pitchAndFamily() const
01097 {
01098 return d->pitchAndFamily;
01099 }
01100
01101 void FontEntityAtom::setPitchAndFamily( int pitchAndFamily )
01102 {
01103 d->pitchAndFamily = pitchAndFamily;
01104 }
01105
01106 void FontEntityAtom::setData( unsigned , const unsigned char* data )
01107 {
01108
01109 UString str;
01110 for( unsigned k=0; k<32; k++ )
01111 {
01112 unsigned uchar = readU16( data + k*2 );
01113 str.append( UString(uchar) );
01114 }
01115 setUString( str );
01116 setCharset( data[64] );
01117 setClipPrecision( data[65] );
01118 setQuality( data[66] );
01119 setPitchAndFamily( data[67] );
01120 }
01121
01122 void FontEntityAtom::dump( std::ostream& out ) const
01123 {
01124 out << "FontEntityAtom" << std::endl;
01125 out << "String : [" << ustring() << "]" << std::endl;
01126 out << "Charset " << charset() << std::endl;
01127 out << "ClipPrecision " << clipPrecision() << std::endl;
01128 out << "Quality " << quality() << std::endl;
01129 out << "PitchAndFamily " << pitchAndFamily() << std::endl;
01130 }
01131
01132
01133
01134 const unsigned int TextCharsAtom::id = 4000;
01135
01136
01137 class TextCharsAtom::Private
01138 {
01139 public:
01140 std::vector<unsigned> index;
01141 std::vector<UString> ustring;
01142 };
01143
01144 TextCharsAtom::TextCharsAtom()
01145 {
01146 d = new Private;
01147 }
01148
01149 TextCharsAtom::~TextCharsAtom()
01150 {
01151 delete d;
01152 }
01153
01154 unsigned TextCharsAtom::listSize() const
01155 {
01156 return d->ustring.size();
01157 }
01158
01159 UString TextCharsAtom::strValue( unsigned index ) const
01160 {
01161 return d->ustring[index];
01162 }
01163
01164 void TextCharsAtom::setText( UString ustring )
01165 {
01166 d->ustring.push_back( ustring );
01167 }
01168
01169 void TextCharsAtom::setData( unsigned size, const unsigned char* data )
01170 {
01171 UString tempStr;
01172 int index = 0;
01173
01174 for( unsigned k=0; k<((0.5*size) + 1); k++ )
01175 {
01176 unsigned uchar = readU16( data + k*2 );
01177 if ( (uchar == 0x0b) | (uchar == 0x0d) | (k == 0.5*size) )
01178 {
01179 setText(tempStr);
01180 index++;
01181 tempStr = "";
01182 }
01183 else
01184 tempStr.append( UString(uchar) );
01185
01186 if ( ( uchar & 0xff00 ) == 0xf000 )
01187 {
01188 std::cout << "got a symbol at " << k << "th character" << std::endl;
01189 }
01190
01191 }
01192 }
01193
01194 void TextCharsAtom::dump( std::ostream& out ) const
01195 {
01196 out << "TextCharsAtom" << std::endl;
01197 out << "listSize " << listSize() << std::endl;
01198
01199 for (uint i=0; i<listSize() ; i++)
01200 {
01201 out << "String " << i << " [" << strValue(i) << "]" << std::endl;
01202 }
01203
01204 }
01205
01206
01207
01208
01209 const unsigned int GuideAtom::id = 1019;
01210
01211 class GuideAtom::Private
01212 {
01213 public:
01214 int type;
01215 int pos;
01216 };
01217
01218 GuideAtom::GuideAtom ()
01219 {
01220 d = new Private;
01221 d->type = 0;
01222 d->pos = 0;
01223 }
01224
01225 GuideAtom::~GuideAtom ()
01226 {
01227 delete d;
01228 }
01229
01230 int GuideAtom::type() const
01231 {
01232 return d->type;
01233 }
01234
01235 void GuideAtom::setType(int type)
01236 {
01237 d->type= type;
01238 }
01239
01240 int GuideAtom::pos() const
01241 {
01242 return d->pos;
01243 }
01244
01245 void GuideAtom::setPos(int pos)
01246 {
01247 d->pos= pos;
01248 }
01249
01250 void GuideAtom::setData( unsigned , const unsigned char* data )
01251 {
01252 setType( readS32( data + 0 ) );
01253 setPos( readS32( data + 4 ) );
01254 }
01255
01256 void GuideAtom::dump( std::ostream& out ) const
01257 {
01258 out << "GuideAtom" << std::endl;
01259 out << "type " << type() << std::endl;
01260 out << "pos " << pos() << std::endl;
01261 }
01262
01263
01264
01265
01266 const unsigned int SSlideLayoutAtom::id = 1015;
01267
01268 class SSlideLayoutAtom ::Private
01269 {
01270 public:
01271 int geom;
01272 int placeholderId;
01273 };
01274
01275 SSlideLayoutAtom::SSlideLayoutAtom ()
01276 {
01277 d = new Private;
01278 d->geom = 0;
01279 d->placeholderId = 0;
01280 }
01281
01282 SSlideLayoutAtom::~SSlideLayoutAtom ()
01283 {
01284 delete d;
01285 }
01286
01287 int SSlideLayoutAtom::geom() const
01288 {
01289 return d->geom;
01290 }
01291
01292 void SSlideLayoutAtom::setGeom(int geom)
01293 {
01294 d->geom= geom;
01295 }
01296
01297 int SSlideLayoutAtom::placeholderId() const
01298 {
01299 return d->placeholderId;
01300 }
01301
01302 void SSlideLayoutAtom::setPlaceholderId(int placeholderId)
01303 {
01304 d->placeholderId= placeholderId;
01305 }
01306
01307 void SSlideLayoutAtom ::setData( unsigned , const unsigned char* data )
01308 {
01309 setGeom( readS32( data + 0 ) );
01310 setPlaceholderId( data [4] );
01311 }
01312
01313 void SSlideLayoutAtom ::dump( std::ostream& out ) const
01314 {
01315 out << "SSlideLayoutAtom" << std::endl;
01316 out << "geom " << geom() << std::endl;
01317 out << "placeholderId " << placeholderId() << std::endl;
01318 }
01319
01320
01321
01322 const unsigned int ExLinkAtom::id = 4049;
01323
01324 class ExLinkAtom ::Private
01325 {
01326 public:
01327 int exObjId;
01328 int flags;
01329 int unavailable;
01330 };
01331
01332 ExLinkAtom::ExLinkAtom ()
01333 {
01334 d = new Private;
01335 d->exObjId = 0;
01336 d->flags = 0;
01337 d->unavailable = 0;
01338 }
01339
01340 ExLinkAtom::~ExLinkAtom ()
01341 {
01342 delete d;
01343 }
01344
01345 int ExLinkAtom::exObjId() const
01346 {
01347 return d->exObjId;
01348 }
01349
01350 void ExLinkAtom::setExObjId(int exObjId)
01351 {
01352 d->exObjId= exObjId;
01353 }
01354
01355 int ExLinkAtom::flags() const
01356 {
01357 return d->flags;
01358 }
01359
01360 void ExLinkAtom::setFlags(int flags)
01361 {
01362 d->flags= flags;
01363 }
01364
01365 int ExLinkAtom::unavailable() const
01366 {
01367 return d->unavailable;
01368 }
01369
01370 void ExLinkAtom::setUnavailable(int unavailable)
01371 {
01372 d->unavailable= unavailable;
01373 }
01374
01375 void ExLinkAtom ::setData( unsigned , const unsigned char* data )
01376 {
01377 setExObjId( readU32( data + 0 ) );
01378 setFlags( readU16( data + 4 ) );
01379 setUnavailable( data [6] );
01380
01381 }
01382
01383 void ExLinkAtom ::dump( std::ostream& out ) const
01384 {
01385 out << "ExLinkAtom" << std::endl;
01386 out << "exObjId " << exObjId() << std::endl;
01387 out << "flags " << flags() << std::endl;
01388 out << "unavailable " << unavailable() << std::endl;
01389 }
01390
01391
01392
01393 const unsigned int NotesAtom::id = 1009;
01394
01395 class NotesAtom ::Private
01396 {
01397 public:
01398 int slideId;
01399 int flags;
01400 };
01401
01402 NotesAtom::NotesAtom ()
01403 {
01404 d = new Private;
01405 d->slideId = 0;
01406 d->flags = 0;
01407 }
01408
01409 NotesAtom::~NotesAtom ()
01410 {
01411 delete d;
01412 }
01413
01414 int NotesAtom::slideId() const
01415 {
01416 return d->slideId;
01417 }
01418
01419 void NotesAtom::setSlideId(int slideId)
01420 {
01421 d->slideId= slideId;
01422 }
01423
01424 int NotesAtom::flags() const
01425 {
01426 return d->flags;
01427 }
01428
01429 void NotesAtom::setFlags(int flags)
01430 {
01431 d->flags= flags;
01432 }
01433
01434 void NotesAtom ::setData( unsigned , const unsigned char* data )
01435 {
01436 setSlideId( readS32( data + 0 ) );
01437 setFlags( readU16( data + 4 ) );
01438 }
01439
01440 void NotesAtom ::dump( std::ostream& out ) const
01441 {
01442 out << "NotesAtom" << std::endl;
01443 out << "slideId " << slideId() << std::endl;
01444 out << "flags " << flags() << std::endl;
01445 }
01446
01447
01448
01449
01450 const unsigned int ExObjListAtom::id = 1034;
01451
01452 class ExObjListAtom ::Private
01453 {
01454 public:
01455 int objectIdSeed;
01456 };
01457
01458 ExObjListAtom::ExObjListAtom ()
01459 {
01460 d = new Private;
01461 d->objectIdSeed = 0;
01462 }
01463
01464 ExObjListAtom::~ExObjListAtom ()
01465 {
01466 delete d;
01467 }
01468
01469 int ExObjListAtom::objectIdSeed() const
01470 {
01471 return d->objectIdSeed;
01472 }
01473
01474 void ExObjListAtom::setObjectIdSeed(int objectIdSeed)
01475 {
01476 d->objectIdSeed= objectIdSeed;
01477 }
01478
01479 void ExObjListAtom ::setData( unsigned , const unsigned char* data )
01480 {
01481 setObjectIdSeed( readU32( data + 0 ) );
01482 }
01483
01484 void ExObjListAtom ::dump( std::ostream& out ) const
01485 {
01486 out << "ExObjListAtom" << std::endl;
01487 out << "objectIdSeed " << objectIdSeed() << std::endl;
01488 }
01489
01490
01491
01492
01493 const unsigned int ExEmbedAtom::id = 4045;
01494
01495 class ExEmbedAtom ::Private
01496 {
01497 public:
01498 int followColorScheme;
01499 int cantLockServerB;
01500 int noSizeToServerB;
01501 int isTable;
01502 };
01503
01504 ExEmbedAtom::ExEmbedAtom ()
01505 {
01506 d = new Private;
01507 d->followColorScheme = 0;
01508 d->cantLockServerB = 0;
01509 d->noSizeToServerB = 0;
01510 d->isTable = 0;
01511 }
01512
01513 ExEmbedAtom::~ExEmbedAtom ()
01514 {
01515 delete d;
01516 }
01517
01518 int ExEmbedAtom::followColorScheme() const
01519 {
01520 return d->followColorScheme;
01521 }
01522
01523 void ExEmbedAtom::setFollowColorScheme(int followColorScheme)
01524 {
01525 d->followColorScheme= followColorScheme;
01526 }
01527
01528 int ExEmbedAtom::cantLockServerB() const
01529 {
01530 return d->cantLockServerB;
01531 }
01532
01533 void ExEmbedAtom::setCantLockServerB(int cantLockServerB)
01534 {
01535 d->cantLockServerB= cantLockServerB;
01536 }
01537
01538 int ExEmbedAtom::noSizeToServerB() const
01539 {
01540 return d->noSizeToServerB;
01541 }
01542
01543 void ExEmbedAtom::setNoSizeToServerB(int noSizeToServerB)
01544 {
01545 d->noSizeToServerB= noSizeToServerB;
01546 }
01547
01548 int ExEmbedAtom::isTable() const
01549 {
01550 return d->isTable;
01551 }
01552
01553 void ExEmbedAtom::setIsTable(int isTable)
01554 {
01555 d->isTable= isTable;
01556 }
01557
01558 void ExEmbedAtom ::setData( unsigned , const unsigned char* data )
01559 {
01560 setFollowColorScheme( readS32( data + 0 ) );
01561 setCantLockServerB( data [4] );
01562 setNoSizeToServerB( data[5] );
01563 setIsTable( data[6] );
01564 }
01565
01566 void ExEmbedAtom ::dump( std::ostream& out ) const
01567 {
01568 out << "ExEmbedAtom" << std::endl;
01569 out << "followColorScheme " << followColorScheme() << std::endl;
01570 out << "cantLockServerB " << cantLockServerB() << std::endl;
01571 out << "noSizeToServerB " << noSizeToServerB() << std::endl;
01572 out << "isTable " << isTable() << std::endl;
01573 }
01574
01575
01576
01577 const unsigned int ExOleObjAtom::id = 4035;
01578
01579 class ExOleObjAtom ::Private
01580 {
01581 public:
01582 int drawAspect;
01583 int type;
01584 int objID;
01585 int subType;
01586 int objStgDataRef;
01587 int isBlank;
01588 };
01589
01590 ExOleObjAtom::ExOleObjAtom ()
01591 {
01592 d = new Private;
01593 d->drawAspect = 0;
01594 d->type = 0;
01595 d->objID = 0;
01596 d->subType = 0;
01597 d->objStgDataRef = 0;
01598 d->isBlank = 0;
01599 }
01600
01601 ExOleObjAtom::~ExOleObjAtom ()
01602 {
01603 delete d;
01604 }
01605
01606 int ExOleObjAtom::drawAspect() const
01607 {
01608 return d->drawAspect;
01609 }
01610
01611 void ExOleObjAtom::setDrawAspect(int drawAspect)
01612 {
01613 d->drawAspect= drawAspect;
01614 }
01615
01616 int ExOleObjAtom::type() const
01617 {
01618 return d->type;
01619 }
01620
01621 void ExOleObjAtom::setType(int type)
01622 {
01623 d->type= type;
01624 }
01625
01626 int ExOleObjAtom::objID() const
01627 {
01628 return d->objID;
01629 }
01630
01631 void ExOleObjAtom::setObjID(int objID)
01632 {
01633 d->objID= objID;
01634 }
01635
01636 int ExOleObjAtom::subType() const
01637 {
01638 return d->subType;
01639 }
01640
01641 void ExOleObjAtom::setSubType(int subType)
01642 {
01643 d->subType= subType;
01644 }
01645
01646 int ExOleObjAtom::objStgDataRef() const
01647 {
01648 return d->objStgDataRef;
01649 }
01650
01651 void ExOleObjAtom::setObjStgDataRef(int objStgDataRef)
01652 {
01653 d->objStgDataRef= objStgDataRef;
01654 }
01655
01656 int ExOleObjAtom::isBlank() const
01657 {
01658 return d->isBlank;
01659 }
01660
01661 void ExOleObjAtom::setIsBlank(int isBlank)
01662 {
01663 d->isBlank= isBlank;
01664 }
01665
01666 void ExOleObjAtom ::setData( unsigned , const unsigned char* data )
01667 {
01668 setDrawAspect( readU32( data + 0 ) );
01669 setType( readS32( data + 4 ) );
01670 setObjID( readS32( data + 8 ) );
01671 setSubType( readS32( data + 12 ) );
01672 setObjStgDataRef( readS32( data + 16 ) );
01673 setIsBlank( data[20] );
01674 }
01675
01676 void ExOleObjAtom ::dump( std::ostream& out ) const
01677 {
01678 out << "ExOleObjAtom" << std::endl;
01679 out << "drawAspect " << drawAspect() << std::endl;
01680 out << "type " << type() << std::endl;
01681 out << "objID " << objID() << std::endl;
01682 out << "subType " << subType() << std::endl;
01683 out << "objID " << objID() << std::endl;
01684 out << "objStgDataRef " << objStgDataRef() << std::endl;
01685 out << "isBlank " << isBlank() << std::endl;
01686 }
01687
01688
01689
01690 const unsigned int ExHyperlinkAtom::id = 4051;
01691
01692 class ExHyperlinkAtom ::Private
01693 {
01694 public:
01695 int objID;
01696 };
01697
01698 ExHyperlinkAtom ::ExHyperlinkAtom ()
01699 {
01700 d = new Private;
01701 d->objID = 0;
01702 }
01703
01704 ExHyperlinkAtom ::~ExHyperlinkAtom ()
01705 {
01706 delete d;
01707 }
01708
01709 int ExHyperlinkAtom ::objID() const
01710 {
01711 return d->objID;
01712 }
01713
01714 void ExHyperlinkAtom ::setObjID(int objID)
01715 {
01716 d->objID = objID;
01717 }
01718
01719 void ExHyperlinkAtom::setData( unsigned , const unsigned char* data )
01720 {
01721 setObjID( readU32( data + 0 ) );
01722 }
01723
01724 void ExHyperlinkAtom ::dump( std::ostream& out ) const
01725 {
01726 out << "ExHyperlinkAtom" << std::endl;
01727 out << "objID " << objID() << std::endl;
01728 }
01729
01730
01731
01732
01733 const unsigned int PersistIncrementalBlockAtom::id = 6002;
01734
01735 class PersistIncrementalBlockAtom::Private
01736 {
01737 public:
01738 std::vector<unsigned long> references;
01739 std::vector<unsigned long> offsets;
01740 };
01741
01742 PersistIncrementalBlockAtom::PersistIncrementalBlockAtom()
01743 {
01744 d = new Private;
01745 }
01746
01747 PersistIncrementalBlockAtom::~PersistIncrementalBlockAtom()
01748 {
01749 delete d;
01750 }
01751
01752 unsigned PersistIncrementalBlockAtom::entryCount() const
01753 {
01754 return d->references.size();
01755 }
01756
01757 unsigned long PersistIncrementalBlockAtom::reference( unsigned index ) const
01758 {
01759 unsigned long r = 0;
01760 if( index < d->references.size() )
01761 r = d->references[index];
01762 return r;
01763 }
01764
01765 unsigned long PersistIncrementalBlockAtom::offset( unsigned index ) const
01766 {
01767 unsigned long ofs = 0;
01768 if( index < d->offsets.size() )
01769 ofs = d->offsets[index];
01770 return ofs;
01771 }
01772
01773 void PersistIncrementalBlockAtom ::setData( unsigned size, const unsigned char* data )
01774 {
01775 d->references.clear();
01776 d->offsets.clear();
01777
01778 unsigned ofs = 0;
01779 while( ofs < size )
01780 {
01781 long k = readU32( data+ ofs );
01782 unsigned count = k>>20;
01783 unsigned start = k&0xfffff;
01784 ofs += 4;
01785 for( unsigned c=0; c < count; c++, ofs+=4 )
01786 {
01787 if( ofs >= size ) break;
01788 long of = readU32( data + ofs );
01789 d->references.push_back( start+c );
01790 d->offsets.push_back( of );
01791 }
01792 }
01793 }
01794
01795 void PersistIncrementalBlockAtom ::dump( std::ostream& out ) const
01796 {
01797 out << "PersistIncrementalBlockAtom" << std::endl;
01798 for( unsigned i = 0; i < entryCount(); i++ )
01799 out << " Ref #" << reference(i) << " at offset " << offset(i) << std::endl;
01800 }
01801
01802
01803
01804
01805 const unsigned int HeadersFootersAtom::id = 4058;
01806
01807 class HeadersFootersAtom ::Private
01808 {
01809 public:
01810 int formatId;
01811 int flags;
01812 };
01813
01814 HeadersFootersAtom::HeadersFootersAtom ()
01815 {
01816 d = new Private;
01817 d->formatId = 0;
01818 d->flags = 0;
01819 }
01820
01821 HeadersFootersAtom::~HeadersFootersAtom ()
01822 {
01823 delete d;
01824 }
01825
01826 int HeadersFootersAtom::formatId() const
01827 {
01828 return d->formatId;
01829 }
01830
01831 void HeadersFootersAtom::setFormatId(int formatId)
01832 {
01833 d->formatId= formatId;
01834 }
01835
01836 int HeadersFootersAtom::flags() const
01837 {
01838 return d->flags;
01839 }
01840
01841 void HeadersFootersAtom::setFlags(int flags)
01842 {
01843 d->flags= flags;
01844 }
01845
01846 void HeadersFootersAtom::setData( unsigned , const unsigned char* data )
01847 {
01848 setFormatId( readS16( data + 0 ) );
01849 setFlags( readU16( data + 2 ) );
01850 }
01851
01852 void HeadersFootersAtom::dump( std::ostream& out ) const
01853 {
01854 out << "HeadersFootersAtom" << std::endl;
01855 out << "formatId " << formatId() << std::endl;
01856 out << "flags " << flags() << std::endl;
01857 }
01858
01859
01860
01861
01862 const unsigned int ColorSchemeAtom::id = 2032;
01863
01864 class ColorSchemeAtom ::Private
01865 {
01866 public:
01867 int background;
01868 int textAndLines;
01869 int shadows;
01870 int titleText;
01871 int fills;
01872 int accent;
01873 int accentAndHyperlink;
01874 int accentAndFollowedHyperlink;
01875
01876 };
01877
01878 ColorSchemeAtom::ColorSchemeAtom ()
01879 {
01880 d = new Private;
01881 d->background = 0 ;
01882 d->textAndLines = 0;
01883 d->shadows = 0 ;
01884 d->titleText = 0 ;
01885 d->fills = 0;
01886 d->accent = 0;
01887 d->accentAndHyperlink = 0;
01888 d->accentAndFollowedHyperlink = 0;
01889 }
01890
01891
01892 ColorSchemeAtom::~ColorSchemeAtom ()
01893 {
01894 delete d;
01895 }
01896
01897 int ColorSchemeAtom::background() const
01898 {
01899 return d->background;
01900 }
01901
01902 void ColorSchemeAtom::setBackground( int background )
01903 {
01904 d->background = background;
01905 }
01906
01907 int ColorSchemeAtom::textAndLines() const
01908 {
01909 return d->textAndLines;
01910 }
01911
01912 void ColorSchemeAtom::setTextAndLines( int textAndLines )
01913 {
01914 d->textAndLines = textAndLines;
01915 }
01916
01917 int ColorSchemeAtom::shadows() const
01918 {
01919 return d->shadows;
01920 }
01921
01922 void ColorSchemeAtom::setShadows( int shadows )
01923 {
01924 d->shadows = shadows;
01925 }
01926
01927 int ColorSchemeAtom::titleText() const
01928 {
01929 return d->titleText;
01930 }
01931
01932 void ColorSchemeAtom::setTitleText( int titleText )
01933 {
01934 d->titleText = titleText;
01935 }
01936
01937 int ColorSchemeAtom::fills() const
01938 {
01939 return d->fills;
01940 }
01941
01942 void ColorSchemeAtom::setFills( int fills )
01943 {
01944 d->fills = fills;
01945 }
01946
01947 int ColorSchemeAtom::accent() const
01948 {
01949 return d->accent;
01950 }
01951
01952 void ColorSchemeAtom::setAccent( int accent )
01953 {
01954 d->accent = accent;
01955 }
01956
01957 int ColorSchemeAtom::accentAndHyperlink() const
01958 {
01959 return d->accentAndHyperlink;
01960 }
01961
01962 void ColorSchemeAtom::setAccentAndHyperlink ( int accentAndHyperlink )
01963 {
01964 d->accentAndHyperlink = accentAndHyperlink;
01965 }
01966
01967 int ColorSchemeAtom::accentAndFollowedHyperlink() const
01968 {
01969 return d->accentAndFollowedHyperlink;
01970 }
01971
01972 void ColorSchemeAtom::setAccentAndFollowedHyperlink( int accentAndFollowedHyperlink )
01973 {
01974 d->accentAndFollowedHyperlink = accentAndFollowedHyperlink;
01975 }
01976
01977 void ColorSchemeAtom ::setData( unsigned , const unsigned char* data )
01978 {
01979 setBackground( readS32( data + 0 ) );
01980 setTextAndLines( readU32( data + 4 ) );
01981 setShadows( readU32( data + 8 ) );
01982 setTitleText( readU32( data + 12 ) );
01983 setFills( readU32( data + 16 ) );
01984 setAccent( readU32( data + 20 ) );
01985 setAccentAndHyperlink( readU32( data + 24 ) );
01986 setAccentAndFollowedHyperlink( readU32( data + 28 ) );
01987
01988 }
01989
01990 void ColorSchemeAtom ::dump( std::ostream& out ) const
01991 {
01992 out << "ColorSchemeAtom" << std::endl;
01993 out << "background " << background() << std::endl;
01994 out << " R " << ( (background() >> 0 ) & 0xff ) ;
01995 out << " G " << ( (background() >> 8 ) & 0xff ) ;
01996 out << " B " << ( (background() >> 16 ) & 0xff ) ;
01997 out << " I " << ( (background() >> 24 ) & 0xff ) << std::endl;
01998 out << "text and Lines " << textAndLines() << std::endl;
01999 out << " R " << ( ( textAndLines() >> 0 ) & 0xff ) ;
02000 out << " G " << ( ( textAndLines() >> 8 ) & 0xff ) ;
02001 out << " B " << ( ( textAndLines() >> 16 ) & 0xff ) ;
02002 out << " I " << ( ( textAndLines() >> 24 ) & 0xff ) << std::endl;
02003 out << "shadows " << shadows() << std::endl;
02004 out << " R " << ( ( shadows() >> 0 ) & 0xff ) ;
02005 out << " G " << ( ( shadows() >> 8 ) & 0xff ) ;
02006 out << " B " << ( ( shadows() >> 16 ) & 0xff ) ;
02007 out << " I " << ( ( shadows() >> 24 ) & 0xff ) << std::endl;
02008 out << "titleText " << titleText() << std::endl;
02009 out << " R " << ( ( titleText() >> 0 ) & 0xff ) ;
02010 out << " G " << ( ( titleText() >> 8 ) & 0xff ) ;
02011 out << " B " << ( ( titleText() >> 16 ) & 0xff ) ;
02012 out << " I " << ( ( titleText() >> 24 ) & 0xff ) << std::endl;
02013 out << "fills " << fills() << std::endl;
02014 out << " R " << ( ( fills() >> 0 ) & 0xff ) ;
02015 out << " G " << ( ( fills() >> 8 ) & 0xff ) ;
02016 out << " B " << ( ( fills() >> 16 ) & 0xff ) ;
02017 out << " I " << ( ( fills() >> 24 ) & 0xff ) << std::endl;
02018 out << "accent " << accent() << std::endl;
02019 out << " R " << ( ( accent() >> 0 ) & 0xff ) ;
02020 out << " G " << ( ( accent() >> 8 ) & 0xff ) ;
02021 out << " B " << ( ( accent() >> 16 ) & 0xff ) ;
02022 out << " I " << ( ( accent() >> 24 ) & 0xff ) << std::endl;
02023 out << "accentAndHyperlink " << accentAndHyperlink() << std::endl;
02024 out << " R " << ( ( accentAndHyperlink() >> 0 ) & 0xff ) ;
02025 out << " G " << ( ( accentAndHyperlink() >> 8 ) & 0xff ) ;
02026 out << " B " << ( ( accentAndHyperlink() >> 16 ) & 0xff ) ;
02027 out << " I " << ( ( accentAndHyperlink() >> 24 ) & 0xff ) << std::endl;
02028 out << "accentAndFollowedHyperlink " << accentAndFollowedHyperlink() << std::endl;
02029 out << " R " << ( ( accentAndFollowedHyperlink() >> 0 ) & 0xff ) ;
02030 out << " G " << ( ( accentAndFollowedHyperlink() >> 8 ) & 0xff ) ;
02031 out << " B " << ( ( accentAndFollowedHyperlink() >> 16 ) & 0xff ) ;
02032 out << " I " << ( ( accentAndFollowedHyperlink() >> 24 ) & 0xff ) << std::endl;
02033 }
02034
02035
02036
02037
02038 const unsigned int CurrentUserAtom::id = 4086;
02039
02040 class CurrentUserAtom ::Private
02041 {
02042 public:
02043 int size;
02044 int magic;
02045 int offsetToCurrentEdit;
02046 int lenUserName;
02047 int docFileVersion;
02048 int majorVersion;
02049 int minorVersion;
02050 };
02051
02052 CurrentUserAtom::CurrentUserAtom ()
02053 {
02054 d = new Private;
02055 d->size = 0 ;
02056 d->magic = 0 ;
02057 d->offsetToCurrentEdit = 0;
02058 d->lenUserName = 0 ;
02059 d->docFileVersion = 0 ;
02060 d->majorVersion = 0;
02061 d->minorVersion = 0;
02062 }
02063
02064 CurrentUserAtom::~CurrentUserAtom ()
02065 {
02066 delete d;
02067 }
02068
02069 int CurrentUserAtom::size() const
02070 {
02071 return d->size;
02072 }
02073
02074 void CurrentUserAtom::setSize( int size )
02075 {
02076 d->size = size;
02077 }
02078
02079 int CurrentUserAtom::magic() const
02080 {
02081 return d->magic;
02082 }
02083
02084 void CurrentUserAtom::setMagic( int magic )
02085 {
02086 d->magic = magic;
02087 }
02088
02089 int CurrentUserAtom::offsetToCurrentEdit() const
02090 {
02091 return d->offsetToCurrentEdit;
02092 }
02093
02094 void CurrentUserAtom::setOffsetToCurrentEdit( int offsetToCurrentEdit )
02095 {
02096 d->offsetToCurrentEdit = offsetToCurrentEdit;
02097 }
02098
02099 int CurrentUserAtom::lenUserName() const
02100 {
02101 return d->lenUserName;
02102 }
02103
02104 void CurrentUserAtom::setLenUserName( int lenUserName )
02105 {
02106 d->lenUserName = lenUserName;
02107 }
02108
02109 int CurrentUserAtom::docFileVersion() const
02110 {
02111 return d->docFileVersion;
02112 }
02113
02114 void CurrentUserAtom::setDocFileVersion( int docFileVersion )
02115 {
02116 d->docFileVersion = docFileVersion;
02117 }
02118
02119 int CurrentUserAtom::majorVersion() const
02120 {
02121 return d->majorVersion;
02122 }
02123
02124 void CurrentUserAtom::setMajorVersion( int majorVersion )
02125 {
02126 d->majorVersion = majorVersion;
02127 }
02128
02129 int CurrentUserAtom::minorVersion() const
02130 {
02131 return d->minorVersion;
02132 }
02133
02134 void CurrentUserAtom::setMinorVersion( int minorVersion )
02135 {
02136 d->minorVersion = minorVersion;
02137 }
02138
02139 void CurrentUserAtom ::setData( unsigned , const unsigned char* data )
02140 {
02141 setSize( readU32( data + 0 ) );
02142 setMagic( readU32( data + 4 ) );
02143 setOffsetToCurrentEdit( readU32( data + 8 ) );
02144 setLenUserName( readU16( data + 12 ) );
02145 setDocFileVersion( readU32( data + 14 ) );
02146 setMajorVersion( data[18] );
02147 setMinorVersion( data[19] );
02148 }
02149
02150 void CurrentUserAtom ::dump( std::ostream& out ) const
02151 {
02152 out << " CurrentUserAtom" << std::endl;
02153 out << " size " << size() << std::endl;
02154 out << " magic " << magic() << std::endl;
02155 out << " offsetToCurrentEdit " << offsetToCurrentEdit() << std::endl;
02156 out << " lenUserName " << lenUserName() << std::endl;
02157 out << " docFileVersion " << docFileVersion() << std::endl;
02158 out << " majorVersion " << majorVersion() << std::endl;
02159 out << " minorVersion " << minorVersion() << std::endl;
02160 }
02161
02162
02163
02164
02165 const unsigned int UserEditAtom::id = 4085;
02166
02167 class UserEditAtom::Private
02168 {
02169 public:
02170 int lastSlideId;
02171 int majorVersion;
02172 int minorVersion;
02173 unsigned long offsetLastEdit;
02174 unsigned long offsetPersistDir;
02175 unsigned long documentRef;
02176 };
02177
02178 UserEditAtom::UserEditAtom()
02179 {
02180 d = new Private;
02181 d->lastSlideId = 0;
02182 d->majorVersion = 0;
02183 d->minorVersion = 0;
02184 }
02185
02186 UserEditAtom::~UserEditAtom()
02187 {
02188 delete d;
02189 }
02190
02191 int UserEditAtom::lastSlideId() const
02192 {
02193 return d->lastSlideId;
02194 }
02195
02196 void UserEditAtom::setLastSlideId( int id )
02197 {
02198 d->lastSlideId = id;
02199 }
02200
02201 int UserEditAtom::majorVersion() const
02202 {
02203 return d->majorVersion;
02204 }
02205
02206 void UserEditAtom::setMajorVersion( int majorVersion )
02207 {
02208 d->majorVersion = majorVersion;
02209 }
02210
02211 int UserEditAtom::minorVersion() const
02212 {
02213 return d->minorVersion;
02214 }
02215
02216 void UserEditAtom::setMinorVersion( int minorVersion )
02217 {
02218 d->minorVersion = minorVersion;
02219 }
02220
02221 unsigned long UserEditAtom::offsetLastEdit() const
02222 {
02223 return d->offsetLastEdit;
02224 }
02225
02226 void UserEditAtom::setOffsetLastEdit( unsigned long ofs )
02227 {
02228 d->offsetLastEdit = ofs;
02229 }
02230
02231 unsigned long UserEditAtom::offsetPersistDir() const
02232 {
02233 return d->offsetPersistDir;
02234 }
02235
02236 void UserEditAtom::setOffsetPersistDir( unsigned long ofs ) const
02237 {
02238 d->offsetPersistDir = ofs;
02239 }
02240
02241 unsigned long UserEditAtom::documentRef() const
02242 {
02243 return d->documentRef;
02244 }
02245
02246 void UserEditAtom::setDocumentRef( unsigned long ref ) const
02247 {
02248 d->documentRef = ref;
02249 }
02250
02251 void UserEditAtom::setData( unsigned , const unsigned char* data )
02252 {
02253 setLastSlideId( readU32( data + 0 ) );
02254 setMinorVersion( readU16( data + 4 ) );
02255 setMajorVersion( readU16( data + 6 ) );
02256 setOffsetLastEdit( readU32( data + 8 ) );
02257 setOffsetPersistDir( readU32( data + 12 ) );
02258 setDocumentRef( readU32( data + 16 ) );
02259 }
02260
02261 void UserEditAtom::dump( std::ostream& out ) const
02262 {
02263 out << " UserEditAtom" << std::endl;
02264 out << " LastSlideID " << lastSlideId() << std::endl;
02265 out << " MajorVersion " << majorVersion() << std::endl;
02266 out << " MinorVersion " << minorVersion() << std::endl;
02267 out << " Offset Last Edit " << offsetLastEdit() << std::endl;
02268 out << " Offset Persist Dir " << offsetPersistDir() << std::endl;
02269 out << " Document Ref " << documentRef() << std::endl;
02270 }
02271
02272
02273
02274 const unsigned int TextBookmarkAtom::id = 4007;
02275
02276 class TextBookmarkAtom::Private
02277 {
02278 public:
02279 int begin;
02280 int end;
02281 int bookmarkID;
02282 };
02283
02284 TextBookmarkAtom::TextBookmarkAtom()
02285 {
02286 d = new Private;
02287 d->begin = 0;
02288 d->end = 0;
02289 d->bookmarkID = 0;
02290 }
02291
02292 TextBookmarkAtom::~TextBookmarkAtom()
02293 {
02294 delete d;
02295 }
02296
02297 int TextBookmarkAtom::begin() const
02298 {
02299 return d->begin;
02300 }
02301
02302 void TextBookmarkAtom::setBegin( int begin )
02303 {
02304 d->begin = begin;
02305 }
02306
02307 int TextBookmarkAtom::end() const
02308 {
02309 return d->end;
02310 }
02311
02312 void TextBookmarkAtom::setEnd( int end )
02313 {
02314 d->end = end;
02315 }
02316
02317 int TextBookmarkAtom::bookmarkID() const
02318 {
02319 return d->bookmarkID;
02320 }
02321
02322 void TextBookmarkAtom::setBookmarkID( int bookmarkID )
02323 {
02324 d->bookmarkID = bookmarkID;
02325 }
02326
02327 void TextBookmarkAtom::setData( unsigned , const unsigned char* data )
02328 {
02329 setBegin( readU32( data + 0 ) );
02330 setEnd( readU32( data + 4 ) );
02331 setBookmarkID( readU32( data + 8 ) );
02332 }
02333
02334 void TextBookmarkAtom::dump( std::ostream& out ) const
02335 {
02336 out << "TextBookmarkAtom" << std::endl;
02337 out << "begin " << begin() << std::endl;
02338 out << "end " << end() << std::endl;
02339 out << "bookmarkID " << bookmarkID() << std::endl;
02340 }
02341
02342
02343
02344 const unsigned int BookmarkEntityAtom::id = 4048;
02345
02346 class BookmarkEntityAtom::Private
02347 {
02348 public:
02349 int bookmarkID;
02350 int bookmarkName;
02351 };
02352
02353 BookmarkEntityAtom::BookmarkEntityAtom()
02354 {
02355 d = new Private;
02356 d->bookmarkID = 0;
02357 d->bookmarkName = 0;
02358 }
02359
02360 BookmarkEntityAtom::~BookmarkEntityAtom()
02361 {
02362 delete d;
02363 }
02364
02365 int BookmarkEntityAtom::bookmarkID() const
02366 {
02367 return d->bookmarkID;
02368 }
02369
02370 void BookmarkEntityAtom::setBookmarkID( int bookmarkID )
02371 {
02372 d->bookmarkID = bookmarkID;
02373 }
02374
02375 int BookmarkEntityAtom::bookmarkName() const
02376 {
02377 return d->bookmarkName;
02378 }
02379
02380 void BookmarkEntityAtom::setBookmarkName( int bookmarkName )
02381 {
02382 d->bookmarkName = bookmarkName;
02383 }
02384
02385 void BookmarkEntityAtom::setData( unsigned , const unsigned char* data )
02386 {
02387 setBookmarkID( readU32( data + 0 ) );
02388 setBookmarkName( readU16( data + 4 ) );
02389 }
02390
02391 void BookmarkEntityAtom::dump( std::ostream& out ) const
02392 {
02393 out << "BookmarkEntityAtom" << std::endl;
02394 out << "bookmarkID " << bookmarkID() << std::endl;
02395 out << "bookmarkName " << bookmarkName() << std::endl;
02396 }
02397
02398
02399
02400 const unsigned int SSDocInfoAtom::id = 1025;
02401
02402 class SSDocInfoAtom::Private
02403 {
02404 public:
02405 int penColorRed;
02406 int penColorGreen;
02407 int penColorBlue;
02408 int penColorIndex;
02409 int restartTime;
02410 int startSlide;
02411 int endSlide;
02412 int namedShow;
02413 int flags;
02414 };
02415
02416 SSDocInfoAtom::SSDocInfoAtom()
02417 {
02418 d = new Private;
02419 d->penColorRed = 0;
02420 d->penColorGreen = 0;
02421 d->penColorBlue = 0;
02422 d->penColorIndex = 0;
02423 d->restartTime = 0;
02424 d->startSlide = 0;
02425 d->endSlide = 0;
02426 d->namedShow = 0;
02427 d->flags = 0;
02428 }
02429
02430 SSDocInfoAtom::~SSDocInfoAtom()
02431 {
02432 delete d;
02433 }
02434
02435 int SSDocInfoAtom::penColorRed() const
02436 {
02437 return d->penColorRed;
02438 }
02439
02440 void SSDocInfoAtom::setPenColorRed( int penColorRed )
02441 {
02442 d->penColorRed = penColorRed;
02443 }
02444
02445 int SSDocInfoAtom::penColorGreen() const
02446 {
02447 return d->penColorGreen;
02448 }
02449
02450 void SSDocInfoAtom::setPenColorGreen( int penColorGreen )
02451 {
02452 d->penColorGreen = penColorGreen;
02453 }
02454
02455 int SSDocInfoAtom::penColorBlue() const
02456 {
02457 return d->penColorBlue;
02458 }
02459
02460 void SSDocInfoAtom::setPenColorBlue( int penColorBlue )
02461 {
02462 d->penColorBlue = penColorBlue;
02463 }
02464
02465 int SSDocInfoAtom::penColorIndex() const
02466 {
02467 return d->penColorIndex;
02468 }
02469
02470 void SSDocInfoAtom::setPenColorIndex( int penColorIndex )
02471 {
02472 d->penColorIndex = penColorIndex;
02473 }
02474
02475 int SSDocInfoAtom::restartTime() const
02476 {
02477 return d->restartTime;
02478 }
02479
02480 void SSDocInfoAtom::setRestartTime( int restartTime )
02481 {
02482 d->restartTime = restartTime;
02483 }
02484
02485 int SSDocInfoAtom::startSlide() const
02486 {
02487 return d->startSlide;
02488 }
02489
02490 void SSDocInfoAtom::setStartSlide( int startSlide )
02491 {
02492 d->startSlide = startSlide;
02493 }
02494
02495 int SSDocInfoAtom::endSlide() const
02496 {
02497 return d->endSlide;
02498 }
02499
02500 void SSDocInfoAtom::setEndSlide( int endSlide )
02501 {
02502 d->endSlide = endSlide;
02503 }
02504
02505 int SSDocInfoAtom::namedShow() const
02506 {
02507 return d->namedShow;
02508 }
02509
02510 void SSDocInfoAtom::setNamedShow( int namedShow )
02511 {
02512 d->namedShow = namedShow;
02513 }
02514
02515 int SSDocInfoAtom::flags() const
02516 {
02517 return d->flags;
02518 }
02519
02520 void SSDocInfoAtom::setFlags( int flags )
02521 {
02522 d->flags = flags;
02523 }
02524
02525 void SSDocInfoAtom::setData( unsigned , const unsigned char* data )
02526 {
02527 setPenColorRed( data[0] );
02528 setPenColorGreen( data[1] );
02529 setPenColorBlue( data[2]);
02530 setPenColorIndex( data[3] );
02531 setRestartTime( readS32( data + 4 ) );
02532 setStartSlide( readS16( data + 8 ) );
02533 setEndSlide( readS16( data + 10 ) );
02534 setNamedShow( readU16( data + 12 ) );
02535 setFlags( readU16( data + 76 ) );
02536 }
02537
02538 void SSDocInfoAtom::dump( std::ostream& out ) const
02539 {
02540 out << "UserEditAtom" << std::endl;
02541 out << "penColorRed " << penColorRed() << std::endl;
02542 out << "penColorGreen " << penColorGreen() << std::endl;
02543 out << "penColorBlue " << penColorBlue() << std::endl;
02544 out << "penColorIndex " << penColorIndex() << std::endl;
02545 out << "restartTime " << restartTime() << std::endl;
02546 out << "startSlide " << startSlide() << std::endl;
02547 out << "endSlide " << endSlide() << std::endl;
02548 out << "namedShow " << namedShow() << std::endl;
02549 out << "Flags " << flags() << std::endl;
02550 }
02551
02552
02553
02554 const unsigned int SrKinsokuAtom::id = 4050;
02555
02556 SrKinsokuAtom::SrKinsokuAtom()
02557 {
02558 }
02559
02560 SrKinsokuAtom::~SrKinsokuAtom()
02561 {
02562 }
02563
02564 void SrKinsokuAtom::dump( std::ostream& out ) const
02565 {
02566 out << "SrKinsokuAtom - not yet implemented" << std::endl;
02567 }
02568
02569
02570
02571 const unsigned int TxMasterStyleAtom::id = 4003;
02572
02573 TxMasterStyleAtom::TxMasterStyleAtom()
02574 {
02575 }
02576
02577 TxMasterStyleAtom::~TxMasterStyleAtom()
02578 {
02579 }
02580
02581 void TxMasterStyleAtom::dump( std::ostream& out ) const
02582 {
02583 out << "TxMasterStyleAtom - not yet implemented" << std::endl;
02584 }
02585
02586
02587
02588 const unsigned int SlideViewInfoAtom::id = 1022;
02589
02590 class SlideViewInfoAtom ::Private
02591 {
02592 public:
02593 int showGuides;
02594 int snapToGrid;
02595 int snapToShape;
02596 };
02597
02598 SlideViewInfoAtom::SlideViewInfoAtom ()
02599 {
02600 d = new Private;
02601 d->showGuides = 0;
02602 d->snapToGrid = 0;
02603 d->snapToShape = 0;
02604 }
02605
02606 SlideViewInfoAtom::~SlideViewInfoAtom ()
02607 {
02608 delete d;
02609 }
02610
02611 int SlideViewInfoAtom::showGuides() const
02612 {
02613 return d->showGuides;
02614 }
02615
02616 void SlideViewInfoAtom::setShowGuides(int showGuides)
02617 {
02618 d->showGuides= showGuides;
02619 }
02620
02621 int SlideViewInfoAtom::snapToGrid() const
02622 {
02623 return d->snapToGrid;
02624 }
02625
02626 void SlideViewInfoAtom::setSnapToGrid(int snapToGrid)
02627 {
02628 d->snapToGrid= snapToGrid;
02629 }
02630
02631 int SlideViewInfoAtom::snapToShape() const
02632 {
02633 return d->snapToShape;
02634 }
02635
02636 void SlideViewInfoAtom::setSnapToShape(int snapToShape)
02637 {
02638 d->snapToGrid= snapToShape;
02639 }
02640
02641 void SlideViewInfoAtom ::setData( unsigned , const unsigned char* data )
02642 {
02643 setShowGuides(data[0]);
02644 setSnapToGrid(data[1]);
02645 setSnapToShape(data[2]);
02646 }
02647
02648 void SlideViewInfoAtom ::dump( std::ostream& out ) const
02649 {
02650 out << "SlideViewInfoAtom" << std::endl;
02651 out << "showGuides " << showGuides() << std::endl;
02652 out << "snapToGrid " << snapToGrid() << std::endl;
02653 out << "snapToShape " << snapToShape() << std::endl;
02654 }
02655
02656
02657
02658 const unsigned int ViewInfoAtom::id = 1021;
02659
02660 class ViewInfoAtom ::Private
02661 {
02662 public:
02663 int curScaleXNum;
02664 int curScaleXDen;
02665 int curScaleYNum;
02666 int curScaleYDen;
02667 int prevScaleXNum;
02668 int prevScaleXDen;
02669 int prevScaleYNum;
02670 int prevScaleYDen;
02671 int viewSizeX;
02672 int viewSizeY;
02673 int originX;
02674 int originY;
02675 int varScale;
02676 int draftMode;
02677 int padding;
02678 };
02679
02680 ViewInfoAtom::ViewInfoAtom ()
02681 {
02682 d = new Private;
02683 d->curScaleXNum = 0;
02684 d->curScaleXDen = 0;
02685 d->curScaleYNum = 0;
02686 d->curScaleYDen = 0;
02687 d->prevScaleXNum = 0;
02688 d->prevScaleXDen = 0;
02689 d->prevScaleYNum = 0;
02690 d->prevScaleYDen = 0;
02691 d->viewSizeX = 0;
02692 d->viewSizeY = 0;
02693 d->originX = 0;
02694 d->originY = 0;
02695 d->varScale = 0;
02696 d->draftMode = 0;
02697 d->padding = 0;
02698 }
02699
02700 ViewInfoAtom::~ViewInfoAtom ()
02701 {
02702 delete d;
02703 }
02704
02705 int ViewInfoAtom::varScale() const
02706 {
02707 return d->varScale;
02708 }
02709
02710 void ViewInfoAtom::setVarScale(int varScale)
02711 {
02712 d->varScale= varScale;
02713 }
02714
02715 int ViewInfoAtom::draftMode() const
02716 {
02717 return d->draftMode;
02718 }
02719
02720 void ViewInfoAtom::setDraftMode(int draftMode)
02721 {
02722 d->draftMode= draftMode;
02723 }
02724
02725 int ViewInfoAtom::padding() const
02726 {
02727 return d->padding;
02728 }
02729
02730 void ViewInfoAtom::setPadding(int padding)
02731 {
02732 d->padding= padding;
02733 }
02734
02735 int ViewInfoAtom::viewSizeX() const
02736 {
02737 return d->viewSizeX;
02738 }
02739
02740 void ViewInfoAtom::setViewSizeX(int viewSizeX)
02741 {
02742 d->viewSizeX= viewSizeX;
02743 }
02744
02745 int ViewInfoAtom::viewSizeY() const
02746 {
02747 return d->viewSizeY;
02748 }
02749
02750 void ViewInfoAtom::setViewSizeY(int viewSizeY)
02751 {
02752 d->viewSizeY= viewSizeY;
02753 }
02754
02755 int ViewInfoAtom::originX() const
02756 {
02757 return d->originX;
02758 }
02759
02760 void ViewInfoAtom::setOriginX(int originX)
02761 {
02762 d->originX= originX;
02763 }
02764
02765 int ViewInfoAtom::originY() const
02766 {
02767 return d->originY;
02768 }
02769
02770 void ViewInfoAtom::setOriginY (int originY)
02771 {
02772 d->originY= originY;
02773 }
02774
02775 int ViewInfoAtom::prevScaleXNum() const
02776 {
02777 return d->prevScaleXNum;
02778 }
02779
02780 void ViewInfoAtom::setPrevScaleXNum(int prevScaleXNum)
02781 {
02782 d->prevScaleXNum= prevScaleXNum;
02783 }
02784
02785 int ViewInfoAtom::prevScaleXDen() const
02786 {
02787 return d->prevScaleXDen;
02788 }
02789
02790 void ViewInfoAtom::setPrevScaleXDen(int prevScaleXDen)
02791 {
02792 d->prevScaleXDen= prevScaleXDen;
02793 }
02794
02795 int ViewInfoAtom::prevScaleYNum() const
02796 {
02797 return d->prevScaleYNum;
02798 }
02799
02800 void ViewInfoAtom::setPrevScaleYNum(int prevScaleYNum)
02801 {
02802 d->prevScaleYNum= prevScaleYNum;
02803 }
02804
02805 int ViewInfoAtom::prevScaleYDen() const
02806 {
02807 return d->prevScaleYDen;
02808 }
02809
02810 void ViewInfoAtom::setPrevScaleYDen(int prevScaleYDen)
02811 {
02812 d->prevScaleYDen= prevScaleYDen;
02813 }
02814
02815 int ViewInfoAtom::curScaleXNum() const
02816 {
02817 return d->curScaleXNum;
02818 }
02819
02820 void ViewInfoAtom::setCurScaleXNum(int curScaleXNum)
02821 {
02822 d->curScaleXNum= curScaleXNum;
02823 }
02824
02825 int ViewInfoAtom::curScaleXDen() const
02826 {
02827 return d->curScaleXDen;
02828 }
02829
02830 void ViewInfoAtom::setCurScaleXDen(int curScaleXDen)
02831 {
02832 d->curScaleXDen= curScaleXDen;
02833 }
02834
02835 int ViewInfoAtom::curScaleYNum() const
02836 {
02837 return d->curScaleYNum;
02838 }
02839
02840 void ViewInfoAtom::setCurScaleYNum(int curScaleYNum)
02841 {
02842 d->curScaleYNum= curScaleYNum;
02843 }
02844
02845 int ViewInfoAtom::curScaleYDen() const
02846 {
02847 return d->curScaleYDen;
02848 }
02849
02850 void ViewInfoAtom::setCurScaleYDen(int curScaleYDen)
02851 {
02852 d->curScaleYDen= curScaleYDen;
02853 }
02854
02855 void ViewInfoAtom ::setData( unsigned , const unsigned char* data )
02856 {
02857 setCurScaleXNum(readS32( data + 0));
02858 setCurScaleXDen(readS32( data + 4 ));
02859 setCurScaleYNum(readS32( data + 8));
02860 setCurScaleYDen(readS32( data + 12 ));
02861 setPrevScaleXNum(readS32( data + 16 ));
02862 setPrevScaleXDen(readS32( data + 20 ));
02863 setPrevScaleYNum(readS32( data + 24 ));
02864 setPrevScaleYDen(readS32( data + 28 ));
02865 setViewSizeX(readS32( data + 32 ));
02866 setViewSizeY(readS32( data + 36 ));
02867 setOriginX(readS32( data + 40 ));
02868 setOriginY(readS32( data + 44));
02869 setVarScale(data[48]);
02870 setDraftMode(data[49]);
02871 setPadding(readU16( data + 50 ));
02872 }
02873
02874 void ViewInfoAtom ::dump( std::ostream& out ) const
02875 {
02876 out << "ViewInfoAtom" << std::endl;
02877 out << "curScaleXNum " << curScaleXNum() << std::endl;
02878 out << "curScaleXDen " << curScaleXDen() << std::endl;
02879 out << "curScaleYNum " << curScaleYNum() << std::endl;
02880 out << "curScaleYDen " << curScaleYDen() << std::endl;
02881 out << "prevScaleXNum " << prevScaleXNum() << std::endl;
02882 out << "prevScaleXDen " << prevScaleXNum() << std::endl;
02883 out << "prevScaleYNum " << prevScaleYNum() << std::endl;
02884 out << "prevScaleYDen " << prevScaleYNum() << std::endl;
02885 out << "viewSizeX " << viewSizeX() << std::endl;
02886 out << "viewSizeY " << viewSizeY() << std::endl;
02887 out << "originX " << originX() << std::endl;
02888 out << "originY " << originY() << std::endl;
02889 out << "varScale " << varScale() << std::endl;
02890 out << "draftMode " << draftMode() << std::endl;
02891 out << "padding " << padding() << std::endl;
02892 }
02893
02894
02895
02896 const unsigned int StyleTextPropAtom ::id = 4001;
02897
02898 class StyleTextPropAtom::Private
02899 {
02900 public:
02901 unsigned stringLength;
02902 struct PropAtomData
02903 {
02904 PropAtomData()
02905 : charCount(0)
02906 , depth(0)
02907 , bulletOn(0)
02908 , bulletHardFont(0)
02909 , bulletHardColor(0)
02910 , bulletChar(0)
02911 , bulletFont(0)
02912 , bulletHeight(0)
02913 , bulletColor(0)
02914 , align(0)
02915 , lineFeed(0)
02916 , upperDist(0)
02917 , lowerDist(0)
02918 , asianLB1(0)
02919 , asianLB2(0)
02920 , asianLB3(0)
02921 , biDi(0)
02922 {}
02923
02924 int charCount;
02925 int depth;
02926 unsigned bulletOn;
02927 unsigned bulletHardFont;
02928 unsigned bulletHardColor;
02929 unsigned bulletChar;
02930 unsigned bulletFont;
02931 unsigned bulletHeight;
02932 unsigned bulletColor;
02933 unsigned align;
02934 unsigned lineFeed;
02935 int upperDist;
02936 int lowerDist;
02937 int asianLB1;
02938 int asianLB2;
02939 int asianLB3;
02940 unsigned biDi;
02941 };
02942 std::vector<PropAtomData> atomData;
02943
02944 int charMask;
02945 int charCount2;
02946 int charFlags;
02947 };
02948
02949 StyleTextPropAtom::StyleTextPropAtom()
02950 {
02951 d = new Private;
02952 d->charMask = 0;
02953 d->charCount2 = 0;
02954 d->charFlags = 0;
02955 }
02956
02957 StyleTextPropAtom::~StyleTextPropAtom()
02958 {
02959 delete d;
02960 }
02961
02962 unsigned StyleTextPropAtom::listSize() const
02963 {
02964 return d->atomData.size();
02965 }
02966
02967 int StyleTextPropAtom::charCount( unsigned index ) const
02968 {
02969 return d->atomData[index].charCount;
02970 }
02971
02972 int StyleTextPropAtom::depth( unsigned index ) const
02973 {
02974 return d->atomData[index].depth;
02975 }
02976
02977 int StyleTextPropAtom::bulletOn( unsigned index ) const
02978 {
02979 return d->atomData[index].bulletOn;
02980 }
02981
02982 int StyleTextPropAtom::bulletHardFont( unsigned index ) const
02983 {
02984 return d->atomData[index].bulletHardFont;
02985 }
02986
02987 int StyleTextPropAtom::bulletHardColor( unsigned index ) const
02988 {
02989 return d->atomData[index].bulletHardColor;
02990 }
02991
02992 int StyleTextPropAtom::bulletChar( unsigned index ) const
02993 {
02994 return d->atomData[index].bulletChar;
02995 }
02996
02997 int StyleTextPropAtom::bulletFont( unsigned index ) const
02998 {
02999 return d->atomData[index].bulletFont;
03000 }
03001
03002 int StyleTextPropAtom::bulletHeight( unsigned index ) const
03003 {
03004 return d->atomData[index].bulletHeight;
03005 }
03006
03007 int StyleTextPropAtom::bulletColor( unsigned index ) const
03008 {
03009 return d->atomData[index].bulletColor;
03010 }
03011
03012 int StyleTextPropAtom::lineFeed( unsigned index ) const
03013 {
03014 return d->atomData[index].lineFeed;
03015 }
03016
03017 int StyleTextPropAtom::upperDist( unsigned index ) const
03018 {
03019 return d->atomData[index].upperDist;
03020 }
03021
03022 int StyleTextPropAtom::lowerDist( unsigned index ) const
03023 {
03024 return d->atomData[index].lowerDist;
03025 }
03026
03027 int StyleTextPropAtom::align( unsigned index ) const
03028 {
03029 return d->atomData[index].align;
03030 }
03031
03032 int StyleTextPropAtom::asianLB1( unsigned index ) const
03033 {
03034 return d->atomData[index].asianLB1;
03035 }
03036
03037 int StyleTextPropAtom::asianLB2( unsigned index ) const
03038 {
03039 return d->atomData[index].asianLB2;
03040 }
03041
03042 int StyleTextPropAtom::asianLB3( unsigned index ) const
03043 {
03044 return d->atomData[index].asianLB3;
03045 }
03046
03047 int StyleTextPropAtom::biDi( unsigned index ) const
03048 {
03049 return d->atomData[index].biDi;
03050 }
03051
03052 int StyleTextPropAtom::charMask() const
03053 {
03054 return d->charMask;
03055 }
03056
03057 void StyleTextPropAtom::setCharMask( int charMask )
03058 {
03059 d->charMask = charMask;
03060 }
03061
03062 int StyleTextPropAtom::charFlags() const
03063 {
03064 return d->charFlags;
03065 }
03066
03067 void StyleTextPropAtom::setCharFlags( int charFlags )
03068 {
03069 d->charFlags = charFlags;
03070 }
03071
03072 void StyleTextPropAtom::setData( unsigned , const unsigned char* data, unsigned lastSize )
03073 {
03074 unsigned charRead = 0;
03075 unsigned charCount = 0;
03076 unsigned stringLength = unsigned( (0.5*lastSize) + 1 );
03077
03078 bool isTextPropAtom = true;
03079 unsigned k=0;
03080
03081 while ( charRead < stringLength )
03082 {
03083 if ( isTextPropAtom == true )
03084 {
03085 Private::PropAtomData atomData;
03086 charCount = readU32(data+k) - 1;
03087 k += 4;
03088 atomData.charCount = charCount;
03089 atomData.depth = readU16(data+k);
03090 k += 2;
03091 unsigned mask = readU32(data+6);
03092 k += 4;
03093
03094 if ( mask & 0xF )
03095 {
03096 int bulletFlag = readU16(data+k);
03097 k += 2;
03098 atomData.bulletOn = ( bulletFlag & 1 ) ? 1 : 0;
03099 atomData.bulletHardFont = ( bulletFlag & 2 ) ? 1 : 0;
03100 atomData.bulletHardColor = ( bulletFlag & 4 ) ? 1 : 0;
03101 }
03102
03103 if ( mask & 0x0080 )
03104 {
03105 atomData.bulletChar = readU16(data+k);
03106 k += 2;
03107 }
03108
03109 if ( mask & 0x0010 )
03110 {
03111 atomData.bulletFont = readU16(data+k);
03112 k += 2;
03113 }
03114
03115 if ( mask & 0x0040 )
03116 {
03117 atomData.bulletHeight = readU16(data+k);
03118 k += 2;
03119 }
03120
03121 if ( mask & 0x0020 )
03122 {
03123 atomData.bulletColor = readU32(data+k);
03124 k += 4;
03125 }
03126
03127 if ( mask & 0x0F00 )
03128 {
03129 if ( mask & 0x800 )
03130 {
03131 unsigned dummy = readU16(data+k);
03132 atomData.align = ( dummy & 3 );
03133 k += 2;
03134 }
03135 if ( mask & 0x400 )
03136 {
03137 readU16(data+k);
03138 k += 2;
03139 }
03140 if ( mask & 0x200 )
03141 {
03142 readU16(data+k);
03143 k += 2;
03144 }
03145 if ( mask & 0x100 )
03146 {
03147 readU16(data+k);
03148 k += 2;
03149 }
03150 }
03151
03152 if ( mask & 0x1000 )
03153 {
03154 atomData.lineFeed = readU16(data+k);
03155 k += 2;
03156 }
03157
03158 if ( mask & 0x2000 )
03159 {
03160 atomData.upperDist = readU16(data+k);
03161 k += 2;
03162 }
03163
03164 if ( mask & 0x4000 )
03165 {
03166 atomData.lowerDist = readU16(data+k);
03167 k += 2;
03168 }
03169
03170 if ( mask & 0x8000 )
03171 {
03172 readU16(data+k);
03173 k += 2;
03174 }
03175
03176 if ( mask & 0x10000 )
03177 {
03178 readU16(data+k);
03179 k += 2;
03180 }
03181
03182 if ( mask & 0xe0000 )
03183 {
03184 unsigned dummy = readU16(data+k);
03185 if ( mask & 0x20000 )
03186 atomData.asianLB1 = dummy & 1;
03187 if ( mask & 0x40000 )
03188 atomData.asianLB2 = (dummy >> 1) & 1;
03189 if ( mask & 0x80000 )
03190 atomData.asianLB3 = (dummy >> 2) & 1;
03191
03192 k += 2;
03193 }
03194
03195 if ( mask & 0x200000 )
03196 {
03197 atomData.biDi = readU16(data+k);
03198 k += 2;
03199 }
03200 d->atomData.push_back( atomData );
03201 }
03202 else
03203 {
03204 std::cout << "isTextPropAtom == false " << std::endl;
03205 charCount = stringLength;
03206 Private::PropAtomData atomData;
03207 atomData.charCount = charCount;
03208 d->atomData.push_back( atomData );
03209 }
03210
03211 if ( ( charCount > stringLength ) || ( stringLength - ( charRead + charCount ) < 0 ) )
03212 {
03213 isTextPropAtom = false;
03214 charCount = stringLength - charRead;
03215 Private::PropAtomData atomData;
03216 atomData.charCount = charCount;
03217 d->atomData.push_back( atomData );
03218 }
03219
03220 charRead += charCount + 1;
03221
03222
03223 }
03224
03225
03226
03227
03228
03229
03230
03231
03232
03233
03234
03235
03236
03237
03238
03239
03240
03241
03242
03243
03244
03245
03246
03247
03248
03249
03250
03251
03252
03253
03254
03255
03256
03257
03258
03259
03260
03261
03262
03263
03264
03265
03266
03267
03268
03269
03270
03271
03272
03273
03274
03275
03276
03277
03278
03279
03280
03281
03282
03283
03284
03285
03286
03287
03288
03289
03290
03291
03292
03293
03294
03295
03296
03297
03298
03299
03300
03301
03302
03303
03304
03305
03306
03307
03308
03309
03310
03311
03312
03313
03314
03315
03316
03317
03318
03319
03320
03321
03322
03323 }
03324
03325
03326 void StyleTextPropAtom::dump( std::ostream& out ) const
03327 {
03328 out << "StyleTextPropAtom" << std::endl;
03329 out << "listSize " << listSize() << std::endl << std::endl;
03330 for ( unsigned i = 0; i < listSize(); i++)
03331 {
03332 out << "charCount " << charCount(i) << std::endl;
03333 out << "depth " << depth(i) << std::endl;
03334 out << "isBulletOn " << bulletOn(i) << std::endl;
03335 out << "isbulletHardFont " << bulletHardFont(i) << std::endl;
03336 out << "isbulletHardColor " << bulletHardColor(i) << std::endl;
03337 out << "bulletChar " << bulletChar(i) << std::endl;
03338 out << "bulletFont " << bulletFont(i) << std::endl;
03339 out << "bulletHeight " << bulletHeight(i) << std::endl;
03340 out << "bulletColor " << std::endl;
03341 out << " R " << ((bulletColor(i) >>0) & 0xff) << std::endl;
03342 out << " G " << ((bulletColor(i) >>8) & 0xff) << std::endl;
03343 out << " B " << ((bulletColor(i) >>16) & 0xff) << std::endl;
03344 out << " I " << ((bulletColor(i) >>24) & 0xff) << std::endl;
03345 out << "align " << align(i) << std::endl;
03346 out << "lineFeed " << lineFeed(i) << std::endl;
03347 out << "upperDist " << upperDist(i) << std::endl;
03348 out << "lowerDist " << lowerDist(i) << std::endl;
03349 out << "biDi " << biDi(i) << std::endl;
03350
03351 out << std::endl;
03352 }
03353
03354
03355
03356 }
03357
03358
03359
03360
03361
03362 const unsigned int TxCFStyleAtom ::id = 4004;
03363
03364
03365 class TxCFStyleAtom ::Private
03366 {
03367 public:
03368 int flags1;
03369 int flags2;
03370 int flags3;
03371 int n1;
03372 int fontHeight;
03373 int fontColor;
03374 };
03375
03376 TxCFStyleAtom ::TxCFStyleAtom ()
03377 {
03378 d = new Private;
03379 d->flags1 = 0;
03380 d->flags2 = 0;
03381 d->flags3 = 0;
03382 d->n1 = 0;
03383 d->fontHeight = 0;
03384 d->fontColor = 0;
03385 }
03386
03387 TxCFStyleAtom ::~TxCFStyleAtom ()
03388 {
03389 delete d;
03390 }
03391
03392 int TxCFStyleAtom::flags1() const
03393 {
03394 return d->flags1;
03395 }
03396
03397 void TxCFStyleAtom::setFlags1( int flags1 )
03398 {
03399 d->flags1 = flags1;
03400 }
03401
03402 int TxCFStyleAtom::flags2() const
03403 {
03404 return d->flags2;
03405 }
03406
03407 void TxCFStyleAtom::setFlags2( int flags2 )
03408 {
03409 d->flags2 = flags2;
03410 }
03411
03412 int TxCFStyleAtom::flags3() const
03413 {
03414 return d->flags3;
03415 }
03416
03417 void TxCFStyleAtom::setFlags3( int flags3 )
03418 {
03419 d->flags3 = flags3;
03420 }
03421
03422 int TxCFStyleAtom::n1() const
03423 {
03424 return d->n1;
03425 }
03426
03427 void TxCFStyleAtom::setN1( int n1 )
03428 {
03429 d->n1 = n1;
03430 }
03431
03432 int TxCFStyleAtom::fontHeight() const
03433 {
03434 return d->fontHeight;
03435 }
03436
03437 void TxCFStyleAtom::setFontHeight( int fontHeight )
03438 {
03439 d->fontHeight = fontHeight;
03440 }
03441
03442 int TxCFStyleAtom::fontColor() const
03443 {
03444 return d->fontColor;
03445 }
03446
03447 void TxCFStyleAtom::setFontColor( int fontColor )
03448 {
03449 d->fontColor = fontColor;
03450 }
03451
03452 void TxCFStyleAtom::setData( unsigned , const unsigned char* data )
03453 {
03454 setFlags1(readU16( data + 0));
03455 setFlags2(readU16( data + 2));
03456 setFlags3(readU16( data + 4));
03457 setN1(readU32( data + 6));
03458 setFontHeight(readU16( data + 10));
03459 setFontColor(readU32( data + 12));
03460 }
03461
03462 void TxCFStyleAtom ::dump( std::ostream& out ) const
03463 {
03464 out << "TxCFStyleAtom " << std::endl;
03465 out << "flags1 " << flags1() << std::endl;
03466 out << "flags2 " << flags2() << std::endl;
03467 out << "flags3 " << flags3() << std::endl;
03468 out << "n1 " << n1() << std::endl;
03469 out << "font height " << fontHeight() << std::endl;
03470 out << "font color " << fontColor() << std::endl;
03471 }
03472
03473
03474
03475 const unsigned int TxPFStyleAtom::id = 4005;
03476
03477 TxPFStyleAtom::TxPFStyleAtom()
03478 {
03479 }
03480
03481 TxPFStyleAtom::~TxPFStyleAtom()
03482 {
03483 }
03484
03485 void TxPFStyleAtom::dump( std::ostream& out ) const
03486 {
03487 out << "TxPFStyleAtom - need special parse code" << std::endl;
03488 }
03489
03490
03491
03492 const unsigned int TxSIStyleAtom ::id = 4009;
03493
03494 TxSIStyleAtom ::TxSIStyleAtom ()
03495 {
03496 }
03497
03498 TxSIStyleAtom ::~TxSIStyleAtom ()
03499 {
03500 }
03501
03502 void TxSIStyleAtom ::dump( std::ostream& out ) const
03503 {
03504 out << "TxSIStyleAtom - need special parse code" << std::endl;
03505 }
03506
03507
03508
03509 const unsigned int Record1043::id = 1043;
03510
03511 Record1043::Record1043()
03512 {
03513 }
03514
03515 void Record1043::dump( std::ostream& out ) const
03516 {
03517 out << "Record1043 - not known" << std::endl;
03518 }
03519
03520
03521
03522 const unsigned int Record1044::id = 1044;
03523
03524 Record1044::Record1044()
03525 {
03526 }
03527
03528 void Record1044::dump( std::ostream& out ) const
03529 {
03530 out << "Record1044 - not known" << std::endl;
03531 }
03532
03533
03534
03535 const unsigned int SlideAtom::id = 1007;
03536
03537 class SlideAtom::Private
03538 {
03539 public:
03540 int layoutGeom;
03541 int layoutPlaceholderId1;
03542 int layoutPlaceholderId2;
03543 int layoutPlaceholderId3;
03544 int layoutPlaceholderId4;
03545 int layoutPlaceholderId5;
03546 int layoutPlaceholderId6;
03547 int layoutPlaceholderId7;
03548 int layoutPlaceholderId8;
03549 int masterId;
03550 int notesId;
03551 int flags;
03552 };
03553
03554 SlideAtom::SlideAtom()
03555 {
03556 d = new Private;
03557 d->layoutGeom = 0;
03558 d->layoutPlaceholderId1 = 0;
03559 d->layoutPlaceholderId2 = 0;
03560 d->layoutPlaceholderId3 = 0;
03561 d->layoutPlaceholderId4 = 0;
03562 d->layoutPlaceholderId5 = 0;
03563 d->layoutPlaceholderId6 = 0;
03564 d->layoutPlaceholderId7 = 0;
03565 d->layoutPlaceholderId8 = 0;
03566 d->masterId = 0;
03567 d->notesId = 0;
03568 d->flags = 0;
03569 }
03570
03571 SlideAtom::~SlideAtom()
03572 {
03573 delete d;
03574 }
03575
03576 int SlideAtom::layoutGeom() const
03577 {
03578 return d->layoutGeom;
03579 }
03580
03581 void SlideAtom::setLayoutGeom(int layoutGeom )
03582 {
03583 d->layoutGeom = layoutGeom;
03584 }
03585
03586
03587 int SlideAtom::layoutPlaceholderId() const
03588 {
03589 return d->layoutPlaceholderId1;
03590 return d->layoutPlaceholderId2;
03591 return d->layoutPlaceholderId3;
03592 return d->layoutPlaceholderId4;
03593 return d->layoutPlaceholderId5;
03594 return d->layoutPlaceholderId6;
03595 return d->layoutPlaceholderId7;
03596 return d->layoutPlaceholderId8;
03597 }
03598
03599 void SlideAtom::setLayoutPlaceholderId(int layoutPlaceholderId1, int layoutPlaceholderId2,int layoutPlaceholderId3,int layoutPlaceholderId4,int layoutPlaceholderId5,int layoutPlaceholderId6,int layoutPlaceholderId7,int layoutPlaceholderId8)
03600 {
03601 d->layoutPlaceholderId1 = layoutPlaceholderId1;
03602 d->layoutPlaceholderId2 = layoutPlaceholderId2;
03603 d->layoutPlaceholderId3 = layoutPlaceholderId3;
03604 d->layoutPlaceholderId4 = layoutPlaceholderId4;
03605 d->layoutPlaceholderId5 = layoutPlaceholderId5;
03606 d->layoutPlaceholderId6 = layoutPlaceholderId6;
03607 d->layoutPlaceholderId7 = layoutPlaceholderId7;
03608 d->layoutPlaceholderId8 = layoutPlaceholderId8;
03609 }
03610
03611 int SlideAtom::masterId() const
03612 {
03613 return d->masterId;
03614 }
03615
03616 void SlideAtom::setMasterId(int masterId )
03617 {
03618 d->masterId = masterId;
03619 }
03620
03621 int SlideAtom::notesId() const
03622 {
03623 return d->notesId;
03624 }
03625
03626 void SlideAtom::setNotesId(int notesId)
03627 {
03628 d->notesId = notesId;
03629 }
03630
03631 int SlideAtom::flags() const
03632 {
03633 return d->flags;
03634 }
03635
03636 void SlideAtom::setFlags( int flags)
03637 {
03638 d->flags = flags;
03639 }
03640
03641 void SlideAtom::setData( unsigned , const unsigned char* data )
03642 {
03643 setLayoutGeom(readS32( data + 0 ) );
03644 setLayoutPlaceholderId (data[4], data[5], data[6], data[7], data[8], data[9], data[10],data[11]);
03645 setMasterId( readS32( data + 12 ) );
03646 setNotesId( readS32( data + 16 ) );
03647 setFlags( readU16( data + 20 ) );
03648 }
03649
03650 void SlideAtom::dump( std::ostream& out ) const
03651 {
03652 out << "SlideAtom" << std::endl;
03653 out << "layoutGeom " << layoutGeom() << std::endl;
03654
03655 out << "layoutPlaceholderId1 " << d->layoutPlaceholderId1 <<std::endl;
03656 out << "layoutPlaceholderId2 " << d->layoutPlaceholderId2 <<std::endl;
03657 out << "layoutPlaceholderId3 " << d->layoutPlaceholderId3 <<std::endl;
03658 out << "layoutPlaceholderId4 " << d->layoutPlaceholderId4 <<std::endl;
03659 out << "layoutPlaceholderId5 " << d->layoutPlaceholderId5 <<std::endl;
03660 out << "layoutPlaceholderId6 " << d->layoutPlaceholderId6 <<std::endl;
03661 out << "layoutPlaceholderId7 " << d->layoutPlaceholderId7 <<std::endl;
03662 out << "layoutPlaceholderId8 " << d->layoutPlaceholderId8 <<std::endl;
03663 out << "masterId " << masterId() << std::endl;
03664 out << "notesId " << notesId() << std::endl;
03665 out << "flags " << flags() << std::endl;
03666 }
03667
03668
03669
03670 const unsigned int SSSlideInfoAtom::id = 1017;
03671
03672 class SSSlideInfoAtom ::Private
03673 {
03674 public:
03675 int transType;
03676 int speed;
03677 int direction;
03678 int slideTime;
03679 int buildFlags;
03680 int soundRef;
03681 };
03682
03683 SSSlideInfoAtom ::SSSlideInfoAtom ()
03684 {
03685 d = new Private;
03686 d->transType = 0;
03687 d->speed = 0;
03688 d->direction = 0;
03689 d->slideTime = 0;
03690 d->buildFlags = 0;
03691 d->soundRef = 0;
03692 }
03693
03694 SSSlideInfoAtom ::~SSSlideInfoAtom ()
03695 {
03696 delete d;
03697 }
03698
03699 int SSSlideInfoAtom ::transType() const
03700 {
03701 return d->transType;
03702 }
03703
03704 void SSSlideInfoAtom ::settransType(int transType)
03705 {
03706 d->transType = transType;
03707 }
03708
03709 int SSSlideInfoAtom ::speed() const
03710 {
03711 return d->transType;
03712 }
03713
03714 void SSSlideInfoAtom ::setspeed(int speed)
03715 {
03716 d->speed = speed;
03717 }
03718
03719 int SSSlideInfoAtom ::direction() const
03720 {
03721 return d->transType;
03722 }
03723
03724 void SSSlideInfoAtom ::setdirection(int direction)
03725 {
03726 d->direction = direction;
03727 }
03728
03729 int SSSlideInfoAtom ::slideTime() const
03730 {
03731 return d->slideTime;
03732 }
03733
03734 void SSSlideInfoAtom ::setslideTime(int slideTime)
03735 {
03736 d->slideTime = slideTime;
03737 }
03738
03739 int SSSlideInfoAtom ::buildFlags() const
03740 {
03741 return d->buildFlags;
03742 }
03743
03744 void SSSlideInfoAtom ::setbuildFlags(int buildFlags)
03745 {
03746 d->buildFlags = buildFlags;
03747 }
03748
03749 int SSSlideInfoAtom ::soundRef() const
03750 {
03751 return d->soundRef;
03752 }
03753
03754 void SSSlideInfoAtom ::setsoundRef(int soundRef)
03755 {
03756 d->soundRef = soundRef;
03757 }
03758
03759 void SSSlideInfoAtom ::setData( unsigned , const unsigned char* data )
03760 {
03761 settransType( readU32( data + 0 ) );
03762 setspeed(readS32( data + 4 ));
03763 setdirection(readS32( data + 8 ));
03764 setslideTime(readS32( data + 12 ));
03765 setbuildFlags(readS32( data + 16 ));
03766 setsoundRef(readS32( data + 20 ));
03767 }
03768
03769 void SSSlideInfoAtom ::dump( std::ostream& out ) const
03770 {
03771 out << "SSSlideInfoAtom" << std::endl;
03772 out << "transType " << transType() << std::endl;
03773 out << "speed " << speed() << std::endl;
03774 out << "direction " << direction() << std::endl;
03775 out << "slideTime " << slideTime() << std::endl;
03776 out << "buildFlags " << buildFlags() << std::endl;
03777 out << "soundRef " << soundRef() << std::endl;
03778 }
03779
03780
03781
03782 const unsigned int TextHeaderAtom::id = 3999;
03783
03784 class TextHeaderAtom ::Private
03785 {
03786 public:
03787 int textType;
03788 };
03789
03790 TextHeaderAtom ::TextHeaderAtom ()
03791 {
03792 d = new Private;
03793 d->textType = 0;
03794 }
03795
03796 TextHeaderAtom ::~TextHeaderAtom ()
03797 {
03798 delete d;
03799 }
03800
03801 int TextHeaderAtom ::textType() const
03802 {
03803 return d->textType;
03804 }
03805
03806 void TextHeaderAtom ::setTextType( int type )
03807 {
03808 d->textType = type;
03809 }
03810
03811 void TextHeaderAtom ::setData( unsigned size, const unsigned char* data )
03812 {
03813 if( size < 4 ) return;
03814 setTextType( readU32( data + 0 ) );
03815 }
03816
03817 void TextHeaderAtom ::dump( std::ostream& out ) const
03818 {
03819 out << "TextHeaderAtom" << std::endl;
03820 out << " textType " << textType() << std::endl;
03821 }
03822
03823
03824
03825 const unsigned int TextBytesAtom::id = 4008;
03826
03827 class TextBytesAtom::Private
03828 {
03829 public:
03830 std::vector<unsigned> index;
03831 std::vector<UString> ustring;
03832 unsigned stringLength;
03833 };
03834
03835 TextBytesAtom::TextBytesAtom()
03836 {
03837 d = new Private;
03838 }
03839
03840 TextBytesAtom::~TextBytesAtom()
03841 {
03842 delete d;
03843 }
03844
03845 unsigned TextBytesAtom::listSize() const
03846 {
03847 return d->ustring.size();
03848 }
03849
03850 unsigned TextBytesAtom::stringLength() const
03851 {
03852 return d->stringLength;
03853 }
03854
03855 void TextBytesAtom::setStringLength( unsigned stringLength )
03856 {
03857 d->stringLength = stringLength;
03858 }
03859
03860 UString TextBytesAtom::strValue( unsigned index ) const
03861 {
03862 return d->ustring[index];
03863 }
03864
03865 void TextBytesAtom::setText( UString ustring )
03866 {
03867 d->ustring.push_back( ustring );
03868 }
03869
03870 void TextBytesAtom::setData( unsigned size, const unsigned char* data )
03871 {
03872 UString tempStr;
03873 int index = 0;
03874 unsigned length = 0;
03875 for( unsigned k=0; k<(size + 1); k++ )
03876 {
03877 unsigned uchar = data[k];
03878 if ( (uchar == 0x0b) | (uchar == 0x0d) | (k == size) )
03879 {
03880 setText(tempStr);
03881 index++;
03882 tempStr = "";
03883 }
03884 else
03885 tempStr.append( UString(uchar) );
03886
03887 if ( ( uchar & 0xff00 ) == 0xf000 )
03888 {
03889 std::cout << "got a symbol at " << k << "th character" << std::endl;
03890 }
03891 length++;
03892 }
03893
03894 setStringLength(length);
03895 }
03896
03897 void TextBytesAtom::dump( std::ostream& out ) const
03898 {
03899 out << "TextBytesAtom" << std::endl;
03900 out << "stringLength " << stringLength() << std::endl;
03901 out << "listSize " << listSize() << std::endl;
03902 for (uint i=0; i<listSize() ; i++)
03903 {
03904 out << "String " << i << " [" << strValue(i) << "]" << std::endl;
03905 }
03906
03907 }
03908
03909
03910
03911
03912 const unsigned int TextSpecInfoAtom::id = 4010;
03913
03914 class TextSpecInfoAtom::Private
03915 {
03916 public:
03917 int charCount;
03918 int flags;
03919 };
03920
03921 TextSpecInfoAtom::TextSpecInfoAtom ()
03922 {
03923 d = new Private;
03924 d->charCount = 0;
03925 d->flags = 0;
03926 }
03927
03928 TextSpecInfoAtom::~TextSpecInfoAtom ()
03929 {
03930 delete d;
03931 }
03932
03933 int TextSpecInfoAtom::charCount() const
03934 {
03935 return d->charCount;
03936 }
03937
03938 void TextSpecInfoAtom::setCharCount(int charCount)
03939 {
03940 d->charCount = charCount;
03941 }
03942
03943 int TextSpecInfoAtom::flags() const
03944 {
03945 return d->flags;
03946 }
03947
03948 void TextSpecInfoAtom::setFlags(int flags)
03949 {
03950 d->flags = flags;
03951 }
03952
03953 void TextSpecInfoAtom::setData( unsigned , const unsigned char* data )
03954 {
03955 setCharCount( readU32( data + 0 ) );
03956 setFlags( readU32( data + 4 ) );
03957
03958 }
03959
03960 void TextSpecInfoAtom::dump( std::ostream& out ) const
03961 {
03962 out << "TextSpecInfoAtom" << std::endl;
03963 out << "charCount " << charCount() << std::endl;
03964 out << "flags " << flags() << std::endl;
03965 }
03966
03967
03968
03969 const unsigned int SlidePersistAtom::id = 1011;
03970
03971 class SlidePersistAtom::Private
03972 {
03973 public:
03974 int psrReference;
03975 int flags;
03976 int numberTexts;
03977 int slideId;
03978 int reserved;
03979 };
03980
03981 SlidePersistAtom::SlidePersistAtom ()
03982 {
03983 d = new Private;
03984 d->psrReference = 0;
03985 d->flags = 0;
03986 d->numberTexts=0;
03987 d->slideId=0;
03988 d->reserved=0;
03989 }
03990
03991 SlidePersistAtom::~SlidePersistAtom ()
03992 {
03993 delete d;
03994 }
03995
03996 int SlidePersistAtom::psrReference() const
03997 {
03998 return d->psrReference;
03999 }
04000
04001 void SlidePersistAtom::setPsrReference( int psrReference )
04002 {
04003 d->psrReference = psrReference;
04004 }
04005
04006 int SlidePersistAtom::flags() const
04007 {
04008 return d->flags;
04009 }
04010
04011 void SlidePersistAtom::setFlags( int flags )
04012 {
04013 d->flags = flags;
04014 }
04015
04016 int SlidePersistAtom::numberTexts() const
04017 {
04018 return d->numberTexts;
04019 }
04020
04021 void SlidePersistAtom::setNumberTexts( int numberTexts )
04022 {
04023 d->numberTexts = numberTexts;
04024 }
04025
04026 int SlidePersistAtom::slideId() const
04027 {
04028 return d->slideId;
04029 }
04030
04031 void SlidePersistAtom::setSlideId( int slideId )
04032 {
04033 d->slideId = slideId;
04034 }
04035
04036 int SlidePersistAtom::reserved() const
04037 {
04038 return d->reserved;
04039 }
04040
04041 void SlidePersistAtom::setReserved( int reserved )
04042 {
04043 d->reserved = reserved;
04044 }
04045
04046 void SlidePersistAtom::setData( unsigned size, const unsigned char* data )
04047 {
04048 if( size < 20 ) return;
04049
04050 setPsrReference( readU32( data + 0 ) );
04051 setFlags( readU32( data + 4 ) );
04052 setNumberTexts( readS32( data + 8 ) );
04053 setSlideId( readS32( data + 12 ) );
04054 setReserved(readU32( data + 16) );
04055 }
04056
04057 void SlidePersistAtom ::dump( std::ostream& out ) const
04058 {
04059 out << "SlidePersistAtom" << std::endl;
04060 out << "psrReference " << psrReference() << std::endl;
04061 out << "flags " << flags() << std::endl;
04062 out << "numberTexts " << numberTexts() << std::endl;
04063 out << "slideId " << slideId() << std::endl;
04064 out << "reserved " << reserved() << " always 0."<<std::endl;
04065 }
04066
04067
04068
04069 const unsigned int msofbtDgAtom::id = 61448;
04070
04071 msofbtDgAtom ::msofbtDgAtom ()
04072 {
04073 }
04074
04075 msofbtDgAtom ::~msofbtDgAtom ()
04076 {
04077 }
04078
04079 void msofbtDgAtom ::dump( std::ostream& out ) const
04080 {
04081 out << "msofbtDgAtom " << std::endl;
04082 }
04083
04084
04085
04086 const unsigned int msofbtSpgrAtom::id = 61449;
04087
04088 msofbtSpgrAtom ::msofbtSpgrAtom ()
04089 {
04090 }
04091
04092 msofbtSpgrAtom ::~msofbtSpgrAtom ()
04093 {
04094 }
04095
04096 void msofbtSpgrAtom ::dump( std::ostream& out ) const
04097 {
04098 out << "msofbtSpgrAtom " << std::endl;
04099 }
04100
04101
04102
04103 const unsigned int msofbtSpAtom::id = 61450;
04104
04105 class msofbtSpAtom::Private
04106 {
04107 public:
04108 unsigned long shapeId;
04109 unsigned long persistentFlag;
04110 bool background;
04111 bool hFlip;
04112 bool vFlip;
04113 };
04114
04115 msofbtSpAtom ::msofbtSpAtom ()
04116 {
04117 d = new Private;
04118 d->shapeId = 0;
04119 d->persistentFlag = 0;
04120 d->background = false;
04121 d->hFlip = false;
04122 d->vFlip = false;
04123 }
04124
04125 msofbtSpAtom ::~msofbtSpAtom ()
04126 {
04127 delete d;
04128 }
04129
04130 unsigned long msofbtSpAtom::shapeId() const
04131 {
04132 return d->shapeId;
04133 }
04134
04135 void msofbtSpAtom::setShapeId( unsigned long id )
04136 {
04137 d->shapeId = id;
04138 }
04139
04140 const char* msofbtSpAtom::shapeTypeAsString() const
04141 {
04142 switch( instance() )
04143 {
04144 case 0: return "msosptMin";
04145 case 1: return "msosptRectangle";
04146 case 2: return "msosptRoundRectangle";
04147 case 3: return "msosptEllipse";
04148 case 4: return "msosptDiamond";
04149 case 5: return "msosptIsoscelesTriangle";
04150 case 6: return "msosptRightTriangle";
04151 case 7: return "msosptParallelogram";
04152 case 8: return "msosptTrapezoid";
04153 case 9: return "msosptHexagon";
04154 case 10: return "msosptOctagon";
04155 case 11: return "msosptPlus";
04156 case 12: return "msosptStar";
04157 case 13: return "msosptArrow";
04158 case 14: return "msosptThickArrow";
04159 case 15: return "msosptHomePlate";
04160 case 16: return "msosptCube";
04161 case 17: return "msosptBalloon";
04162 case 18: return "msosptSeal";
04163 case 19: return "msosptArc";
04164 case 20: return "msosptLine";
04165 case 21: return "msosptPlaque";
04166 case 22: return "msosptCan =";
04167 case 23: return "msosptDonut";
04168 case 24: return "msosptTextSimple";
04169 case 25: return "msosptTextOctagon";
04170 case 26: return "msosptTextHexagon";
04171 case 27: return "msosptTextCurve";
04172 case 28: return "msosptTextOnRing";
04173 case 29: return "msosptTextRing";
04174 case 30: return "msosptTextOnCurve";
04175 case 31: return "msosptTextOnRing";
04176 case 32: return "msosptStraightConnector1";
04177 case 75: return "msosptPictureFrame";
04178 case 74: return "msosptHeart";
04179 case 96: return "msosptSmileyFace";
04180 case 202: return "msosptTextBox";
04181 default: break;
04182 };
04183 return "Unknown";
04184 }
04185
04186 unsigned long msofbtSpAtom::persistentFlag() const
04187 {
04188 return d->persistentFlag;
04189 }
04190
04191 void msofbtSpAtom::setPersistentFlag( unsigned long persistentFlag )
04192 {
04193 d->persistentFlag = persistentFlag;
04194 }
04195
04196 bool msofbtSpAtom::isBackground() const
04197 {
04198 return d->background;
04199 }
04200
04201 void msofbtSpAtom::setBackground( bool bg )
04202 {
04203 d->background = bg;
04204 }
04205
04206 bool msofbtSpAtom::isVerFlip() const
04207 {
04208 return d->vFlip;
04209 }
04210
04211 void msofbtSpAtom::setVerFlip( bool vFlip )
04212 {
04213 d->vFlip = vFlip;
04214 }
04215
04216 bool msofbtSpAtom::isHorFlip() const
04217 {
04218 return d->hFlip;
04219 }
04220
04221 void msofbtSpAtom::setHorFlip( bool hFlip )
04222 {
04223 d->hFlip = hFlip;
04224 }
04225
04226 void msofbtSpAtom::setData( unsigned size, const unsigned char* data )
04227 {
04228 if( size < 8 ) return;
04229
04230 setShapeId( readU32( data + 0 ) );
04231 setPersistentFlag( readU32( data + 4 ) );
04232
04233 unsigned flag = readU16( data + 4 );
04234 setBackground( flag & 0x800 );
04235 setVerFlip( flag & 0x80 );
04236 setHorFlip( flag & 0x40 );
04237 }
04238
04239 void msofbtSpAtom ::dump( std::ostream& out ) const
04240 {
04241 out << "msofbtSpAtom " << std::endl;
04242 }
04243
04244
04245
04246 const unsigned int msofbtOPTAtom::id = 61451;
04247
04248 class msofbtOPTAtom::Private
04249 {
04250 public:
04251 std::vector<unsigned> ids;
04252 std::vector<unsigned long> values;
04253 };
04254
04255 msofbtOPTAtom ::msofbtOPTAtom ()
04256 {
04257 d = new Private;
04258 }
04259
04260 msofbtOPTAtom ::~msofbtOPTAtom ()
04261 {
04262 delete d;
04263 }
04264
04265 unsigned msofbtOPTAtom ::propertyCount() const
04266 {
04267 return d->ids.size();
04268 }
04269
04270 unsigned msofbtOPTAtom ::propertyId( unsigned index ) const
04271 {
04272 return d->ids[index];
04273 }
04274
04275 unsigned long msofbtOPTAtom ::propertyValue( unsigned index ) const
04276 {
04277 return d->values[index];
04278 }
04279
04280 void msofbtOPTAtom::setProperty( unsigned id, unsigned long val )
04281 {
04282 d->ids.push_back( id );
04283 d->values.push_back( val );
04284 }
04285
04286 void msofbtOPTAtom::setData( unsigned size, const unsigned char* data )
04287 {
04288 unsigned i = 0;
04289 unsigned comp_len = 0;
04290
04291 d->ids.clear();
04292 d->values.clear();
04293
04294 while( i < size )
04295 {
04296 unsigned x = readU16( data+i );
04297 unsigned int id = x & 0x3fff;
04298 bool comp = x & 0x8000;
04299 unsigned long val = readU32( data + i + 2 );
04300 if( comp )
04301 comp_len += val;
04302 i += 6;
04303 setProperty( id, val );
04304 }
04305 }
04306
04307 void msofbtOPTAtom ::dump( std::ostream& out ) const
04308 {
04309 out << "msofbtOPTAtom " << std::endl;
04310 }
04311
04312
04313
04314
04315 const unsigned int msofbtChildAnchorAtom::id = 61455;
04316
04317 msofbtChildAnchorAtom ::msofbtChildAnchorAtom ()
04318 {
04319 }
04320
04321 msofbtChildAnchorAtom ::~msofbtChildAnchorAtom ()
04322 {
04323 }
04324
04325 void msofbtChildAnchorAtom ::dump( std::ostream& out ) const
04326 {
04327 out << "msofbtChildAnchorAtom " << std::endl;
04328 }
04329
04330
04331
04332 const unsigned int msofbtClientAnchorAtom::id = 61456;
04333
04334 class msofbtClientAnchorAtom::Private
04335 {
04336 public:
04337 int left;
04338 int top;
04339 int right;
04340 int bottom;
04341 };
04342
04343 msofbtClientAnchorAtom::msofbtClientAnchorAtom ()
04344 {
04345 d = new Private;
04346 d->left = 0;
04347 d->top = 0;
04348 d->right=0;
04349 d->bottom=0;
04350 }
04351
04352 msofbtClientAnchorAtom ::~msofbtClientAnchorAtom ()
04353 {
04354 delete d;
04355 }
04356
04357 int msofbtClientAnchorAtom ::left() const
04358 {
04359 return d->left;
04360 }
04361
04362 void msofbtClientAnchorAtom ::setLeft( int left )
04363 {
04364 d->left = left;
04365 }
04366
04367 int msofbtClientAnchorAtom ::top() const
04368 {
04369 return d->top;
04370 }
04371
04372 void msofbtClientAnchorAtom ::setTop( int top )
04373 {
04374 d->top = top;
04375 }
04376
04377 int msofbtClientAnchorAtom ::right() const
04378 {
04379 return d->right;
04380 }
04381
04382 void msofbtClientAnchorAtom ::setRight( int right )
04383 {
04384 d->right = right;
04385 }
04386
04387 int msofbtClientAnchorAtom ::bottom() const
04388 {
04389 return d->bottom;
04390 }
04391
04392 void msofbtClientAnchorAtom ::setBottom( int bottom )
04393 {
04394 d->bottom = bottom;
04395 }
04396
04397 void msofbtClientAnchorAtom ::setData( unsigned , const unsigned char* data )
04398 {
04399 setTop( readU16( data + 0 ) );
04400 setLeft( readU16( data + 2 ) );
04401 setRight( readU16( data + 4 ) );
04402 setBottom( readU16( data + 6 ) );
04403 }
04404
04405 void msofbtClientAnchorAtom ::dump( std::ostream& out ) const
04406 {
04407 out << "msofbtClientAnchorAtom " << std::endl;
04408 out << "left " << left() << std::endl;
04409 out << "top " << top() << std::endl;
04410 out << "right " << right() << std::endl;
04411 out << "bottom " << bottom() << std::endl;
04412
04413 }
04414
04415
04416
04417 const unsigned int msofbtClientDataAtom::id = 61457;
04418
04419 class msofbtClientDataAtom::Private
04420 {
04421 public:
04422 unsigned placementId;
04423 unsigned placeholderId;
04424 };
04425
04426 msofbtClientDataAtom::msofbtClientDataAtom ()
04427 {
04428 d = new Private;
04429 d->placementId = 0;
04430 d->placeholderId = 0;
04431 }
04432
04433 msofbtClientDataAtom::~msofbtClientDataAtom ()
04434 {
04435 delete d;
04436 }
04437
04438 unsigned msofbtClientDataAtom::placementId() const
04439 {
04440 return d->placementId;
04441 }
04442
04443 void msofbtClientDataAtom::setPlacementId( unsigned id )
04444 {
04445 d->placementId = id;
04446 }
04447
04448 unsigned msofbtClientDataAtom::placeholderId() const
04449 {
04450 return d->placeholderId;
04451 }
04452
04453 void msofbtClientDataAtom::setPlaceholderId( unsigned id )
04454 {
04455 d->placeholderId = id;
04456 }
04457
04458 const char* msofbtClientDataAtom::placeholderIdAsString() const
04459 {
04460 switch( d->placeholderId )
04461 {
04462 case 0: return "None";
04463 case 1: return "Master title";
04464 case 2: return "Master body";
04465 case 3: return "Master centered title";
04466 case 4: return "Master notes slide image";
04467 case 5: return "Master notes body image";
04468 case 6: return "Master date";
04469 case 7: return "Master slide number";
04470 case 8: return "Master footer";
04471 case 9: return "Master header";
04472 case 10: return "Master subtitle";
04473 case 11: return "Generic text object";
04474 case 12: return "Title";
04475 case 13: return "Body";
04476 case 14: return "Notes body";
04477 case 15: return "Centered title";
04478 case 16: return "Subtitle";
04479 case 17: return "Vertical text title";
04480 case 18: return "Vertical text body";
04481 case 19: return "Notes slide image";
04482 case 20: return "Object";
04483 case 21: return "Graph";
04484 case 22: return "Table";
04485 case 23: return "Clip Art";
04486 case 24: return "Organization Chart";
04487 case 25: return "Media Clip";
04488 default: break;
04489 };
04490
04491 return "Unknown";
04492 }
04493
04494
04495
04496
04497
04498
04499
04500
04501
04502 void msofbtClientDataAtom::setData( unsigned size, const unsigned char* data )
04503 {
04504 if( size < 12 ) return;
04505 setPlacementId( readU16( data+8 ) );
04506 setPlaceholderId( data[12]-1 );
04507 }
04508
04509 void msofbtClientDataAtom ::dump( std::ostream& out ) const
04510 {
04511 out << "msofbtClientDataAtom " << std::endl;
04512 }
04513
04514
04515
04516 const unsigned int msofbtDggAtom::id = 61446;
04517
04518 msofbtDggAtom ::msofbtDggAtom ()
04519 {
04520 }
04521
04522 msofbtDggAtom ::~msofbtDggAtom ()
04523 {
04524 }
04525
04526 void msofbtDggAtom ::dump( std::ostream& out ) const
04527 {
04528 out << "msofbtDggAtom " << std::endl;
04529 }
04530
04531
04532
04533 const unsigned int msofbtClientTextboxAtom::id = 61453;
04534
04535 class msofbtClientTextboxAtom::Private
04536 {
04537 public:
04538 UString ustring;
04539 };
04540
04541 msofbtClientTextboxAtom::msofbtClientTextboxAtom()
04542 {
04543 d = new Private;
04544 }
04545
04546 msofbtClientTextboxAtom::~msofbtClientTextboxAtom()
04547 {
04548 delete d;
04549 }
04550
04551 UString msofbtClientTextboxAtom::ustring() const
04552 {
04553 return d->ustring;
04554 }
04555
04556 void msofbtClientTextboxAtom::setUString( const UString& ustr )
04557 {
04558 d->ustring = ustr;
04559 }
04560
04561 void msofbtClientTextboxAtom::setData( unsigned size, const unsigned char* data )
04562 {
04563 UString str;
04564 for( unsigned k=0; k<size/2; k++ )
04565 {
04566 unsigned uchar = readU16( data + k*2 );
04567 str.append( UString(uchar) );
04568 }
04569 setUString( str );
04570 }
04571
04572 void msofbtClientTextboxAtom::dump( std::ostream& out ) const
04573 {
04574 out << "msofbtClientTextboxAtom" << std::endl;
04575 out << "String : [" << ustring() << "]" << std::endl;
04576 }
04577
04578
04579
04580
04581
04582
04583
04584
04585
04586
04587
04588
04589
04590
04591
04592
04593
04594
04595 const unsigned int msofbtDeletedPsplAtom::id = 61725;
04596
04597 msofbtDeletedPsplAtom ::msofbtDeletedPsplAtom ()
04598 {
04599 }
04600
04601 msofbtDeletedPsplAtom ::~msofbtDeletedPsplAtom ()
04602 {
04603 }
04604
04605 void msofbtDeletedPsplAtom ::dump( std::ostream& out ) const
04606 {
04607 out << "msofbtDeletedPsplAtom " << std::endl;
04608 }
04609
04610
04611
04612 const unsigned int msofbtAnchorAtom::id = 61454;
04613
04614 msofbtAnchorAtom ::msofbtAnchorAtom ()
04615 {
04616 }
04617
04618 msofbtAnchorAtom ::~msofbtAnchorAtom ()
04619 {
04620 }
04621
04622 void msofbtAnchorAtom ::dump( std::ostream& out ) const
04623 {
04624 out << "msofbtAnchorAtom " << std::endl;
04625 }
04626
04627
04628
04629 const unsigned int msofbtColorMRUAtom::id = 61722;
04630
04631 msofbtColorMRUAtom ::msofbtColorMRUAtom ()
04632 {
04633 }
04634
04635 msofbtColorMRUAtom ::~msofbtColorMRUAtom ()
04636 {
04637 }
04638
04639 void msofbtColorMRUAtom ::dump( std::ostream& out ) const
04640 {
04641 out << "msofbtColorMRUAtom " << std::endl;
04642 }
04643
04644
04645
04646 const unsigned int msofbtOleObjectAtom::id = 61727;
04647
04648 msofbtOleObjectAtom ::msofbtOleObjectAtom ()
04649 {
04650 }
04651
04652 msofbtOleObjectAtom ::~msofbtOleObjectAtom ()
04653 {
04654 }
04655
04656 void msofbtOleObjectAtom ::dump( std::ostream& out ) const
04657 {
04658 out << "msofbtOleObjectAtom " << std::endl;
04659 }
04660
04661
04662
04663 const unsigned int msofbtSplitMenuColorsAtom::id = 61726;
04664
04665 class msofbtSplitMenuColorsAtom::Private
04666 {
04667 public:
04668 unsigned fillColor;
04669 unsigned lineColor;
04670 unsigned shadowColor;
04671 unsigned threeDColor;
04672 };
04673
04674 msofbtSplitMenuColorsAtom ::msofbtSplitMenuColorsAtom ()
04675 {
04676 d = new Private;
04677 d->fillColor = 0;
04678 d->lineColor = 0;
04679 d->shadowColor = 0;
04680 d->threeDColor = 0;
04681 }
04682
04683 msofbtSplitMenuColorsAtom ::~msofbtSplitMenuColorsAtom ()
04684 {
04685 delete d;
04686 }
04687
04688 unsigned msofbtSplitMenuColorsAtom::fillColor() const
04689 {
04690 return d->fillColor;
04691 }
04692
04693 void msofbtSplitMenuColorsAtom::setFillColor( unsigned fillColor )
04694 {
04695 d->fillColor = fillColor;
04696 }
04697
04698 unsigned msofbtSplitMenuColorsAtom::lineColor() const
04699 {
04700 return d->lineColor;
04701 }
04702
04703 void msofbtSplitMenuColorsAtom::setLineColor( unsigned lineColor )
04704 {
04705 d->lineColor = lineColor;
04706 }
04707
04708 unsigned msofbtSplitMenuColorsAtom::shadowColor() const
04709 {
04710 return d->shadowColor;
04711 }
04712
04713 void msofbtSplitMenuColorsAtom::setShadowColor( unsigned shadowColor )
04714 {
04715 d->shadowColor = shadowColor;
04716 }
04717
04718 unsigned msofbtSplitMenuColorsAtom::threeDColor() const
04719 {
04720 return d->threeDColor;
04721 }
04722
04723 void msofbtSplitMenuColorsAtom::setThreeDColor( unsigned threeDColor )
04724 {
04725 d->threeDColor = threeDColor;
04726 }
04727
04728 void msofbtSplitMenuColorsAtom::setData( unsigned , const unsigned char* data )
04729 {
04730 setFillColor( readU32( data+0 ) );
04731 setLineColor( readU32( data+4 ) );
04732 setShadowColor( readU32( data+8 ) );
04733 setThreeDColor( readU32( data+12 ) );
04734 }
04735
04736 void msofbtSplitMenuColorsAtom ::dump( std::ostream& out ) const
04737 {
04738 out << "msofbtSplitMenuColorsAtom " << std::endl;
04739 out << "fillColor" << fillColor() << std::endl;
04740 out << "lineColor" << lineColor() << std::endl;
04741 out << "shadowColor" << shadowColor() << std::endl;
04742 out << "threeDColor" << threeDColor() << std::endl;
04743 }
04744
04745
04746
04747 const unsigned int msofbtBSEAtom::id = 61447;
04748
04749 msofbtBSEAtom ::msofbtBSEAtom ()
04750 {
04751 }
04752
04753 msofbtBSEAtom ::~msofbtBSEAtom ()
04754 {
04755 }
04756
04757 void msofbtBSEAtom ::dump( std::ostream& out ) const
04758 {
04759 out << "msofbtBSEAtom " << std::endl;
04760 }
04761
04762
04763
04764 const unsigned int msofbtCLSIDAtom::id = 61462;
04765
04766 msofbtCLSIDAtom ::msofbtCLSIDAtom ()
04767 {
04768 }
04769
04770 msofbtCLSIDAtom ::~msofbtCLSIDAtom ()
04771 {
04772 }
04773
04774 void msofbtCLSIDAtom ::dump( std::ostream& out ) const
04775 {
04776 out << "msofbtCLSIDAtom " << std::endl;
04777 }
04778
04779
04780
04781 const unsigned int msofbtRegroupItemsAtom::id = 61720;
04782
04783 msofbtRegroupItemsAtom ::msofbtRegroupItemsAtom ()
04784 {
04785 }
04786
04787 msofbtRegroupItemsAtom ::~msofbtRegroupItemsAtom ()
04788 {
04789 }
04790
04791 void msofbtRegroupItemsAtom ::dump( std::ostream& out ) const
04792 {
04793 out << "msofbtRegroupItemsAtom " << std::endl;
04794 }
04795
04796
04797
04798 const unsigned int msofbtColorSchemeAtom::id = 61728;
04799
04800 msofbtColorSchemeAtom ::msofbtColorSchemeAtom ()
04801 {
04802 }
04803
04804 msofbtColorSchemeAtom ::~msofbtColorSchemeAtom ()
04805 {
04806 }
04807
04808 void msofbtColorSchemeAtom ::dump( std::ostream& out ) const
04809 {
04810 out << "msofbtColorSchemeAtom " << std::endl;
04811 }
04812
04813
04814
04815 const unsigned int msofbtConnectorRuleAtom::id = 61458;
04816
04817 msofbtConnectorRuleAtom ::msofbtConnectorRuleAtom ()
04818 {
04819 }
04820
04821 msofbtConnectorRuleAtom ::~msofbtConnectorRuleAtom ()
04822 {
04823 }
04824
04825 void msofbtConnectorRuleAtom ::dump( std::ostream& out ) const
04826 {
04827 out << "msofbtConnectorRuleAtom " << std::endl;
04828 }
04829
04830
04831
04832 const unsigned int msofbtAlignRuleAtom::id = 61459;
04833
04834 class msofbtAlignRuleAtom ::Private
04835 {
04836 public:
04837 int ruid;
04838 int align;
04839 int cProxies;
04840 };
04841
04842
04843 msofbtAlignRuleAtom ::msofbtAlignRuleAtom ()
04844 { d = new Private;
04845 d->ruid = 0;
04846 d->align = 0;
04847 d->cProxies = 0;
04848 }
04849
04850 msofbtAlignRuleAtom ::~msofbtAlignRuleAtom ()
04851 {
04852 delete d;
04853 }
04854
04855 int msofbtAlignRuleAtom::ruid() const
04856 {
04857 return d->ruid;
04858 }
04859
04860 void msofbtAlignRuleAtom::setRuid( int ruid )
04861 {
04862 d->ruid = ruid;
04863 }
04864
04865 int msofbtAlignRuleAtom::align() const
04866 {
04867 return d->align;
04868 }
04869
04870 void msofbtAlignRuleAtom::setAlign( int ruid )
04871 {
04872 d->ruid = ruid;
04873 }
04874
04875 int msofbtAlignRuleAtom::cProxies() const
04876 {
04877 return d->cProxies;
04878 }
04879
04880 void msofbtAlignRuleAtom::setCProxies( int cProxies )
04881 {
04882 d->cProxies = cProxies;
04883 }
04884
04885 void msofbtAlignRuleAtom::setData( unsigned , const unsigned char* data )
04886 {
04887 setRuid( readU32( data+0 ) );
04888 setAlign( readU32( data+4 ) );
04889 setCProxies( readU32( data+8 ) );
04890 }
04891
04892 void msofbtAlignRuleAtom ::dump( std::ostream& out ) const
04893 {
04894 out << "msofbtAlignRuleAtom " << std::endl;
04895 out << "ruid" << ruid() << std::endl;
04896 out << "align " << align() << std::endl;
04897 out << "cProxies " << cProxies() << std::endl;
04898 }
04899
04900
04901
04902
04903 const unsigned int msofbtArcRuleAtom::id = 61460;
04904
04905 msofbtArcRuleAtom ::msofbtArcRuleAtom ()
04906 {
04907 }
04908
04909 msofbtArcRuleAtom ::~msofbtArcRuleAtom ()
04910 {
04911 }
04912
04913 void msofbtArcRuleAtom ::dump( std::ostream& out ) const
04914 {
04915 out << "msofbtArcRuleAtom " << std::endl;
04916 }
04917
04918
04919
04920 const unsigned int msofbtClientRuleAtom::id = 61461;
04921
04922 msofbtClientRuleAtom ::msofbtClientRuleAtom ()
04923 {
04924 }
04925
04926 msofbtClientRuleAtom ::~msofbtClientRuleAtom ()
04927 {
04928 }
04929
04930 void msofbtClientRuleAtom ::dump( std::ostream& out ) const
04931 {
04932 out << "msofbtClientRuleAtom " << std::endl;
04933 }
04934
04935
04936
04937 const unsigned int msofbtCalloutRuleAtom::id = 61463;
04938
04939 msofbtCalloutRuleAtom ::msofbtCalloutRuleAtom ()
04940 {
04941 }
04942
04943 msofbtCalloutRuleAtom ::~msofbtCalloutRuleAtom ()
04944 {
04945 }
04946
04947 void msofbtCalloutRuleAtom ::dump( std::ostream& out ) const
04948 {
04949 out << "msofbtCalloutRuleAtom " << std::endl;
04950 }
04951
04952
04953
04954 const unsigned int msofbtSelectionAtom::id = 61465;
04955
04956 msofbtSelectionAtom ::msofbtSelectionAtom ()
04957 {
04958 }
04959
04960 msofbtSelectionAtom ::~msofbtSelectionAtom ()
04961 {
04962 }
04963
04964 void msofbtSelectionAtom ::dump( std::ostream& out ) const
04965 {
04966 out << "msofbtSelectionAtom " << std::endl;
04967 }
04968
04969
04970
04971 class PPTReader::Private
04972 {
04973 public:
04974 Libppt::Presentation* presentation;
04975
04976 POLE::Stream* userStream;
04977 POLE::Stream* docStream;
04978
04979 std::vector<long> persistenceList;
04980 std::map<int,Libppt::Slide*> slideMap;
04981 Libppt::Slide* currentSlide;
04982 unsigned currentTextType;
04983 unsigned currentTextId;
04984
04985 GroupObject* currentGroup;
04986 Object* currentObject;
04987 bool isShapeGroup;
04988 };
04989
04990
04991 PPTReader::PPTReader()
04992 {
04993 d = new Private;
04994 d->presentation = 0;
04995
04996 d->userStream = 0;
04997 d->docStream = 0;
04998
04999 d->persistenceList.clear();
05000 d->slideMap.clear();
05001 d->currentSlide = 0;
05002 d->currentTextType = 0;
05003 d->currentTextId = 0;
05004 d->isShapeGroup = false;
05005 }
05006
05007 PPTReader::~PPTReader()
05008 {
05009 delete d;
05010 }
05011
05012 bool PPTReader::load( Presentation* pr, const char* filename )
05013 {
05014 bool result = false;
05015
05016
05017 d->presentation = pr;
05018 d->docStream = 0;
05019 d->userStream = 0;
05020 d->persistenceList.clear();
05021 d->slideMap.clear();
05022 d->currentSlide = 0;
05023 d->currentTextType = 0;
05024 d->currentTextId = 0;
05025 d->currentGroup = 0;
05026 d->currentObject = 0;
05027 d->isShapeGroup = false;
05028
05029 POLE::Storage storage( filename );
05030 if( !storage.open() )
05031 {
05032 std::cerr << "Cannot open " << filename << std::endl;
05033 }
05034 else
05035 {
05036
05037
05038 std::cout << "Loading file " << filename << std::endl;
05039 d->docStream = new POLE::Stream( &storage, "/PowerPoint Document" );
05040 d->userStream = new POLE::Stream( &storage, "/Current User" );
05041
05042 if( d->docStream->fail() || d->userStream->fail() )
05043 {
05044
05045 storage.close();
05046 std::cerr << filename << " is not PowerPoint presentation" << std::endl;
05047 delete d->docStream;
05048 d->docStream = 0;
05049 return false;
05050 }
05051 else
05052 {
05053
05054 loadUserEdit();
05055
05056 d->presentation->clear();
05057 loadMaster();
05058 loadSlides();
05059 loadDocument();
05060
05061 result = true;
05062 std::cout << std::endl << filename << " loaded. Done." << std::endl;
05063 }
05064
05065
05066 storage.close();
05067 delete d->docStream;
05068 delete d->userStream;
05069 d->presentation = 0;
05070 d->docStream = 0;
05071 d->userStream = 0;
05072 d->persistenceList.clear();
05073 d->slideMap.clear();
05074 d->currentSlide = 0;
05075 d->currentTextType = 0;
05076 d->currentTextId = 0;
05077 d->currentGroup = 0;
05078 d->currentObject = 0;
05079 d->isShapeGroup = false;
05080 }
05081
05082 return result;
05083 }
05084
05085 void PPTReader::loadUserEdit()
05086 {
05087 unsigned char buffer[128];
05088 unsigned long currentUserEditAtom = 0;
05089 std::vector<unsigned long> userEditList;
05090 std::vector<unsigned long> lastEditList;
05091 std::vector<unsigned long> persistDirList;
05092 std::vector<unsigned long> usefulPersistDirList;
05093 std::map<int,unsigned long> persistenceMap;
05094
05095 #ifdef LIBPPT_DEBUG
05096 std::cout << std::endl;
05097 std::cout << "Parsing Current User information" << std::endl;
05098 std::cout << "================================================" << std::endl;
05099 #endif
05100
05101
05102 d->userStream->seek( 0 );
05103 unsigned bytes_read = d->userStream->read( buffer, 8 );
05104 if( bytes_read != 8 ) return;
05105 unsigned long type = readU16( buffer + 2 );
05106 unsigned long size = readU32( buffer + 4 );
05107
05108
05109 if( ( size < 20 ) || ( size > sizeof(buffer) ) )
05110 {
05111 std::cerr << "ERROR: CurrentUserAtom is not recognized" << std::endl;
05112 return;
05113 }
05114
05115
05116 if( type != CurrentUserAtom::id )
05117 {
05118 std::cerr << "ERROR: First in /Current User is not CurrentUserAtom" << std::endl;
05119 return;
05120 }
05121 else
05122 {
05123 d->userStream->read( buffer, size );
05124 CurrentUserAtom* atom = new CurrentUserAtom;
05125 atom->setData( size, buffer );
05126 currentUserEditAtom = atom->offsetToCurrentEdit();
05127 #ifdef LIBPPT_DEBUG
05128 #if 0
05129 d->userStream->read( buffer, atom->lenUserName()*2 );
05130 std::cout << "Found username: ";
05131 for( unsigned b=0; b<atom->lenUserName()*2; b+=2 )
05132 std::cout << (char)buffer[b];
05133 std::cout << std::endl;
05134 #endif
05135 atom->dump( std::cout );
05136 #endif
05137 delete atom;
05138 }
05139
05140
05141 #ifdef LIBPPT_DEBUG
05142 std::cout << std::endl;
05143 std::cout << "Scanning for all UserEdit atoms" << std::endl;
05144 std::cout << "================================================" << std::endl;
05145 #endif
05146
05147 d->docStream->seek( 0 );
05148 unsigned long stream_size = d->docStream->size();
05149 while( d->docStream->tell() < stream_size )
05150 {
05151
05152 unsigned long pos = d->docStream->tell();
05153 unsigned bytes_read = d->docStream->read( buffer, 8 );
05154 if( bytes_read != 8 ) break;
05155
05156 unsigned long type = readU16( buffer + 2 );
05157 unsigned long size = readU32( buffer + 4 );
05158 unsigned long nextpos = d->docStream->tell() + size;
05159
05160
05161 if( type == UserEditAtom::id )
05162 if( size < sizeof(buffer) )
05163 {
05164 d->docStream->read( buffer, size );
05165 UserEditAtom* atom = new UserEditAtom;
05166 atom->setData( size, buffer );
05167 userEditList.push_back( pos );
05168 lastEditList.push_back( atom->offsetLastEdit() );
05169 persistDirList.push_back( atom->offsetPersistDir() );
05170 #ifdef LIBPPT_DEBUG
05171 std::cout << "Found at pos " << pos << " size is " << size << std::endl;
05172 #endif
05173 atom->dump( std::cout );
05174 delete atom;
05175 }
05176
05177 d->docStream->seek( nextpos );
05178 }
05179
05180 #ifdef LIBPPT_DEBUG
05181 std::cout << "Found: " << userEditList.size() << " UserEdit atom(s) " << std::endl;
05182 #endif
05183
05184 #ifdef LIBPPT_DEBUG
05185 std::cout << std::endl;
05186 std::cout << "Constructing UserEdit list" << std::endl;
05187 std::cout << "================================================" << std::endl;
05188 #endif
05189
05190 bool stop = true;
05191 do
05192 {
05193 stop = true;
05194
05195 #ifdef LIBPPT_DEBUG
05196 std::cout << "Searching for UserEdit at offset " << currentUserEditAtom << std::endl;
05197 #endif
05198
05199 for( unsigned k=0; k < userEditList.size(); k++ )
05200 if( (userEditList[k] = currentUserEditAtom) )
05201 {
05202 stop = false;
05203 usefulPersistDirList.push_back( persistDirList[k] );
05204 currentUserEditAtom = lastEditList[k];
05205 #ifdef LIBPPT_DEBUG
05206 std::cout << " found... ";
05207 std::cout << " persistence at offset " << persistDirList[k];
05208 if( lastEditList[k] != 0 )
05209 std::cout << " previous is " << lastEditList[k];
05210 std::cout << std::endl;
05211 #endif
05212 break;
05213 }
05214 }
05215 while( !stop && (currentUserEditAtom!=0) );
05216
05217
05218 if( usefulPersistDirList.size() == 0 )
05219 {
05220 std::cerr << "ERROR: No useful UserEdit information !" << std::endl;
05221 return;
05222 }
05223
05224 #ifdef LIBPPT_DEBUG
05225 std::cout << std::endl;
05226 std::cout << "Searching for persistence information" << std::endl;
05227 std::cout << "================================================" << std::endl;
05228 #endif
05229
05230 unsigned max = 0;
05231
05232 for( unsigned j = 0; j < usefulPersistDirList.size(); j++ )
05233 {
05234 unsigned long offset = usefulPersistDirList[j];
05235
05236 d->docStream->seek( 0 );
05237 while( d->docStream->tell() < stream_size )
05238 {
05239 unsigned long pos = d->docStream->tell();
05240 unsigned bytes_read = d->docStream->read( buffer, 8 );
05241 if( bytes_read != 8 ) break;
05242
05243 unsigned long type = readU16( buffer + 2 );
05244 unsigned long size = readU32( buffer + 4 );
05245 unsigned long nextpos = d->docStream->tell() + size;
05246
05247
05248 if( pos == offset )
05249 if( type == PersistIncrementalBlockAtom::id )
05250 {
05251 unsigned char* buf = new unsigned char[ size ];
05252 d->docStream->read( buf, size );
05253 PersistIncrementalBlockAtom* atom = new PersistIncrementalBlockAtom;
05254 atom->setData( size, buf );
05255 delete [] buf;
05256
05257
05258 #ifdef LIBPPT_DEBUG
05259 std::cout << "Found at pos " << pos << " size is " << size << std::endl;
05260 atom->dump( std::cout );
05261 #endif
05262
05263 for( unsigned m = 0; m < atom->entryCount(); m++ )
05264 {
05265 unsigned long ref = atom->reference(m);
05266 unsigned long ofs = atom->offset(m);
05267
05268 if( !persistenceMap.count( ref ) )
05269 persistenceMap[ref] = ofs;
05270 max = (ref > max) ? ref : max;
05271 }
05272 delete atom;
05273 }
05274
05275 d->docStream->seek( nextpos );
05276 }
05277 }
05278
05279
05280 for( unsigned n = 0; n <= max; n++ )
05281 {
05282 unsigned long ofs = -1;
05283 if( persistenceMap.count( n ) )
05284 ofs = persistenceMap[n];
05285 d->persistenceList.push_back( ofs );
05286 }
05287
05288 #ifdef LIBPPT_DEBUG
05289 std::cout << std::endl;
05290 std::cout << "Final persistence list" << std::endl;
05291 for( unsigned nn = 1; nn < d->persistenceList.size(); nn++ )
05292 std::cout << " #" << nn << ": " << d->persistenceList[nn] << std::endl;
05293 std::cout << std::endl;
05294 #endif
05295
05296 }
05297
05298 void PPTReader::loadMaster()
05299 {
05300 #ifdef LIBPPT_DEBUG
05301 std::cout << std::endl;
05302 std::cout << "Loading master" << std::endl;
05303 std::cout << "================================================" << std::endl;
05304 #endif
05305
05306 d->docStream->seek( 0 );
05307 unsigned long stream_size = d->docStream->size();
05308 while( d->docStream->tell() < stream_size )
05309 {
05310 unsigned char buffer[8];
05311 unsigned long pos = d->docStream->tell();
05312 unsigned bytes_read = d->docStream->read( buffer, 8 );
05313 if( bytes_read != 8 ) break;
05314
05315 unsigned long type = readU16( buffer + 2 );
05316 unsigned long size = readU32( buffer + 4 );
05317 unsigned long nextpos = d->docStream->tell() + size;
05318
05319
05320 if( type == MainMasterContainer::id )
05321 if( indexPersistence( pos ) )
05322 {
05323 #ifdef LIBPPT_DEBUG
05324 std::cout << "Found at pos " << pos << " size is " << size << std::endl;
05325 std::cout << std::endl;
05326 #endif
05327 Slide* master = new Slide( d->presentation );
05328 d->presentation->setMasterSlide( master );
05329 d->currentSlide = master;
05330 MainMasterContainer* container = new MainMasterContainer;
05331 handleContainer( container, type, size );
05332 delete container;
05333 }
05334
05335 d->docStream->seek( nextpos );
05336 }
05337 d->currentSlide = 0;
05338 }
05339
05340 void PPTReader::loadSlides()
05341 {
05342 #ifdef LIBPPT_DEBUG
05343 std::cout << std::endl;
05344 std::cout << "Loading all slide containers" << std::endl;
05345 std::cout << "================================================" << std::endl;
05346 #endif
05347
05348 int totalSlides = 0;
05349
05350 d->docStream->seek( 0 );
05351 unsigned long stream_size = d->docStream->size();
05352 while( d->docStream->tell() < stream_size )
05353 {
05354 unsigned char buffer[8];
05355 unsigned long pos = d->docStream->tell();
05356 unsigned bytes_read = d->docStream->read( buffer, 8 );
05357 if( bytes_read != 8 ) break;
05358
05359 unsigned long type = readU16( buffer + 2 );
05360 unsigned long size = readU32( buffer + 4 );
05361 unsigned long nextpos = d->docStream->tell() + size;
05362
05363 unsigned k = 0;
05364
05365
05366 if( type == SlideContainer::id )
05367 if( (k = indexPersistence( pos )) )
05368 {
05369
05370 Slide* s = new Slide( d->presentation );
05371 d->slideMap[ k ] = s;
05372 d->presentation->appendSlide( s );
05373 d->currentSlide = s;
05374 d->currentTextId = 0;
05375 d->currentTextType = TextObject::Body;
05376
05377 #ifdef LIBPPT_DEBUG
05378 std::cout << "SLIDE #" << totalSlides+1 << std::endl;
05379 std::cout << "Found at pos " << pos << " size is " << size << std::endl;
05380 std::cout << "Reference #" << k << std::endl;
05381 std::cout << std::endl;
05382 #endif
05383
05384
05385 SlideContainer* container = new SlideContainer;
05386 handleContainer( container, type, size );
05387 delete container;
05388
05389 totalSlides++;
05390 }
05391
05392 d->docStream->seek( nextpos );
05393 }
05394
05395
05396 #ifdef LIBPPT_DEBUG
05397 std::cout << std::endl;
05398 std::cout << "Total: " << totalSlides << " slides" << std::endl;
05399 #endif
05400 }
05401
05402 void PPTReader::loadDocument()
05403 {
05404 #ifdef LIBPPT_DEBUG
05405 std::cout << std::endl;
05406 std::cout << "Loading document content" << std::endl;
05407 std::cout << "================================================" << std::endl;
05408 #endif
05409
05410 d->currentSlide = 0;
05411 d->currentGroup = 0;
05412 d->currentObject = 0;
05413 d->isShapeGroup = false;
05414
05415 d->docStream->seek( 0 );
05416 unsigned long stream_size = d->docStream->size();
05417 while( d->docStream->tell() < stream_size )
05418 {
05419 unsigned char buffer[8];
05420 unsigned long pos = d->docStream->tell();
05421 unsigned bytes_read = d->docStream->read( buffer, 8 );
05422 if( bytes_read != 8 ) break;
05423
05424 unsigned long type = readU16( buffer + 2 );
05425 unsigned long size = readU32( buffer + 4 );
05426 unsigned long nextpos = d->docStream->tell() + size;
05427
05428
05429 if( type == DocumentContainer::id )
05430 if( indexPersistence( pos ) )
05431 {
05432 #ifdef LIBPPT_DEBUG
05433 std::cout << "Found at pos " << pos << " size is " << size << std::endl;
05434 std::cout << std::endl;
05435 #endif
05436 DocumentContainer* container = new DocumentContainer;
05437 container->setPosition( pos );
05438 handleContainer( container, type, size );
05439 delete container;
05440 }
05441
05442 d->docStream->seek( nextpos );
05443 }
05444
05445 }
05446
05447 int PPTReader::indexPersistence( unsigned long ofs )
05448 {
05449 for( unsigned k=1; k < d->persistenceList.size(); k++ )
05450 if( (d->persistenceList[k] == ofs) )
05451 return k;
05452
05453 return 0;
05454 }
05455
05456 void PPTReader::loadRecord( Record* parent )
05457 {
05458
05459 unsigned char buffer[65536];
05460
05461
05462 unsigned long pos = d->docStream->tell();
05463 unsigned bytes_read = d->docStream->read( buffer, 8 );
05464 if( bytes_read != 8 ) return;
05465
05466 unsigned instance = readU16( buffer ) >> 4;
05467 unsigned long type = readU16( buffer + 2 );
05468 unsigned long size = readU32( buffer + 4 );
05469 unsigned long nextpos = d->docStream->tell() + size;
05470 unsigned lastSize;
05471
05472 Record* record = Record::create( type );
05473 if( record )
05474 {
05475 record->setParent( parent );
05476 record->setPosition( pos );
05477 record->setInstance( instance );
05478
05479 if( !record->isContainer() )
05480 {
05481 d->docStream->read( buffer, size );
05482
05483 if ( type == StyleTextPropAtom::id )
05484 record->setData(size, buffer, lastSize);
05485 else
05486 record->setData( size, buffer );
05487 handleRecord( record, type );
05488 }
05489 else
05490 handleContainer( static_cast<Container*>( record ), type, size );
05491
05492 delete record;
05493 }
05494 lastSize = size;
05495 d->docStream->seek( nextpos );
05496 }
05497
05498 void PPTReader::handleRecord( Record* record, int type )
05499 {
05500 if( !record ) return;
05501
05502 switch( type )
05503 {
05504 case DocumentAtom::id:
05505 handleDocumentAtom( static_cast<DocumentAtom*>(record) ); break;
05506 case SlidePersistAtom::id:
05507 handleSlidePersistAtom( static_cast<SlidePersistAtom*>(record) ); break;
05508 case TextHeaderAtom::id:
05509 handleTextHeaderAtom( static_cast<TextHeaderAtom*>(record) ); break;
05510 case TextCharsAtom::id:
05511 handleTextCharsAtom( static_cast<TextCharsAtom*>(record) ); break;
05512 case TextBytesAtom::id:
05513 handleTextBytesAtom( static_cast<TextBytesAtom*>(record) ); break;
05514 case StyleTextPropAtom::id:
05515 handleStyleTextPropAtom( static_cast<StyleTextPropAtom*>(record) ); break;
05516 case ColorSchemeAtom::id:
05517 handleColorSchemeAtom( static_cast<ColorSchemeAtom*>(record) ); break;
05518
05519 case msofbtSpgrAtom::id:
05520 handleEscherGroupAtom( static_cast<msofbtSpgrAtom*>(record) ); break;
05521 case msofbtSpAtom::id:
05522 handleEscherSpAtom( static_cast<msofbtSpAtom*>(record) ); break;
05523 case msofbtOPTAtom::id:
05524 handleEscherPropertiesAtom( static_cast<msofbtOPTAtom*>(record) ); break;
05525 case msofbtClientDataAtom::id:
05526 handleEscherClientDataAtom( static_cast<msofbtClientDataAtom*>(record) ); break;
05527 case msofbtClientAnchorAtom::id:
05528 handleEscherClientAnchorAtom( static_cast<msofbtClientAnchorAtom*>(record) ); break;
05529 case msofbtClientTextboxAtom::id:
05530 handleEscherTextBoxAtom( static_cast<msofbtClientTextboxAtom*>(record) ); break;
05531
05532 default: break;
05533 }
05534 }
05535
05536 void PPTReader::handleContainer( Container* container, int type, unsigned size )
05537 {
05538 if( !container || !container->isContainer() ) return;
05539
05540 unsigned long nextpos = d->docStream->tell() + size - 6;
05541
05542 switch( type )
05543 {
05544 case msofbtDgContainer::id:
05545 handleDrawingContainer( static_cast<msofbtDgContainer*>(container), size ); break;
05546 case msofbtSpgrContainer::id:
05547 handleEscherGroupContainer( static_cast<msofbtSpgrContainer*>(container), size ); break;
05548 case msofbtSpContainer::id:
05549 handleSPContainer( static_cast<msofbtSpContainer*>(container), size ); break;
05550 default:
05551 while( d->docStream->tell() < nextpos )
05552 loadRecord( container );
05553 }
05554 }
05555
05556 void PPTReader::handleDocumentAtom( DocumentAtom* atom )
05557 {
05558 if( !atom ) return;
05559 if( !d->presentation ) return;
05560
05561 double pageWidth = atom->slideWidth() * 0.125;
05562 double pageHeight = atom->slideHeight() * 0.125;
05563
05564 d->presentation->masterSlide()->setPageWidth( pageWidth );
05565 d->presentation->masterSlide()->setPageHeight ( pageHeight );
05566
05567 #ifdef LIBPPT_DEBUG
05568 std::cout << std::endl<< "page width = " << pageWidth << std::endl;
05569 std::cout << std::endl<< "page height = " << pageHeight << std::endl;
05570 #endif
05571 }
05572
05573 void PPTReader::handleSlidePersistAtom( SlidePersistAtom* atom )
05574 {
05575 if( !atom ) return;
05576 if( !d->presentation ) return;
05577
05578
05579 unsigned ref = atom->psrReference();
05580
05581 d->currentSlide = d->slideMap[ ref ];
05582 d->currentTextId = 0;
05583 d->currentTextType = TextObject::Body;
05584
05585 #ifdef LIBPPT_DEBUG
05586 std::cout << std::endl<< "Slide id = " << id << std::endl;
05587 #endif
05588 }
05589
05590 void PPTReader::handleTextHeaderAtom( TextHeaderAtom* atom )
05591 {
05592 if( !atom ) return;
05593 if( !d->presentation ) return;
05594 if( !d->currentSlide ) return;
05595
05596 d->currentTextId++;
05597 d->currentTextType = atom->textType();
05598 }
05599
05600 void PPTReader::handleTextCharsAtom( TextCharsAtom* atom )
05601 {
05602 if( !atom ) return;
05603 if( !d->presentation ) return;
05604 if( !d->currentSlide ) return;
05605 if( !d->currentTextId ) return;
05606
05607 int placeId = d->currentTextId-1;
05608 TextObject* text = d->currentSlide->textObject( placeId );
05609 if( !text )
05610 {
05611 std::cerr << "No place for text object! " << placeId << std::endl;
05612 return;
05613 }
05614
05615 text->setType( d->currentTextType );
05616
05617 for (uint i=0; i<atom->listSize(); i++)
05618 {
05619 text->setText(atom->strValue(i));
05620
05621 }
05622
05623 if( (d->currentTextType == TextObject::Title) | (d->currentTextType == TextObject::CenterTitle) )
05624 for (unsigned i=0; i<atom->listSize(); i++)
05625 d->currentSlide->setTitle( atom->strValue(i) );
05626
05627
05628
05629 #ifdef LIBPPT_DEBUG
05630 std::cout << " Text Object " << atom->ustring().ascii();
05631 std::cout << " placed at " << placeId << std::endl;
05632 #endif
05633
05634 }
05635
05636 void PPTReader::handleTextBytesAtom( TextBytesAtom* atom )
05637 {
05638 if( !atom ) return;
05639 if( !d->presentation ) return;
05640 if( !d->currentSlide ) return;
05641 if( !d->currentTextId ) return;
05642
05643 int placeId = d->currentTextId-1;
05644 TextObject* text = d->currentSlide->textObject( placeId );
05645 if( !text )
05646 {
05647 std::cerr << "No place for text object! " << placeId << std::endl;
05648 return;
05649 }
05650
05651 text->setType( d->currentTextType );
05652
05653 for (uint i=0; i<atom->listSize(); i++)
05654 {
05655 text->setText(atom->strValue(i));
05656
05657 }
05658
05659 if( (d->currentTextType == TextObject::Title) | (d->currentTextType == TextObject::CenterTitle) )
05660 for (unsigned i=0; i<atom->listSize(); i++)
05661 d->currentSlide->setTitle( atom->strValue(i) );
05662
05663
05664
05665 #ifdef LIBPPT_DEBUG
05666 std::cout << " Text Object " << atom->ustring().ascii();
05667 std::cout << " placed at " << placeId << std::endl;
05668 #endif
05669 }
05670
05671 void PPTReader::handleStyleTextPropAtom ( StyleTextPropAtom* atom )
05672 {
05673 if( !atom ) return;
05674 if( !d->presentation ) return;
05675 if( !d->currentSlide ) return;
05676 if( !d->currentTextId ) return;
05677
05678 int placeId = d->currentTextId-1;
05679 TextObject* text = d->currentSlide->textObject( placeId );
05680
05681 for (uint i=0; i<atom->listSize(); i++)
05682 {
05683 if (atom->bulletOn(i) == 1)
05684 text->setBulletFlag(true);
05685 else
05686 text->setBulletFlag(false);
05687 }
05688
05689 }
05690
05691 void PPTReader::handleColorSchemeAtom( ColorSchemeAtom* atom )
05692 {
05693 if( !atom ) return;
05694 if( !d->presentation ) return;
05695
05696 }
05697
05698 std::string spaces( int x )
05699 {
05700 std::string str;
05701 for( int i=0; i<x; i++ )
05702 str += ' ';
05703 return str;
05704 }
05705
05706 void dumpGroup( GroupObject* obj, unsigned indent );
05707
05708 void dumpObject( Object* obj, unsigned indent )
05709 {
05710 std::cout << spaces(indent) << "Top: " << obj->top() << std::endl;
05711 std::cout << spaces(indent) << "Left: " << obj->left() << std::endl;
05712
05713 if( obj->isGroup() )
05714 {
05715 std::cout << spaces(indent) << "This is a group" << std::endl;
05716 GroupObject* gr = static_cast<GroupObject*>(obj);
05717 dumpGroup( gr, indent+2 );
05718 }
05719 }
05720
05721 void dumpGroup( GroupObject* obj, unsigned indent )
05722 {
05723 for( unsigned i=0; i <obj->objectCount(); i++ )
05724 {
05725 std::cout << spaces(indent) << "Object #" << i+1 << std::endl;
05726 Object* o = obj->object(i);
05727 dumpObject( o, indent+2 );
05728 }
05729 }
05730
05731 void dumpSlide( Slide* slide )
05732 {
05733 std::cout << "Slide: " << slide->title().ascii() << std::endl;
05734 GroupObject* root = slide->rootObject();
05735 dumpGroup( root, 0 );
05736 std::cout << std::endl;
05737 }
05738
05739
05740 void PPTReader::handleDrawingContainer( msofbtDgContainer* container, unsigned size )
05741 {
05742 if( !container ) return;
05743 if( !d->presentation ) return;
05744 if( !d->currentSlide ) return;
05745
05746 d->currentGroup = new GroupObject();
05747 d->currentObject = 0;
05748 d->isShapeGroup = false;
05749
05750 unsigned long nextpos = d->docStream->tell() + size - 6;
05751 while( d->docStream->tell() < nextpos )
05752 loadRecord( container );
05753
05754 for( unsigned i=0; i<d->currentGroup->objectCount(); i++ )
05755 {
05756 Object* obj = d->currentGroup->object(i);
05757 if( ( i == 0 ) && ( obj->isGroup() ) )
05758 {
05759 d->currentGroup->takeObject( obj );
05760 d->currentSlide->setRootObject( (GroupObject*)obj );
05761 break;
05762 }
05763 }
05764
05765 delete d->currentGroup;
05766 d->currentGroup = 0;
05767 d->currentObject = 0;
05768 d->isShapeGroup = false;
05769 }
05770
05771 void PPTReader::handleEscherGroupContainer( msofbtSpgrContainer* container, unsigned size )
05772 {
05773 if( !container ) return;
05774 if( !d->presentation ) return;
05775 if( !d->currentSlide ) return;
05776 if( !d->currentGroup ) return;
05777
05778 GroupObject* lastGroup = d->currentGroup;
05779
05780 d->currentGroup = new GroupObject();
05781 d->currentObject = 0;
05782 d->isShapeGroup = false;
05783
05784 unsigned long nextpos = d->docStream->tell() + size - 6;
05785 while( d->docStream->tell() < nextpos )
05786 loadRecord( container );
05787
05788 lastGroup->addObject( d->currentGroup );
05789 d->currentGroup = lastGroup;
05790 d->currentObject = 0;
05791 d->isShapeGroup = false;
05792 }
05793
05794 void PPTReader::handleSPContainer( msofbtSpContainer* container, unsigned size )
05795 {
05796 if( !container ) return;
05797 if( !d->presentation ) return;
05798 if( !d->currentSlide ) return;
05799 if( !d->currentGroup ) return;
05800
05801 d->isShapeGroup = false;
05802
05803 unsigned long nextpos = d->docStream->tell() + size - 6;
05804 while( d->docStream->tell() < nextpos )
05805 loadRecord( container );
05806
05807 if( d->currentObject )
05808 if( !d->isShapeGroup )
05809 d->currentGroup->addObject( d->currentObject );
05810
05811 d->currentObject = 0;
05812 d->isShapeGroup = false;
05813 }
05814
05815 void PPTReader::handleEscherGroupAtom( msofbtSpgrAtom* atom )
05816 {
05817 if( !atom ) return;
05818 if( !d->presentation ) return;
05819 if( !d->currentSlide ) return;
05820 if( !d->currentGroup ) return;
05821
05822
05823
05824
05825 d->isShapeGroup = true;
05826 }
05827
05828 void PPTReader::handleEscherSpAtom( msofbtSpAtom* atom )
05829 {
05830 if( !atom ) return;
05831 if( !d->presentation ) return;
05832 if( !d->currentSlide ) return;
05833 if( !d->currentGroup ) return;
05834
05835 DrawObject* drawObject = new DrawObject;
05836
05837 drawObject->setBackground( atom->isBackground() );
05838
05839 unsigned sh = DrawObject::None;
05840 switch( atom->instance() )
05841 {
05842 case msofbtSpAtom::msosptRectangle: sh = DrawObject::Rectangle; break;
05843 case msofbtSpAtom::msosptRoundRectangle: sh = DrawObject::RoundRectangle; break;
05844 case msofbtSpAtom::msosptEllipse: sh = DrawObject::Ellipse; break;
05845 case msofbtSpAtom::msosptDiamond: sh = DrawObject::Diamond; break;
05846 case msofbtSpAtom::msosptIsoscelesTriangle: sh = DrawObject::IsoscelesTriangle; break;
05847 case msofbtSpAtom::msosptRightTriangle: sh = DrawObject::RightTriangle; break;
05848 case msofbtSpAtom::msosptParallelogram: sh = DrawObject::Parallelogram; break;
05849 case msofbtSpAtom::msosptTrapezoid: sh = DrawObject::Trapezoid; break;
05850 case msofbtSpAtom::msosptHexagon: sh = DrawObject::Hexagon; break;
05851 case msofbtSpAtom::msosptOctagon: sh = DrawObject::Octagon; break;
05852
05853 case msofbtSpAtom::msosptArrow: sh = DrawObject::LeftArrow; break;
05854 case msofbtSpAtom::msosptDownArrow: sh = DrawObject::DownArrow; break;
05855 case msofbtSpAtom::msosptUpArrow: sh = DrawObject::UpArrow; break;
05856 case msofbtSpAtom::msosptLeftArrow: sh = DrawObject::LeftArrow; break;
05857
05858 case msofbtSpAtom::msosptLine: sh = DrawObject::Line; break;
05859 case msofbtSpAtom::msosptSmileyFace: sh = DrawObject::Smiley; break;
05860 case msofbtSpAtom::msosptHeart: sh = DrawObject::Heart; break;
05861 case msofbtSpAtom::msosptMin: sh = DrawObject::FreeLine; break;
05862
05863 default: break;
05864 }
05865
05866 drawObject->setShape( sh );
05867
05868
05869
05870
05871
05872
05873
05874 d->currentObject = drawObject;
05875
05876 if (atom->isVerFlip() == true)
05877 d->currentObject->setProperty( "draw:mirror-vertical", "true");
05878
05879 if (atom->isHorFlip() == true)
05880 d->currentObject->setProperty( "draw:mirror-horizontal", "true");
05881
05882
05883 }
05884
05885 void PPTReader::handleEscherClientDataAtom( msofbtClientDataAtom* atom )
05886 {
05887 if( !atom ) return;
05888 if( !d->presentation ) return;
05889 if( !d->currentSlide ) return;
05890 if( !d->currentGroup ) return;
05891 if( !d->currentObject ) return;
05892
05893 TextObject* textObject = 0;
05894 if( !d->currentObject->isText() )
05895 {
05896 textObject = new TextObject();
05897 textObject->convertFrom( d->currentObject );
05898 delete d->currentObject;
05899 d->currentObject = textObject;
05900 }
05901 else
05902 textObject = static_cast<TextObject*>( d->currentObject );
05903
05904 switch( atom->placeholderId() )
05905 {
05906 case msofbtClientDataAtom::MasterTitle:
05907 case msofbtClientDataAtom::Title:
05908 textObject->setType( TextObject::Title ); break;
05909
05910 case msofbtClientDataAtom::MasterBody:
05911 case msofbtClientDataAtom::MasterSubtitle:
05912 case msofbtClientDataAtom::Body:
05913 case msofbtClientDataAtom::Subtitle:
05914 textObject->setType( TextObject::Body ); break;
05915
05916 case msofbtClientDataAtom::MasterCenteredTitle:
05917 case msofbtClientDataAtom::CenteredTitle:
05918 textObject->setType( TextObject::CenterTitle ); break;
05919
05920 default:
05921 textObject->setType( TextObject::Other ); break;
05922 break;
05923 }
05924
05925 textObject->setId( atom->placementId() );
05926 }
05927
05928 void PPTReader::handleEscherClientAnchorAtom( msofbtClientAnchorAtom* atom )
05929 {
05930 if( !atom ) return;
05931 if( !d->presentation ) return;
05932 if( !d->currentSlide ) return;
05933 if( !d->currentGroup ) return;
05934 if( !d->currentObject ) return;
05935
05936 d->currentObject->setLeft( atom->left()*25.4/576 );
05937 d->currentObject->setTop( atom->top()*25.4/576 );
05938 d->currentObject->setWidth( (atom->right()-atom->left())*25.4/576 );
05939 d->currentObject->setHeight( (atom->bottom()-atom->top())*25.4/576 );
05940 }
05941
05942 void PPTReader::handleEscherTextBoxAtom( msofbtClientTextboxAtom* atom )
05943 {
05944 if( !atom ) return;
05945 if( !d->presentation ) return;
05946 if( !d->currentGroup ) return;
05947 if( !d->currentObject ) return;
05948
05949 TextObject* textObject = 0;
05950 if( !d->currentObject->isText() )
05951 {
05952 textObject = new TextObject();
05953 textObject->convertFrom( d->currentObject );
05954 delete d->currentObject;
05955 d->currentObject = textObject;
05956 }
05957 else
05958 textObject = static_cast<TextObject*>( d->currentObject );
05959
05960 textObject->setType( TextObject::Other );
05961 textObject->setText( atom->ustring() );
05962 textObject->setBulletFlag( false );
05963 }
05964
05965 Color convertFromLong( unsigned long i )
05966 {
05967 unsigned r = (i & 0xff);
05968 unsigned g = (i>>8) & 0xff;
05969 unsigned b = (i>>16) & 0xff;
05970
05971 return Color( r, g, b );
05972 }
05973
05974 void PPTReader::handleEscherPropertiesAtom( msofbtOPTAtom* atom )
05975 {
05976 if( !atom ) return;
05977 if( !d->presentation ) return;
05978 if( !d->currentSlide ) return;
05979 if( !d->currentGroup ) return;
05980 if( !d->currentObject ) return;
05981
05982 for( unsigned c=0; c<atom->propertyCount(); c++ )
05983 {
05984 unsigned pid = atom->propertyId(c);
05985 signed long pvalue = atom->propertyValue(c);
05986
05987 switch( pid )
05988 {
05989 case msofbtOPTAtom::FillColor:
05990 d->currentObject->setProperty( "draw:fill-color", convertFromLong(pvalue) );
05991 break;
05992 case msofbtOPTAtom::LineColor:
05993 d->currentObject->setProperty( "svg:stroke-color", convertFromLong(pvalue) );
05994 break;
05995 case msofbtOPTAtom::LineWidth:
05996 d->currentObject->setProperty( "svg:stroke-width", pvalue*(25.4/(12700*72) ));
05997 break;
05998 case msofbtOPTAtom::Rotation:
05999 { double deg = pvalue/65536.00 ;
06000 if (deg > 180.00) deg = 360.00 - deg;
06001 d->currentObject->setProperty( "libppt:rotation", (deg*0.0174533) ) ;
06002 } break;
06003 case msofbtOPTAtom::FillType:
06004 switch( pvalue )
06005 {
06006 case msofbtOPTAtom::FillSolid:
06007 d->currentObject->setProperty( "draw:fill", "solid"); break;
06008 case msofbtOPTAtom::FillPattern:
06009 d->currentObject->setProperty( "draw:fill", "solid"); break;
06010 default:
06011 d->currentObject->setProperty( "draw:fill", "solid"); break;
06012 }
06013 break;
06014 case msofbtOPTAtom::LineDashing:
06015 switch( pvalue )
06016 {
06017 case msofbtOPTAtom::LineSolid :
06018 {d->currentObject->setProperty( "draw:stroke", "solid");
06019
06020 } break;
06021 case msofbtOPTAtom::LineDashSys :
06022 {
06023 d->currentObject->setProperty( "draw:stroke", "dash");
06024 d->currentObject->setProperty( "draw:stroke-dash", "Dash_20_2");
06025
06026 } break;
06027 case msofbtOPTAtom::LineDotSys :
06028 {
06029 d->currentObject->setProperty( "draw:stroke", "dash");
06030 d->currentObject->setProperty( "draw:stroke-dash", "Dash_20_3");
06031
06032 } break;
06033 case msofbtOPTAtom::LineDashDotSys :
06034 {
06035 d->currentObject->setProperty( "draw:stroke", "dash");
06036 d->currentObject->setProperty( "draw:stroke-dash", "Dash_20_2");
06037
06038 } break;
06039 case msofbtOPTAtom::LineDashDotDotSys :
06040 { d->currentObject->setProperty( "draw:stroke", "dash");
06041 d->currentObject->setProperty( "draw:stroke-dash", "Dash_20_2");
06042
06043 } break;
06044 case msofbtOPTAtom::LineDotGEL :
06045 { d->currentObject->setProperty( "draw:stroke", "dash");
06046 d->currentObject->setProperty( "draw:stroke-dash", "Dash_20_2");
06047
06048 } break;
06049 case msofbtOPTAtom::LineDashGEL :
06050 { d->currentObject->setProperty( "draw:stroke", "dash");
06051 d->currentObject->setProperty( "draw:stroke-dash", "Dash_20_4");
06052
06053 } break;
06054 case msofbtOPTAtom::LineLongDashGEL :
06055 { d->currentObject->setProperty( "draw:stroke", "dash");
06056 d->currentObject->setProperty( "draw:stroke-dash", "Dash_20_6");
06057
06058 } break;
06059 case msofbtOPTAtom::LineDashDotGEL :
06060 { d->currentObject->setProperty( "draw:stroke", "dash");
06061 d->currentObject->setProperty( "draw:stroke-dash", "Dash_20_5");
06062
06063 } break;
06064 case msofbtOPTAtom::LineLongDashDotGEL :
06065 { d->currentObject->setProperty( "draw:stroke", "dash");
06066 d->currentObject->setProperty( "draw:stroke-dash", "Dash_20_7");
06067
06068 } break;
06069 case msofbtOPTAtom::LineLongDashDotDotGEL :
06070 { d->currentObject->setProperty( "draw:stroke", "dash");
06071 d->currentObject->setProperty( "draw:stroke-dash", "Dash_20_8");
06072
06073 } break;
06074 default:
06075 d->currentObject->setProperty( "draw:stroke", "solid"); break;
06076 } break;
06077
06078 case msofbtOPTAtom::FlagNoLineDrawDash:
06079 { if (pvalue == 589824 )
06080 d->currentObject->setProperty( "libppt:invisibleLine", true );
06081 } break;
06082
06083 case msofbtOPTAtom::LineStartArrowhead:
06084 {
06085 switch( pvalue )
06086 {
06087 case msofbtOPTAtom::LineNoEnd : break;
06088 case msofbtOPTAtom::LineArrowEnd :
06089 d->currentObject->setProperty( "draw:marker-start", "msArrowEnd_20_5" ); break;
06090 case msofbtOPTAtom::LineArrowStealthEnd :
06091 d->currentObject->setProperty( "draw:marker-start", "msArrowStealthEnd_20_5" ); break;
06092 case msofbtOPTAtom::LineArrowDiamondEnd :
06093 d->currentObject->setProperty( "draw:marker-start", "msArrowDiamondEnd_20_5" ); break;
06094 case msofbtOPTAtom::LineArrowOvalEnd :
06095 d->currentObject->setProperty( "draw:marker-start", "msArrowOvalEnd_20_5" ); break;
06096 case msofbtOPTAtom::LineArrowOpenEnd :
06097 d->currentObject->setProperty( "draw:marker-start", "msArrowOpenEnd_20_5" ); break;
06098 default : break;
06099 }
06100 } break;
06101
06102 case msofbtOPTAtom::LineStartArrowWidth:
06103 {
06104 switch ( pvalue )
06105 {
06106 case msofbtOPTAtom::LineNarrowArrow :
06107 d->currentObject->setProperty( "draw:marker-start-width", 0.2 ); break;
06108 case msofbtOPTAtom::LineMediumWidthArrow :
06109 d->currentObject->setProperty( "draw:marker-start-width", 0.3 ); break;
06110 case msofbtOPTAtom::LineWideArrow :
06111 d->currentObject->setProperty( "draw:marker-start-width", 0.4 ); break;
06112 default : break;
06113 }
06114 } break;
06115
06116 case msofbtOPTAtom::LineEndArrowhead:
06117 {
06118 switch( pvalue )
06119 {
06120 case msofbtOPTAtom::LineNoEnd : break;
06121 case msofbtOPTAtom::LineArrowEnd :
06122 d->currentObject->setProperty( "draw:marker-end", "msArrowEnd_20_5" ); break;
06123 case msofbtOPTAtom::LineArrowStealthEnd :
06124 d->currentObject->setProperty( "draw:marker-end", "msArrowStealthEnd_20_5" ); break;
06125 case msofbtOPTAtom::LineArrowDiamondEnd :
06126 d->currentObject->setProperty( "draw:marker-end", "msArrowDiamondEnd_20_5" ); break;
06127 case msofbtOPTAtom::LineArrowOvalEnd :
06128 d->currentObject->setProperty( "draw:marker-end", "msArrowOvalEnd_20_5" ); break;
06129 case msofbtOPTAtom::LineArrowOpenEnd :
06130 d->currentObject->setProperty( "draw:marker-end", "msArrowOpenEnd_20_5" ); break;
06131 default : break;
06132 }
06133 } break;
06134
06135
06136
06137
06138
06139
06140
06141
06142
06143
06144
06145
06146
06147
06148
06149
06150
06151 case msofbtOPTAtom::LineEndArrowWidth:
06152 {
06153 switch ( pvalue )
06154 {
06155 case msofbtOPTAtom::LineNarrowArrow :
06156 d->currentObject->setProperty( "draw:marker-end-width", 0.2 ); break;
06157 case msofbtOPTAtom::LineMediumWidthArrow :
06158 d->currentObject->setProperty( "draw:marker-end-width", 0.3 ); break;
06159 case msofbtOPTAtom::LineWideArrow :
06160 d->currentObject->setProperty( "draw:marker-end-width", 0.4 ); break;
06161 default : break;
06162 }
06163 } break;
06164
06165
06166
06167
06168
06169
06170
06171
06172
06173
06174
06175
06176
06177
06178
06179 #if 0
06180 case msofbtOPTAtom::ShadowColor:
06181 {
06182 d->currentObject->setProperty( "draw:shadow-color", convertFromLong(pvalue) );
06183 } break;
06184 case msofbtOPTAtom::ShadowOpacity:
06185 {
06186 d->currentObject->setProperty( "draw:shadow-opacity", 100.0-(pvalue/(65536.0)) );
06187 } break;
06188 case msofbtOPTAtom::ShadowOffsetX:
06189 {
06190 d->currentObject->setProperty("draw:shadow-offset-x",(pvalue*2.54/(12700*72)));
06191 } break;
06192 case msofbtOPTAtom::ShadowOffsetY:
06193 {
06194 d->currentObject->setProperty("draw:shadow-offset-y",(pvalue*2.54/(12700*72)));
06195 } break;
06196 #endif
06197 }
06198
06199 }
06200
06201 }