25#include <powerpoint.h>
27const int Powerpoint::s_area = 30512;
29Powerpoint::Powerpoint()
35Powerpoint::~Powerpoint()
37 m_persistentReferences.clear();
41void Powerpoint::invokeHandler(
44 TQDataStream &operands)
46 typedef void (Powerpoint::*method)(Header &op, TQ_UINT32 bytes, TQDataStream &operands);
55 static const opcodeEntry funcTab[] =
57 { "ANIMATIONINFO", 4116, 0 },
58 { "ANIMATIONINFOATOM", 4081, 0 },
59 { "ARRAYELEMENTATOM", 2030, 0 },
60 { "BASETEXTPROPATOM", 4002, 0 },
61 { "BINARYTAGDATA", 5003, 0 },
62 { "BOOKMARKCOLLECTION", 2019, 0 },
63 { "BOOKMARKENTITYATOM", 4048, 0 },
64 { "BOOKMARKSEEDATOM", 2025, 0 },
65 { "CHARFORMATATOM", 4066, 0 },
66 { "CLIENTSIGNAL1", 6, 0 },
67 { "CLIENTSIGNAL2", 7, 0 },
68 { "COLORSCHEMEATOM", 2032, &Powerpoint::opColorSchemeAtom },
69 { "COREPICT", 4037, 0 },
70 { "COREPICTATOM", 4038, 0 },
71 { "CSTRING", 4026, &Powerpoint::opCString },
72 { "CURRENTUSERATOM", 4086, &Powerpoint::opCurrentUserAtom },
73 { "DATETIMEMCATOM", 4087, 0 },
74 { "DEFAULTRULERATOM", 4011, 0 },
75 { "DOCROUTINGSLIP", 1030, 0 },
76 { "DOCUMENT", 1000, &Powerpoint::opDocument },
77 { "DOCUMENTATOM", 1001, &Powerpoint::opDocumentAtom },
78 { "DOCVIEWINFO", 1014, 0 },
79 { "EMFORMATATOM", 4065, 0 },
80 { "ENDDOCUMENT", 1002, &Powerpoint::opEndDocument },
81 { "ENVIRONMENT", 1010, &Powerpoint::opEnvironment },
82 { "EXAVIMOVIE", 4102, 0 },
83 { "EXCDAUDIO", 4110, 0 },
84 { "EXCDAUDIOATOM", 4114, 0 },
85 { "EXCONTROL", 4078, 0 },
86 { "EXCONTROLATOM", 4091, 0 },
87 { "EXEMBED", 4044, &Powerpoint::opExEmbed },
88 { "EXEMBEDATOM", 4045, &Powerpoint::opExEmbedAtom },
89 { "EXHYPERLINK", 4055, 0 },
90 { "EXHYPERLINKATOM", 4051, 0 },
91 { "EXLINK", 4046, 0 },
92 { "EXLINKATOM", 4049, 0 },
93 { "EXLINKATOM_OLD", 4047, 0 },
94 { "EXMCIMOVIE", 4103, 0 },
95 { "EXMEDIAATOM", 4100, 0 },
96 { "EXMIDIAUDIO", 4109, 0 },
97 { "EXOBJLIST", 1033, &Powerpoint::opExObjList },
98 { "EXOBJLISTATOM", 1034, &Powerpoint::opExObjListAtom },
99 { "EXOBJREFATOM", 3009, &Powerpoint::opExObjRefAtom },
100 { "EXOLEOBJ", 4034, &Powerpoint::opExOleObj },
101 { "EXOLEOBJATOM", 4035, &Powerpoint::opExOleObjAtom },
102 { "EXOLEOBJSTG", 4113, &Powerpoint::opExOleObjStg },
103 { "EXPLAIN", 4053, 0 },
104 { "EXPLAINATOM", 4039, 0 },
105 { "EXPLAINLINK", 4054, 0 },
106 { "EXPLAINLINKATOM", 4036, 0 },
107 { "EXQUICKTIME", 4073, 0 },
108 { "EXQUICKTIMEMOVIE", 4074, 0 },
109 { "EXQUICKTIMEMOVIEDATA", 4075, 0 },
110 { "EXSUBSCRIPTION", 4076, 0 },
111 { "EXSUBSCRIPTIONSECTION", 4077, 0 },
112 { "EXTERNALOBJECT", 4027, 0 },
113 { "EXVIDEO", 4101, 0 },
114 { "EXWAVAUDIOEMBEDDED", 4111, 0 },
115 { "EXWAVAUDIOEMBEDDEDATOM", 4115, 0 },
116 { "EXWAVAUDIOLINK", 4112, 0 },
117 { "FONTCOLLECTION", 2005, &Powerpoint::opFontCollection },
118 { "FONTEMBEDDATA", 4024, 0 },
119 { "FONTENTITYATOM", 4023, &Powerpoint::opFontEntityAtom },
120 { "FOOTERMCATOM", 4090, 0 },
121 { "GENERICDATEMCATOM", 4088, 0 },
122 { "GLINEATOM", 10004, 0 },
123 { "GLPOINTATOM", 10003, 0 },
124 { "GPOINTATOM", 3034, 0 },
125 { "GRATIOATOM", 3031, 0 },
126 { "GRCOLOR", 3020, 0 },
127 { "GRCOLORATOM", 10002, 0 },
128 { "GRECTATOM", 3025, 0 },
129 { "GSCALING", 3032, 0 },
130 { "GSCALINGATOM", 10001, 0 },
131 { "GUIDEATOM", 1019, 0 },
132 { "GUIDELIST", 2026, 0 },
133 { "HANDOUT", 4041, 0 },
134 { "HEADERMCATOM", 4089, 0 },
135 { "HEADERSFOOTERS", 4057, &Powerpoint::opHeadersFooters },
136 { "HEADERSFOOTERSATOM", 4058, &Powerpoint::opHeadersFootersAtom },
137 { "INT4ARRAYATOM", 2031, 0 },
138 { "INTERACTIVEINFO", 4082, 0 },
139 { "INTERACTIVEINFOATOM", 4083, 0 },
141 { "LIST", 2000, &Powerpoint::opList },
142 { "LISTPLACEHOLDER", 2017, 0 },
143 { "MAINMASTER", 1016, &Powerpoint::opMainMaster },
144 { "MASTERTEXT", 4068, 0 },
145 { "METAFILE", 4033, 0 },
146 { "NAMEDSHOW", 1041, 0 },
147 { "NAMEDSHOWS", 1040, 0 },
148 { "NAMEDSHOWSLIDES", 1042, 0 },
149 { "NOTES", 1008, &Powerpoint::opNotes },
150 { "NOTESATOM", 1009, &Powerpoint::opNotesAtom },
151 { "OEPLACEHOLDERATOM", 3011, 0 },
152 { "OESHAPE", 3008, 0 },
153 { "OESHAPEATOM", 3035, 0 },
154 { "OUTLINETEXTREFATOM", 3998, 0 },
155 { "OUTLINEVIEWINFO", 1031, &Powerpoint::opOutlineViewInfo },
156 { "PARAFORMATATOM", 4067, 0 },
157 { "PERSISTPTRFULLBLOCK", 6001, 0 },
158 { "PERSISTPTRINCREMENTALBLOCK", 6002, &Powerpoint::opPersistPtrIncrementalBlock },
159 { "POWERPOINTSTATEINFOATOM", 10, 0 },
160 { "PPDRAWING", 1036, &Powerpoint::opPPDrawing },
161 { "PPDRAWINGGROUP", 1035, &Powerpoint::opPPDrawingGroup },
162 { "PRINTOPTIONS", 6000, 0 },
163 { "PROGBINARYTAG", 5002, 0 },
164 { "PROGSTRINGTAG", 5001, 0 },
165 { "PROGTAGS", 5000, 0 },
167 { "RECOLORENTRYATOM", 4062, 0 },
168 { "RECOLORINFOATOM", 4071, 0 },
169 { "RTFDATETIMEMCATOM", 4117, 0 },
170 { "RULERINDENTATOM", 10000, 0 },
171 { "RUNARRAY", 2028, 0 },
172 { "RUNARRAYATOM", 2029, 0 },
173 { "SCHEME", 1012, 0 },
174 { "SCHEMEATOM", 1013, 0 },
175 { "SLIDE", 1006, &Powerpoint::opSlide },
176 { "SLIDEATOM", 1007, &Powerpoint::opSlideAtom },
177 { "SLIDEBASE", 1004, 0 },
178 { "SLIDEBASEATOM", 1005, 0 },
179 { "SLIDELIST", 4084, 0 },
180 { "SLIDELISTWITHTEXT", 4080, &Powerpoint::opSlideListWithText },
181 { "SLIDENUMBERMCATOM", 4056, 0 },
182 { "SLIDEPERSIST", 1003, 0 },
183 { "SLIDEPERSISTATOM", 1011, &Powerpoint::opSlidePersistAtom },
184 { "SLIDEVIEWINFO", 1018, &Powerpoint::opSlideViewInfo },
185 { "SLIDEVIEWINFOATOM", 1022, 0 },
186 { "SORTERVIEWINFO", 1032, 0 },
187 { "SOUND", 2022, 0 },
188 { "SOUNDCOLLATOM", 2021, 0 },
189 { "SOUNDCOLLECTION", 2020, 0 },
190 { "SOUNDDATA", 2023, 0 },
191 { "SRKINSOKU", 4040, &Powerpoint::opSrKinsoku },
192 { "SRKINSOKUATOM", 4050, 0 },
193 { "SSDOCINFOATOM", 1025, &Powerpoint::opSSDocInfoAtom },
194 { "SSLIDELAYOUTATOM", 1015, &Powerpoint::opSSSlideLayoutAtom },
195 { "SSSLIDEINFOATOM", 1017, 0 },
196 { "STYLETEXTPROPATOM", 4001, &Powerpoint::opStyleTextPropAtom },
197 { "SUBCONTAINERCOMPLETED", 1, 0 },
198 { "SUBCONTAINEREXCEPTION", 4, 0 },
199 { "SUMMARY", 1026, 0 },
200 { "TEXTBOOKMARKATOM", 4007, 0 },
201 { "TEXTBYTESATOM", 4008, &Powerpoint::opTextBytesAtom },
202 { "TEXTCHARSATOM", 4000, &Powerpoint::opTextCharsAtom },
203 { "TEXTHEADERATOM", 3999, &Powerpoint::opTextHeaderAtom },
204 { "TEXTRULERATOM", 4006, 0 },
205 { "TEXTSPECINFOATOM", 4010, &Powerpoint::opTextSpecInfoAtom },
206 { "TEXTURE", 1027, 0 },
207 { "TXCFSTYLEATOM", 4004, 0 },
208 { "TXINTERACTIVEINFOATOM", 4063, 0 },
209 { "TXMASTERSTYLEATOM", 4003, &Powerpoint::opTxMasterStyleAtom },
210 { "TXPFSTYLEATOM", 4005, 0 },
211 { "TXSISTYLEATOM", 4009, &Powerpoint::opTxSIStyleAtom },
212 { "TYPEFACE", 4025, 0 },
213 { "USEREDITATOM", 4085, &Powerpoint::opUserEditAtom },
214 { "VBAINFO", 1023, &Powerpoint::opVBAInfo },
215 { "VBAINFOATOM", 1024, 0 },
216 { "VBASLIDEINFO", 1028, 0 },
217 { "VBASLIDEINFOATOM", 1029, 0 },
218 { "VIEWINFO", 1020, 0 },
219 { "VIEWINFOATOM", 1021, 0 },
221 { "MSOD", 0, &Powerpoint::opMsod }
228 for (i = 0; funcTab[i].name; i++)
230 if (funcTab[i].opcode == op.type)
238 result = funcTab[i].handler;
239 if (!result && (op.type >= 0xF000) && (0xFFFF >= op.type))
240 result = funcTab[++i].handler;
244 kdWarning(s_area) << "invokeHandler: unsupported opcode: " <<
246 " operands: " << bytes << endl;
248 kdWarning(s_area) << "invokeHandler: unsupported opcode: " <<
250 " operands: " << bytes << endl;
253 skip(bytes, operands);
257 kdDebug(s_area) << "invokeHandler: opcode: " << funcTab[i].name <<
258 " operands: " << bytes << endl;
268 TQByteArray *record = new TQByteArray(bytes);
271 operands.readRawBytes(record->data(), bytes);
272 body = new TQDataStream(*record, IO_ReadOnly);
273 body->setByteOrder(TQDataStream::LittleEndian);
274 (this->*result)(op, bytes, *body);
280 TQDataStream *body = new TQDataStream();
282 (this->*result)(op, bytes, *body);
288bool Powerpoint::parse(
295 m_mainStream = mainStream;
296 m_pictures = pictures;
298 m_documentRefFound = false;
299 m_persistentReferences.clear();
305 m_pass = PASS_GET_SLIDE_REFERENCES;
306 kdError(s_area) << "parseing step 1 walkRecord..." << endl;
307 walkRecord(currentUser.length, currentUser.data);
309 kdError(s_area) << "parseing step 2 walkReference..." << endl;
315 kdError(s_area) << "walking slide list!!!!.." << endl;
316 if(mEditOffset != 0) walk(mEditOffset);
319 m_pass = PASS_GET_SLIDE_CONTENTS;
320 kdError(s_area) << "TOTAL SLIDES XXxx: " << m_slideList.count() << endl;
322 for (i = 0; i < m_slideList.count(); i++)
324 m_pptSlide = m_slideList.at(i);
326 gotSlide(*m_pptSlide);
332void Powerpoint::opColorSchemeAtom(
335 TQDataStream &operands)
339 TQ_UINT32 background;
340 TQ_UINT32 textAndLines;
345 TQ_UINT32 accentAndHyperlink;
346 TQ_UINT32 accentAndFollowedHyperlink;
349 operands >> data.background >> data.textAndLines >> data.shadows >>
350 data.titleText >> data.fills >> data.accent >> data.accentAndHyperlink >>
351 data.accentAndFollowedHyperlink;
357void Powerpoint::opCString(
360 TQDataStream &operands)
365 for (i = 0; i < bytes / 2; i++)
372 kdDebug(s_area) << "value: " << value << endl;
375void Powerpoint::opCurrentUserAtom(
378 TQDataStream &operands)
381 const TQ_UINT32 MAGIC_NUMBER = (TQ_UINT32)(-476987297);
384 operands >> mCurrentUserAtom.size >> mCurrentUserAtom.magic >> mCurrentUserAtom.offsetToCurrentEdit >>
385 mCurrentUserAtom.lenUserName >> mCurrentUserAtom.docFileVersion >> mCurrentUserAtom.majorVersion >>
386 mCurrentUserAtom.minorVersion;
388 kdDebug(s_area) << "\nPSR_CurrentUserAtom:" <<
389 "\n\tsize: " << mCurrentUserAtom.size <<
390 "\n\tmagic: " << mCurrentUserAtom.magic <<
391 "\n\toffsetToCurrentEdit: " << mCurrentUserAtom.offsetToCurrentEdit <<
392 "\n\tlenUserName: " << mCurrentUserAtom.lenUserName <<
393 "\n\tdocFileVersion: " << mCurrentUserAtom.docFileVersion <<
394 "\n\tmajorVersion: " << mCurrentUserAtom.majorVersion <<
395 "\n\tminorVersion: " << mCurrentUserAtom.minorVersion << endl;
399 case PASS_GET_SLIDE_REFERENCES:
400 if (mCurrentUserAtom.size != 20)
402 kdError(s_area) << "invalid size: " << mCurrentUserAtom.size << endl;
404 if (mCurrentUserAtom.magic != MAGIC_NUMBER)
406 kdError(s_area) << "invalid magic number: " << mCurrentUserAtom.magic << endl;
408 if ((mCurrentUserAtom.docFileVersion != 1012) ||
409 (mCurrentUserAtom.majorVersion != 3) ||
410 (mCurrentUserAtom.minorVersion != 0))
414 kdError(s_area) << "invalid version: " << mCurrentUserAtom.docFileVersion <<
415 "." << mCurrentUserAtom.majorVersion <<
416 "." << mCurrentUserAtom.minorVersion <<
423 walkRecord(mCurrentUserAtom.offsetToCurrentEdit);
425 case PASS_GET_SLIDE_CONTENTS:
430void Powerpoint::opDocument(
433 TQDataStream &operands)
435 walk(bytes, operands);
438void Powerpoint::opDocumentAtom(
445void Powerpoint::opEndDocument(
448 TQDataStream &operands)
450 walk(bytes, operands);
453void Powerpoint::opEnvironment(
456 TQDataStream &operands)
458 walk(bytes, operands);
465void Powerpoint::opExEmbed(
468 TQDataStream &operands)
470 walk(bytes, operands);
476void Powerpoint::opExEmbedAtom(
479 TQDataStream &operands)
483 TQ_INT32 followColorScheme;
484 TQ_UINT8 cantLockServerB;
485 TQ_UINT8 noSizeToServerB;
489 operands >> data.followColorScheme;
490 operands >> data.cantLockServerB;
491 operands >> data.noSizeToServerB;
492 operands >> data.isTable;
495void Powerpoint::opFontCollection(
498 TQDataStream &operands)
500 walk(bytes, operands);
503void Powerpoint::opFontEntityAtom(
510void Powerpoint::opHeadersFooters(
513 TQDataStream &operands)
515 walk(bytes, operands);
518void Powerpoint::opHeadersFootersAtom(
525void Powerpoint::opList(
528 TQDataStream &operands)
530 walk(bytes, operands);
533void Powerpoint::opMainMaster(
536 TQDataStream &operands)
538 walk(bytes, operands);
541void Powerpoint::opMsod(
544 TQDataStream &operands)
550 case PASS_GET_SLIDE_REFERENCES:
552 case PASS_GET_SLIDE_CONTENTS:
553 data = new char[bytes];
554 operands.readRawBytes(( char *)data, bytes);
555kdError() << " drgid: "<< m_pptSlide->getPsrReference() << endl;
556 gotDrawing(m_pptSlide->getPsrReference(), "msod", bytes, data);
562void Powerpoint::opNotes(
565 TQDataStream &operands)
567 walk(bytes, operands);
570void Powerpoint::opNotesAtom(
573 TQDataStream &operands)
581 operands >> data.slideId >> data.flags;
587void Powerpoint::opExObjList(
590 TQDataStream &operands)
592 walk(bytes, operands);
598void Powerpoint::opExObjListAtom(
601 TQDataStream &operands)
603 TQ_UINT32 objectSeedId;
605 operands >> objectSeedId;
606 kdDebug(s_area) << "next OLE obj id: " << objectSeedId << endl;
609void Powerpoint::opExObjRefAtom(
616void Powerpoint::opExOleObj(
623void Powerpoint::opExOleObjAtom(
626 TQDataStream &operands)
630 TQ_UINT32 drawAspect;
637 operands >> data.drawAspect;
638 operands >> data.type;
639 operands >> data.objID;
640 operands >> data.subType;
641 operands >> data.isBlank;
642 kdDebug(s_area) << ((data.type == 0) ? "embedded " : "linked ") <<
643 "OLE obj id: " << data.objID << endl;
646void Powerpoint::opExOleObjStg(
653void Powerpoint::opOutlineViewInfo(
656 TQDataStream &operands)
658 walk(bytes, operands);
661void Powerpoint::opPersistPtrIncrementalBlock2(
679void Powerpoint::opPersistPtrIncrementalBlock(
682 TQDataStream &operands)
691 TQ_UINT32 offsetNumber: 20;
692 TQ_UINT32 offsetCount: 12;
697 TQ_UINT32 length = 0;
699 while (length < bytes)
707 operands >> data.header.info;
708 length += sizeof(data.header.info);
709 kdDebug(s_area) << "length1: " << length << endl;
710 kdDebug(s_area) << "m_pass: " << m_pass << endl;
712 kdDebug(s_area) << "data.header.fields.offsetCount: " << data.header.fields.offsetCount << endl;
714 for (i = 0; i < data.header.fields.offsetCount; i++)
716 unsigned reference = data.header.fields.offsetNumber + i;
718 operands >> data.offset;
719 length += sizeof(data.offset);
723 case PASS_GET_SLIDE_REFERENCES:
727 if (m_persistentReferences.end() == m_persistentReferences.find(reference))
731 kdDebug(s_area) << "persistent reference: " << reference <<
732 ": " << data.offset << endl;
734 m_persistentReferences.insert(reference, data.offset);
745 case PASS_GET_SLIDE_CONTENTS:
749 kdDebug(s_area) << "LEAVING persistant block -- " << endl;
754void Powerpoint::opPPDrawing(
757 TQDataStream &operands)
759 walk(bytes, operands);
762void Powerpoint::opPPDrawingGroup(
765 TQDataStream &operands)
767 walk(bytes, operands);
770void Powerpoint::opSlide(
773 TQDataStream &operands)
775 walk(bytes, operands);
778void Powerpoint::opSlideAtom(
781 TQDataStream &operands)
793 tmp.length = sizeof(data.layout);
794 invokeHandler(tmp, tmp.length, operands);
795 operands >> data.masterId >> data.notesId >> data.flags;
797 kdDebug(s_area) << "\nSlideAtom:" <<
798 "\n\tmasterId: " << data.masterId <<
799 "\n\tnotesId: " << data.notesId <<
800 "\n\tflags: " << data.flags << endl;
806void Powerpoint::opSlideListWithText(
809 TQDataStream &operands)
811 walk(bytes, operands);
814void Powerpoint::opSlidePersistAtom(
817 TQDataStream &operands)
821 TQ_UINT32 psrReference;
823 TQ_INT32 numberTexts;
828 operands >> data.psrReference >> data.flags >> data.numberTexts >>
829 data.slideId >> data.reserved;
831 kdDebug(s_area) << "\nopSlidePersistAtom: " <<
832 "\n\tpsrReference: " << data.psrReference <<
833 "\n\tflags: " << data.flags <<
834 "\n\tnumberTexts: " << data.numberTexts <<
835 "\n\tslideId: " << data.slideId <<
836 "\n\treserved: " << data.reserved << endl;
840 case PASS_GET_SLIDE_REFERENCES:
843 m_pptSlide = new PptSlide;
844 m_pptSlide->setPsrReference(data.psrReference);
845 m_slideList.append(m_pptSlide);
847 kdDebug(s_area) << "XXXXXXXXXslide: " << data.psrReference <<
848 " has texts: " << data.numberTexts << endl;
851 case PASS_GET_SLIDE_CONTENTS:
856void Powerpoint::opSlideViewInfo(
859 TQDataStream &operands)
861 walk(bytes, operands);
864void Powerpoint::opSrKinsoku(
867 TQDataStream &operands)
869 walk(bytes, operands);
872void Powerpoint::opSSDocInfoAtom(
879void Powerpoint::opSSSlideLayoutAtom(
882 TQDataStream &operands)
885 PSR_SSlideLayoutAtom data;
888 operands >> data.geom;
889 for (i = 0; i < sizeof(data.placeholderId); i++)
891 operands >> data.placeholderId[i];
894 kdDebug(s_area) << "\nPSR_SSlideLayoutAtom:" <<
895 "\n\tgeom: " << data.geom <<
896 "\n\tplaceholderId[0]: " << data.placeholderId[0] <<
897 "\n\tplaceholderId[1]: " << data.placeholderId[1] <<
898 "\n\tplaceholderId[2]: " << data.placeholderId[2] <<
899 "\n\tplaceholderId[3]: " << data.placeholderId[3] <<
900 "\n\tplaceholderId[4]: " << data.placeholderId[4] <<
901 "\n\tplaceholderId[5]: " << data.placeholderId[5] <<
902 "\n\tplaceholderId[6]: " << data.placeholderId[6] <<
903 "\n\tplaceholderId[7]: " << data.placeholderId[7] << endl;
907void Powerpoint::opStyleTextPropAtom(
910 TQDataStream &operands)
913 TQ_UINT16 totalLength = 0;
914 TQ_UINT16 length = 0;
915 TQ_UINT32 style1 = 0;
916 TQ_UINT32 style2 = 0;
917 TQ_UINT16 style3 = 0;
918 TQ_UINT32 BOLD = 0x00010000;
919 TQ_UINT32 ITALIC = 0x00020000;
920 TQ_UINT32 UNDERLINE = 0x00040000;
923 operands >> length >> style1 >> style2;
926 kdDebug(s_area) << "\nopStyleTextPropAtom1:" <<
927 "\n\tlength: " << length <<
928 "\n\tstyle1: " << style1 <<
929 "\n\tstyle2: " << style2 << endl;
933 while(bytes > totalLength)
940 operands >> length >> style1;
953 kdDebug(s_area) << "\nopStyleTextPropAtom2:" <<
954 "\n\tlength: " << length <<
955 "\n\tstyle1: " << style1 <<
956 "\n\tstyle2: " << style2 <<
957 "\n\tstyle3: " << style3 << endl;
959 kdDebug(s_area) << "BOLD here" << endl;
961 kdDebug(s_area) << "ITALIC here" << endl;
962 if(style1 & UNDERLINE)
963 kdDebug(s_area) << "UNDERLINE here" << endl;
968void Powerpoint::opTextBytesAtom(
971 TQDataStream &operands)
976 for (i = 0; i < bytes; i++)
983 kdDebug(s_area) << "\nopTextBytesAtom: " <<
984 "\n\tdata: " << data << endl;
989 case PASS_GET_SLIDE_REFERENCES:
996 m_pptSlide->addText(data, m_textType);
997 kdDebug(s_area) << "Text Added: " << data << " type: " << m_textType << endl;
1000 kdDebug(s_area) << "WEVE GOTS US AN ERROR!!!" << endl;
1003 case PASS_GET_SLIDE_CONTENTS:
1008void Powerpoint::opTextCharsAtom(
1011 TQDataStream &operands)
1016 for (i = 0; i < bytes / 2; i++)
1027 case PASS_GET_SLIDE_REFERENCES:
1034 m_pptSlide->addText(data, m_textType);
1035 kdDebug(s_area) << "Text Added: " << data << " type: " << m_textType << endl;
1038 kdDebug(s_area) << "WEVE GOTS US AN ERROR!!!" << endl;
1041 case PASS_GET_SLIDE_CONTENTS:
1046void Powerpoint::opTextHeaderAtom(
1049 TQDataStream &operands)
1066 operands >> data.txType;
1068 kdDebug(s_area) << "\nopTextHeaderAtom:" <<
1069 "\n\ttxType: " << data.txType << endl;
1073 case PASS_GET_SLIDE_REFERENCES:
1074 m_textType = data.txType;
1076 case PASS_GET_SLIDE_CONTENTS:
1081void Powerpoint::opTextSpecInfoAtom(
1088void Powerpoint::opTxMasterStyleAtom(
1095void Powerpoint::opTxSIStyleAtom(
1106void Powerpoint::opUserEditAtom(
1109 TQDataStream &operands)
1112 operands >> mUserEditAtom.lastSlideID >> mUserEditAtom.version >> mUserEditAtom.offsetLastEdit >>
1113 mUserEditAtom.offsetPersistDirectory >> mUserEditAtom.documentRef >>
1114 mUserEditAtom.maxPersistWritten >> mUserEditAtom.lastViewType;
1116 if(mEditOffset == 0)mEditOffset = mUserEditAtom.offsetLastEdit;
1118 kdDebug(s_area) << "\nPSR_UserEditAtom:" <<
1119 "\n\tlastSlideID: " << mUserEditAtom.lastSlideID <<
1120 "\n\tversion: " << mUserEditAtom.version <<
1121 "\n\toffsetLastEdit: " << mUserEditAtom.offsetLastEdit <<
1122 "\n\toffsetPersistDirectory: " << mUserEditAtom.offsetPersistDirectory <<
1123 "\n\tdocumentRef: " << mUserEditAtom.documentRef <<
1124 "\n\tmaxPersistWritten: " << mUserEditAtom.maxPersistWritten <<
1125 "\n\tlastViewType: " << mUserEditAtom.lastViewType << endl;
1127 if (!m_documentRefFound)
1129 m_documentRef = mUserEditAtom.documentRef;
1130 m_documentRefFound = true;
1134 case PASS_GET_SLIDE_REFERENCES:
1139 walkRecord(mUserEditAtom.offsetPersistDirectory);
1143 if (mUserEditAtom.offsetLastEdit)
1146 walkRecord(mUserEditAtom.offsetLastEdit);
1150 case PASS_GET_SLIDE_CONTENTS:
1155void Powerpoint::opVBAInfo(
1158 TQDataStream &operands)
1160 walk(bytes, operands);
1163void Powerpoint::skip(TQ_UINT32 bytes, TQDataStream &operands)
1167 kdError(s_area) << "skip: " << (int)bytes << endl;
1175 kdDebug(s_area) << "skip: " << bytes << endl;
1176 for (i = 0; i < bytes; i++)
1178 operands >> discard;
1186void Powerpoint::walk(TQ_UINT32 bytes, TQDataStream &operands)
1189 TQ_UINT32 length = 0;
1193 while (length + 8 <= bytes)
1195 operands >> op.opcode.info >> op.type >> op.length;
1198 if (length + op.length + 8 > bytes)
1200 op.length = bytes - length - 8;
1202 length += op.length + 8;
1206 invokeHandler(op, op.length, operands);
1210 skip(bytes - length, operands);
1213void Powerpoint::walk(TQ_UINT32 mainStreamOffset)
1215 TQ_UINT32 length = m_mainStream.length - mainStreamOffset;
1218 a.setRawData(( const char *)m_mainStream.data + mainStreamOffset, length);
1219 TQDataStream stream(a, IO_ReadOnly);
1220 stream.setByteOrder(TQDataStream::LittleEndian);
1221 walk(length, stream);
1222 a.resetRawData(( const char *)m_mainStream.data + mainStreamOffset, length);
1224void Powerpoint::walkDocument()
1227 TQ_UINT32 mainStreamOffset = 0;
1228 TQ_UINT32 bytes = m_mainStream.length - mainStreamOffset;
1230 a.setRawData(( const char *)m_mainStream.data + mainStreamOffset, bytes);
1231 TQDataStream stream(a, IO_ReadOnly);
1232 stream.setByteOrder(TQDataStream::LittleEndian);
1235 TQ_UINT32 length = 0;
1239 while (length + 8 <= bytes && op.type != 1000)
1241 stream >> op.opcode.info >> op.type >> op.length;
1244 if (length + op.length + 8 > bytes)
1246 op.length = bytes - length - 8;
1248 length += op.length + 8;
1252 invokeHandler(op, op.length, stream);
1253 a.resetRawData(( const char *)m_mainStream.data + mainStreamOffset, bytes);
1257void Powerpoint::walkRecord(TQ_UINT32 bytes, const unsigned char *operands)
1261 kdError(s_area) << "WalkRecord - bytes: " << bytes << endl;
1263 TQ_UINT32 length = sizeof(Header);
1267 a.setRawData(( const char *)operands, bytes);
1268 TQDataStream stream1(a, IO_ReadOnly);
1269 stream1.setByteOrder(TQDataStream::LittleEndian);
1270 stream1 >> op.opcode.info >> op.type >> op.length;
1271 a.resetRawData(( const char *)operands, bytes);
1275 length += op.length;
1276 a.setRawData(( const char *)operands, length);
1277 TQDataStream stream2(a, IO_ReadOnly);
1278 stream2.setByteOrder(TQDataStream::LittleEndian);
1279 walk(length, stream2);
1280 a.resetRawData(( const char *)operands, length);
1283void Powerpoint::walkRecord(TQ_UINT32 mainStreamOffset)
1285 walkRecord( sizeof(Header), m_mainStream.data + mainStreamOffset);
1288void Powerpoint::walkReference(TQ_UINT32 reference)
1290 if (m_persistentReferences.end() == m_persistentReferences.find(reference))
1292 kdError(s_area) << "cannot find reference: " << reference << endl;
1296 unsigned offset = m_persistentReferences[reference];
1297 kdDebug(s_area) << "found reference: " << reference <<
1298 " offset: " << offset << endl;
1300 kdDebug(s_area) << "****************************" << endl;
|