summaryrefslogtreecommitdiffstats
path: root/filters/olefilters/powerpoint97
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /filters/olefilters/powerpoint97
downloadkoffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz
koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'filters/olefilters/powerpoint97')
-rw-r--r--filters/olefilters/powerpoint97/Makefile.am17
-rw-r--r--filters/olefilters/powerpoint97/README47
-rw-r--r--filters/olefilters/powerpoint97/ole_powerpoint97_import.desktop67
-rw-r--r--filters/olefilters/powerpoint97/powerpoint.cc1303
-rw-r--r--filters/olefilters/powerpoint97/powerpoint.h355
-rw-r--r--filters/olefilters/powerpoint97/powerpointfilter.cc73
-rw-r--r--filters/olefilters/powerpoint97/powerpointfilter.h47
-rw-r--r--filters/olefilters/powerpoint97/pptSlide.cpp111
-rw-r--r--filters/olefilters/powerpoint97/pptSlide.h93
-rw-r--r--filters/olefilters/powerpoint97/pptdoc.cc87
-rw-r--r--filters/olefilters/powerpoint97/pptdoc.h82
-rw-r--r--filters/olefilters/powerpoint97/pptxml.cc317
-rw-r--r--filters/olefilters/powerpoint97/pptxml.h109
-rw-r--r--filters/olefilters/powerpoint97/status.html156
14 files changed, 2864 insertions, 0 deletions
diff --git a/filters/olefilters/powerpoint97/Makefile.am b/filters/olefilters/powerpoint97/Makefile.am
new file mode 100644
index 00000000..d0c3fc2b
--- /dev/null
+++ b/filters/olefilters/powerpoint97/Makefile.am
@@ -0,0 +1,17 @@
+####### General stuff
+
+INCLUDES= -I$(srcdir) -I$(srcdir)/../lib $(KOFFICE_INCLUDES) $(all_includes)
+
+####### Files
+
+noinst_LTLIBRARIES = libpowerpoint97.la
+
+libpowerpoint97_la_SOURCES = powerpointfilter.cc powerpoint.cc pptdoc.cc pptxml.cc pptSlide.cpp
+libpowerpoint97_la_LDFLAGS = $(all_libraries)
+
+noinst_HEADERS = powerpointfilter.h powerpoint.h pptdoc.h pptxml.h pptSlide.h
+
+METASOURCES = AUTO
+
+service_DATA = ole_powerpoint97_import.desktop
+servicedir = $(kde_servicesdir)
diff --git a/filters/olefilters/powerpoint97/README b/filters/olefilters/powerpoint97/README
new file mode 100644
index 00000000..9a667e75
--- /dev/null
+++ b/filters/olefilters/powerpoint97/README
@@ -0,0 +1,47 @@
+The Powerpoint filter design has these components:
+
+powerpointfilter.h
+powerpoint.h
+pptdoc.h
+pptxml.h
+
+These are described in turn below.
+
+powerpointfilter.h
+==================
+
+This is the interface to the KOffice filter architecture. It is invoked from
+olefilter when an OLE file is detected to have a Powerpoint document in it.
+
+powerpoint.h
+============
+
+This is the actual parser. It is designed to walk the Powerpoint file and is
+not intended to have much embedded knowledge beyond that required to invoke
+a series of virtual functions when it recognises low level objects. See also
+pptdoc.h.
+
+In principle, each record in the Powerpoint file is modelled as a structure
+defined in powerpoint.h, as well as a virtual function callback to output it.
+In practice, this is true only of records that contain data. Records that are
+simply containers for other records don't have an associated structure, but
+instead have two callbacks, one each marking entry to and exit from the
+container.
+
+pptdoc.h
+========
+
+The purpose of pptdoc.h is to take the output from powerpoint.h and create a
+high level interface to the Powerpoint file contents. The idea is that it can
+take the low output from powerpoint.h and aggregate it into objects at a more
+useful level of abstraction.
+
+The output of this is again via a series of virtual function callbacks.
+Subclasses of pptdoc.h can simply override the callbacks for the objects of
+interest.
+
+pptxml.h
+========
+
+This is a subclass of pptdoc.h that produces kpresenter-compatible XML which
+is delivered to kpresenter via powerpointfilter.h.
diff --git a/filters/olefilters/powerpoint97/ole_powerpoint97_import.desktop b/filters/olefilters/powerpoint97/ole_powerpoint97_import.desktop
new file mode 100644
index 00000000..f8927120
--- /dev/null
+++ b/filters/olefilters/powerpoint97/ole_powerpoint97_import.desktop
@@ -0,0 +1,67 @@
+[Desktop Entry]
+Type=Service
+Name=KPresenter PowerPoint 97 Filter
+Name[af]=Kpresenter Powerpoint 97 Filter
+Name[az]=KPresenter PowerPoint 97 Süzgəci
+Name[bg]=Филтър за експортиране от KPresenter в PowerPoint 97
+Name[br]=Sil PowerPoint 97 KPresenter
+Name[ca]=Filtre d'exportació PowerPoint 97 per a KPresenter
+Name[cy]=Hidlen PowerPoint 97 KPresenter
+Name[de]=KPresenter PowerPoint97-Filter
+Name[el]=Φίλτρο εξαγωγής PowerPoint 97 του KPresenter
+Name[eo]=KPresenter PowerPoint-97-filtrilo
+Name[es]=Filtro de PowerPoint 97 para KPresenter
+Name[et]=KPresenteri PowerPoint 97 filter
+Name[eu]=KPresenter-en PowerPoint 97 iragazkia
+Name[fa]=پالایۀ KPresenter PowerPoint 97
+Name[fr]=Filtre d'exportation PowerPoint 97 de KPresenter
+Name[fy]=PowerPoint 97-filter foar KPresenter
+Name[ga]=Scagaire PowerPoint 97 le haghaidh KPresenter
+Name[gl]=Filtro de PowerPoint 97 para KPresenter
+Name[hi]=के-प्रेज़ेन्टर पावरपाइंट 97 छननी
+Name[hr]=KPresenter PowerPoint 97 filtar
+Name[hu]=KPresenter PowerPoint 97 importszűrő
+Name[id]=Filter PowerPoint 97 KPresenter
+Name[is]=PowerPoint 97 sía f. KPresenter
+Name[it]=Filtro PowerPoint 97 per KPresenter
+Name[ja]=KPresenter PowerPoint 97 エクスポートフィルタ
+Name[km]=តម្រង KPresenter PowerPoint 97
+Name[lo]=ຕົວຕອງ PowerPoint 97 ຂອງການນຳສະເໝK
+Name[lt]=KPresenter PowerPoint 97 filtras
+Name[lv]=KPresenter PowerPoint 97 filtrs
+Name[mk]=KPresenter PowerPoint 97 филтер
+Name[ms]=Penapis KPresenter PowerPoint 97
+Name[mt]=Filtru PowerPoint 97 għal KPresenter
+Name[nb]=PowerPoint 97-filter for KPresenter
+Name[nds]=PowerPoint97-Filter för KPresenter
+Name[ne]=केडीई प्रस्तुतकर्ता पावरपोइन्ट ९७ फिल्टर
+Name[nl]=PowerPoint 97-filter voor KPresenter
+Name[nn]=PowerPoint 97-filter for KPresenter
+Name[pl]=Filtr PowerPoint 97 dla KPresenter
+Name[pt]=Filtro de PowerPoint 97 para o KPresenter
+Name[pt_BR]=Filtro de PowerPoint 97 para o KPresenter
+Name[ro]=Filtru KPresenter pentru PowerPoint 97
+Name[ru]=Фильтр импорта презентаций PowerPoint 97 в KPresenter
+Name[se]=KPresenter:a PowerPoint 97 silli
+Name[sk]=PowerPoint 97 Filter pre KPresenter
+Name[sl]=Filter za PowerPoint 97 v KPresenteru
+Name[sr]=KPresenter-ов филтер за PowerPoint 97
+Name[sr@Latn]=KPresenter-ov filter za PowerPoint 97
+Name[sv]=Kpresenter PowerPoint 97-filter
+Name[ta]=KPresenter PowerPoint 97 வடிகட்டி
+Name[tg]=Филтри KPresenter PowerPoint 97
+Name[th]=ตัวกรอง PowerPoint 97 ของการนำเสนอ K
+Name[tr]=KPresenter PowerPoint 97 Filtresi
+Name[uk]=Фільтр PowerPoint 97 для KPresenter
+Name[uz]=KPresenter PowerPoint 97 filteri
+Name[uz@cyrillic]=KPresenter PowerPoint 97 филтери
+Name[ven]=Mulanguli wa K fhethu ha maanda 97 filithara
+Name[wa]=Passete PowerPoint 97 po KPresenter
+Name[xh]=Isihluzi se KPresenter PowerPoint 97
+Name[zh_TW]=KPresenter PowerPoint 97 過濾程式
+Name[zu]=KPresenter PowerPoint 97 Icebo lokuhlaziya ifayela
+X-KDE-Export=application/x-kpresenter
+X-KDE-Import=application/mspowerpoint
+X-KDE-Weight=1
+X-KDE-Library=libolefilter
+ServiceTypes=KOfficeFilter
diff --git a/filters/olefilters/powerpoint97/powerpoint.cc b/filters/olefilters/powerpoint97/powerpoint.cc
new file mode 100644
index 00000000..f01c71c7
--- /dev/null
+++ b/filters/olefilters/powerpoint97/powerpoint.cc
@@ -0,0 +1,1303 @@
+/*
+ Copyright (C) 2000, S.R.Haque <[email protected]>.
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+DESCRIPTION
+*/
+
+#include <kdebug.h>
+#include <myfile.h>
+#include <powerpoint.h>
+
+const int Powerpoint::s_area = 30512;
+
+Powerpoint::Powerpoint()
+{
+ mEditOffset = 0;
+ m_pptSlide = 0;
+}
+
+Powerpoint::~Powerpoint()
+{
+ m_persistentReferences.clear();
+ //m_slides.clear();
+}
+
+void Powerpoint::invokeHandler(
+ Header &op,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ typedef void (Powerpoint::*method)(Header &op, Q_UINT32 bytes, QDataStream &operands);
+
+ typedef struct
+ {
+ const char *name;
+ Q_UINT16 opcode;
+ method handler;
+ } opcodeEntry;
+
+ static const opcodeEntry funcTab[] =
+ {
+ { "ANIMATIONINFO", 4116, 0 /* &Powerpoint::opAnimationInfo */ },
+ { "ANIMATIONINFOATOM", 4081, 0 /* &Powerpoint::opAnimationInfoAtom */ },
+ { "ARRAYELEMENTATOM", 2030, 0 /* &Powerpoint::opArrayElementAtom */ },
+ { "BASETEXTPROPATOM", 4002, 0 /* &Powerpoint::opBaseTextPropAtom */ },
+ { "BINARYTAGDATA", 5003, 0 /* &Powerpoint::opBinaryTagData */ },
+ { "BOOKMARKCOLLECTION", 2019, 0 /* &Powerpoint::opBookmarkCollection */ },
+ { "BOOKMARKENTITYATOM", 4048, 0 /* &Powerpoint::opBookmarkEntityAtom */ },
+ { "BOOKMARKSEEDATOM", 2025, 0 /* &Powerpoint::opBookmarkSeedAtom */ },
+ { "CHARFORMATATOM", 4066, 0 /* &Powerpoint::opCharFormatAtom */ },
+ { "CLIENTSIGNAL1", 6, 0 /* &Powerpoint::opClientSignal1 */ },
+ { "CLIENTSIGNAL2", 7, 0 /* &Powerpoint::opClientSignal2 */ },
+ { "COLORSCHEMEATOM", 2032, &Powerpoint::opColorSchemeAtom },
+ { "COREPICT", 4037, 0 /* &Powerpoint::opCorePict */ },
+ { "COREPICTATOM", 4038, 0 /* &Powerpoint::opCorePictAtom */ },
+ { "CSTRING", 4026, &Powerpoint::opCString },
+ { "CURRENTUSERATOM", 4086, &Powerpoint::opCurrentUserAtom },
+ { "DATETIMEMCATOM", 4087, 0 /* &Powerpoint::opDateTimeMCAtom */ },
+ { "DEFAULTRULERATOM", 4011, 0 /* &Powerpoint::opDefaultRulerAtom */ },
+ { "DOCROUTINGSLIP", 1030, 0 /* &Powerpoint::opDocRoutingSlip */ },
+ { "DOCUMENT", 1000, &Powerpoint::opDocument },
+ { "DOCUMENTATOM", 1001, &Powerpoint::opDocumentAtom },
+ { "DOCVIEWINFO", 1014, 0 /* &Powerpoint::opDocViewInfo */ },
+ { "EMFORMATATOM", 4065, 0 /* &Powerpoint::opEmFormatAtom */ },
+ { "ENDDOCUMENT", 1002, &Powerpoint::opEndDocument },
+ { "ENVIRONMENT", 1010, &Powerpoint::opEnvironment },
+ { "EXAVIMOVIE", 4102, 0 /* &Powerpoint::opExAviMovie */ },
+ { "EXCDAUDIO", 4110, 0 /* &Powerpoint::opExCDAudio */ },
+ { "EXCDAUDIOATOM", 4114, 0 /* &Powerpoint::opExCDAudioAtom */ },
+ { "EXCONTROL", 4078, 0 /* &Powerpoint::opExControl */ },
+ { "EXCONTROLATOM", 4091, 0 /* &Powerpoint::opExControlAtom */ },
+ { "EXEMBED", 4044, &Powerpoint::opExEmbed },
+ { "EXEMBEDATOM", 4045, &Powerpoint::opExEmbedAtom },
+ { "EXHYPERLINK", 4055, 0 /* &Powerpoint::opExHyperlink */ },
+ { "EXHYPERLINKATOM", 4051, 0 /* &Powerpoint::opExHyperlinkAtom */ },
+ { "EXLINK", 4046, 0 /* &Powerpoint::opExLink */ },
+ { "EXLINKATOM", 4049, 0 /* &Powerpoint::opExLinkAtom */ },
+ { "EXLINKATOM_OLD", 4047, 0 /* &Powerpoint::opExLinkAtom_old */ },
+ { "EXMCIMOVIE", 4103, 0 /* &Powerpoint::opExMCIMovie */ },
+ { "EXMEDIAATOM", 4100, 0 /* &Powerpoint::opExMediaAtom */ },
+ { "EXMIDIAUDIO", 4109, 0 /* &Powerpoint::opExMIDIAudio */ },
+ { "EXOBJLIST", 1033, &Powerpoint::opExObjList },
+ { "EXOBJLISTATOM", 1034, &Powerpoint::opExObjListAtom },
+ { "EXOBJREFATOM", 3009, &Powerpoint::opExObjRefAtom },
+ { "EXOLEOBJ", 4034, &Powerpoint::opExOleObj },
+ { "EXOLEOBJATOM", 4035, &Powerpoint::opExOleObjAtom },
+ { "EXOLEOBJSTG", 4113, &Powerpoint::opExOleObjStg },
+ { "EXPLAIN", 4053, 0 /* &Powerpoint::opExPlain */ },
+ { "EXPLAINATOM", 4039, 0 /* &Powerpoint::opExPlainAtom */ },
+ { "EXPLAINLINK", 4054, 0 /* &Powerpoint::opExPlainLink */ },
+ { "EXPLAINLINKATOM", 4036, 0 /* &Powerpoint::opExPlainLinkAtom */ },
+ { "EXQUICKTIME", 4073, 0 /* &Powerpoint::opExQuickTime */ },
+ { "EXQUICKTIMEMOVIE", 4074, 0 /* &Powerpoint::opExQuickTimeMovie */ },
+ { "EXQUICKTIMEMOVIEDATA", 4075, 0 /* &Powerpoint::opExQuickTimeMovieData */ },
+ { "EXSUBSCRIPTION", 4076, 0 /* &Powerpoint::opExSubscription */ },
+ { "EXSUBSCRIPTIONSECTION", 4077, 0 /* &Powerpoint::opExSubscriptionSection */ },
+ { "EXTERNALOBJECT", 4027, 0 /* &Powerpoint::opExternalObject */ },
+ { "EXVIDEO", 4101, 0 /* &Powerpoint::opExVideo */ },
+ { "EXWAVAUDIOEMBEDDED", 4111, 0 /* &Powerpoint::opExWAVAudioEmbedded */ },
+ { "EXWAVAUDIOEMBEDDEDATOM", 4115, 0 /* &Powerpoint::opExWAVAudioEmbeddedAtom */ },
+ { "EXWAVAUDIOLINK", 4112, 0 /* &Powerpoint::opExWAVAudioLink */ },
+ { "FONTCOLLECTION", 2005, &Powerpoint::opFontCollection },
+ { "FONTEMBEDDATA", 4024, 0 /* &Powerpoint::opFontEmbedData */ },
+ { "FONTENTITYATOM", 4023, &Powerpoint::opFontEntityAtom },
+ { "FOOTERMCATOM", 4090, 0 /* &Powerpoint::opFooterMCAtom */ },
+ { "GENERICDATEMCATOM", 4088, 0 /* &Powerpoint::opGenericDateMCAtom */ },
+ { "GLINEATOM", 10004, 0 /* &Powerpoint::opGlineAtom */ },
+ { "GLPOINTATOM", 10003, 0 /* &Powerpoint::opGLPointAtom */ },
+ { "GPOINTATOM", 3034, 0 /* &Powerpoint::opGpointAtom */ },
+ { "GRATIOATOM", 3031, 0 /* &Powerpoint::opGratioAtom */ },
+ { "GRCOLOR", 3020, 0 /* &Powerpoint::opGrColor */ },
+ { "GRCOLORATOM", 10002, 0 /* &Powerpoint::opGrColorAtom */ },
+ { "GRECTATOM", 3025, 0 /* &Powerpoint::opGrectAtom */ },
+ { "GSCALING", 3032, 0 /* &Powerpoint::opGscaling */ },
+ { "GSCALINGATOM", 10001, 0 /* &Powerpoint::opGscalingAtom */ },
+ { "GUIDEATOM", 1019, 0 /* &Powerpoint::opGuideAtom */ },
+ { "GUIDELIST", 2026, 0 /* &Powerpoint::opGuideList */ },
+ { "HANDOUT", 4041, 0 /* &Powerpoint::opHandout */ },
+ { "HEADERMCATOM", 4089, 0 /* &Powerpoint::opHeaderMCAtom */ },
+ { "HEADERSFOOTERS", 4057, &Powerpoint::opHeadersFooters },
+ { "HEADERSFOOTERSATOM", 4058, &Powerpoint::opHeadersFootersAtom },
+ { "INT4ARRAYATOM", 2031, 0 /* &Powerpoint::opInt4ArrayAtom */ },
+ { "INTERACTIVEINFO", 4082, 0 /* &Powerpoint::opInteractiveInfo */ },
+ { "INTERACTIVEINFOATOM", 4083, 0 /* &Powerpoint::opInteractiveInfoAtom */ },
+ { "IRRATOM", 2, 0 /* &Powerpoint::opIRRAtom */ },
+ { "LIST", 2000, &Powerpoint::opList },
+ { "LISTPLACEHOLDER", 2017, 0 /* &Powerpoint::opListPlaceholder */ },
+ { "MAINMASTER", 1016, &Powerpoint::opMainMaster },
+ { "MASTERTEXT", 4068, 0 /* &Powerpoint::opMasterText */ },
+ { "METAFILE", 4033, 0 /* &Powerpoint::opMetaFile */ },
+ { "NAMEDSHOW", 1041, 0 /* &Powerpoint::opNamedShow */ },
+ { "NAMEDSHOWS", 1040, 0 /* &Powerpoint::opNamedShows */ },
+ { "NAMEDSHOWSLIDES", 1042, 0 /* &Powerpoint::opNamedShowSlides */ },
+ { "NOTES", 1008, &Powerpoint::opNotes },
+ { "NOTESATOM", 1009, &Powerpoint::opNotesAtom },
+ { "OEPLACEHOLDERATOM", 3011, 0 /* &Powerpoint::opOEPlaceholderAtom */ },
+ { "OESHAPE", 3008, 0 /* &Powerpoint::opOEShape */ },
+ { "OESHAPEATOM", 3035, 0 /* &Powerpoint::opOEShapeAtom */ },
+ { "OUTLINETEXTREFATOM", 3998, 0 /* &Powerpoint::opOutlineTextRefAtom */ },
+ { "OUTLINEVIEWINFO", 1031, &Powerpoint::opOutlineViewInfo },
+ { "PARAFORMATATOM", 4067, 0 /* &Powerpoint::opParaFormatAtom */ },
+ { "PERSISTPTRFULLBLOCK", 6001, 0 /* &Powerpoint::opPersistPtrFullBlock */ },
+ { "PERSISTPTRINCREMENTALBLOCK", 6002, &Powerpoint::opPersistPtrIncrementalBlock },
+ { "POWERPOINTSTATEINFOATOM", 10, 0 /* &Powerpoint::opPowerPointStateInfoAtom */ },
+ { "PPDRAWING", 1036, &Powerpoint::opPPDrawing },
+ { "PPDRAWINGGROUP", 1035, &Powerpoint::opPPDrawingGroup },
+ { "PRINTOPTIONS", 6000, 0 /* &Powerpoint::opPrintOptions */ },
+ { "PROGBINARYTAG", 5002, 0 /* &Powerpoint::opProgBinaryTag */ },
+ { "PROGSTRINGTAG", 5001, 0 /* &Powerpoint::opProgStringTag */ },
+ { "PROGTAGS", 5000, 0 /* &Powerpoint::opProgTags */ },
+ { "PSS", 3, 0 /* &Powerpoint::opPSS */ },
+ { "RECOLORENTRYATOM", 4062, 0 /* &Powerpoint::opRecolorEntryAtom */ },
+ { "RECOLORINFOATOM", 4071, 0 /* &Powerpoint::opRecolorInfoAtom */ },
+ { "RTFDATETIMEMCATOM", 4117, 0 /* &Powerpoint::opRTFDateTimeMCAtom */ },
+ { "RULERINDENTATOM", 10000, 0 /* &Powerpoint::opRulerIndentAtom */ },
+ { "RUNARRAY", 2028, 0 /* &Powerpoint::opRunArray */ },
+ { "RUNARRAYATOM", 2029, 0 /* &Powerpoint::opRunArrayAtom */ },
+ { "SCHEME", 1012, 0 /* &Powerpoint::opScheme */ },
+ { "SCHEMEATOM", 1013, 0 /* &Powerpoint::opSchemeAtom */ },
+ { "SLIDE", 1006, &Powerpoint::opSlide },
+ { "SLIDEATOM", 1007, &Powerpoint::opSlideAtom },
+ { "SLIDEBASE", 1004, 0 /* &Powerpoint::opSlideBase */ },
+ { "SLIDEBASEATOM", 1005, 0 /* &Powerpoint::opSlideBaseAtom */ },
+ { "SLIDELIST", 4084, 0 /* &Powerpoint::opSlideList */ },
+ { "SLIDELISTWITHTEXT", 4080, &Powerpoint::opSlideListWithText },
+ { "SLIDENUMBERMCATOM", 4056, 0 /* &Powerpoint::opSlideNumberMCAtom */ },
+ { "SLIDEPERSIST", 1003, 0 /* &Powerpoint::opSlidePersist */ },
+ { "SLIDEPERSISTATOM", 1011, &Powerpoint::opSlidePersistAtom },
+ { "SLIDEVIEWINFO", 1018, &Powerpoint::opSlideViewInfo },
+ { "SLIDEVIEWINFOATOM", 1022, 0 /* &Powerpoint::opSlideViewInfoAtom */ },
+ { "SORTERVIEWINFO", 1032, 0 /* &Powerpoint::opSorterViewInfo */ },
+ { "SOUND", 2022, 0 /* &Powerpoint::opSound */ },
+ { "SOUNDCOLLATOM", 2021, 0 /* &Powerpoint::opSoundCollAtom */ },
+ { "SOUNDCOLLECTION", 2020, 0 /* &Powerpoint::opSoundCollection */ },
+ { "SOUNDDATA", 2023, 0 /* &Powerpoint::opSoundData */ },
+ { "SRKINSOKU", 4040, &Powerpoint::opSrKinsoku },
+ { "SRKINSOKUATOM", 4050, 0 /* &Powerpoint::opSrKinsokuAtom */ },
+ { "SSDOCINFOATOM", 1025, &Powerpoint::opSSDocInfoAtom },
+ { "SSLIDELAYOUTATOM", 1015, &Powerpoint::opSSSlideLayoutAtom },
+ { "SSSLIDEINFOATOM", 1017, 0 /* &Powerpoint::opSSSlideInfoAtom */ },
+ { "STYLETEXTPROPATOM", 4001, &Powerpoint::opStyleTextPropAtom },
+ { "SUBCONTAINERCOMPLETED", 1, 0 /* &Powerpoint::opSubContainerCompleted */ },
+ { "SUBCONTAINEREXCEPTION", 4, 0 /* &Powerpoint::opSubContainerException */ },
+ { "SUMMARY", 1026, 0 /* &Powerpoint::opSummary */ },
+ { "TEXTBOOKMARKATOM", 4007, 0 /* &Powerpoint::opTextBookmarkAtom */ },
+ { "TEXTBYTESATOM", 4008, &Powerpoint::opTextBytesAtom },
+ { "TEXTCHARSATOM", 4000, &Powerpoint::opTextCharsAtom },
+ { "TEXTHEADERATOM", 3999, &Powerpoint::opTextHeaderAtom },
+ { "TEXTRULERATOM", 4006, 0 /* &Powerpoint::opTextRulerAtom */ },
+ { "TEXTSPECINFOATOM", 4010, &Powerpoint::opTextSpecInfoAtom },
+ { "TEXTURE", 1027, 0 /* &Powerpoint::opTexture */ },
+ { "TXCFSTYLEATOM", 4004, 0 /* &Powerpoint::opTxCFStyleAtom */ },
+ { "TXINTERACTIVEINFOATOM", 4063, 0 /* &Powerpoint::opTxInteractiveInfoAtom */ },
+ { "TXMASTERSTYLEATOM", 4003, &Powerpoint::opTxMasterStyleAtom },
+ { "TXPFSTYLEATOM", 4005, 0 /* &Powerpoint::opTxPFStyleAtom */ },
+ { "TXSISTYLEATOM", 4009, &Powerpoint::opTxSIStyleAtom },
+ { "TYPEFACE", 4025, 0 /* &Powerpoint::opTypeFace */ },
+ { "USEREDITATOM", 4085, &Powerpoint::opUserEditAtom },
+ { "VBAINFO", 1023, &Powerpoint::opVBAInfo },
+ { "VBAINFOATOM", 1024, 0 /* &Powerpoint::opVBAInfoAtom */ },
+ { "VBASLIDEINFO", 1028, 0 /* &Powerpoint::opVBASlideInfo */ },
+ { "VBASLIDEINFOATOM", 1029, 0 /* &Powerpoint::opVBASlideInfoAtom */ },
+ { "VIEWINFO", 1020, 0 /* &Powerpoint::opViewInfo */ },
+ { "VIEWINFOATOM", 1021, 0 /* &Powerpoint::opViewInfoAtom */ },
+ { NULL, 0, 0 },
+ { "MSOD", 0, &Powerpoint::opMsod }
+ };
+ unsigned i;
+ method result;
+
+ // Scan lookup table for operation.
+
+ for (i = 0; funcTab[i].name; i++)
+ {
+ if (funcTab[i].opcode == op.type)
+ {
+ break;
+ }
+ }
+
+ // Invoke handler.
+
+ result = funcTab[i].handler;
+ if (!result && (op.type >= 0xF000) && (0xFFFF >= op.type))
+ result = funcTab[++i].handler;
+ if (!result)
+ {
+ if (funcTab[i].name)
+ kdWarning(s_area) << "invokeHandler: unsupported opcode: " <<
+ funcTab[i].name <<
+ " operands: " << bytes << endl;
+ else
+ kdWarning(s_area) << "invokeHandler: unsupported opcode: " <<
+ op.type <<
+ " operands: " << bytes << endl;
+
+ // Skip data we cannot use.
+ skip(bytes, operands);
+ }
+ else
+ {
+ kdDebug(s_area) << "invokeHandler: opcode: " << funcTab[i].name <<
+ " operands: " << bytes << endl;
+
+ // We don't invoke the handler directly on the incoming operands, but
+ // via a temporary datastream. This adds overhead, but eliminates the
+ // need for the individual handlers to read *exactly* the right amount
+ // of data (thus speeding development, and possibly adding some
+ // future-proofing).
+
+ if (bytes)
+ {
+ QByteArray *record = new QByteArray(bytes);
+ QDataStream *body;
+
+ operands.readRawBytes(record->data(), bytes);
+ body = new QDataStream(*record, IO_ReadOnly);
+ body->setByteOrder(QDataStream::LittleEndian);
+ (this->*result)(op, bytes, *body);
+ delete body;
+ delete record;
+ }
+ else
+ {
+ QDataStream *body = new QDataStream();
+
+ (this->*result)(op, bytes, *body);
+ delete body;
+ }
+ }
+}
+
+bool Powerpoint::parse(
+ myFile &mainStream,
+ myFile &currentUser,
+ myFile &pictures)
+{
+ unsigned i;
+
+ m_mainStream = mainStream;
+ m_pictures = pictures;
+ m_documentRef = 0;
+ m_documentRefFound = false;
+ m_persistentReferences.clear();
+ m_slideList.clear();
+ m_editDepth = 0;
+
+ // Find the slide references.
+
+ m_pass = PASS_GET_SLIDE_REFERENCES;
+ kdError(s_area) << "parseing step 1 walkRecord..." << endl;
+ walkRecord(currentUser.length, currentUser.data);//get curren user information
+
+ kdError(s_area) << "parseing step 2 walkReference..." << endl;
+ //for(i = 0; i <= 2; i++)//walk the 2 slide atoms
+ //{
+ // kdError(s_area) << "ref == :" << i <<endl;
+ //walkReference(i);
+ //}
+ kdError(s_area) << "walking slide list!!!!.." << endl;
+ if(mEditOffset != 0) walk(mEditOffset);
+ else walkDocument();
+ // We should have a complete list of slide persistent references.
+ m_pass = PASS_GET_SLIDE_CONTENTS;
+ kdError(s_area) << "TOTAL SLIDES XXxx: " << m_slideList.count() << endl;
+
+ for (i = 0; i < m_slideList.count(); i++)
+ {
+ m_pptSlide = m_slideList.at(i);
+ walkReference(i);
+ gotSlide(*m_pptSlide);
+ }
+
+ return true;
+}
+
+void Powerpoint::opColorSchemeAtom(
+ Header & /* op */,
+ Q_UINT32,
+ QDataStream &operands)
+{
+ struct
+ {
+ Q_UINT32 background;
+ Q_UINT32 textAndLines;
+ Q_UINT32 shadows;
+ Q_UINT32 titleText;
+ Q_UINT32 fills;
+ Q_UINT32 accent;
+ Q_UINT32 accentAndHyperlink;
+ Q_UINT32 accentAndFollowedHyperlink;
+ } data;
+
+ operands >> data.background >> data.textAndLines >> data.shadows >>
+ data.titleText >> data.fills >> data.accent >> data.accentAndHyperlink >>
+ data.accentAndFollowedHyperlink;
+}
+
+//
+// A Unicode String.
+//
+void Powerpoint::opCString(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ QString value;
+ unsigned i;
+
+ for (i = 0; i < bytes / 2; i++)
+ {
+ Q_UINT16 tmp;
+
+ operands >> tmp;
+ value += tmp;
+ }
+ kdDebug(s_area) << "value: " << value << endl;
+}
+
+void Powerpoint::opCurrentUserAtom(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &operands)
+{
+
+ const Q_UINT32 MAGIC_NUMBER = (Q_UINT32)(-476987297);
+ //unsigned i;
+
+ operands >> mCurrentUserAtom.size >> mCurrentUserAtom.magic >> mCurrentUserAtom.offsetToCurrentEdit >>
+ mCurrentUserAtom.lenUserName >> mCurrentUserAtom.docFileVersion >> mCurrentUserAtom.majorVersion >>
+ mCurrentUserAtom.minorVersion;
+
+ kdDebug(s_area) << "\nPSR_CurrentUserAtom:" <<
+ "\n\tsize: " << mCurrentUserAtom.size <<
+ "\n\tmagic: " << mCurrentUserAtom.magic <<
+ "\n\toffsetToCurrentEdit: " << mCurrentUserAtom.offsetToCurrentEdit <<
+ "\n\tlenUserName: " << mCurrentUserAtom.lenUserName <<
+ "\n\tdocFileVersion: " << mCurrentUserAtom.docFileVersion <<
+ "\n\tmajorVersion: " << mCurrentUserAtom.majorVersion <<
+ "\n\tminorVersion: " << mCurrentUserAtom.minorVersion << endl;
+
+ switch (m_pass)
+ {
+ case PASS_GET_SLIDE_REFERENCES:
+ if (mCurrentUserAtom.size != 20)
+ {
+ kdError(s_area) << "invalid size: " << mCurrentUserAtom.size << endl;
+ }
+ if (mCurrentUserAtom.magic != MAGIC_NUMBER)
+ {
+ kdError(s_area) << "invalid magic number: " << mCurrentUserAtom.magic << endl;
+ }
+ if ((mCurrentUserAtom.docFileVersion != 1012) ||
+ (mCurrentUserAtom.majorVersion != 3) ||
+ (mCurrentUserAtom.minorVersion != 0))// ||
+ // (data.release < 8) ||
+ // (data.release > 10))
+ {
+ kdError(s_area) << "invalid version: " << mCurrentUserAtom.docFileVersion <<
+ "." << mCurrentUserAtom.majorVersion <<
+ "." << mCurrentUserAtom.minorVersion <<
+ endl;
+ //"." << data.release << endl;
+ }
+
+ // Now walk main stream starting at current edit point.
+
+ walkRecord(mCurrentUserAtom.offsetToCurrentEdit);
+ break;
+ case PASS_GET_SLIDE_CONTENTS:
+ break;
+ };
+}
+
+void Powerpoint::opDocument(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+void Powerpoint::opDocumentAtom(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &/*operands*/)
+{
+}
+
+void Powerpoint::opEndDocument(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+void Powerpoint::opEnvironment(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+//
+// Contains an ExEmbedAtom and 3 CStrings (the menu name, the program id which
+// unqiuely identifies the type of object, and the "paste special" name).
+//
+void Powerpoint::opExEmbed(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+//
+// Information about an embedded object.
+//
+void Powerpoint::opExEmbedAtom(
+ Header & /* op */,
+ Q_UINT32,
+ QDataStream &operands)
+{
+ struct
+ {
+ Q_INT32 followColorScheme;
+ Q_UINT8 cantLockServerB;
+ Q_UINT8 noSizeToServerB;
+ Q_UINT8 isTable;
+ } data;
+
+ operands >> data.followColorScheme;
+ operands >> data.cantLockServerB;
+ operands >> data.noSizeToServerB;
+ operands >> data.isTable;
+}
+
+void Powerpoint::opFontCollection(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+void Powerpoint::opFontEntityAtom(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &/*operands*/)
+{
+}
+
+void Powerpoint::opHeadersFooters(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+void Powerpoint::opHeadersFootersAtom(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &/*operands*/)
+{
+}
+
+void Powerpoint::opList(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+void Powerpoint::opMainMaster(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+void Powerpoint::opMsod(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ char *data;
+
+ switch (m_pass)
+ {
+ case PASS_GET_SLIDE_REFERENCES:
+ break;
+ case PASS_GET_SLIDE_CONTENTS:
+ data = new char[bytes];
+ operands.readRawBytes((char *)data, bytes);
+kdError() <<" drgid: "<< m_pptSlide->getPsrReference() << endl;
+ gotDrawing(m_pptSlide->getPsrReference(), "msod", bytes, data);
+ delete [] data;
+ break;
+ };
+}
+
+void Powerpoint::opNotes(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+void Powerpoint::opNotesAtom(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &operands)
+{
+ struct
+ {
+ Q_INT32 slideId; // Id for the corresponding slide.
+ Q_UINT16 flags;
+ } data;
+
+ operands >> data.slideId >> data.flags;
+}
+
+//
+// Contains an ExObjListAtom and a list of all objects in a document.
+//
+void Powerpoint::opExObjList(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+//
+// Get the next unique identifier for OLE objects.
+//
+void Powerpoint::opExObjListAtom(
+ Header & /* op */,
+ Q_UINT32,
+ QDataStream &operands)
+{
+ Q_UINT32 objectSeedId;
+
+ operands >> objectSeedId;
+ kdDebug(s_area) << "next OLE obj id: " << objectSeedId << endl;
+}
+
+void Powerpoint::opExObjRefAtom(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &/*operands*/)
+{
+}
+
+void Powerpoint::opExOleObj(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &/*operands*/)
+{
+}
+
+void Powerpoint::opExOleObjAtom(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &operands)
+{
+ struct
+ {
+ Q_UINT32 drawAspect;
+ Q_INT32 type;
+ Q_INT32 objID;
+ Q_INT32 subType;
+ Q_INT8 isBlank;
+ } data;
+
+ operands >> data.drawAspect;
+ operands >> data.type;
+ operands >> data.objID;
+ operands >> data.subType;
+ operands >> data.isBlank;
+ kdDebug(s_area) << ((data.type == 0) ? "embedded " : "linked ") <<
+ "OLE obj id: " << data.objID << endl;
+}
+
+void Powerpoint::opExOleObjStg(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &/*operands*/)
+{
+}
+
+void Powerpoint::opOutlineViewInfo(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+void Powerpoint::opPersistPtrIncrementalBlock2(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &/*operands*/)
+{
+ //PSR_UserEditAtom userEdit;
+ //Q_INT16 offsetToEdit = mCurrentUserAtom.offsetToCurrentEdit;
+
+ /* huh?
+ while(0 < offsetToEdit)
+ {
+
+ }*/
+
+// mpLastUserEditAtom;
+
+}
+
+void Powerpoint::opPersistPtrIncrementalBlock(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ struct
+ {
+ union
+ {
+ Q_UINT32 info;
+ struct
+ {
+ Q_UINT32 offsetNumber: 20;
+ Q_UINT32 offsetCount: 12;
+ } fields;
+ } header;
+ Q_UINT32 offset;
+ } data;
+ Q_UINT32 length = 0;
+
+ while (length < bytes)
+ {
+ unsigned i;
+
+ // Walk references numbered between:
+ //
+ // offsetNumber..offsetNumber + offsetCount - 1
+ //
+ operands >> data.header.info;
+ length += sizeof(data.header.info);
+ kdDebug(s_area) << "length1: " << length << endl;
+ kdDebug(s_area) << "m_pass: " << m_pass << endl;
+ //kdDebug(s_area) << "PASS_GET_SLIDE_REFERENCES: " << PASS_GET_SLIDE_REFERENCES << endl;
+ kdDebug(s_area) << "data.header.fields.offsetCount: " << data.header.fields.offsetCount << endl;
+
+ for (i = 0; i < data.header.fields.offsetCount; i++)
+ {
+ unsigned reference = data.header.fields.offsetNumber + i;
+
+ operands >> data.offset;
+ length += sizeof(data.offset);
+ //kdDebug(s_area) << "length2: " << length << endl;
+ switch (m_pass)
+ {
+ case PASS_GET_SLIDE_REFERENCES:
+
+ // Create a record of this persistent reference.
+
+ if (m_persistentReferences.end() == m_persistentReferences.find(reference))
+ {
+ if(reference < 5)
+ {
+ kdDebug(s_area) << "persistent reference: " << reference <<
+ ": " << data.offset << endl;
+ }
+ m_persistentReferences.insert(reference, data.offset);
+ }
+ else
+ {
+ // This reference has already been seen! Since the parse proceeds
+ // backwards in time form the most recent edit, I assume this means
+ // that this is an older version of this slide...so just ignore it.
+ // kdDebug(s_area) << "superseded reference: " << reference <<
+ // ": " << data.offset << endl;
+ }
+ break;
+ case PASS_GET_SLIDE_CONTENTS:
+ break;
+ };
+ }
+ kdDebug(s_area) << "LEAVING persistant block -- " << endl;
+ }
+
+}
+
+void Powerpoint::opPPDrawing(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+void Powerpoint::opPPDrawingGroup(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+void Powerpoint::opSlide(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+void Powerpoint::opSlideAtom(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &operands)
+{
+ struct
+ {
+ Q_UINT8 layout[12]; // Slide layout descriptor.
+ Q_INT32 masterId; // Id of the master of the slide. Zero for a master slide.
+ Q_INT32 notesId; // Id for the corresponding notes slide. Zero if slide has no notes.
+ Q_UINT16 flags;
+ } data;
+
+ Header tmp;
+ tmp.type = 1015;
+ tmp.length = sizeof(data.layout);
+ invokeHandler(tmp, tmp.length, operands);
+ operands >> data.masterId >> data.notesId >> data.flags;
+
+ kdDebug(s_area) << "\nSlideAtom:" <<
+ "\n\tmasterId: " << data.masterId <<
+ "\n\tnotesId: " << data.notesId <<
+ "\n\tflags: " << data.flags << endl;
+
+ //invokeHandler(tmp, tmp.length, operands);
+
+}
+
+void Powerpoint::opSlideListWithText(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+void Powerpoint::opSlidePersistAtom(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &operands)
+{
+ struct
+ {
+ Q_UINT32 psrReference; // Logical reference to the slide persist object.
+ Q_UINT32 flags; // If bit 3 set then slide contains shapes other than placeholders.
+ Q_INT32 numberTexts; // Number of placeholder texts stored with the persist object.
+ Q_INT32 slideId; // Unique slide identifier, used for OLE link monikers for example.
+ Q_UINT32 reserved;
+ } data;
+
+ operands >> data.psrReference >> data.flags >> data.numberTexts >>
+ data.slideId >> data.reserved;
+
+ kdDebug(s_area) << "\nopSlidePersistAtom: " <<
+ "\n\tpsrReference: " << data.psrReference <<
+ "\n\tflags: " << data.flags <<
+ "\n\tnumberTexts: " << data.numberTexts <<
+ "\n\tslideId: " << data.slideId <<
+ "\n\treserved: " << data.reserved << endl;
+
+ switch (m_pass)
+ {
+ case PASS_GET_SLIDE_REFERENCES:
+ if(data.slideId > 0)//if not master slide.. is there another way to tell???
+ {
+ m_pptSlide = new PptSlide;
+ m_pptSlide->setPsrReference(data.psrReference);
+ m_slideList.append(m_pptSlide);
+
+ kdDebug(s_area) << "XXXXXXXXXslide: " << data.psrReference <<
+ " has texts: " << data.numberTexts << endl;
+ }
+ break;
+ case PASS_GET_SLIDE_CONTENTS:
+ break;
+ };
+}
+
+void Powerpoint::opSlideViewInfo(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+void Powerpoint::opSrKinsoku(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+void Powerpoint::opSSDocInfoAtom(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &/*operands*/)
+{
+}
+
+void Powerpoint::opSSSlideLayoutAtom(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &operands)
+{
+
+ PSR_SSlideLayoutAtom data;
+ unsigned i;
+
+ operands >> data.geom;
+ for (i = 0; i < sizeof(data.placeholderId); i++)
+ {
+ operands >> data.placeholderId[i];
+ }
+
+ kdDebug(s_area) << "\nPSR_SSlideLayoutAtom:" <<
+ "\n\tgeom: " << data.geom <<
+ "\n\tplaceholderId[0]: " << data.placeholderId[0] <<
+ "\n\tplaceholderId[1]: " << data.placeholderId[1] <<
+ "\n\tplaceholderId[2]: " << data.placeholderId[2] <<
+ "\n\tplaceholderId[3]: " << data.placeholderId[3] <<
+ "\n\tplaceholderId[4]: " << data.placeholderId[4] <<
+ "\n\tplaceholderId[5]: " << data.placeholderId[5] <<
+ "\n\tplaceholderId[6]: " << data.placeholderId[6] <<
+ "\n\tplaceholderId[7]: " << data.placeholderId[7] << endl;
+
+}
+//this is where we set bold/italic/etc and paragraph styles
+void Powerpoint::opStyleTextPropAtom(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+
+ Q_UINT16 totalLength = 0;
+ Q_UINT16 length = 0;
+ Q_UINT32 style1 = 0;
+ Q_UINT32 style2 = 0;
+ Q_UINT16 style3 = 0;
+ Q_UINT32 BOLD = 0x00010000;
+ Q_UINT32 ITALIC = 0x00020000;
+ Q_UINT32 UNDERLINE = 0x00040000;
+
+ //--get the paragraph style?
+ operands >> length >> style1 >> style2;
+ totalLength += 10;
+
+ kdDebug(s_area) << "\nopStyleTextPropAtom1:" <<
+ "\n\tlength: " << length <<
+ "\n\tstyle1: " << style1 <<
+ "\n\tstyle2: " << style2 << endl;
+ //--
+
+ //--get the char styles
+ while(bytes > totalLength)
+ {
+ length = 0;
+ style1 = 0;
+ style2 = 0;
+ style3 = 0;
+
+ operands >> length >> style1;
+ totalLength += 6;
+ if(style1 == 0)
+ {
+ operands >> style3;
+ totalLength += 2;
+ }
+ else
+ {
+ operands >> style2;
+ totalLength += 4;
+ }
+
+ kdDebug(s_area) << "\nopStyleTextPropAtom2:" <<
+ "\n\tlength: " << length <<
+ "\n\tstyle1: " << style1 <<
+ "\n\tstyle2: " << style2 <<
+ "\n\tstyle3: " << style3 << endl;
+ if(style1 & BOLD)
+ kdDebug(s_area) << "BOLD here" << endl;
+ if(style1 & ITALIC)
+ kdDebug(s_area) << "ITALIC here" << endl;
+ if(style1 & UNDERLINE)
+ kdDebug(s_area) << "UNDERLINE here" << endl;
+ }
+ //--
+}
+
+void Powerpoint::opTextBytesAtom(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ QString data;
+ unsigned i;
+
+ for (i = 0; i < bytes; i++)
+ {
+ Q_UINT8 tmp;
+
+ operands >> tmp;
+ data += tmp;
+ }
+ kdDebug(s_area) << "\nopTextBytesAtom: " <<
+ "\n\tdata: " << data << endl;
+
+ //SlideText *text;
+ switch (m_pass)
+ {
+ case PASS_GET_SLIDE_REFERENCES:
+ //text = new SlideText;
+ //text->type = m_textType;
+ //text->data = data;
+ //m_slide->text.append(text);
+ if(m_pptSlide)
+ {
+ m_pptSlide->addText(data, m_textType);
+ kdDebug(s_area) << "Text Added: " << data << " type: " << m_textType << endl;
+ }
+ else
+ kdDebug(s_area) << "WEVE GOTS US AN ERROR!!!" << endl;
+
+ break;
+ case PASS_GET_SLIDE_CONTENTS:
+ break;
+ };
+}
+
+void Powerpoint::opTextCharsAtom(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ QString data;
+ unsigned i;
+
+ for (i = 0; i < bytes / 2; i++)
+ {
+ Q_UINT16 tmp;
+
+ operands >> tmp;
+ data += tmp;
+ }
+
+ //SlideText *text;
+ switch (m_pass)
+ {
+ case PASS_GET_SLIDE_REFERENCES:
+ //text = new SlideText;
+ //text->type = m_textType;
+ //text->data = data;
+ //m_slide->text.append(text);
+ if(m_pptSlide)
+ {
+ m_pptSlide->addText(data, m_textType);
+ kdDebug(s_area) << "Text Added: " << data << " type: " << m_textType << endl;
+ }
+ else
+ kdDebug(s_area) << "WEVE GOTS US AN ERROR!!!" << endl;
+
+ break;
+ case PASS_GET_SLIDE_CONTENTS:
+ break;
+ };
+}
+
+void Powerpoint::opTextHeaderAtom(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &operands)
+{
+ struct
+ {
+ Q_UINT32 txType; // Type of text:
+ //
+ // 0 Title
+ // 1 Body
+ // 2 Notes
+ // 3 Not Used
+ // 4 Other (Text in a shape)
+ // 5 Center body (subtitle in title slide)
+ // 6 Center title (title in title slide)
+ // 7 Half body (body in two-column slide)
+ // 8 Quarter body (body in four-body slide)
+ } data;
+
+ operands >> data.txType;
+
+ kdDebug(s_area) << "\nopTextHeaderAtom:" <<
+ "\n\ttxType: " << data.txType << endl;
+
+ switch (m_pass)
+ {
+ case PASS_GET_SLIDE_REFERENCES:
+ m_textType = data.txType;
+ break;
+ case PASS_GET_SLIDE_CONTENTS:
+ break;
+ };
+}
+
+void Powerpoint::opTextSpecInfoAtom(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &/*operands*/)
+{
+}
+
+void Powerpoint::opTxMasterStyleAtom(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &/*operands*/)
+{
+}
+
+void Powerpoint::opTxSIStyleAtom(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &/*operands*/)
+{
+}
+
+//
+// This routine is where the parse actually gets going. It should be the first
+// structure encoutered in the main OLE stream.
+//
+void Powerpoint::opUserEditAtom(
+ Header & /* op */,
+ Q_UINT32 /*bytes*/,
+ QDataStream &operands)
+{
+
+ operands >> mUserEditAtom.lastSlideID >> mUserEditAtom.version >> mUserEditAtom.offsetLastEdit >>
+ mUserEditAtom.offsetPersistDirectory >> mUserEditAtom.documentRef >>
+ mUserEditAtom.maxPersistWritten >> mUserEditAtom.lastViewType;
+
+ if(mEditOffset == 0)mEditOffset = mUserEditAtom.offsetLastEdit;
+
+ kdDebug(s_area) << "\nPSR_UserEditAtom:" <<
+ "\n\tlastSlideID: " << mUserEditAtom.lastSlideID <<
+ "\n\tversion: " << mUserEditAtom.version <<
+ "\n\toffsetLastEdit: " << mUserEditAtom.offsetLastEdit <<
+ "\n\toffsetPersistDirectory: " << mUserEditAtom.offsetPersistDirectory <<
+ "\n\tdocumentRef: " << mUserEditAtom.documentRef <<
+ "\n\tmaxPersistWritten: " << mUserEditAtom.maxPersistWritten <<
+ "\n\tlastViewType: " << mUserEditAtom.lastViewType << endl;
+
+ if (!m_documentRefFound)
+ {
+ m_documentRef = mUserEditAtom.documentRef;
+ m_documentRefFound = true;
+ }
+ switch (m_pass)
+ {
+ case PASS_GET_SLIDE_REFERENCES:
+
+ // Gather the persistent references. That should fill the list of
+ // references which we then use to look up our document.
+
+ walkRecord(mUserEditAtom.offsetPersistDirectory);
+
+ // Now recursively walk the main OLE stream parsing previous edits.
+
+ if (mUserEditAtom.offsetLastEdit)
+ {
+ m_editDepth++;
+ walkRecord(mUserEditAtom.offsetLastEdit);
+ m_editDepth--;
+ }
+ break;
+ case PASS_GET_SLIDE_CONTENTS:
+ break;
+ };
+}
+
+void Powerpoint::opVBAInfo(
+ Header & /* op */,
+ Q_UINT32 bytes,
+ QDataStream &operands)
+{
+ walk(bytes, operands);
+}
+
+void Powerpoint::skip(Q_UINT32 bytes, QDataStream &operands)
+{
+ if ((int)bytes < 0)
+ {
+ kdError(s_area) << "skip: " << (int)bytes << endl;
+ return;
+ }
+ if (bytes)
+ {
+ Q_UINT32 i;
+ Q_UINT8 discard;
+
+ kdDebug(s_area) << "skip: " << bytes << endl;
+ for (i = 0; i < bytes; i++)
+ {
+ operands >> discard;
+ }
+ }
+}
+
+//
+// Handle a container record.
+//
+void Powerpoint::walk(Q_UINT32 bytes, QDataStream &operands)
+{
+ Header op;
+ Q_UINT32 length = 0;
+
+ // Stop parsing when there are no more records. Note that we stop as soon
+ // as we cannot get a complete header.
+ while (length + 8 <= bytes)
+ {
+ operands >> op.opcode.info >> op.type >> op.length;
+
+ // If we get some duff data, protect ourselves.
+ if (length + op.length + 8 > bytes)
+ {
+ op.length = bytes - length - 8;
+ }
+ length += op.length + 8;
+
+ // Package the arguments...
+
+ invokeHandler(op, op.length, operands);
+ }
+
+ // Eat unexpected data that the caller may expect us to consume.
+ skip(bytes - length, operands);
+}
+
+void Powerpoint::walk(Q_UINT32 mainStreamOffset)
+{
+ Q_UINT32 length = m_mainStream.length - mainStreamOffset;
+ QByteArray a;
+
+ a.setRawData((const char *)m_mainStream.data + mainStreamOffset, length);
+ QDataStream stream(a, IO_ReadOnly);
+ stream.setByteOrder(QDataStream::LittleEndian);
+ walk(length, stream);
+ a.resetRawData((const char *)m_mainStream.data + mainStreamOffset, length);
+}
+void Powerpoint::walkDocument()
+{
+ QByteArray a;
+ Q_UINT32 mainStreamOffset = 0;
+ Q_UINT32 bytes = m_mainStream.length - mainStreamOffset;
+
+ a.setRawData((const char *)m_mainStream.data + mainStreamOffset, bytes);
+ QDataStream stream(a, IO_ReadOnly);
+ stream.setByteOrder(QDataStream::LittleEndian);
+ //--get tho the slide list
+ Header op;
+ Q_UINT32 length = 0;
+
+ // Stop parsing when there are no more records. Note that we stop as soon
+ // as we cannot get a complete header.
+ while (length + 8 <= bytes && op.type != 1000)//document
+ {
+ stream >> op.opcode.info >> op.type >> op.length;
+
+ // If we get some duff data, protect ourselves.
+ if (length + op.length + 8 > bytes)
+ {
+ op.length = bytes - length - 8;
+ }
+ length += op.length + 8;
+ }
+
+ //--
+ invokeHandler(op, op.length, stream);
+ a.resetRawData((const char *)m_mainStream.data + mainStreamOffset, bytes);
+
+}
+
+void Powerpoint::walkRecord(Q_UINT32 bytes, const unsigned char *operands)
+{
+ // First read what should be the next header using one stream.
+
+ kdError(s_area) << "WalkRecord - bytes: " << bytes << endl;
+
+ Q_UINT32 length = sizeof(Header);
+ QByteArray a;
+ Header op;
+
+ a.setRawData((const char *)operands, bytes);
+ QDataStream stream1(a, IO_ReadOnly);
+ stream1.setByteOrder(QDataStream::LittleEndian);
+ stream1 >> op.opcode.info >> op.type >> op.length;
+ a.resetRawData((const char *)operands, bytes);
+
+ // Armed with the length, parse in the usual way using a second stream.
+
+ length += op.length;
+ a.setRawData((const char *)operands, length);
+ QDataStream stream2(a, IO_ReadOnly);
+ stream2.setByteOrder(QDataStream::LittleEndian);
+ walk(length, stream2);
+ a.resetRawData((const char *)operands, length);
+}
+
+void Powerpoint::walkRecord(Q_UINT32 mainStreamOffset)
+{
+ walkRecord(sizeof(Header), m_mainStream.data + mainStreamOffset);
+}
+
+void Powerpoint::walkReference(Q_UINT32 reference)
+{
+ if (m_persistentReferences.end() == m_persistentReferences.find(reference))
+ {
+ kdError(s_area) << "cannot find reference: " << reference << endl;
+ }
+ else
+ {
+ unsigned offset = m_persistentReferences[reference];
+ kdDebug(s_area) << "found reference: " << reference <<
+ " offset: " << offset << endl;
+ walkRecord(offset);
+ kdDebug(s_area) << "****************************" << endl;
+
+ }
+}
diff --git a/filters/olefilters/powerpoint97/powerpoint.h b/filters/olefilters/powerpoint97/powerpoint.h
new file mode 100644
index 00000000..5c7a9195
--- /dev/null
+++ b/filters/olefilters/powerpoint97/powerpoint.h
@@ -0,0 +1,355 @@
+/*
+ Copyright (C) 2000, S.R.Haque <[email protected]>.
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+DESCRIPTION
+
+ This is a generic parser for Microsoft Powerpoint documents. The output is
+ a series of callbacks (a.k.a. virtual functions) which the caller can
+ override as required.
+*/
+
+#ifndef POWERPOINT_H
+#define POWERPOINT_H
+
+
+#include <myfile.h>
+#include <qdatastream.h>
+#include <qptrlist.h>
+#include <qmap.h>
+#include <pptSlide.h>
+
+typedef Q_INT32 sint4; // signed 4-byte integral value
+typedef Q_INT16 sint2; // signed 4-byte integral value
+typedef Q_UINT32 uint4; // unsigned 4-byte integral value
+typedef Q_UINT16 uint2; // 2-byte
+typedef Q_INT8 bool1; // 1-byte boolean
+typedef Q_UINT8 ubyte1; // unsigned byte value
+typedef uint2 psrType;
+typedef uint4 psrSize; // each record is preceded by
+// pssTypeType and pssSizeType.
+typedef uint2 psrInstance;
+typedef uint2 psrVersion;
+typedef uint4 psrReference; // Saved object reference
+//typedef QList<PptSlide> PptSlideList;
+
+class Powerpoint
+{
+public:
+
+ // Construction.
+
+ Powerpoint();
+ virtual ~Powerpoint();
+
+ // Called to parse the given file.
+
+ bool parse(
+ myFile &mainStream,
+ myFile &currentUser,
+ myFile &pictures);
+
+ typedef struct
+ {
+ unsigned type;
+ QString data;
+ } SlideText;
+
+ typedef struct
+ {
+ unsigned persistentReference;
+ QPtrList<SlideText> text;
+ } Slide;
+
+protected:
+
+ virtual void gotDrawing(
+ unsigned id,
+ QString type,
+ unsigned length,
+ const char *data) = 0;
+ virtual void gotSlide(
+ PptSlide &slide) = 0;
+
+private:
+ Powerpoint(const Powerpoint &);
+ const Powerpoint &operator=(const Powerpoint &);
+
+ // Debug support.
+
+public:
+ static const int s_area;
+
+private:
+ myFile m_mainStream;
+ myFile m_pictures;
+ unsigned m_documentRef;
+ bool m_documentRefFound;
+ QMap<unsigned, unsigned> m_persistentReferences;
+ unsigned m_editDepth;
+ enum
+ {
+ PASS_GET_SLIDE_REFERENCES,
+ PASS_GET_SLIDE_CONTENTS
+ } m_pass;
+ unsigned m_textType;
+
+ QPtrList<PptSlide> m_slideList;
+ PptSlide* m_pptSlide;
+
+struct PSR_CurrentUserAtom
+{
+ uint4 size;
+ uint4 magic; // Magic number to ensure this is a PowerPoint file.
+ uint4 offsetToCurrentEdit; // Offset in main stream to current edit field.
+ uint2 lenUserName;
+ uint2 docFileVersion;
+ ubyte1 majorVersion;
+ ubyte1 minorVersion;
+};
+
+struct PSR_UserEditAtom
+{
+ sint4 lastSlideID; // slideID
+ uint4 version; // This is major/minor/build which did the edit
+ uint4 offsetLastEdit; // File offset of last edit
+ uint4 offsetPersistDirectory; // Offset to PersistPtrs for
+ // this file version.
+ uint4 documentRef;
+ uint4 maxPersistWritten; // Addr of last persist ref written to the file (max seen so far).
+ sint2 lastViewType; // enum view type
+};
+
+struct PSR_SSlideLayoutAtom
+{
+ sint4 geom;
+ ubyte1 placeholderId[8];
+};
+
+ PSR_CurrentUserAtom mCurrentUserAtom;
+ PSR_UserEditAtom mUserEditAtom;
+ PSR_UserEditAtom* mpLastUserEditAtom;
+ Q_UINT32 mEditOffset;
+
+ // Common Header.
+
+ typedef struct
+ {
+ union
+ {
+ Q_UINT16 info;
+ struct
+ {
+ Q_UINT16 version: 4;
+ Q_UINT16 instance: 12;
+ } fields;
+ } opcode;
+ Q_UINT16 type;
+ Q_UINT32 length;
+ } Header;
+
+ // Opcode handling and painter methods.
+
+ void walk(
+ Q_UINT32 bytes,
+ QDataStream &operands);
+ void walk(
+ Q_UINT32 mainStreamOffset);
+ void walkRecord(
+ Q_UINT32 bytes,
+ const unsigned char *operands);
+ void walkRecord(
+ Q_UINT32 mainStreamOffset);
+ void walkReference(
+ Q_UINT32 reference);
+ void skip(
+ Q_UINT32 bytes,
+ QDataStream &operands);
+ void invokeHandler(
+ Header &op,
+ Q_UINT32 bytes,
+ QDataStream &operands);
+ void walkDocument();
+
+ void opAnimationInfo(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opAnimationInfoAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opArrayElementAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opBaseTextPropAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opBinaryTagData(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opBookmarkCollection(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opBookmarkEntityAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opBookmarkSeedAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opCharFormatAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opClientSignal1(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opClientSignal2(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opColorSchemeAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opCorePict(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opCorePictAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opCString(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opCurrentUserAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opDateTimeMCAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opDefaultRulerAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opDocRoutingSlip(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opDocument(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opDocumentAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opDocViewInfo(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opEmFormatAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opEndDocument(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opEnvironment(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExAviMovie(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExCDAudio(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExCDAudioAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExControl(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExControlAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExEmbed(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExEmbedAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExHyperlink(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExHyperlinkAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExLink(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExLinkAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExLinkAtom_old(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExMCIMovie(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExMediaAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExMIDIAudio(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExObjList(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExObjListAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExObjRefAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExOleObj(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExOleObjAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExOleObjStg(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExPlain(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExPlainAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExPlainLink(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExPlainLinkAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExQuickTime(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExQuickTimeMovie(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExQuickTimeMovieData(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExSubscription(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExSubscriptionSection(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExternalObject(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExVideo(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExWAVAudioEmbedded(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExWAVAudioEmbeddedAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opExWAVAudioLink(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opFontCollection(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opFontEmbedData(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opFontEntityAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opFooterMCAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opGenericDateMCAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opGlineAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opGLPointAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opGpointAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opGratioAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opGrColor(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opGrColorAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opGrectAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opGscaling(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opGscalingAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opGuideAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opGuideList(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opHandout(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opHeaderMCAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opHeadersFooters(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opHeadersFootersAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opInt4ArrayAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opInteractiveInfo(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opInteractiveInfoAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opIRRAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opList(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opListPlaceholder(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opMainMaster(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opMasterText(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opMetaFile(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opMsod(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opNamedShow(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opNamedShows(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opNamedShowSlides(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opNotes(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opNotesAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opOEPlaceholderAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opOEShape(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opOEShapeAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opOutlineTextRefAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opOutlineViewInfo(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opParaFormatAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opPersistPtrFullBlock(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opPersistPtrIncrementalBlock(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opPersistPtrIncrementalBlock2(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opPowerPointStateInfoAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opPPDrawing(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opPPDrawingGroup(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opPrintOptions(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opProgBinaryTag(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opProgStringTag(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opProgTags(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opPSS(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opRecolorEntryAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opRecolorInfoAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opRTFDateTimeMCAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opRulerIndentAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opRunArray(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opRunArrayAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opScheme(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSchemeAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSlide(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSlideAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSlideBase(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSlideBaseAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSlideList(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSlideListWithText(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSlideNumberMCAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSlidePersist(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSlidePersistAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSlideViewInfo(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSlideViewInfoAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSorterViewInfo(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSound(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSoundCollAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSoundCollection(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSoundData(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSrKinsoku(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSrKinsokuAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSSDocInfoAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSSSlideLayoutAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSSSlideInfoAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opStyleTextPropAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSubContainerCompleted(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSubContainerException(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opSummary(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opTextBookmarkAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opTextBytesAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opTextCharsAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opTextHeaderAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opTextRulerAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opTextSpecInfoAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opTexture(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opTxCFStyleAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opTxInteractiveInfoAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opTxMasterStyleAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opTxPFStyleAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opTxSIStyleAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opTypeFace(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opUserEditAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opVBAInfo(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opVBAInfoAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opVBASlideInfo(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opVBASlideInfoAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opViewInfo(Header &op, Q_UINT32 bytes, QDataStream &operands);
+ void opViewInfoAtom(Header &op, Q_UINT32 bytes, QDataStream &operands);
+};
+#endif
diff --git a/filters/olefilters/powerpoint97/powerpointfilter.cc b/filters/olefilters/powerpoint97/powerpointfilter.cc
new file mode 100644
index 00000000..e0ea629a
--- /dev/null
+++ b/filters/olefilters/powerpoint97/powerpointfilter.cc
@@ -0,0 +1,73 @@
+/* This file is part of the KDE project
+ Copyright (C) 1999 Werner Trobin <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <pptxml.h>
+#include <powerpointfilter.h>
+
+PowerPointFilter::PowerPointFilter(
+ const myFile &mainStream,
+ const myFile &currentUser,
+ const myFile &pictures):
+ FilterBase()
+{
+ m_tree = new PptXml(mainStream, currentUser, pictures);
+
+ // Hook up the embedded object support.
+
+ connect(
+ m_tree,
+ SIGNAL(signalPart(const QString&, QString &, QString &)),
+ this,
+ SIGNAL(signalPart(const QString&, QString &, QString &)));
+
+ // Hook up the embedded picture support.
+
+ connect(
+ m_tree,
+ SIGNAL(signalSavePic(const QString &, QString &, const QString &, unsigned int, const char *)),
+ this,
+ SIGNAL(signalSavePic(const QString &, QString &, const QString &, unsigned int, const char *)));
+
+ // Hook up the embedded part support.
+
+ connect(
+ m_tree,
+ SIGNAL(signalSavePart(const QString &, QString &, QString &, const QString &, unsigned int, const char *)),
+ this,
+ SIGNAL(signalSavePart(const QString &, QString &, QString &, const QString &, unsigned int, const char *)));
+}
+
+PowerPointFilter::~PowerPointFilter()
+{
+ delete m_tree;
+}
+
+bool PowerPointFilter::filter()
+{
+ return m_tree->convert();
+}
+
+const QDomDocument * const PowerPointFilter::part()
+{
+ m_part = QDomDocument("DOC");
+ m_part.setContent(m_tree->getXml());
+ return &m_part;
+}
+
+#include <powerpointfilter.moc>
diff --git a/filters/olefilters/powerpoint97/powerpointfilter.h b/filters/olefilters/powerpoint97/powerpointfilter.h
new file mode 100644
index 00000000..173d1ebb
--- /dev/null
+++ b/filters/olefilters/powerpoint97/powerpointfilter.h
@@ -0,0 +1,47 @@
+/* This file is part of the KDE project
+ Copyright (C) 1999 Werner Trobin <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef POWERPOINTFILTER_H
+#define POWERPOINTFILTER_H
+
+#include <filterbase.h>
+#include <pptxml.h>
+
+class PowerPointFilter:
+ public FilterBase
+{
+ Q_OBJECT
+
+public:
+ PowerPointFilter(
+ const myFile &mainStream,
+ const myFile &currentUser,
+ const myFile &pictures);
+ virtual ~PowerPointFilter();
+ virtual bool filter();
+ virtual const QDomDocument * const part();
+
+private:
+ PowerPointFilter(const PowerPointFilter &);
+ const PowerPointFilter &operator=(const PowerPointFilter &);
+
+ PptXml *m_tree;
+};
+#endif
+
diff --git a/filters/olefilters/powerpoint97/pptSlide.cpp b/filters/olefilters/powerpoint97/pptSlide.cpp
new file mode 100644
index 00000000..b86418c9
--- /dev/null
+++ b/filters/olefilters/powerpoint97/pptSlide.cpp
@@ -0,0 +1,111 @@
+/*
+ Copyright (C) 2002, M.Marcucio <[email protected]>.
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+DESCRIPTION
+
+*/
+
+#include <pptSlide.h>
+
+static const int s_area = 30512;
+
+PptSlide::PptSlide()
+{
+ m_slideLayout = 0; //type of slide
+ m_numberOfPholders = 0; //number of placeholder on the slide
+ m_psrReference = 0; //logical reference
+}
+
+//PptSlide::~PptSlide()
+//{
+//}
+
+QStringList PptSlide::getPlaceholderText(void)
+{
+ return m_currentPholder->paragraphs;
+}
+
+//styleRun PptSlide::getPlaceholderStyleRun(void)
+//{
+// return m_currentPholder->styleRun;
+//}
+
+Q_UINT16 PptSlide::getPlaceholderType(void)
+{
+ return m_currentPholder->type;
+}
+
+Q_UINT16 PptSlide::gotoPlaceholder(Q_UINT16 pholderNumber)
+{
+ m_currentPholder = m_placeholderList.at(pholderNumber);
+ return 0;
+}
+
+Q_INT32 PptSlide::getPsrReference(void)
+{
+ return m_psrReference;
+}
+
+void PptSlide::setPsrReference(Q_INT32 psr)
+{
+ m_psrReference = psr;
+}
+
+Q_UINT16 PptSlide::getNumberOfPholders()
+{
+ return m_numberOfPholders;
+}
+
+void PptSlide::addText(QString text, Q_UINT16 type)
+{
+ unsigned j;
+ m_currentPholder = new placeholder;
+ m_placeholderList.append(m_currentPholder);
+ m_numberOfPholders++;
+ m_currentPholder->type = type;
+ kdError(s_area) << "adding to slide now!!!!!!!!!!!! m_numberOfPholders: " << m_numberOfPholders << endl;
+
+ switch (type)
+ {
+ case TITLE_TEXT:
+ case CENTER_TITLE_TEXT:
+ m_currentPholder->paragraphs.append(text);
+ //m_titleText.append("\n");
+ break;
+ case NOTES_TEXT:
+ m_currentPholder->paragraphs.append(text);
+ m_currentPholder->paragraphs.append("\n");
+ //m_notesText.append("\n");
+ break;
+ case BODY_TEXT:
+ case OTHER_TEXT:
+ case CENTER_BODY_TEXT:
+ case HALF_BODY_TEXT:
+ case QUARTER_BODY_TEXT:
+ QStringList data(QStringList::split(QChar('\r'), text, true));
+ for (j = 0; j < data.count(); j++)
+ {
+ m_currentPholder->paragraphs.append(data[j]);
+ //m_body.paragraphs.append(data[j]);
+ }
+ //m_body.type = type;
+ break;
+ }
+}//addtext
+
diff --git a/filters/olefilters/powerpoint97/pptSlide.h b/filters/olefilters/powerpoint97/pptSlide.h
new file mode 100644
index 00000000..16d53f8b
--- /dev/null
+++ b/filters/olefilters/powerpoint97/pptSlide.h
@@ -0,0 +1,93 @@
+/*
+ Copyright (C) 2002, M.Marcucio <[email protected]>.
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+DESCRIPTION
+
+*/
+
+//#ifndef PPTSLIDE_H
+//#define PPTSLIDE_H
+
+#include <kdebug.h>
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qptrlist.h>
+
+//--text types
+#define TITLE_TEXT 0 //title
+#define BODY_TEXT 1 //body
+#define NOTES_TEXT 2 //notes
+#define NOTUSED_TEXT 3 //not used
+#define OTHER_TEXT 4 //other(test in shape)
+#define CENTER_BODY_TEXT 5 //center body(subtitle in title slide)
+#define CENTER_TITLE_TEXT 6 //center title(title in title slide)
+#define HALF_BODY_TEXT 7 //half body(body in two-column slide)
+#define QUARTER_BODY_TEXT 8 //quarter body(body in four-body slide)
+//--
+
+//--char style types
+enum
+{
+ BOLD_STYLE = 1,
+ ITALIC_STYLE = 2,
+ UNDERLINE_STYLE = 3
+};
+//--
+
+class PptSlide
+{
+public:
+ typedef struct
+ {
+ Q_UINT16 style; //the style of the text run
+ Q_UINT16 length; //length of the style run
+ }styleRunType;
+
+ typedef QPtrList<styleRunType> styleRun;
+
+ PptSlide();
+ QStringList getPlaceholderText(void); //gets the list of paragraphs from the placeholder
+ //styleRun getPlaceholderStyleRun(void); //gets the list of placeholder style runs
+ Q_UINT16 getPlaceholderType(void); //gets the type of the placeholder
+ Q_UINT16 gotoPlaceholder(Q_UINT16 pholderNumber); //goto the n'th placeholder
+ Q_UINT16 getNumberOfPholders(); //gets the number of placeholders on slide
+
+ Q_INT32 getPsrReference(void);
+ void setPsrReference(Q_INT32 psr);
+
+ void addText(QString text, Q_UINT16 type); //adds text of the given type
+ void addToStyleRun(Q_UINT16 style, Q_UINT16 length); //adds to the current style run
+
+private:
+ typedef struct
+ {
+ QStringList paragraphs; //text of the placeholder
+ Q_UINT16 type; //what is the text type
+ styleRun style; //char style info
+ }placeholder;
+
+ Q_INT16 m_slideLayout; //type of slide
+ Q_INT16 m_numberOfPholders; //number of placeholder on the slide
+ Q_INT32 m_psrReference; //logical reference
+ QPtrList<placeholder> m_placeholderList; //list of all the placeholders on the slide
+ placeholder* m_currentPholder; //pointer to current placeholder
+
+};
+
+//#endif
diff --git a/filters/olefilters/powerpoint97/pptdoc.cc b/filters/olefilters/powerpoint97/pptdoc.cc
new file mode 100644
index 00000000..0e40293f
--- /dev/null
+++ b/filters/olefilters/powerpoint97/pptdoc.cc
@@ -0,0 +1,87 @@
+/*
+ Copyright (C) 2000, S.R.Haque <[email protected]>.
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+DESCRIPTION
+
+ This file implements a simplified abstraction of Microsoft Powerpoint documents.
+*/
+
+#include <kdebug.h>
+#include <pptdoc.h>
+#include <qptrlist.h>
+
+const int PptDoc::s_area = 30512;
+
+PptDoc::PptDoc(
+ const myFile &mainStream,
+ const myFile &currentUser,
+ const myFile &pictures) :
+ Powerpoint()
+{
+ m_mainStream = mainStream;
+ m_currentUser = currentUser;
+ m_pictures = pictures;
+}
+
+PptDoc::~PptDoc()
+{
+}
+/*
+void PptDoc::gotSlide(
+ PptSlide &slide)
+{
+ Slide ourSlide;
+ unsigned i;
+
+ for (i = 0; i < slide.text.count(); i++)
+ {
+ SlideText *text = slide.text.at(i);
+ QStringList data(QStringList::split(QChar('\r'), text->data, true));
+ unsigned j;
+
+ switch (text->type)
+ {
+ case TITLE_TEXT:
+ case CENTER_TITLE_TEXT:
+ ourSlide.title = data.join("\n");
+ break;
+ case NOTES_TEXT:
+ ourSlide.notes = data.join("\n");
+ break;
+ case BODY_TEXT:
+ case OTHER_TEXT:
+ case CENTER_BODY_TEXT:
+ case HALF_BODY_TEXT:
+ case QUARTER_BODY_TEXT:
+ for (j = 0; j < data.count(); j++)
+ {
+ ourSlide.body.append(data[j]);
+ }
+ break;
+ }
+ }
+
+ gotSlide(slide);
+}
+*/
+
+bool PptDoc::parse()
+{
+ return Powerpoint::parse(m_mainStream, m_currentUser, m_pictures);
+}
diff --git a/filters/olefilters/powerpoint97/pptdoc.h b/filters/olefilters/powerpoint97/pptdoc.h
new file mode 100644
index 00000000..f7008ad9
--- /dev/null
+++ b/filters/olefilters/powerpoint97/pptdoc.h
@@ -0,0 +1,82 @@
+/*
+ Copyright (C) 2000, S.R.Haque <[email protected]>.
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+DESCRIPTION
+
+ This file implements a simplified abstraction of Microsoft Powerpoint documents.
+*/
+
+#ifndef PPTDOC_H
+#define PPTDOC_H
+
+#include <kdebug.h>
+#include <myfile.h>
+#include <powerpoint.h>
+#include <qstring.h>
+#include <qstringlist.h>
+
+class myFile;
+
+class PptDoc:
+ protected Powerpoint
+{
+protected:
+
+ // Construction. Invoke with the OLE streams that comprise the Powerpoint document.
+
+ PptDoc(
+ const myFile &mainStream,
+ const myFile &currentUser,
+ const myFile &pictures);
+ virtual ~PptDoc();
+
+ // Metadata.
+
+ QString getAuthor(void) const;
+
+ // Call the parse() function to process the document. The callbacks return
+ // the text along with any relevant attributes.
+
+ bool parse();
+
+ virtual void gotDrawing(
+ unsigned id,
+ QString type,
+ unsigned length,
+ const char *data) = 0;
+ virtual void gotSlide(PptSlide &slide) = 0;
+
+private:
+ PptDoc(const PptDoc &);
+ const PptDoc &operator=(const PptDoc &);
+
+ // Error handling and reporting support.
+
+ static const int s_area;
+
+ myFile m_mainStream;
+ myFile m_currentUser;
+ myFile m_pictures;
+
+ // Override the base class functions.
+
+ //void gotSlide(
+ // PptSlide &slide);
+};
+#endif
diff --git a/filters/olefilters/powerpoint97/pptxml.cc b/filters/olefilters/powerpoint97/pptxml.cc
new file mode 100644
index 00000000..1202edcc
--- /dev/null
+++ b/filters/olefilters/powerpoint97/pptxml.cc
@@ -0,0 +1,317 @@
+/*
+ Copyright (C) 2000, S.R.Haque <[email protected]>.
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+DESCRIPTION
+*/
+
+#include <pptdoc.h>
+#include <pptxml.h>
+#include <qobject.h>
+#include <KoGlobal.h>
+
+const int PptXml::s_area = 30512;
+
+PptXml::PptXml(
+ const myFile &mainStream,
+ const myFile &currentUser,
+ const myFile &pictures):
+ PptDoc(
+ mainStream,
+ currentUser,
+ pictures)
+{
+ m_isConverted = false;
+ m_success = false;
+ m_half = false;
+ m_y = 0;
+}
+
+PptXml::~PptXml()
+{
+}
+
+bool PptXml::convert()
+{
+ if (!m_isConverted)
+ {
+ // m_y = 30;
+ m_success = parse();
+ m_isConverted = true;
+ }
+ return m_success;
+}
+
+void PptXml::encode(QString &text)
+{
+ // When encoding the stored form of text to its run-time form,
+ // be sure to do the conversion for "&amp;" to "&" first to avoid
+ // accidentally converting user text into one of the other escape
+ // sequences.
+
+ text.replace('&', "&amp;");
+ text.replace('<', "&lt;");
+ text.replace('>', "&gt;"); // Needed to avoid ]]>
+
+ // Strictly, there is no need to encode " or ', but we do so to allow
+ // them to co-exist!
+
+ text.replace('"', "&quot;");
+ text.replace('\'', "&apos;");
+}
+
+const QString PptXml::getXml() const
+{
+ QString body = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE DOC>\n"
+ "<DOC mime=\"application/x-kpresenter\" email=\"[email protected]\" syntaxVersion=\"2\" author=\"Reginald Stadlbauer\" editor=\"Powerpoint import filter\">\n"
+ " <PAPER ptWidth=\"680\" unit=\"0\" format=\"5\" orientation=\"0\" ptHeight=\"510\">\n"
+ " <PAPERBORDERS ptRight=\"0\" ptBottom=\"0\" ptLeft=\"0\" ptTop=\"0\"/>\n"
+ " </PAPER>\n"
+ " <BACKGROUND rastX=\"10\" rastY=\"10\" color=\"#ffffff\">\n";
+ body += m_pages;
+ body += " </BACKGROUND>\n"
+ " <HEADER show=\"0\">\n"
+ " <ORIG x=\"0\" y=\"0\"/>\n"
+ " <SIZE width=\"680\" height=\"20\"/>\n"
+ " <PEN width=\"1\" style=\"0\" color=\"#000000\"/>\n"
+ " <TEXTOBJ>\n"
+ " <P/>\n"
+ " </TEXTOBJ>\n"
+ " </HEADER>\n"
+ " <FOOTER show=\"0\">\n"
+ " <ORIG x=\"0\" y=\"430\"/>\n"
+ " <SIZE width=\"680\" height=\"20\"/>\n"
+ " <PEN width=\"1\" style=\"0\" color=\"#000000\"/>\n"
+ " <TEXTOBJ>\n"
+ " <P/>\n"
+ " </TEXTOBJ>\n"
+ " </FOOTER>\n"
+ " <PAGETITLES>\n";
+ body += m_titles;
+ body += " </PAGETITLES>\n"
+ " <PAGENOTES>\n";
+ body += m_notes;
+ body += " </PAGENOTES>\n"
+ " <OBJECTS>\n";
+ body += m_text;
+ body += " </OBJECTS>\n"
+ " <INFINITLOOP value=\"0\"/>\n"
+ " <MANUALSWITCH value=\"1\"/>\n"
+ " <PRESSPEED value=\"1\"/>\n"
+ " <PRESSLIDES value=\"0\"/>\n"
+ " <SELSLIDES>\n"
+ " <SLIDE nr=\"0\" show=\"1\"/>\n"
+ " </SELSLIDES>\n"
+ " <PIXMAPS>\n"
+ " </PIXMAPS>\n"
+ " <CLIPARTS>\n"
+ " </CLIPARTS>\n";
+ body += m_embedded;
+ body += "</DOC>\n";
+ //kdDebug(s_area) << body << endl;
+ return body;
+}
+
+void PptXml::gotDrawing(
+ unsigned id,
+ QString type,
+ unsigned length,
+ const char *data)
+{
+ QString ourKey;
+ QString uid;
+ QString mimeType;
+ QString filterArgs;
+
+ // Send the picture to the outside world and get back the UID.
+
+ ourKey = "vectorGraphic" + QString::number(id) + "." + type;
+ if (type == "msod")
+ {
+ filterArgs = "shape-id=";
+ filterArgs += QString::number(id);
+ filterArgs += ";delay-stream=";
+ filterArgs += QString::number(0);
+ }
+ emit signalSavePart(
+ ourKey,
+ uid,
+ mimeType,
+ type,
+ length,
+ data);
+
+ // Add an entry to the list of embedded objects too. TBD: fix
+ // RECT and FRAME settings.
+if (mimeType != "application/x-kontour")
+{
+ m_embedded += " <EMBEDDED>\n"
+ "<OBJECT url=\"" +
+ uid +
+ "\" mime=\"" +
+ mimeType +
+ "\">\n<RECT x=\"30\" y=\"190\" w=\"120\" h=\"80\"/>\n"
+ "</OBJECT>\n"
+ "<SETTINGS>\n"
+ "<EFFECTS effect=\"0\" effect2=\"0\"/>\n"
+ "<PEN red=\"0\" green=\"0\" blue=\"0\" width=\"1\" style=\"0\"/>\n"
+ "<BRUSH red=\"0\" green=\"0\" blue=\"0\" style=\"0\"/>\n"
+ "<PRESNUM value=\"0\"/>\n"
+ "<ANGLE value=\"0\"/>\n"
+ "<FILLTYPE value=\"0\"/>\n"
+ "<GRADIENT red1=\"255\" green1=\"0\" blue1=\"0\" red2=\"0\" green2=\"255\" blue2=\"0\" type=\"1\" unbalanced=\"0\" xfactor=\"100\" yfactor=\"100\"/>\n"
+ "<DISAPPEAR effect=\"0\" doit=\"0\" num=\"1\"/>\n"
+ "</SETTINGS>\n"
+ " </EMBEDDED>\n";
+}
+}
+
+void PptXml::gotSlide(PptSlide &slide)
+{
+ static const unsigned pageHeight = 510;
+ Q_UINT16 numbOfPholders = 0;
+ m_pages += " <PAGE/>\n";
+ numbOfPholders = slide.getNumberOfPholders();
+ for(Q_UINT16 i = 0; i < numbOfPholders; i++)
+ {
+ slide.gotoPlaceholder(i);
+ setPlaceholder(slide);
+ }
+ m_y += pageHeight;
+}
+
+void PptXml::setPlaceholder(PptSlide &slide)
+{
+ QString xml_friendly;
+ unsigned i = 0;
+ bool bulletedList = false; //is this a bulleted list?
+ Q_UINT16 type; //type of text
+ QString x; //x of placeholder
+ QString align; //align of text
+ QString height ; //height of placeholder
+ QString width ; //width of placeholder
+ QString pointSize; //font size
+
+ xml_friendly = *slide.getPlaceholderText().at(i);
+ encode(xml_friendly);
+
+ type = slide.getPlaceholderType();
+ Q_UINT16 y = 0;
+
+ switch (type)
+ {
+ case TITLE_TEXT:
+ y = 30;
+ height = QString::number(55);
+ x = QString::number(30);
+ width = QString::number(610);
+ align = QString::number(ALIGN_CENTER);
+ pointSize = QString::number(44);
+ bulletedList = false;
+ m_titles += " <Title title=\"" + xml_friendly + "\" />\n";
+ break;
+ case CENTER_TITLE_TEXT:
+ y = 130;
+ x = QString::number(45);
+ height = QString::number(55);
+ width = QString::number(610);
+ align = QString::number(ALIGN_CENTER);
+ pointSize = QString::number(44);
+ bulletedList = false;
+ m_titles += " <Title title=\"" + xml_friendly + "\" />\n";
+ break;
+ case CENTER_BODY_TEXT:
+ y = 200;
+ x = QString::number(35);
+ height = QString::number(37);
+ width = QString::number(610);
+ align = QString::number(ALIGN_CENTER);
+ pointSize = QString::number(32);
+ bulletedList = false;
+ break;
+ case NOTES_TEXT:
+ m_notes += " <Note note=\"\" />\n";
+ break;
+ case BODY_TEXT:
+ y = 130;
+ x = QString::number(35);
+ height = QString::number(268);
+ width = QString::number(610);
+ align = QString::number(ALIGN_LEFT);
+ pointSize = QString::number(28);
+ bulletedList = true;
+ break;
+ case OTHER_TEXT:
+ case HALF_BODY_TEXT:
+ case QUARTER_BODY_TEXT:
+ y = 130;
+ if(m_half)
+ {
+ x = QString::number(335);
+ width = QString::number(300);
+ m_half = false;
+ }
+ else
+ {
+ x = QString::number(30);
+ width = QString::number(300);
+ m_half = true;
+ }
+ height = QString::number(268);
+ align = QString::number(ALIGN_LEFT);
+ pointSize = QString::number(28);
+ bulletedList = true;
+ break;
+ default:
+ return;
+ break;
+ }
+
+ m_text += "<OBJECT type=\"4\">\n"
+ " <ORIG x=\""+x+"\" y=\""+QString::number(y + m_y)+"\"/>\n"
+ " <SIZE width=\""+width+"\" height=\""+ height +"\"/>\n"
+ " <PEN width=\"1\" style=\"0\" color=\"#000000\"/>\n"
+ " <TEXTOBJ>\n"
+ " <P align=\""+align+"\">\n";
+ if(bulletedList)
+ m_text += " <COUNTER numberingtype=\"0\" type=\"10\" depth=\"0\" />\n";
+ m_text += " <TEXT family=\"utopia\" pointSize=\""+pointSize+"\" color=\"#000000\">";
+
+ for (i = 0; i < slide.getPlaceholderText().count(); i++)
+ {
+ xml_friendly = *slide.getPlaceholderText().at(i);
+ encode(xml_friendly);
+ m_text += xml_friendly;
+ if (i < slide.getPlaceholderText().count() - 1)
+ {
+ m_text += "</TEXT>\n"
+ " </P>\n"
+ " <P align=\"1\">\n";
+ if(bulletedList)
+ m_text += " <COUNTER numberingtype=\"0\" type=\"10\" depth=\"0\" />\n";
+ m_text += " <TEXT family=\"utopia\" pointSize=\""+pointSize+"\" color=\"#000000\">";
+ }
+ }
+ m_text += "</TEXT>\n"
+ " </P>\n"
+ " </TEXTOBJ>\n"
+ "</OBJECT>";
+
+}
+
+#include "pptxml.moc"
diff --git a/filters/olefilters/powerpoint97/pptxml.h b/filters/olefilters/powerpoint97/pptxml.h
new file mode 100644
index 00000000..b57338cb
--- /dev/null
+++ b/filters/olefilters/powerpoint97/pptxml.h
@@ -0,0 +1,109 @@
+/*
+ Copyright (C) 2000, S.R.Haque <[email protected]>.
+ This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+
+DESCRIPTION
+*/
+
+#ifndef PPTXML_H
+#define PPTXML_H
+
+#include <pptdoc.h>
+#include <qobject.h>
+#include <qstring.h>
+
+#define ALIGN_LEFT 1
+#define ALIGN_RIGHT 2
+#define ALIGN_CENTER 4
+#define ALIGN_JUSTIFY 8
+
+class myFile;
+class QDomDocument;
+
+class PptXml:
+ public QObject,
+ private PptDoc
+{
+
+ Q_OBJECT
+
+public:
+ PptXml(
+ const myFile &mainStream,
+ const myFile &currentUser,
+ const myFile &pictures);
+ ~PptXml();
+
+ bool convert();
+
+ const QString getXml() const;
+
+signals:
+ // See olefilter.h for information
+ void signalSavePic(
+ const QString &nameIN,
+ QString &storageId,
+ const QString &extension,
+ unsigned int length,
+ const char *data);
+
+ void signalSavePart(
+ const QString &nameIN,
+ QString &storageId,
+ QString &mimeType,
+ const QString &extension,
+ unsigned int length,
+ const char *data);
+
+ void signalPart(
+ const QString& nameIN,
+ QString &storageId,
+ QString &mimeType);
+
+private:
+ PptXml(const PptXml &);
+ const PptXml &operator=(const PptXml &);
+
+ // Error handling and reporting support.
+
+ static const int s_area;
+
+ // The conversion is done exactly once. Has it already happened?
+
+ bool m_isConverted;
+ bool m_success;
+ bool m_half;
+ unsigned m_y;
+ QString m_embedded;
+ QString m_pages;
+ QString m_titles;
+ QString m_notes;
+ QString m_text;
+ void encode(QString &text);
+
+ // Override the base class functions.
+
+ void gotDrawing(
+ unsigned id,
+ QString type,
+ unsigned length,
+ const char *data);
+ void gotSlide(PptSlide &slide);
+ void setPlaceholder(PptSlide &slide);
+};
+#endif
diff --git a/filters/olefilters/powerpoint97/status.html b/filters/olefilters/powerpoint97/status.html
new file mode 100644
index 00000000..5db4ed52
--- /dev/null
+++ b/filters/olefilters/powerpoint97/status.html
@@ -0,0 +1,156 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>KOffice filters status: POWERPOINT FILTER</title>
+</head>
+<body text="#000000" bgcolor="#FFFFFF" link="#000099" vlink="#666666" alink="#666666">
+<A NAME="START">&nbsp;</A>
+
+<BR>
+<center>
+ <h1>
+ KOffice filters status: &nbsp;&nbsp;<i>PowerPoint97 FILTER</i>
+ </h1>
+</center>
+
+<hr NOSHADE SIZE=2 WIDTH="70%">
+
+<font size="-1"><b>
+ <A HREF="#import">Import</A> |
+ <A HREF="#export">Export</A>
+</b></font>
+
+<BR><BR><BR>
+<center><a NAME="import"></a></center>
+
+<A HREF="#START"><font size="-1"><b>Up</b></font></A>
+<center>
+<table BORDER=0 CELLSPACING=0 BGCOLOR="#000000" WIDTH="100%">
+ <tr>
+ <td>
+ <table BORDER=0 CELLPADDING=2 BGCOLOR="#FFFFFF" WIDTH="100%">
+
+ <tr BGCOLOR="#DDFFDD">
+ <td COLSPAN="2">
+ <center><b><i><font size="+1">
+ <BR>
+ Import PowerPoint97 for kpresenter<BR>
+ <BR>
+ </font></i></b></center>
+ </td>
+ </tr>
+
+ <tr BGCOLOR="#EEEEFF">
+ <td VALIGN=TOP WIDTH="1%" NOWRAP><b><font size="+1">Last update</font></b></td>
+ <td>27 March 2002</td>
+ </tr>
+
+ <tr BGCOLOR="#CCCCFF">
+ <td VALIGN=TOP><b><font size="+1">Features</font></b></td>
+ <td>Imports text from Powerpoint97/XP documents.</td>
+ </tr>
+
+ <tr BGCOLOR="#EEEEFF">
+ <td VALIGN=TOP><b><font size="+1">Todo</font></b></td>
+ <td>- Everything!</td>
+ </tr>
+
+ <tr BGCOLOR="#CCCCFF">
+ <td VALIGN=TOP><b><font size="+1">History</font></b></td>
+ <td>---</td>
+ </tr>
+
+ <tr BGCOLOR="#EEEEFF">
+ <td VALIGN=TOP><b><font size="+1">Authors</font></b></td>
+ <td>
+ <A HREF="mailto:[email protected]">Shaheed Haque</A>
+ </td>
+ </tr>
+
+ <tr BGCOLOR="#CCCCFF">
+ <td VALIGN=TOP><b><font size="+1">Links</font></b></td>
+ <td>Check your local copy of the MSDN Library</td>
+ </tr>
+
+ <tr BGCOLOR="#EEEEFF">
+ <td VALIGN=TOP><b><font size="+1">Progress report </font></b></td>
+ <td>---</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+</center>
+<A HREF="#START"><font size="-1"><b>Up</b></font></A>
+
+<br><br><br>
+
+<hr NOSHADE SIZE=1>
+<br><br><br>
+
+
+<center>
+ <a NAME="export"></a>
+</center>
+
+<A HREF="#START"><font size="-1"><b>Up</b></font></A>
+<center>
+<table BORDER=0 CELLSPACING=0 BGCOLOR="#000000" WIDTH="100%">
+ <tr>
+ <td>
+ <table BORDER=0 CELLPADDING=2 BGCOLOR="#FFFFFF" WIDTH="100%">
+ <tr BGCOLOR="#FFDDDD">
+ <td COLSPAN="2">
+ <center><b><i><font size="+1">
+ <BR>Export kpresenter to PowerPoint97<BR><BR>
+ </font></i></b></center>
+ </td>
+ </tr>
+
+ <tr BGCOLOR="#EEEEFF">
+ <td VALIGN=TOP WIDTH="1%" NOWRAP><b><font size="+1">Last update</font></b></td>
+ <td>-</td>
+ </tr>
+
+ <tr BGCOLOR="#CCCCFF">
+ <td VALIGN=TOP><b><font size="+1">Features</font></b></td>
+ <td>None</td>
+ </tr>
+
+ <tr BGCOLOR="#EEEEFF">
+ <td VALIGN=TOP><b><font size="+1">Todo</font></b></td>
+ <td>Everything</td>
+ </tr>
+
+ <tr BGCOLOR="#CCCCFF">
+ <td VALIGN=TOP><b><font size="+1">History</font></b></td>
+ <td>-</td>
+ </tr>
+
+ <tr BGCOLOR="#EEEEFF">
+ <td VALIGN=TOP><b><font size="+1">Authors</font></b></td>
+ <td><!a href="mailto:[email protected]">-</a></td>
+ </tr>
+
+ <tr BGCOLOR="#CCCCFF">
+ <td VALIGN=TOP><b><font size="+1">Links</font></b></td>
+ <td><!a href="http://www.koffice.org">-</a></td>
+ </tr>
+
+ <tr BGCOLOR="#EEEEFF">
+ <td VALIGN=TOP><b><font size="+1">Progress report </font></b></td>
+ <td>---</td>
+ </tr>
+
+
+
+ </table>
+ </td>
+ </tr>
+</table>
+</center>
+<A HREF="#START"><font size="-1"><b>Up</b></font></A>
+
+</body>
+</html>