From 48119ae05819132c6a4558dac23da8c70cad0814 Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Mon, 5 Jan 2009 14:06:42 +0000 Subject: CWS-TOOLING: integrate CWS libmsword 2008-12-18 12:33:19 +0100 kendy r265681 : Export less symbols. 2008-12-17 19:26:56 +0100 kendy r265655 : Move libmsword to the -writer package. 2008-12-15 17:46:16 +0100 kendy r265516 : Enable exceptions for iodetect.cxx. 2008-12-15 15:17:53 +0100 kendy r265504 : Deliver the msword.dll. 2008-12-09 19:38:17 +0100 kendy r265138 : Remove accidentally added method. 2008-12-09 19:33:57 +0100 kendy r265137 : Fix linking on Win32. 2008-12-09 18:37:16 +0100 kendy r265135 : Move SwFltControlStack::Delete() to ww1/fltshell.cxx to fix linking. 2008-12-09 18:01:56 +0100 kendy r265127 : Visibility fixes. 2008-12-09 15:51:52 +0100 kendy r265109 : Fix ambiguous usage of class Color. 2008-12-09 14:54:27 +0100 kendy r265091 : Add #include "precompiled_sw.hxx" to fix --enable-pch build. 2008-12-09 14:44:59 +0100 kendy r265088 : Add #include "precompiled_sw.hxx" to fix --enable-pch build. 2008-12-08 19:14:49 +0100 kendy r265015 : #i96313# Get rid of inc/iodetect.cxx, it's a really bad idea to share code by #ifdefing parts of it, and #including a .cxx file ;-) This change moves it to iodetect.cxx, which is compiled to a .o/.obj that is used where needed. 2008-11-20 17:45:08 +0100 kendy r264083 : #i96313# Make the destruction of Readers consistent. 2008-11-20 17:18:11 +0100 kendy r264070 : #i96313# Added missing SW_DLLPUBLIC for (Import|Export)(DOC|RTF). 2008-11-18 19:21:07 +0100 kendy r263797 : #i96313# Remove accidentally added file. 2008-11-18 17:14:31 +0100 kendy r263790 : #i96313# Split doc and rtf filters into a separate library From: Radek Doulik fix SwFieldBookmark class visibility (suggested by kendy) 2008-11-18 17:14:01 +0100 kendy r263789 : #i96313# Split doc and rtf filters into a separate library From: Fridrich Strba add visibility markup to allow linking 2008-11-18 17:13:29 +0100 kendy r263788 : #i96313# Split doc and rtf filters into a separate library From: Jan Holesovsky Visibility markup for libmsword. This is the most trivial approach, every class that had a symbol that needed to be visible was marked with SW_DLLPUBLIC; the correct (but more time consuming) way would be to mark just the exact methods that were needed. To be done later if generally shows that the separate libmsword makes sense; and also now we have the upper limit of symbols that needed to be added, and we can only make it better [decrease the number] ;-) 2008-11-18 17:12:58 +0100 kendy r263787 : #i96313# Split doc and rtf filters into a separate library From: Jan Holesovsky Added the missing msword.map. 2008-11-18 17:12:25 +0100 kendy r263786 : #i96313# Split doc and rtf filters into a separate library From: Jan Holesovsky scp2 change for libmsword. 2008-11-18 17:11:55 +0100 kendy r263785 : #i96313# Split doc and rtf filters into a separate library From: Jan Holesovsky Convert the binary .doc and .rtf filters into a separate library. It is called 'libmsword' and loaded on demand when either of the formats (.doc, .rtf) is loaded or saved. --- sw/inc/SwStyleNameMapper.hxx | 2 +- sw/inc/anchoreddrawobject.hxx | 2 +- sw/inc/anchoredobject.hxx | 2 +- sw/inc/bookmrk.hxx | 2 +- sw/inc/bparr.hxx | 3 +- sw/inc/breakit.hxx | 8 +- sw/inc/calbck.hxx | 14 +- sw/inc/chpfld.hxx | 2 +- sw/inc/dbfld.hxx | 8 +- sw/inc/dcontact.hxx | 4 +- sw/inc/doc.hxx | 12 +- sw/inc/docary.hxx | 2 +- sw/inc/docufld.hxx | 16 +- sw/inc/expfld.hxx | 6 +- sw/inc/fchrfmt.hxx | 2 +- sw/inc/fldbas.hxx | 2 +- sw/inc/flddat.hxx | 2 +- sw/inc/flypos.hxx | 5 +- sw/inc/fmtcnct.hxx | 2 +- sw/inc/fmtcntnt.hxx | 2 +- sw/inc/fmthbsh.hxx | 2 +- sw/inc/fmthdft.hxx | 4 +- sw/inc/fmtruby.hxx | 2 +- sw/inc/fmtwrapinfluenceonobjpos.hxx | 2 +- sw/inc/format.hxx | 8 +- sw/inc/frmfmt.hxx | 4 +- sw/inc/grfatr.hxx | 10 +- sw/inc/hfspacingitem.hxx | 2 +- sw/inc/hintids.hxx | 14 +- sw/inc/index.hxx | 3 +- sw/inc/iodetect.cxx | 697 ----------------------------------- sw/inc/iodetect.hxx | 130 +++++++ sw/inc/mdiexp.hxx | 8 +- sw/inc/ndarr.hxx | 2 +- sw/inc/ndgrf.hxx | 2 +- sw/inc/ndindex.hxx | 4 +- sw/inc/ndnotxt.hxx | 2 +- sw/inc/ndole.hxx | 4 +- sw/inc/node.hxx | 4 +- sw/inc/numrule.hxx | 2 +- sw/inc/pam.hxx | 10 +- sw/inc/redline.hxx | 4 +- sw/inc/shellio.hxx | 134 +++---- sw/inc/shellres.hxx | 2 +- sw/inc/sw.mk | 2 + sw/inc/swatrset.hxx | 6 +- sw/inc/swfltopt.hxx | 2 +- sw/inc/swmodule.hxx | 20 +- sw/inc/swtable.hxx | 6 +- sw/inc/swtypes.hxx | 6 +- sw/inc/txtatr.hxx | 2 +- sw/inc/txtftn.hxx | 2 +- sw/inc/txtinet.hxx | 2 +- sw/inc/unoobj.hxx | 2 +- sw/inc/usrfld.hxx | 2 +- sw/prj/d.lst | 1 + sw/source/core/attr/hints.cxx | 12 +- sw/source/core/docnode/section.cxx | 2 +- sw/source/core/edit/edglss.cxx | 2 +- sw/source/core/inc/pamtyp.hxx | 2 +- sw/source/core/inc/tblrwcl.hxx | 2 +- sw/source/core/sw3io/sw3convert.cxx | 4 +- sw/source/core/unocore/unoobj.cxx | 2 +- sw/source/filter/basflt/fltini.cxx | 176 ++++++--- sw/source/filter/basflt/iodetect.cxx | 595 ++++++++++++++++++++++++++++++ sw/source/filter/basflt/makefile.mk | 5 +- sw/source/filter/inc/fltini.hxx | 14 +- sw/source/filter/inc/fltshell.hxx | 22 +- sw/source/filter/inc/wrt_fn.hxx | 6 +- sw/source/filter/inc/wrtswtbl.hxx | 2 +- sw/source/filter/makefile.mk | 2 - sw/source/filter/rtf/makefile.mk | 1 + sw/source/filter/rtf/swparrtf.cxx | 5 + sw/source/filter/rtf/swparrtf.hxx | 5 + sw/source/filter/rtf/wrtrtf.cxx | 2 +- sw/source/filter/ww1/fltshell.cxx | 86 +++++ sw/source/filter/ww8/makefile.mk | 1 + sw/source/filter/ww8/wrtww8.cxx | 12 +- sw/source/filter/ww8/ww8par.cxx | 99 +---- sw/source/filter/ww8/ww8par.hxx | 10 + sw/source/ui/app/docsh.cxx | 4 +- sw/source/ui/app/mainwn.cxx | 2 +- sw/source/ui/dbui/mmlayoutpage.cxx | 4 +- sw/source/ui/dbui/mmoutputpage.cxx | 6 +- sw/source/ui/dochdl/gloshdl.cxx | 2 +- sw/source/ui/dochdl/swdtflvr.cxx | 2 +- sw/source/ui/misc/glossary.cxx | 2 +- sw/source/ui/ribbar/makefile.mk | 1 - sw/source/ui/uiview/srcview.cxx | 25 +- sw/source/ui/uno/swdet2.cxx | 12 +- sw/util/makefile.mk | 32 +- sw/util/msword.map | 10 + 92 files changed, 1221 insertions(+), 1157 deletions(-) delete mode 100644 sw/inc/iodetect.cxx create mode 100644 sw/inc/iodetect.hxx create mode 100644 sw/source/filter/basflt/iodetect.cxx create mode 100644 sw/util/msword.map diff --git a/sw/inc/SwStyleNameMapper.hxx b/sw/inc/SwStyleNameMapper.hxx index e32f6abfb766..cf1d7aed0c64 100644 --- a/sw/inc/SwStyleNameMapper.hxx +++ b/sw/inc/SwStyleNameMapper.hxx @@ -164,7 +164,7 @@ public: // This gets the programmatic Name from the Pool ID static void FillProgName( sal_uInt16 nId, String& rFillName ); - static const String& GetProgName ( sal_uInt16 nId, const String& rName ); + SW_DLLPUBLIC static const String& GetProgName ( sal_uInt16 nId, const String& rName ); // This gets the PoolId from the UI Name SW_DLLPUBLIC static sal_uInt16 GetPoolIdFromUIName( const String& rName, SwGetPoolIdFromName ); diff --git a/sw/inc/anchoreddrawobject.hxx b/sw/inc/anchoreddrawobject.hxx index bb95a8abf7b6..7a52a523d2c2 100644 --- a/sw/inc/anchoreddrawobject.hxx +++ b/sw/inc/anchoreddrawobject.hxx @@ -39,7 +39,7 @@ @author OD */ -class SwAnchoredDrawObject : public SwAnchoredObject +class SW_DLLPUBLIC SwAnchoredDrawObject : public SwAnchoredObject { private: // boolean, indicating that the object position has been invalidated diff --git a/sw/inc/anchoredobject.hxx b/sw/inc/anchoredobject.hxx index 3cbd93d75104..c9c4c55d701e 100644 --- a/sw/inc/anchoredobject.hxx +++ b/sw/inc/anchoredobject.hxx @@ -56,7 +56,7 @@ class SwFmtAnchor; @author OD */ -class SwAnchoredObject +class SW_DLLPUBLIC SwAnchoredObject { private: // drawing object representing the anchored object in the drawing layer diff --git a/sw/inc/bookmrk.hxx b/sw/inc/bookmrk.hxx index a5c58f2bf740..3b459f61c081 100644 --- a/sw/inc/bookmrk.hxx +++ b/sw/inc/bookmrk.hxx @@ -151,7 +151,7 @@ public: const String& rName, const String& rShortName); }; -class SwFieldBookmark : public SwBookmark +class SW_DLLPUBLIC SwFieldBookmark : public SwBookmark { private: int fftype; // Type: 0 = Text, 1 = Check Box, 2 = List diff --git a/sw/inc/bparr.hxx b/sw/inc/bparr.hxx index c6f44647b46a..8a2d320382a7 100644 --- a/sw/inc/bparr.hxx +++ b/sw/inc/bparr.hxx @@ -33,6 +33,7 @@ #include #include +#include struct BlockInfo; class BigPtrArray; @@ -73,7 +74,7 @@ struct BlockInfo { // Block-Info: USHORT nElem; // Anzahl Elemente }; -class BigPtrArray +class SW_DLLPUBLIC BigPtrArray { BlockInfo** ppInf; // Block-Infos ULONG nSize; // Anzahl Elemente diff --git a/sw/inc/breakit.hxx b/sw/inc/breakit.hxx index 5614d59e405d..53940bd00e37 100644 --- a/sw/inc/breakit.hxx +++ b/sw/inc/breakit.hxx @@ -36,10 +36,8 @@ #include #include #include - -#ifndef _COM_SUN_STAR_I18N_FORBIDDENCHARACTERS_HDL_ #include -#endif +#include class String; @@ -48,7 +46,7 @@ class String; *************************************************************************/ -class SwBreakIt +class SW_DLLPUBLIC SwBreakIt { com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMSF; @@ -110,7 +108,7 @@ public: #define SW_XBREAKITER() SW_BREAKITER()->GetBreakIter() // @@@ backward compatibility @@@ -extern SwBreakIt* pBreakIt; +SW_DLLPUBLIC extern SwBreakIt* pBreakIt; #endif diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index b5a0819ea897..7a8ff7f8f471 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -130,7 +130,7 @@ class SW_DLLPUBLIC SwModify: public SwClient friend class SwClientIter; SwClient* pRoot; - SW_DLLPRIVATE SwClient *_Remove(SwClient *pDepend); + SwClient *_Remove(SwClient *pDepend); public: SwModify() : pRoot(0) {} @@ -176,7 +176,7 @@ protected: * abhaengig ist. Diese sollte fuer jede Abhaengigkeit ein Objekt * der Klasse SwDepend als Member haben. */ -class SwDepend: public SwClient +class SW_DLLPUBLIC SwDepend: public SwClient { SwClient *pToTell; @@ -197,7 +197,7 @@ private: }; -class SW_DLLPUBLIC SwClientIter +class SwClientIter { friend SwClient* SwModify::_Remove(SwClient *); // fuer Ptr-Korrektur friend void SwModify::Add(SwClient *); // nur fuer ASSERT ! @@ -213,8 +213,8 @@ class SW_DLLPUBLIC SwClientIter TypeId aSrchId; // fuer First/Next - suche diesen Type public: - SwClientIter( SwModify& ); - ~SwClientIter(); + SW_DLLPUBLIC SwClientIter( SwModify& ); + SW_DLLPUBLIC ~SwClientIter(); const SwModify& GetModify() const { return rRoot; } SwModify& GetModify() { return rRoot; } @@ -236,8 +236,8 @@ public: int IsChanged() const { return pDelNext != pAkt; } - SwClient* First( TypeId nType ); - SwClient* Next(); + SW_DLLPUBLIC SwClient* First( TypeId nType ); + SW_DLLPUBLIC SwClient* Next(); const SwClient* GetWatchClient() const { return mpWatchClient; } void SetWatchClient( SwClient* pWatch ) { mpWatchClient = pWatch; } diff --git a/sw/inc/chpfld.hxx b/sw/inc/chpfld.hxx index 9eb641660672..08ebcf93bd5c 100644 --- a/sw/inc/chpfld.hxx +++ b/sw/inc/chpfld.hxx @@ -65,7 +65,7 @@ public: /*-------------------------------------------------------------------- Beschreibung: Kapitelnummer --------------------------------------------------------------------*/ -class SwChapterField : public SwField +class SW_DLLPUBLIC SwChapterField : public SwField { friend class SwChapterFieldType; BYTE nLevel; diff --git a/sw/inc/dbfld.hxx b/sw/inc/dbfld.hxx index b918a038da72..9b61f001ed12 100644 --- a/sw/inc/dbfld.hxx +++ b/sw/inc/dbfld.hxx @@ -172,7 +172,7 @@ public: Beschreibung: Datenbankfeld Naechster Satz --------------------------------------------------------------------*/ -class SwDBNextSetFieldType : public SwFieldType +class SW_DLLPUBLIC SwDBNextSetFieldType : public SwFieldType { public: SwDBNextSetFieldType(); @@ -286,7 +286,7 @@ public: Beschreibung: Datenbankfeld --------------------------------------------------------------------*/ -class SwDBNameField : public SwDBNameInfField +class SW_DLLPUBLIC SwDBNameField : public SwDBNameInfField { public: SwDBNameField(SwDBNameFieldType*, const SwDBData& rDBData, ULONG nFmt = 0); @@ -301,7 +301,7 @@ public: Beschreibung: Datensatznummer --------------------------------------------------------------------*/ -class SwDBSetNumberFieldType : public SwFieldType +class SW_DLLPUBLIC SwDBSetNumberFieldType : public SwFieldType { public: SwDBSetNumberFieldType(); @@ -313,7 +313,7 @@ public: Beschreibung: Datenbankfeld --------------------------------------------------------------------*/ -class SwDBSetNumberField : public SwDBNameInfField +class SW_DLLPUBLIC SwDBSetNumberField : public SwDBNameInfField { long nNumber; diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx index 2c905275ac84..3bb2fb4f49c0 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -67,7 +67,7 @@ class SwIndex; //Anderfalls ist es eben ein einfaches Zeichenobjekt. Diese hat einen //UserCall und der ist Client vom gesuchten Format. //Implementierung in dcontact.cxx -SwFrmFmt *FindFrmFmt( SdrObject *pObj ); +SW_DLLPUBLIC SwFrmFmt *FindFrmFmt( SdrObject *pObj ); inline const SwFrmFmt *FindFrmFmt( const SdrObject *pObj ) { return ::FindFrmFmt( (SdrObject*)pObj ); } sal_Bool HasWrap( const SdrObject* pObj ); @@ -237,7 +237,7 @@ public: //KontactObjekt fuer die Verbindung zwischen Rahmen bzw. deren Formaten //im StarWriter (SwClient) und den Zeichenobjekten des Drawing (SdrObjUserCall) -class SwFlyDrawContact : public SwContact +class SW_DLLPUBLIC SwFlyDrawContact : public SwContact { private: // OD 2004-04-01 #i26791# diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index dcc17451454f..920f7495a63f 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -267,7 +267,7 @@ void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem ); // global function to start grammar checking in the document void StartGrammarChecking( SwDoc &rDoc, SwRootFrm &rRootFrame ); -class SwDoc : +class SW_DLLPUBLIC SwDoc : public IInterface, public IDocumentSettingAccess, public IDocumentDeviceAccess, @@ -966,7 +966,7 @@ public: virtual void DocInfoChgd(); virtual const SwDocStat &GetDocStat() const; virtual void SetDocStat(const SwDocStat& rStat); - SW_DLLPUBLIC virtual void UpdateDocStat(SwDocStat& rStat); + virtual void UpdateDocStat(SwDocStat& rStat); /** IDocumentState */ @@ -1121,7 +1121,7 @@ public: sal_Bool bDelRedlines = sal_True, sal_Bool bCopyFlyAtFly = sal_False ) const; - SW_DLLPUBLIC sal_Bool SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet ); + sal_Bool SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet ); sal_Bool SetFrmFmtToFly( SwFrmFmt& rFlyFmt, SwFrmFmt& rNewFmt, SfxItemSet* pSet = 0, sal_Bool bKeepOrient = sal_False ); @@ -1238,7 +1238,7 @@ public: void SetDefault( const SfxItemSet& ); // Erfrage das Default Attribut in diesem Dokument. - SW_DLLPUBLIC const SfxPoolItem& GetDefault( sal_uInt16 nFmtHint ) const; + const SfxPoolItem& GetDefault( sal_uInt16 nFmtHint ) const; // TextAttribute nicht mehr aufspannen lassen sal_Bool DontExpandFmt( const SwPosition& rPos, sal_Bool bFlag = sal_True ); @@ -2092,8 +2092,8 @@ public: // <-- //Update all the page masters - SW_DLLPUBLIC void SetDefaultPageMode(bool bSquaredPageMode); - SW_DLLPUBLIC sal_Bool IsSquaredPageMode() const; + void SetDefaultPageMode(bool bSquaredPageMode); + sal_Bool IsSquaredPageMode() const; // i#78591# void Setn32DummyCompatabilityOptions1( sal_uInt32 CompatabilityOptions1 ) diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx index 920d6273f674..649d7b4e650d 100644 --- a/sw/inc/docary.hxx +++ b/sw/inc/docary.hxx @@ -91,7 +91,7 @@ SV_DECL_PTRARR_DEL(SwSectionFmts,SwSectionFmtPtr,0,4) typedef SwNumRule* SwNumRulePtr; -SV_DECL_PTRARR_DEL( SwNumRuleTbl, SwNumRulePtr, 0, 5 ) +SV_DECL_PTRARR_DEL_VISIBILITY( SwNumRuleTbl, SwNumRulePtr, 0, 5, SW_DLLPUBLIC ) typedef SwRedline* SwRedlinePtr; SV_DECL_PTRARR_SORT_DEL( _SwRedlineTbl, SwRedlinePtr, 0, 16 ) diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx index 3cd0f1bb034f..88c4e650cfd0 100644 --- a/sw/inc/docufld.hxx +++ b/sw/inc/docufld.hxx @@ -169,7 +169,7 @@ public: Beschreibung: Seitennummerierung --------------------------------------------------------------------*/ -class SwPageNumberField : public SwField +class SW_DLLPUBLIC SwPageNumberField : public SwField { String sUserStr; USHORT nSubType; @@ -246,7 +246,7 @@ public: Beschreibung: FileName --------------------------------------------------------------------*/ -class SwFileNameField : public SwField +class SW_DLLPUBLIC SwFileNameField : public SwField { String aContent; @@ -281,7 +281,7 @@ public: Beschreibung: TemplName --------------------------------------------------------------------*/ -class SwTemplNameField : public SwField +class SW_DLLPUBLIC SwTemplNameField : public SwField { public: SwTemplNameField(SwTemplNameFieldType*, sal_uInt32 nFmt = 0); @@ -314,7 +314,7 @@ public: Beschreibung: Dokumentstatistik --------------------------------------------------------------------*/ -class SwDocStatField : public SwField +class SW_DLLPUBLIC SwDocStatField : public SwField { USHORT nSubType; @@ -460,7 +460,7 @@ public: Beschreibung: Macrofeld --------------------------------------------------------------------*/ -class SwMacroField : public SwField +class SW_DLLPUBLIC SwMacroField : public SwField { String aMacro; String aText; @@ -517,7 +517,7 @@ public: Beschreibung: PostIt --------------------------------------------------------------------*/ -class SwPostItField : public SwField +class SW_DLLPUBLIC SwPostItField : public SwField { String sTxt; // die Anmerkung String sAuthor; // der Author @@ -566,7 +566,7 @@ public: virtual SwFieldType* Copy() const; }; -class SwDocInfoField : public SwValueField +class SW_DLLPUBLIC SwDocInfoField : public SwValueField { USHORT nSubType; String aContent; @@ -815,7 +815,7 @@ public: #define MAX_COMBINED_CHARACTERS 6 -class SwCombinedCharField : public SwField +class SW_DLLPUBLIC SwCombinedCharField : public SwField { String sCharacters; // combine these characters diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx index febde8d8e6f8..83629f8cf6d5 100644 --- a/sw/inc/expfld.hxx +++ b/sw/inc/expfld.hxx @@ -93,7 +93,7 @@ public: Beschreibung: GetExperession --------------------------------------------------------------------*/ -class SwGetExpField : public SwFormulaField +class SW_DLLPUBLIC SwGetExpField : public SwFormulaField { String sExpand; BOOL bIsInBodyTxt; @@ -228,7 +228,7 @@ inline const String& SwSetExpFieldType::GetSetRefName() const Beschreibung: Ausdruck --------------------------------------------------------------------*/ -class SwSetExpField : public SwFormulaField +class SW_DLLPUBLIC SwSetExpField : public SwFormulaField { String sExpand; String aPText; @@ -315,7 +315,7 @@ public: Beschreibung: Eingabefeld --------------------------------------------------------------------*/ -class SwInputField : public SwField +class SW_DLLPUBLIC SwInputField : public SwField { String aContent; String aPText; diff --git a/sw/inc/fchrfmt.hxx b/sw/inc/fchrfmt.hxx index de0334f5ef50..c34d6f484037 100644 --- a/sw/inc/fchrfmt.hxx +++ b/sw/inc/fchrfmt.hxx @@ -42,7 +42,7 @@ class IntlWrapper; // ATT_CHARFMT ********************************************* -class SwFmtCharFmt: public SfxPoolItem, public SwClient +class SW_DLLPUBLIC SwFmtCharFmt: public SfxPoolItem, public SwClient { friend class SwTxtCharFmt; SwTxtCharFmt* pTxtAttr; // mein TextAttribut diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx index 36c352b4429e..11213224844c 100644 --- a/sw/inc/fldbas.hxx +++ b/sw/inc/fldbas.hxx @@ -439,7 +439,7 @@ public: static sal_uInt32 GetSystemFormat(SvNumberFormatter* pFormatter, sal_uInt32 nFmt); }; -class SwFormulaField : public SwValueField +class SW_DLLPUBLIC SwFormulaField : public SwValueField { String sFormula; diff --git a/sw/inc/flddat.hxx b/sw/inc/flddat.hxx index 5f00deb46b08..e2c61cfe8809 100644 --- a/sw/inc/flddat.hxx +++ b/sw/inc/flddat.hxx @@ -113,7 +113,7 @@ public: Beschreibung: Datum/Uhrzeitfeld --------------------------------------------------------------------*/ -class SwDateTimeField : public SwValueField +class SW_DLLPUBLIC SwDateTimeField : public SwValueField { USHORT nSubType; long nOffset; // Offset in Minuten diff --git a/sw/inc/flypos.hxx b/sw/inc/flypos.hxx index 7508816507b0..287e6544712b 100644 --- a/sw/inc/flypos.hxx +++ b/sw/inc/flypos.hxx @@ -32,12 +32,13 @@ #include +#include class SwFrmFmt; class SwNodeIndex; // Struktur zum Erfragen der akt. freifliegenden Rahmen am Dokument. -class SwPosFlyFrm +class SW_DLLPUBLIC SwPosFlyFrm { const SwFrmFmt* pFrmFmt; // das FlyFrmFmt // SwPosition* pPos; // Position in den ContentNode @@ -57,6 +58,6 @@ public: }; typedef SwPosFlyFrm* SwPosFlyFrmPtr; -SV_DECL_PTRARR_SORT( SwPosFlyFrms, SwPosFlyFrmPtr, 0, 40 ) +SV_DECL_PTRARR_SORT_VISIBILITY( SwPosFlyFrms, SwPosFlyFrmPtr, 0, 40, SW_DLLPUBLIC ) #endif // _FLYPOS_HXX diff --git a/sw/inc/fmtcnct.hxx b/sw/inc/fmtcnct.hxx index 3299beefcb7d..d229f91b8b78 100644 --- a/sw/inc/fmtcnct.hxx +++ b/sw/inc/fmtcnct.hxx @@ -41,7 +41,7 @@ class IntlWrapper; //Verbindung (Textfluss) zwischen zwei FlyFrms -class SwFmtChain: public SfxPoolItem +class SW_DLLPUBLIC SwFmtChain: public SfxPoolItem { SwClient aPrev, //Vorgaenger (SwFlyFrmFmt), wenn es diesen gibt. aNext; //Nachfolger (SwFlyFrmFmt), wenn es diesen gibt. diff --git a/sw/inc/fmtcntnt.hxx b/sw/inc/fmtcntnt.hxx index 703390ad9088..c5b262331e44 100644 --- a/sw/inc/fmtcntnt.hxx +++ b/sw/inc/fmtcntnt.hxx @@ -39,7 +39,7 @@ class SwStartNode; //Cntnt, Inhalt des Frame (Header, Footer, Fly) ---- -class SwFmtCntnt: public SfxPoolItem +class SW_DLLPUBLIC SwFmtCntnt: public SfxPoolItem { SwNodeIndex *pStartNode; diff --git a/sw/inc/fmthbsh.hxx b/sw/inc/fmthbsh.hxx index 663ab703d7dd..32c4df8c4007 100644 --- a/sw/inc/fmthbsh.hxx +++ b/sw/inc/fmthbsh.hxx @@ -53,7 +53,7 @@ public: // ATT_HARDBLANK ****************************** // Attribut fuer geschuetzte Leerzeichen. -class SwFmtHardBlank : public SfxPoolItem +class SW_DLLPUBLIC SwFmtHardBlank : public SfxPoolItem { sal_Unicode cChar; public: diff --git a/sw/inc/fmthdft.hxx b/sw/inc/fmthdft.hxx index 92338d069b9a..d6661c9d4ddc 100644 --- a/sw/inc/fmthdft.hxx +++ b/sw/inc/fmthdft.hxx @@ -42,7 +42,7 @@ class IntlWrapper; //Kopfzeile, fuer Seitenformate //Client von FrmFmt das den Header beschreibt. -class SwFmtHeader: public SfxPoolItem, public SwClient +class SW_DLLPUBLIC SwFmtHeader: public SfxPoolItem, public SwClient { BOOL bActive; //Nur zur Steuerung (Erzeugung des Inhaltes) @@ -74,7 +74,7 @@ public: //Fusszeile, fuer Seitenformate //Client von FrmFmt das den Footer beschreibt. -class SwFmtFooter: public SfxPoolItem, public SwClient +class SW_DLLPUBLIC SwFmtFooter: public SfxPoolItem, public SwClient { BOOL bActive; //Nur zur Steuerung (Erzeugung des Inhaltes) diff --git a/sw/inc/fmtruby.hxx b/sw/inc/fmtruby.hxx index 8f8f53161eea..516d5c3d8eed 100644 --- a/sw/inc/fmtruby.hxx +++ b/sw/inc/fmtruby.hxx @@ -36,7 +36,7 @@ class SwTxtRuby; -class SwFmtRuby : public SfxPoolItem +class SW_DLLPUBLIC SwFmtRuby : public SfxPoolItem { friend class SwTxtRuby; diff --git a/sw/inc/fmtwrapinfluenceonobjpos.hxx b/sw/inc/fmtwrapinfluenceonobjpos.hxx index 6cefcb035fab..b9ece15840e7 100644 --- a/sw/inc/fmtwrapinfluenceonobjpos.hxx +++ b/sw/inc/fmtwrapinfluenceonobjpos.hxx @@ -35,7 +35,7 @@ #include #include -class SwFmtWrapInfluenceOnObjPos: public SfxPoolItem +class SW_DLLPUBLIC SwFmtWrapInfluenceOnObjPos: public SfxPoolItem { private: sal_Int16 mnWrapInfluenceOnPosition; diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx index b68e48042151..b72ca46866d4 100644 --- a/sw/inc/format.hxx +++ b/sw/inc/format.hxx @@ -45,7 +45,7 @@ class IDocumentFieldsAccess; class IDocumentChartDataProviderAccess; class SwDoc; -class SwFmt : public SwModify +class SW_DLLPUBLIC SwFmt : public SwModify { // friend class SwSwgReader; // friend class SwSwgWriter; @@ -105,9 +105,9 @@ public: const SfxPoolItem **ppItem = 0 ) const; // --> OD 2008-03-03 #refactorlists# // methods renamed and made virtual - SW_DLLPUBLIC virtual BOOL SetFmtAttr( const SfxPoolItem& rAttr ); - SW_DLLPUBLIC virtual BOOL SetFmtAttr( const SfxItemSet& rSet ); - SW_DLLPUBLIC virtual BOOL ResetFmtAttr( USHORT nWhich1, USHORT nWhich2 = 0 ); + virtual BOOL SetFmtAttr( const SfxPoolItem& rAttr ); + virtual BOOL SetFmtAttr( const SfxItemSet& rSet ); + virtual BOOL ResetFmtAttr( USHORT nWhich1, USHORT nWhich2 = 0 ); // <-- // --> OD 2007-01-24 #i73790# diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx index 07c29b780faf..608ac7ac7174 100644 --- a/sw/inc/frmfmt.hxx +++ b/sw/inc/frmfmt.hxx @@ -141,7 +141,7 @@ public: //Das FlyFrame-Format ------------------------------ -class SwFlyFrmFmt: public SwFrmFmt +class SW_DLLPUBLIC SwFlyFrmFmt: public SwFrmFmt { friend class SwDoc; @@ -207,7 +207,7 @@ public: //Das DrawFrame-Format ----------------------------- -class SwDrawFrmFmt: public SwFrmFmt +class SW_DLLPUBLIC SwDrawFrmFmt: public SwFrmFmt { friend class SwDoc; diff --git a/sw/inc/grfatr.hxx b/sw/inc/grfatr.hxx index 55015099b98e..f9a232bae0ef 100644 --- a/sw/inc/grfatr.hxx +++ b/sw/inc/grfatr.hxx @@ -99,7 +99,7 @@ public: * class SwAttrCropGrf ******************************************************************************/ -class SwCropGrf : public SvxGrfCrop +class SW_DLLPUBLIC SwCropGrf : public SvxGrfCrop { public: TYPEINFO(); @@ -139,7 +139,7 @@ public: const Size& GetUnrotatedSize() const { return aUnrotatedSize; } }; -class SwLuminanceGrf : public SfxInt16Item +class SW_DLLPUBLIC SwLuminanceGrf : public SfxInt16Item { public: SwLuminanceGrf( sal_Int16 nVal = 0 ) @@ -155,7 +155,7 @@ public: const IntlWrapper* pIntl = 0 ) const; }; -class SwContrastGrf : public SfxInt16Item +class SW_DLLPUBLIC SwContrastGrf : public SfxInt16Item { public: SwContrastGrf( sal_Int16 nVal = 0 ) @@ -212,7 +212,7 @@ public: virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; }; -class SwGammaGrf : public SfxPoolItem +class SW_DLLPUBLIC SwGammaGrf : public SfxPoolItem { double nValue; public: @@ -285,7 +285,7 @@ public: BYTE nMemberId = 0 ); }; -class SwDrawModeGrf : public SfxEnumItem +class SW_DLLPUBLIC SwDrawModeGrf : public SfxEnumItem { public: SwDrawModeGrf( USHORT nMode = 0 ) diff --git a/sw/inc/hfspacingitem.hxx b/sw/inc/hfspacingitem.hxx index 6b960182c479..17b62c0d4760 100644 --- a/sw/inc/hfspacingitem.hxx +++ b/sw/inc/hfspacingitem.hxx @@ -37,7 +37,7 @@ class IntlWrapper; -class SwHeaderAndFooterEatSpacingItem : public SfxBoolItem +class SW_DLLPUBLIC SwHeaderAndFooterEatSpacingItem : public SfxBoolItem { public: SwHeaderAndFooterEatSpacingItem( USHORT nId = RES_HEADER_FOOTER_EAT_SPACING, diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 8cc1d30603df..f8d6a78f9737 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -386,15 +386,7 @@ typedef SfxPoolItem* SwDfltAttrTab[ POOLATTR_END - POOLATTR_BEGIN ]; extern SwDfltAttrTab __FAR_DATA aAttrTab; extern SfxItemInfo __FAR_DATA aSlotTab[]; - -#ifndef PRODUCT -const SfxPoolItem* GetDfltAttr( USHORT nWhich ); -#else -inline const SfxPoolItem* GetDfltAttr( USHORT nWhich ) -{ - return aAttrTab[ nWhich - POOLATTR_BEGIN ]; -} -#endif +SW_DLLPUBLIC const SfxPoolItem* GetDfltAttr( USHORT nWhich ); SW_DLLPUBLIC USHORT GetWhichOfScript( USHORT nWhich, USHORT nScript ); @@ -414,7 +406,7 @@ extern USHORT __FAR_DATA aTxtFmtCollSetRange[]; // AttrSet-Range fuer die GrfFmtColl extern USHORT __FAR_DATA aGrfFmtCollSetRange[]; // AttrSet-Range fuer die TextNode -extern USHORT __FAR_DATA aTxtNodeSetRange[]; +SW_DLLPUBLIC extern USHORT __FAR_DATA aTxtNodeSetRange[]; // AttrSet-Range fuer die NoTxtNode extern USHORT __FAR_DATA aNoTxtNodeSetRange[]; // AttrSet-Range fuer die SwTable @@ -424,7 +416,7 @@ extern USHORT __FAR_DATA aTableLineSetRange[]; // AttrSet-Range fuer die SwTableBox extern USHORT __FAR_DATA aTableBoxSetRange[]; // AttrSet-Range fuer die SwFrmFmt -extern USHORT __FAR_DATA aFrmFmtSetRange[]; +SW_DLLPUBLIC extern USHORT __FAR_DATA aFrmFmtSetRange[]; // AttrSet-Range fuer die SwCharFmt extern USHORT __FAR_DATA aCharFmtSetRange[]; // AttrSet-Range fuer die character autostyles diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx index e865fadd6c9f..5a57724f2540 100644 --- a/sw/inc/index.hxx +++ b/sw/inc/index.hxx @@ -34,6 +34,7 @@ #include #include // for RTTI of SwIndexReg #include // for xub_StrLen +#include #define INVALID_INDEX STRING_NOTFOUND @@ -48,7 +49,7 @@ struct SwPosition; #define INLINE #endif -class SwIndex +class SW_DLLPUBLIC SwIndex { friend class SwIndexReg; diff --git a/sw/inc/iodetect.cxx b/sw/inc/iodetect.cxx deleted file mode 100644 index a340f342b0d7..000000000000 --- a/sw/inc/iodetect.cxx +++ /dev/null @@ -1,697 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: iodetect.cxx,v $ - * $Revision: 1.31 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org 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 Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _IODETECT_CXX -#define _IODETECT_CXX - -#include -#include -#include -#include -#include -#include // for ASSERT -#include -#include - -#ifdef _DLL_ -#include -#endif - -using namespace com::sun::star; - -class Reader; -USHORT AutoDetec(const String& FileName, USHORT & rVersion); -bool IsDocShellRegistered(); -void GetWW8Writer( const String&, const String&, WriterRef& ); - -typedef void (*FnGetWriter)(const String&, const String& rBaseURL, WriterRef&); - -struct SwIoDetect -{ -// eigentlich privat, aber der Compiler kann sonst die -// Tabelle nicht initialisieren - const sal_Char* pName; - USHORT nLen; - - inline int IsFilter( const String& rNm ) - { - return pName && rNm.EqualsAscii( pName, 0, nLen ); - } - -#ifdef _DLL_ - Reader* pReader; - FnGetWriter fnGetWriter; - BOOL bDelReader; - - inline Reader* GetReader() const { return pReader; } - inline void GetWriter( const String& rNm, const String& rBaseURL, WriterRef& xWrt ) const - { if( fnGetWriter ) (*fnGetWriter)(rNm,rBaseURL,xWrt); else xWrt = WriterRef(0); } -#endif - - const sal_Char* IsReader(const sal_Char* pHeader, ULONG nLen_, - const String &rFileName, const String& rUserData ) const; -}; - - -#ifdef _DLL_ -#define SwIoEntry(sNm, cCharLen, pWrt, bDel) { sNm, cCharLen, 0, pWrt, bDel } -#else -#define SwIoEntry(sNm, cCharLen, pWrt, bDel) { sNm, cCharLen } -#endif - -#ifdef DEBUG_SH - -#define DEB_SH_SwIoEntry(sNm, cCharLen, pWrt, bDel) , SwIoEntry(sNm, cCharLen, pWrt, bDel) -#else -#define DEB_SH_SwIoEntry(sNm, cCharLen, pWrt, bDel) -#endif - -const USHORT MAXFILTER = -#ifdef DEBUG_SH - 1 + -#endif - 11; - -const sal_Char __FAR_DATA FILTER_BAS[] = "BAS"; -const sal_Char __FAR_DATA FILTER_RTF[] = "RTF"; -const sal_Char __FAR_DATA FILTER_SWW4V[] = "CSW4VWEB"; -const sal_Char __FAR_DATA FILTER_SWW5V[] = "CSW5VWEB"; -const sal_Char __FAR_DATA sRtfWH[] = "WH_RTF"; -const sal_Char __FAR_DATA sHTML[] = "HTML"; -const sal_Char __FAR_DATA sWW1[] = "WW1"; -const sal_Char __FAR_DATA sWW5[] = "WW6"; -const sal_Char __FAR_DATA sWW6[] = "CWW6"; -const sal_Char __FAR_DATA FILTER_WW8[] = "CWW8"; -const sal_Char __FAR_DATA FILTER_TEXT_DLG[] = "TEXT_DLG"; -const sal_Char __FAR_DATA FILTER_TEXT[] = "TEXT"; -const sal_Char __FAR_DATA sDebug[] = "DEBUG"; -const sal_Char __FAR_DATA sUndo[] = "UNDO"; -const sal_Char __FAR_DATA FILTER_XML[] = "CXML"; -const sal_Char __FAR_DATA FILTER_XMLV[] = "CXMLV"; -const sal_Char __FAR_DATA FILTER_XMLVW[] = "CXMLVWEB"; - -#ifdef _DLL_ -const sal_Char* GetFILTER_XML() -{ - return FILTER_XML; -} -const sal_Char* GetFILTER_WW8() -{ - return FILTER_WW8; -} -#endif - -SwIoDetect aReaderWriter[ MAXFILTER ] = -{ -///* 0*/ SwIoEntry(FILTER_SW5, 4, &::GetSw3Writer, TRUE), -///* 1*/ SwIoEntry(FILTER_SW4, 4, &::GetSw3Writer, FALSE), -///* 2*/ SwIoEntry(FILTER_SW3, 4, &::GetSw3Writer, FALSE), -///* 3*/ SwIoEntry(FILTER_SWG, STRING_LEN, 0, TRUE), -///* 4*/ SwIoEntry(FILTER_SWGV, 4, 0, FALSE), -/* 5*/ SwIoEntry(FILTER_RTF, STRING_LEN, &::GetRTFWriter, TRUE), -///* 6*/ SwIoEntry(sSwDos, STRING_LEN, 0, TRUE), -/* 7*/ SwIoEntry(FILTER_BAS, STRING_LEN, &::GetASCWriter, FALSE), -/* 8*/ SwIoEntry(sWW6, STRING_LEN, &::GetWW8Writer, TRUE), -/* 9*/ SwIoEntry(FILTER_WW8, STRING_LEN, &::GetWW8Writer, FALSE), -///* 10*/ SwIoEntry(FILTER_W4W, 3, &::GetW4WWriter, TRUE), -/* 11*/ SwIoEntry(sRtfWH, STRING_LEN, &::GetRTFWriter, FALSE), -///* 12*/ SwIoEntry(sCExcel, 5, 0, TRUE), -///* 13*/ SwIoEntry(sExcel, 4, 0, FALSE), -///* 14*/ SwIoEntry(sLotusD, 5, 0, TRUE), -/* 15*/ SwIoEntry(sHTML, 4, &::GetHTMLWriter, TRUE), -/* 16*/ SwIoEntry(sWW1, STRING_LEN, 0, TRUE), -/* 17*/ SwIoEntry(sWW5, STRING_LEN, 0, FALSE), -///* 18*/ SwIoEntry(sSwg1, 4, 0, FALSE), -/* 19*/ SwIoEntry(FILTER_XML, 4, &::GetXMLWriter, TRUE), -/*20*/ SwIoEntry(FILTER_TEXT_DLG, 8, &::GetASCWriter, TRUE), -/*last*/ SwIoEntry(FILTER_TEXT, 4, &::GetASCWriter, TRUE) -}; - -const char* pSw = "swriter"; -const char* pSwWeb = "swriter/web"; - -// Filter erkennung -struct W1_FIB -{ - SVBT16 wIdent; // 0x0 int magic number - SVBT16 nFib; // 0x2 FIB version written - SVBT16 nProduct; // 0x4 product version written by - SVBT16 nlocale; // 0x6 language stamp---localized version; - SVBT16 pnNext; // 0x8 - SVBT16 fFlags; - - USHORT nFibGet() { return SVBT16ToShort(nFib); } - USHORT wIdentGet() { return SVBT16ToShort(wIdent); } - USHORT fFlagsGet() { return SVBT16ToShort(fFlags); } - // SVBT16 fComplex :1;// 0004 when 1, file is in complex, fast-saved format. - BOOL fComplexGet() { return static_cast< BOOL >((fFlagsGet() >> 2) & 1); } -}; - -const sal_Char* SwIoDetect::IsReader(const sal_Char* pHeader, ULONG nLen_, - const String & /*rFileName*/, const String& /*rUserData*/) const -{ - int bRet = FALSE; - if( sHTML == pName ) - bRet = HTMLParser::IsHTMLFormat( pHeader, TRUE, RTL_TEXTENCODING_DONTKNOW ); - else if( FILTER_RTF == pName ) - bRet = 0 == strncmp( "{\\rtf", pHeader, 5 ); - else if( sWW5 == pName ) - { - W1_FIB *pW1Header = (W1_FIB*)pHeader; - if (pW1Header->wIdentGet() == 0xA5DC && pW1Header->nFibGet() == 0x65) - bRet = true; /*WW5*/ - else if (pW1Header->wIdentGet() == 0xA5DB && pW1Header->nFibGet() == 0x2D) - bRet = true; /*WW2*/ - } - else if( sWW1 == pName ) - { - bRet = (( ((W1_FIB*)pHeader)->wIdentGet() == 0xA59C - && ((W1_FIB*)pHeader)->nFibGet() == 0x21) - && ((W1_FIB*)pHeader)->fComplexGet() == 0); - } - else if (FILTER_TEXT == pName) - bRet = SwIoSystem::IsDetectableText(pHeader, nLen_); - else if( FILTER_TEXT_DLG == pName) - bRet = SwIoSystem::IsDetectableText( pHeader, nLen_, 0, 0, 0, true); - return bRet ? pName : 0; -} - -const String SwIoSystem::GetSubStorageName( const SfxFilter& rFltr ) -{ - /* bei den StorageFiltern noch den SubStorageNamen setzen */ - const String& rUserData = rFltr.GetUserData(); - if( rUserData.EqualsAscii(FILTER_XML) || - rUserData.EqualsAscii(FILTER_XMLV) || - rUserData.EqualsAscii(FILTER_XMLVW) ) - return String::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "content.xml" )); - if( rUserData.EqualsAscii(sWW6) || rUserData.EqualsAscii(FILTER_WW8) ) - return String::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "WordDocument" )); - return String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "" )); -} -const SfxFilter* SwIoSystem::GetFilterOfFormat(const String& rFmtNm, - const SfxFilterContainer* pCnt) -{ - SfxFilterContainer aCntSw( String::CreateFromAscii( pSw ) ); - SfxFilterContainer aCntSwWeb( String::CreateFromAscii( pSwWeb ) ); - const SfxFilterContainer* pFltCnt = pCnt ? pCnt : ( IsDocShellRegistered() ? &aCntSw : &aCntSwWeb ); - - do { - if( pFltCnt ) - { - SfxFilterMatcher aMatcher( pFltCnt->GetName() ); - SfxFilterMatcherIter aIter( &aMatcher ); - const SfxFilter* pFilter = aIter.First(); - while ( pFilter ) - { - if( pFilter->GetUserData() == rFmtNm ) - return pFilter; - pFilter = aIter.Next(); - } - } - if( pCnt || pFltCnt == &aCntSwWeb ) - break; - pFltCnt = &aCntSwWeb; - } while( TRUE ); - return 0; -} - -BOOL SwIoSystem::IsValidStgFilter( const uno::Reference < embed::XStorage >& rStg, const SfxFilter& rFilter) -{ - BOOL bRet = FALSE; - try - { - ULONG nStgFmtId = SotStorage::GetFormatID( rStg ); - bRet = rStg->isStreamElement( ::rtl::OUString::createFromAscii("content.xml") ); - if ( bRet ) - bRet = ( nStgFmtId && ( rFilter.GetFormat() == nStgFmtId ) ); - } - catch ( uno::Exception& ) - { - } - - return bRet; -} - -BOOL SwIoSystem::IsValidStgFilter(SotStorage& rStg, const SfxFilter& rFilter) -{ - ULONG nStgFmtId = rStg.GetFormat(); - /*#i8409# We cannot trust the clipboard id anymore :-(*/ - if( rFilter.GetUserData().EqualsAscii(FILTER_WW8) || - rFilter.GetUserData().EqualsAscii(sWW6) ) - { - nStgFmtId = 0; - } - - BOOL bRet = SVSTREAM_OK == rStg.GetError() && - ( !nStgFmtId || rFilter.GetFormat() == nStgFmtId ) && - ( rStg.IsContained( SwIoSystem::GetSubStorageName( rFilter )) ); - if( bRet ) - { - /* Bug 53445 - es gibt Excel Docs ohne ClipBoardId! */ - /* Bug 62703 - und auch WinWord Docs ohne ClipBoardId! */ - if( rFilter.GetUserData().EqualsAscii(FILTER_WW8) || - rFilter.GetUserData().EqualsAscii(sWW6) ) - { - bRet = !((rStg.IsContained( String::CreateFromAscii("0Table" )) || - rStg.IsContained( String::CreateFromAscii("1Table" ))) ^ - rFilter.GetUserData().EqualsAscii(FILTER_WW8)); - if (bRet && !rFilter.IsAllowedAsTemplate()) - { - SotStorageStreamRef xRef = - rStg.OpenSotStream(String::CreateFromAscii("WordDocument"), - STREAM_STD_READ | STREAM_NOCREATE ); - xRef->Seek(10); - BYTE nByte; - *xRef >> nByte; - bRet = !(nByte & 1); - } - } -// else if( !rFilter.GetUserData().EqualsAscii(sCExcel) ) -// bRet = rFilter.GetFormat() == nStgFmtId; - } - return bRet; -} - -void TerminateBuffer(sal_Char *pBuffer, ULONG nBytesRead, ULONG nBufferLen) -{ - ASSERT(nBytesRead <= nBufferLen - 2, - "what you read must be less than the max + null termination"); - ASSERT(!(nBufferLen & 0x00000001), "nMaxReadBuf must be an even number"); - if (nBytesRead <= nBufferLen - 2) - { - pBuffer[nBytesRead] = '\0'; - pBuffer[nBytesRead+1] = '\0'; - if (nBytesRead & 0x00000001) - pBuffer[nBytesRead+2] = '\0'; - } -} - - /* Feststellen ob das File in dem entsprechenden Format vorliegt. */ - /* Z.z werden nur unsere eigene Filter unterstuetzt */ -BOOL SwIoSystem::IsFileFilter( SfxMedium& rMedium, const String& rFmtName, - const SfxFilter** ppFilter ) -{ - BOOL bRet = FALSE; - - SfxFilterContainer aCntSw( String::CreateFromAscii( pSw ) ); - SfxFilterContainer aCntSwWeb( String::CreateFromAscii( pSwWeb ) ); - const SfxFilterContainer& rFltContainer = IsDocShellRegistered() ? aCntSw : aCntSwWeb; - - uno::Reference < embed::XStorage > xStor; - SotStorageRef xStg; - if (rMedium.IsStorage()) - xStor = rMedium.GetStorage(); - else - { - SvStream* pStream = rMedium.GetInStream(); - if ( pStream && SotStorage::IsStorageFile(pStream) ) - xStg = new SotStorage( pStream, FALSE ); - } - - SfxFilterMatcher aMatcher( rFltContainer.GetName() ); - SfxFilterMatcherIter aIter( &aMatcher ); - const SfxFilter* pFltr = aIter.First(); - while ( pFltr ) - { - if( pFltr->GetUserData() == rFmtName ) - { - const String& rUserData = pFltr->GetUserData(); - if( 'C' == *rUserData.GetBuffer() ) - { - if ( xStor.is() ) - bRet = IsValidStgFilter( xStor, *pFltr ); - else if ( xStg.Is() ) - bRet = xStg.Is() && IsValidStgFilter( *xStg, *pFltr ); - bRet = bRet && (pFltr->GetUserData() == rFmtName); - } - else if( !xStg.Is() && !xStor.is() ) - { - SvStream* pStrm = rMedium.GetInStream(); - if( pStrm && !pStrm->GetError() ) - { - sal_Char aBuffer[4098]; - const ULONG nMaxRead = sizeof(aBuffer) - 2; - ULONG nBytesRead = pStrm->Read(aBuffer, nMaxRead); - pStrm->Seek(STREAM_SEEK_TO_BEGIN); - TerminateBuffer(aBuffer, nBytesRead, sizeof(aBuffer)); - for (USHORT i = 0; i < MAXFILTER; ++i) - { - if (aReaderWriter[i].IsFilter(rFmtName)) - { - bRet = 0 != aReaderWriter[i].IsReader( aBuffer, nBytesRead, - rMedium.GetPhysicalName(), rUserData ); - break; - } - } - } - } - - if( bRet && ppFilter ) - *ppFilter = pFltr; - } - - pFltr = aIter.Next(); - } - - return bRet; -} - -/* die Methode stellt fest, von welchem Typ der stream (File) ist. */ -/* Es wird versucht, eine dem Filter entsprechende Byte-Folge zu finden. */ -/* Wird kein entsprechender gefunden, wird zur Zeit der ASCII-Reader */ -/* returnt !! Der Returnwert ist der interne Filtername! */ -/* rPrefFltName ist der interne Name des Filters, den der Benutzer im */ -/* Open-Dialog eingestellt hat. */ -const SfxFilter* SwIoSystem::GetFileFilter(const String& rFileName, - const String& rPrefFltName, SfxMedium* pMedium) -{ - SfxFilterContainer aCntSw( String::CreateFromAscii( pSw ) ); - SfxFilterContainer aCntSwWeb( String::CreateFromAscii( pSwWeb ) ); - const SfxFilterContainer* pFCntnr = IsDocShellRegistered() ? &aCntSw : &aCntSwWeb; - - if( !pFCntnr ) - return 0; - - SfxFilterMatcher aMatcher( pFCntnr->GetName() ); - SfxFilterMatcherIter aIter( &aMatcher ); - const SfxFilter* pFilter = aIter.First(); - if ( !pFilter ) - return 0; - - if( pMedium ? ( pMedium->IsStorage() || SotStorage::IsStorageFile( pMedium->GetInStream() ) ) : SotStorage::IsStorageFile( rFileName ) ) - { - // package storage or OLEStorage based format - SotStorageRef xStg; - BOOL bDeleteMedium = FALSE; - if (!pMedium ) - { - INetURLObject aObj; - aObj.SetSmartProtocol( INET_PROT_FILE ); - aObj.SetSmartURL( rFileName ); - pMedium = new SfxMedium( aObj.GetMainURL( INetURLObject::NO_DECODE ), STREAM_STD_READ, FALSE ); - bDeleteMedium = TRUE; - } - - // templates should not get precedence over "normal" filters (#i35508, #i33168) - const SfxFilter* pTemplateFilter = 0; - const SfxFilter* pOldFilter = pFCntnr->GetFilter4FilterName( rPrefFltName ); - BOOL bLookForTemplate = pOldFilter && pOldFilter->IsOwnTemplateFormat(); - if ( pMedium->IsStorage() ) - { - uno::Reference < embed::XStorage > xStor = pMedium->GetStorage(); - if ( xStor.is() ) - { - while ( pFilter ) - { - if( 'C' == *pFilter->GetUserData().GetBuffer() && IsValidStgFilter( xStor, *pFilter ) ) - { - if ( pFilter->IsOwnTemplateFormat() && !bLookForTemplate ) - // found template filter; maybe there's a "normal" one also - pTemplateFilter = pFilter; - else - return pFilter; - } - - pFilter = aIter.Next(); - } - - // there's only a template filter that could be found - if ( pTemplateFilter ) - pFilter = pTemplateFilter; - } - } - else - { - SvStream* pStream = pMedium->GetInStream(); - if ( pStream && SotStorage::IsStorageFile(pStream) ) - xStg = new SotStorage( pStream, FALSE ); - - if( xStg.Is() && ( xStg->GetError() == SVSTREAM_OK ) ) - { - while ( pFilter ) - { - if( 'C' == *pFilter->GetUserData().GetBuffer() && IsValidStgFilter( *xStg, *pFilter ) ) - { - if ( pFilter->IsOwnTemplateFormat() && !bLookForTemplate ) - // found template filter; maybe there's a "normal" one also - pTemplateFilter = pFilter; - else - return pFilter; - } - - pFilter = aIter.Next(); - } - - // there's only a template filter that could be found - if ( pTemplateFilter ) - pFilter = pTemplateFilter; - - } - } - - return pFilter; - } - - sal_Char aBuffer[4098]; - const ULONG nMaxRead = sizeof(aBuffer) - 2; - ULONG nBytesRead = 0; - if (pMedium) - { - SvStream* pIStrm = pMedium->GetInStream(); - if( !pIStrm || SVSTREAM_OK != pIStrm->GetError() ) - return 0; - ULONG nCurrPos = pIStrm->Tell(); - nBytesRead = pIStrm->Read(aBuffer, nMaxRead); - pIStrm->Seek( nCurrPos ); - } - /* - else - { - SvFileStream aStrm( rFileName, STREAM_READ ); - - // ohne FileName oder ohne Stream gibts nur den ANSI-Filter - if( !rFileName.Len() || SVSTREAM_OK != aStrm.GetError() ) - return 0; - - nBytesRead = aStrm.Read(aBuffer, nMaxRead); - aStrm.Close(); - }*/ - - TerminateBuffer(aBuffer, nBytesRead, sizeof(aBuffer)); - - - /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ - /* suche nach dem bestimmten Filter, falls kein entsprechender */ - /* gefunden wird, so wird der ASCII-Filter returnt. */ - /* Gibt es Filter ohne einen Identifizierungs-String, so werden diese */ - /* nie erkannt und es wird auch der ASCII-Filter returnt. */ - /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ - { - const SfxFilter* pFilterTmp = 0; - const sal_Char* pNm; - for( USHORT n = 0; n < MAXFILTER; ++n ) - { - String sEmptyUserData; - pNm = aReaderWriter[n].IsReader(aBuffer, nBytesRead, rFileName, sEmptyUserData); - pFilterTmp = pNm ? SwIoSystem::GetFilterOfFormat(String::CreateFromAscii(pNm), pFCntnr) : 0; - if (pNm && pFilterTmp) - { - return pFilterTmp; - } - } - } - - /* Ok, bis jetzt kein Filter gefunden, also befrage mal die */ - /* "WORD 4 WORD" Filter */ - if( rFileName.Len() ) - { - if( pMedium ) - pMedium->CloseInStream(); - - } - return SwIoSystem::GetTextFilter( aBuffer, nBytesRead); -} - -bool SwIoSystem::IsDetectableText(const sal_Char* pBuf, ULONG &rLen, - CharSet *pCharSet, bool *pSwap, LineEnd *pLineEnd, bool bEncodedFilter) -{ - bool bSwap = false; - CharSet eCharSet = RTL_TEXTENCODING_DONTKNOW; - bool bLE = true; - ULONG nHead=0; - /*See if its a known unicode type*/ - if (rLen >= 2) - { - if (rLen > 2 && BYTE(pBuf[0]) == 0xEF && BYTE(pBuf[1]) == 0xBB && - BYTE(pBuf[2]) == 0xBF) - { - eCharSet = RTL_TEXTENCODING_UTF8; - nHead = 3; - } - else if (BYTE(pBuf[0]) == 0xFE && BYTE(pBuf[1]) == 0xFF) - { - eCharSet = RTL_TEXTENCODING_UCS2; - bLE = false; - nHead = 2; - } - else if (BYTE(pBuf[1]) == 0xFE && BYTE(pBuf[0]) == 0xFF) - { - eCharSet = RTL_TEXTENCODING_UCS2; - nHead = 2; - } - pBuf+=nHead; - rLen-=nHead; - } - - bool bCR = false, bLF = false, bNoNormalChar = false, - bIsBareUnicode = false; - - if (eCharSet != RTL_TEXTENCODING_DONTKNOW) - { - String sWork; - sal_Unicode *pNewBuf = sWork.AllocBuffer( static_cast< xub_StrLen >(rLen)); - sal_Size nNewLen; - if (eCharSet != RTL_TEXTENCODING_UCS2) - { - nNewLen = rLen; - rtl_TextToUnicodeConverter hConverter = - rtl_createTextToUnicodeConverter(eCharSet); - rtl_TextToUnicodeContext hContext = - rtl_createTextToUnicodeContext(hConverter); - - sal_Size nCntBytes; - sal_uInt32 nInfo; - nNewLen = rtl_convertTextToUnicode( hConverter, hContext, pBuf, - rLen, pNewBuf, nNewLen, - (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT | - RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT | - RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT), &nInfo, &nCntBytes); - - rtl_destroyTextToUnicodeContext(hConverter, hContext); - rtl_destroyTextToUnicodeConverter(hConverter); - } - else - { - nNewLen = rLen/2; - memcpy(pNewBuf, pBuf, rLen); -#ifdef OSL_LITENDIAN - bool bNativeLE = true; -#else - bool bNativeLE = false; -#endif - if (bLE != bNativeLE) - { - bSwap = true; - sal_Char* pF = (sal_Char*)pNewBuf; - sal_Char* pN = pF+1; - for(xub_StrLen n = 0; n < nNewLen; ++n, pF+=2, pN+=2) - { - sal_Char c = *pF; - *pF = *pN; - *pN = c; - } - } - } - - sWork.ReleaseBufferAccess( static_cast< xub_StrLen >(nNewLen) ); - pNewBuf = sWork.GetBufferAccess(); - - for (ULONG nCnt = 0; nCnt < nNewLen; ++nCnt, ++pNewBuf) - { - switch (*pNewBuf) - { - case 0xA: - bLF = true; - break; - case 0xD: - bCR = true; - break; - default: - break; - } - } - } - else - { - for( ULONG nCnt = 0; nCnt < rLen; ++nCnt, ++pBuf ) - { - switch (*pBuf) - { - case 0x0: - if( nCnt + 1 < rLen && !*(pBuf+1) ) - return 0; - bIsBareUnicode = true; - break; - case 0xA: - bLF = true; - break; - case 0xD: - bCR = true; - break; - case 0xC: - case 0x1A: - case 0x9: - break; - default: - if (0x20 > (BYTE)*pBuf) - bNoNormalChar = true; - break; - } - } - } - - LineEnd eSysLE = GetSystemLineEnd(); - LineEnd eLineEnd; - if (!bCR && !bLF) - eLineEnd = eSysLE; - else - eLineEnd = bCR ? ( bLF ? LINEEND_CRLF : LINEEND_CR ) : LINEEND_LF; - - if (pCharSet) - *pCharSet = eCharSet; - if (pSwap) - *pSwap = bSwap; - if (pLineEnd) - *pLineEnd = eLineEnd; - - return bEncodedFilter || (!bIsBareUnicode && eSysLE == eLineEnd); -} - -const SfxFilter* SwIoSystem::GetTextFilter( const sal_Char* pBuf, ULONG nLen) -{ - bool bAuto = IsDetectableText(pBuf, nLen); - const sal_Char* pNm = bAuto ? FILTER_TEXT : FILTER_TEXT_DLG; - return SwIoSystem::GetFilterOfFormat( String::CreateFromAscii(pNm), 0 ); -} - - -#endif diff --git a/sw/inc/iodetect.hxx b/sw/inc/iodetect.hxx new file mode 100644 index 000000000000..24467f7ad537 --- /dev/null +++ b/sw/inc/iodetect.hxx @@ -0,0 +1,130 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: iodetect.cxx,v $ + * $Revision: 1.31 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _IODETECT_HXX_ +#define _IODETECT_HXX_ + +#include +#include +#include +#include +#include // for ASSERT +#include +#include + +#define FILTER_RTF "RTF" // RTF-Filter +#define sRtfWH "WH_RTF" +#define FILTER_TEXT "TEXT" // Text-Filter mit Default-CodeSet +#define FILTER_BAS "BAS" // StarBasic (identisch mit ANSI) +#define FILTER_WW8 "CWW8" // WinWord 97-Filter +#define FILTER_TEXT_DLG "TEXT_DLG" // text filter with encoding dialog +#define FILTER_XML "CXML" // XML filter +#define FILTER_XMLV "CXMLV" // XML filter +#define FILTER_XMLVW "CXMLVWEB" // XML filter +#define sHTML "HTML" +#define sWW1 "WW1" +#define sWW5 "WW6" +#define sWW6 "CWW6" + +#define sSWRITER "swriter" +#define sSWRITERWEB "swriter/web" + +struct SwIoDetect +{ + const sal_Char* pName; + USHORT nLen; + + inline SwIoDetect( const sal_Char *pN, USHORT nL ) + : pName( pN ), nLen( nL ) + {} + + inline int IsFilter( const String& rNm ) const + { + return pName && rNm.EqualsAscii( pName, 0, nLen ); + } + + const sal_Char* IsReader( const sal_Char* pHeader, ULONG nLen_, + const String &rFileName, const String& rUserData ) const; +}; + +enum ReaderWriterEnum { + READER_WRITER_RTF, + READER_WRITER_BAS, + READER_WRITER_WW6, + READER_WRITER_WW8, + READER_WRITER_RTF_WH, + READER_WRITER_HTML, + READER_WRITER_WW1, + READER_WRITER_WW5, + READER_WRITER_XML, + READER_WRITER_TEXT_DLG, + READER_WRITER_TEXT, + MAXFILTER +}; + +extern SwIoDetect aFilterDetect[]; + +// Die folgende Klasse ist ein Wrappe fuer die Basic-I/O-Funktionen +// des Writer 3.0. Alles ist statisch. Alle u.a. Filternamen sind die +// Writer-internen Namen, d.h. die namen, die in INSTALL.INI vor dem +// Gleichheitszeichen stehen, z.b. SWG oder ASCII. + +class SwIoSystem +{ +public: + // suche ueber den internen FormatNamen den Filtereintrag + SW_DLLPUBLIC static const SfxFilter* GetFilterOfFormat( const String& rFormat, + const SfxFilterContainer* pCnt = 0 ); + + // Feststellen des zu verwendenden Filters fuer die uebergebene + // Datei. Der Filtername wird zurueckgeliefert. Konnte kein Filter + // zurueckgeliefert werden, wird der Name des ASCII-Filters geliefert! + static const SfxFilter* GetFileFilter( const String& rFileName, + const String& rPrefFltName, + SfxMedium* pMedium = 0 ); + + // Feststellen ob das File in dem vorgegebenen Format vorliegt. + // Z.z werden nur unsere eigene Filter unterstuetzt!! + static BOOL IsFileFilter( SfxMedium& rMedium, const String& rFmtName, + const SfxFilter** ppFlt = 0 ); + + static BOOL IsValidStgFilter( SotStorage& , const SfxFilter& ); + static BOOL IsValidStgFilter( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const SfxFilter& rFilter); + + static bool IsDetectableText( const sal_Char* pBuf, ULONG &rLen, + CharSet *pCharSet=0, bool *pSwap=0, LineEnd *pLineEnd=0, bool bEncodedFilter = false ); + // static bool IsDetectableW4W(const String& rFileName, const String& rUserData); + + static const SfxFilter* GetTextFilter( const sal_Char* pBuf, ULONG nLen ); + + static const String GetSubStorageName( const SfxFilter& rFltr ); +}; + +#endif diff --git a/sw/inc/mdiexp.hxx b/sw/inc/mdiexp.hxx index 69dc79bf5380..31df17358a77 100644 --- a/sw/inc/mdiexp.hxx +++ b/sw/inc/mdiexp.hxx @@ -32,6 +32,8 @@ #include #include +#include + class UniString; class SwRect; class Size; @@ -53,9 +55,9 @@ extern void PageNumNotify( ViewShell* pVwSh, enum FlyMode { FLY_DRAG_START, FLY_DRAG, FLY_DRAG_END }; extern void FrameNotify( ViewShell* pVwSh, FlyMode eMode = FLY_DRAG ); -void StartProgress ( USHORT nMessId, long nStartVal, long nEndVal, SwDocShell *pDocSh = 0 ); -void EndProgress ( SwDocShell *pDocSh = 0 ); -void SetProgressState ( long nPosition, SwDocShell *pDocShell ); +SW_DLLPUBLIC void StartProgress ( USHORT nMessId, long nStartVal, long nEndVal, SwDocShell *pDocSh = 0 ); +SW_DLLPUBLIC void EndProgress ( SwDocShell *pDocSh = 0 ); +SW_DLLPUBLIC void SetProgressState ( long nPosition, SwDocShell *pDocShell ); void SetProgressText ( USHORT nMessId, SwDocShell *pDocShell ); void RescheduleProgress( SwDocShell *pDocShell ); diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx index 536061940fd1..55b38090545a 100644 --- a/sw/inc/ndarr.hxx +++ b/sw/inc/ndarr.hxx @@ -84,7 +84,7 @@ typedef BOOL (*FnForEach_SwNodes)( const SwNodePtr&, void* pArgs ); SV_DECL_PTRARR_SORT( SwOutlineNodes, SwNodePtr, 0, 10 ) -class SwNodes: private BigPtrArray +class SW_DLLPUBLIC SwNodes: private BigPtrArray { friend class SwDoc; friend class SwNode; diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx index 1d8a3940c46b..45ecea30a9c0 100644 --- a/sw/inc/ndgrf.hxx +++ b/sw/inc/ndgrf.hxx @@ -48,7 +48,7 @@ class SvStorage; // -------------------- // SwGrfNode // -------------------- -class SwGrfNode: public SwNoTxtNode +class SW_DLLPUBLIC SwGrfNode: public SwNoTxtNode { friend class SwNodes; diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx index d1d66028a4aa..0942621991e8 100644 --- a/sw/inc/ndindex.hxx +++ b/sw/inc/ndindex.hxx @@ -39,7 +39,7 @@ class SwNode; class SwNodes; -class SwNodeIndex +class SW_DLLPUBLIC SwNodeIndex { friend void SwNodes::RegisterIndex( SwNodeIndex& ); friend void SwNodes::DeRegisterIndex( SwNodeIndex& ); @@ -112,7 +112,7 @@ public: /* * SwRange */ -class SwNodeRange +class SW_DLLPUBLIC SwNodeRange { public: SwNodeIndex aStart; diff --git a/sw/inc/ndnotxt.hxx b/sw/inc/ndnotxt.hxx index 5d7cab19f4b2..b123bfd70cb3 100644 --- a/sw/inc/ndnotxt.hxx +++ b/sw/inc/ndnotxt.hxx @@ -38,7 +38,7 @@ class PolyPolygon; // SwNoTxtNode // -------------------- -class SwNoTxtNode : public SwCntntNode +class SW_DLLPUBLIC SwNoTxtNode : public SwCntntNode { friend class SwNodes; friend class SwNoTxtFrm; diff --git a/sw/inc/ndole.hxx b/sw/inc/ndole.hxx index 6e0838d06671..41dde811bc40 100644 --- a/sw/inc/ndole.hxx +++ b/sw/inc/ndole.hxx @@ -40,7 +40,7 @@ class SwOLENode; class SwOLEListener_Impl; class SwEmbedObjectLink; -class SwOLEObj +class SW_DLLPUBLIC SwOLEObj { friend class SwOLENode; @@ -82,7 +82,7 @@ public: // SwOLENode // -------------------- -class SwOLENode: public SwNoTxtNode +class SW_DLLPUBLIC SwOLENode: public SwNoTxtNode { friend class SwNodes; mutable SwOLEObj aOLEObj; diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index fc15c370db3e..029e8a8b8454 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -367,7 +367,7 @@ private: // -------------------- // SwCntntNode // -------------------- -class SwCntntNode: public SwModify, public SwNode, public SwIndexReg +class SW_DLLPUBLIC SwCntntNode: public SwModify, public SwNode, public SwIndexReg { // Der Reader darf NewAttrSet() aufrufen! // friend class SwSwgReader; @@ -510,7 +510,7 @@ private: //--------- // SwTableNode //--------- -class SwTableNode : public SwStartNode +class SW_DLLPUBLIC SwTableNode : public SwStartNode { friend class SwNodes; SwTable* pTable; diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx index 8715cba74ae5..9b3714c806bf 100644 --- a/sw/inc/numrule.hxx +++ b/sw/inc/numrule.hxx @@ -347,7 +347,7 @@ namespace numfunc @author OD */ - const Font& GetDefBulletFont(); + SW_DLLPUBLIC const Font& GetDefBulletFont(); /** retrieve unicode of character used for the default bullet list for the given list level diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx index f4237c6b964b..b568a474cd7c 100644 --- a/sw/inc/pam.hxx +++ b/sw/inc/pam.hxx @@ -55,7 +55,7 @@ namespace utl { class TextSearch; } -struct SwPosition +struct SW_DLLPUBLIC SwPosition { SwNodeIndex nNode; SwIndex nContent; @@ -113,12 +113,12 @@ SwComparePosition ComparePosition( struct SwMoveFnCollection; typedef SwMoveFnCollection* SwMoveFn; SW_DLLPUBLIC extern SwMoveFn fnMoveForward; // SwPam::Move()/Find() default argument. -extern SwMoveFn fnMoveBackward; +SW_DLLPUBLIC extern SwMoveFn fnMoveBackward; typedef BOOL (*SwGoInDoc)( SwPaM& rPam, SwMoveFn fnMove ); -extern SwGoInDoc fnGoDoc; +SW_DLLPUBLIC extern SwGoInDoc fnGoDoc; extern SwGoInDoc fnGoSection; -extern SwGoInDoc fnGoNode; +SW_DLLPUBLIC extern SwGoInDoc fnGoNode; SW_DLLPUBLIC extern SwGoInDoc fnGoCntnt; // SwPam::Move() default argument. extern SwGoInDoc fnGoCntntCells; extern SwGoInDoc fnGoCntntSkipHidden; @@ -126,7 +126,7 @@ extern SwGoInDoc fnGoCntntCellsSkipHidden; void _InitPam(); -class SwPaM : public Ring +class SW_DLLPUBLIC SwPaM : public Ring { SwPosition aBound1; SwPosition aBound2; diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx index b05f132b5e23..871c9f477f9a 100644 --- a/sw/inc/redline.hxx +++ b/sw/inc/redline.hxx @@ -91,7 +91,7 @@ public: }; -class SwRedlineData +class SW_DLLPUBLIC SwRedlineData { friend class SwRedline; SwRedlineData* pNext; // Verweis auf weitere Daten @@ -169,7 +169,7 @@ public: }; -class SwRedline : public SwPaM +class SW_DLLPUBLIC SwRedline : public SwPaM { SwRedlineData* pRedlineData; SwNodeIndex* pCntntSect; diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx index d40320cf0543..bc1453b561df 100644 --- a/sw/inc/shellio.hxx +++ b/sw/inc/shellio.hxx @@ -32,17 +32,22 @@ #include #include +#include +#include +#include +#include +#include #include #include #include #include #include -#include -#include "swdllapi.h" +#include +#include #include #include // SwDocFac - -#include +#include +#include // einige Forward - Deklarationen class SfxFilterContainer; @@ -210,7 +215,7 @@ protected: #define SW_STREAM_READER 1 #define SW_STORAGE_READER 2 -class Reader +class SW_DLLPUBLIC Reader { friend class SwReader; SwDoc* pTemplate; @@ -292,12 +297,6 @@ private: virtual int SetStrmStgPtr(); }; -class RtfReader: public Reader -{ - virtual ULONG Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &); -}; - - class AsciiReader: public Reader { friend class SwReader; @@ -311,7 +310,7 @@ public: virtual ULONG Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &); }; */ -class StgReader : public Reader +class SW_DLLPUBLIC StgReader : public Reader { String aFltName; @@ -411,7 +410,7 @@ public: extern void _InitFilter(); extern void _FinitFilter(); -extern SwRead ReadRtf, ReadAscii, /*ReadSwg, ReadSw3, */ReadHTML, ReadXML; +extern SwRead ReadAscii, /*ReadSwg, ReadSw3, */ReadHTML, ReadXML; //SW_DLLPUBLIC SwRead SwGetReaderSw3(); SW_DLLPUBLIC SwRead SwGetReaderXML(); @@ -435,7 +434,7 @@ extern BOOL SetHTMLTemplate( SwDoc &rDoc ); //Fuer Vorlagen aus HTML.vor laden s class IDocumentSettingAccess; class IDocumentStylePoolAccess; -class Writer : public SvRefBase +class SW_DLLPUBLIC Writer : public SvRefBase { SwAsciiOptions aAscOpts; String sBaseURL; @@ -555,7 +554,7 @@ SV_DECL_REF(Writer) SV_IMPL_REF(Writer) // Basisklasse fuer alle Storage-Writer -class StgWriter : public Writer +class SW_DLLPUBLIC StgWriter : public Writer { protected: String aFltName; @@ -636,81 +635,44 @@ public: /* */ ///////////////////////////////////////////////////////////////////////////// -void GetRTFWriter( const String&, const String&, WriterRef& ); -void GetASCWriter( const String&, const String&, WriterRef& ); -//void GetSw3Writer( const String&, const String&, WriterRef& ); -void GetHTMLWriter( const String&, const String&, WriterRef& ); -void GetXMLWriter( const String&, const String&, WriterRef& ); - -// Die folgende Klasse ist ein Wrappe fuer die Basic-I/O-Funktionen -// des Writer 3.0. Alles ist statisch. Alle u.a. Filternamen sind die -// Writer-internen Namen, d.h. die namen, die in INSTALL.INI vor dem -// Gleichheitszeichen stehen, z.b. SWG oder ASCII. +typedef Reader* (*FnGetReader)(); +typedef void (*FnGetWriter)(const String&, const String& rBaseURL, WriterRef&); -class SW_DLLPUBLIC SwIoSystem +struct SwReaderWriterEntry { -public: - // suche ueber den internen FormatNamen den Filtereintrag - static const SfxFilter* GetFilterOfFormat( const String& rFormat, - const SfxFilterContainer* pCnt = 0 ); - - // Feststellen des zu verwendenden Filters fuer die uebergebene - // Datei. Der Filtername wird zurueckgeliefert. Konnte kein Filter - // zurueckgeliefert werden, wird der Name des ASCII-Filters geliefert! - static const SfxFilter* GetFileFilter( const String& rFileName, - const String& rPrefFltName, - SfxMedium* pMedium = 0 ); - - // Feststellen ob das File in dem vorgegebenen Format vorliegt. - // Z.z werden nur unsere eigene Filter unterstuetzt!! - static BOOL IsFileFilter( SfxMedium& rMedium, const String& rFmtName, - const SfxFilter** ppFlt = 0 ); - - static BOOL IsValidStgFilter( SotStorage& , const SfxFilter& ); - static BOOL IsValidStgFilter( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const SfxFilter& rFilter); - - static bool IsDetectableText(const sal_Char* pBuf, ULONG &rLen, - CharSet *pCharSet=0, bool *pSwap=0, LineEnd *pLineEnd=0, bool bEncodedFilter = false); -// static bool IsDetectableW4W(const String& rFileName, const String& rUserData); - - static const SfxFilter* GetTextFilter(const sal_Char* pBuf, ULONG nLen); - // gebe einen bestimmten Reader zurueck - static Reader* GetReader( const String& rFltName ); - // gebe einen bestimmten Writer zurueck - static void GetWriter( const String& rFltName, const String& rBaseURL, WriterRef& xWrt ); - - static const String GetSubStorageName( const SfxFilter& rFltr ); + Reader* pReader; + FnGetReader fnGetReader; + FnGetWriter fnGetWriter; + BOOL bDelReader; + + SwReaderWriterEntry( const FnGetReader fnReader, const FnGetWriter fnWriter, BOOL bDel ) + : pReader( NULL ), fnGetReader( fnReader ), fnGetWriter( fnWriter ), bDelReader( bDel ) + {} + + /// Get access to the reader + Reader* GetReader(); + + /// Get access to the writer + void GetWriter( const String& rNm, const String& rBaseURL, WriterRef& xWrt ) const; }; +namespace SwReaderWriter +{ + /// Return reader based on ReaderWriterEnum + Reader* GetReader( ReaderWriterEnum eReader ); + + /// Return reader based on the name + Reader* GetReader( const String& rFltName ); + + /// Return writer based on the name + void GetWriter( const String& rFltName, const String& rBaseURL, WriterRef& xWrt ); +} -// ---------------------------------- -// diese Filter sind immer vorhanden und koennen ueber die -// Formatnamen gesucht werden. Alle anderen Filter sind nur intern -// bekannt. Die UI-Seite benutzt die GetReader()/GetWriter() -Funktionen, -// um die speziellen zu erhalten. - -//extern const sal_Char __FAR_DATA FILTER_SWG[]; // SWG-Filter -extern const sal_Char __FAR_DATA FILTER_RTF[]; // RTF-Filter -extern const sal_Char __FAR_DATA FILTER_TEXT[]; // Text-Filter mit Default-CodeSet -extern const sal_Char __FAR_DATA FILTER_BAS[]; // StarBasic (identisch mit ANSI) -//extern const sal_Char __FAR_DATA FILTER_W4W[]; // W4W-Filter -extern const sal_Char __FAR_DATA FILTER_WW8[]; // WinWord 97-Filter -//extern const sal_Char __FAR_DATA FILTER_SW3[]; // SW3-Storage Filter -//extern const sal_Char __FAR_DATA FILTER_SW4[]; // SW4-Storage Filter -//extern const sal_Char __FAR_DATA FILTER_SW4[]; // SW4-Storage Filter -//extern const sal_Char __FAR_DATA FILTER_SW5[]; // SW5-Storage Filter -//extern const sal_Char __FAR_DATA FILTER_SWGV[]; // SWG-Vorlagen Filter -//extern const sal_Char __FAR_DATA FILTER_SW3V[]; // SW3-Storage Vorlagen Filter -//extern const sal_Char __FAR_DATA FILTER_SW4V[]; // SW4-Storage Vorlagen Filter -//extern const sal_Char __FAR_DATA FILTER_SW5V[]; // SW5-Storage Vorlagen Filter -//extern const sal_Char __FAR_DATA FILTER_SWW4V[]; // SW/Web Storage Vorlagen Filter -//extern const sal_Char __FAR_DATA FILTER_SWW5V[]; // SW/Web Storage Vorlagen Filter -extern const sal_Char __FAR_DATA FILTER_TEXT_DLG[]; // text filter with encoding dialog -extern const sal_Char __FAR_DATA FILTER_XML[]; // XML filter -extern const sal_Char __FAR_DATA FILTER_XMLV[]; // XML filter -extern const sal_Char __FAR_DATA FILTER_XMLVW[]; // XML filter - -SW_DLLPUBLIC const sal_Char* GetFILTER_XML(); -SW_DLLPUBLIC const sal_Char* GetFILTER_WW8(); +void GetRTFWriter( const String&, const String&, WriterRef& ); +void GetASCWriter( const String&, const String&, WriterRef& ); +//void GetSw3Writer( const String&, const String&, WriterRef& ); +void GetHTMLWriter( const String&, const String&, WriterRef& ); +void GetXMLWriter( const String&, const String&, WriterRef& ); +void GetWW8Writer( const String&, const String&, WriterRef& ); #endif diff --git a/sw/inc/shellres.hxx b/sw/inc/shellres.hxx index be63a2984742..4c7bb09ebe45 100644 --- a/sw/inc/shellres.hxx +++ b/sw/inc/shellres.hxx @@ -42,7 +42,7 @@ #include #endif -struct ShellResource : public Resource +struct SW_DLLPUBLIC ShellResource : public Resource { String aPostItAuthor; String aPostItPage; diff --git a/sw/inc/sw.mk b/sw/inc/sw.mk index dffaeea33716..e827ec156025 100644 --- a/sw/inc/sw.mk +++ b/sw/inc/sw.mk @@ -37,6 +37,8 @@ CDEFS+=-DACCESSIBLE_LAYOUT # define SW_DLLIMPLEMENTATION (see @ swdllapi.h) +.IF "$(MAKING_LIBMSWORD)" != "TRUE" CDEFS += -DSW_DLLIMPLEMENTATION +.ENDIF VISIBILITY_HIDDEN=TRUE diff --git a/sw/inc/swatrset.hxx b/sw/inc/swatrset.hxx index e420a4db5f2d..3c5df0617713 100644 --- a/sw/inc/swatrset.hxx +++ b/sw/inc/swatrset.hxx @@ -33,7 +33,7 @@ #include #include #include - +#include class SwModify; class SwDoc; @@ -171,7 +171,7 @@ public: }; -class SwAttrSet : public SfxItemSet +class SW_DLLPUBLIC SwAttrSet : public SfxItemSet { // Pointer fuers Modify-System SwAttrSet *pOldSet, *pNewSet; @@ -344,7 +344,7 @@ public: }; //Helper for filters to find true lineheight of a font -long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess, +SW_DLLPUBLIC long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess, const SwAttrSet &rSet, const OutputDevice &rOut, sal_Int16 nScript); #endif diff --git a/sw/inc/swfltopt.hxx b/sw/inc/swfltopt.hxx index 94ef51c83617..8b7e9c2ea451 100644 --- a/sw/inc/swfltopt.hxx +++ b/sw/inc/swfltopt.hxx @@ -32,7 +32,7 @@ #include -class SwFilterOptions : public utl::ConfigItem +class SW_DLLPUBLIC SwFilterOptions : public utl::ConfigItem { public: SwFilterOptions( sal_uInt16 nCnt, const sal_Char** ppNames, diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx index 03aad91d2242..ab3311e2fee2 100644 --- a/sw/inc/swmodule.hxx +++ b/sw/inc/swmodule.hxx @@ -77,7 +77,7 @@ namespace com{ namespace sun{ namespace star{ namespace scanner{ class XScannerManager; }}}} -class SwModule: public SfxModule, public SfxListener +class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener { String sActAuthor; @@ -157,29 +157,29 @@ public: void ExecOther(SfxRequest &); // Felder, Formel .. // Benutzereinstellungen modifizieren - SW_DLLPUBLIC const SwMasterUsrPref *GetUsrPref(sal_Bool bWeb) const; + const SwMasterUsrPref *GetUsrPref(sal_Bool bWeb) const; const SwViewOption* GetViewOption(sal_Bool bWeb); void ApplyUsrPref(const SwViewOption &, SwView*, sal_uInt16 nDest = VIEWOPT_DEST_VIEW ); void ApplyUserMetric( FieldUnit eMetric, BOOL bWeb ); - SW_DLLPUBLIC void ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags); - SW_DLLPUBLIC void ApplyLinkMode(sal_Int32 nNewLinkMode); + void ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags); + void ApplyLinkMode(sal_Int32 nNewLinkMode); //default page mode for text grid - SW_DLLPUBLIC void ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode); + void ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode); // ConfigItems erzeugen SwModuleOptions* GetModuleConfig() { return pModuleConfig;} - SW_DLLPUBLIC SwPrintOptions* GetPrtOptions(sal_Bool bWeb); - SW_DLLPUBLIC SwChapterNumRules* GetChapterNumRules(); + SwPrintOptions* GetPrtOptions(sal_Bool bWeb); + SwChapterNumRules* GetChapterNumRules(); SwStdFontConfig* GetStdFontConfig() { return pStdFontConfig; } SwNavigationConfig* GetNavigationConfig(); SwToolbarConfigItem*GetToolbarConfig() { return pToolbarConfig; } SwToolbarConfigItem*GetWebToolbarConfig() { return pWebToolbarConfig; } - SW_DLLPUBLIC SwDBConfig* GetDBConfig(); + SwDBConfig* GetDBConfig(); svtools::ColorConfig& GetColorConfig(); - SW_DLLPUBLIC SvtAccessibilityOptions& GetAccessibilityOptions(); - SW_DLLPUBLIC SvtCTLOptions& GetCTLOptions(); + SvtAccessibilityOptions& GetAccessibilityOptions(); + SvtCTLOptions& GetCTLOptions(); SvtUserOptions& GetUserOptions(); SvtUndoOptions& GetUndoOptions(); diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx index 40aa72ec3d7c..1a62bb3d4dfd 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -85,7 +85,7 @@ typedef SwTableBox* SwTableBoxPtr; SV_DECL_PTRARR_SORT( SwTableSortBoxes, SwTableBoxPtr, 25, 50 ) typedef SwTableLine* SwTableLinePtr; -class SwTable: public SwClient //Client vom FrmFmt +class SW_DLLPUBLIC SwTable: public SwClient //Client vom FrmFmt { using SwClient::IsModifyLocked; @@ -328,7 +328,7 @@ public: #endif }; -class SwTableLine: public SwClient // Client vom FrmFmt +class SW_DLLPUBLIC SwTableLine: public SwClient // Client vom FrmFmt { SwTableBoxes aBoxes; SwTableBox *pUpper; @@ -367,7 +367,7 @@ public: bool hasSoftPageBreak() const; }; -class SwTableBox: public SwClient //Client vom FrmFmt +class SW_DLLPUBLIC SwTableBox: public SwClient //Client vom FrmFmt { friend class SwNodes; // um den Index umzusetzen ! friend void DelBoxNode(SwTableSortBoxes&); // um den StartNode* zu loeschen ! diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx index 9f23da9fdfa6..f19df7fd1894 100644 --- a/sw/inc/swtypes.hxx +++ b/sw/inc/swtypes.hxx @@ -103,9 +103,9 @@ const SwTwips lMinBorder = 1134; #define UNDO_ACTION_COUNT 20 // Konstante Strings -extern UniString aEmptyStr; // "" +SW_DLLPUBLIC extern UniString aEmptyStr; // "" extern ByteString aEmptyByteStr; // "" -extern UniString aDotStr; // '.' +SW_DLLPUBLIC extern UniString aDotStr; // '.' //Zum Einfuegen von Beschriftungen (wie bzw. wo soll eingefuegt werden). //Hier weil ein eigenes hxx nicht lohnt und es sonst nirgendwo so recht @@ -208,7 +208,7 @@ const sal_Unicode cMarkSeperator = '|'; extern const sal_Char* __FAR_DATA pMarkToTable; // Strings stehen extern const sal_Char* __FAR_DATA pMarkToFrame; // im Init.cxx extern const sal_Char* __FAR_DATA pMarkToRegion; -extern const sal_Char* __FAR_DATA pMarkToOutline; +SW_DLLPUBLIC extern const sal_Char* __FAR_DATA pMarkToOutline; extern const sal_Char* __FAR_DATA pMarkToText; extern const sal_Char* __FAR_DATA pMarkToGraphic; extern const sal_Char* __FAR_DATA pMarkToOLE; diff --git a/sw/inc/txtatr.hxx b/sw/inc/txtatr.hxx index fd9957c09e6d..50914169d6fc 100644 --- a/sw/inc/txtatr.hxx +++ b/sw/inc/txtatr.hxx @@ -81,7 +81,7 @@ public: // ****************************** -class SwTxtRuby : public SwTxtAttrEnd, public SwClient +class SW_DLLPUBLIC SwTxtRuby : public SwTxtAttrEnd, public SwClient { SwTxtNode* pMyTxtNd; diff --git a/sw/inc/txtftn.hxx b/sw/inc/txtftn.hxx index 80c372aad3e6..c2011babf8a9 100644 --- a/sw/inc/txtftn.hxx +++ b/sw/inc/txtftn.hxx @@ -39,7 +39,7 @@ class SwDoc; // ATT_FTN ********************************************************** -class SwTxtFtn : public SwTxtAttr +class SW_DLLPUBLIC SwTxtFtn : public SwTxtAttr { SwNodeIndex *pStartNode; SwTxtNode* pMyTxtNd; diff --git a/sw/inc/txtinet.hxx b/sw/inc/txtinet.hxx index ac404ad5ac12..ef55bf69d5c9 100644 --- a/sw/inc/txtinet.hxx +++ b/sw/inc/txtinet.hxx @@ -38,7 +38,7 @@ class Color; // ATT_INETFMT ********************************************* -class SwTxtINetFmt : public SwTxtAttrEnd, public SwClient +class SW_DLLPUBLIC SwTxtINetFmt : public SwTxtAttrEnd, public SwClient { SwTxtNode* pMyTxtNd; BOOL bVisited : 1; // Besuchter Link? diff --git a/sw/inc/unoobj.hxx b/sw/inc/unoobj.hxx index c7ec5d4ef73e..7893d198309c 100644 --- a/sw/inc/unoobj.hxx +++ b/sw/inc/unoobj.hxx @@ -710,7 +710,7 @@ public: /*-----------------23.02.98 12:05------------------- --------------------------------------------------*/ -class SwXTextRange : public cppu::WeakImplHelper8 +class SW_DLLPUBLIC SwXTextRange : public cppu::WeakImplHelper8 < ::com::sun::star::text::XTextRange, ::com::sun::star::lang::XUnoTunnel, diff --git a/sw/inc/usrfld.hxx b/sw/inc/usrfld.hxx index 30e7b9e7d741..55fb2ebd3d98 100644 --- a/sw/inc/usrfld.hxx +++ b/sw/inc/usrfld.hxx @@ -105,7 +105,7 @@ inline void SwUserFieldType::SetType(USHORT nSub) Beschreibung: Benutzerfelder --------------------------------------------------------------------*/ -class SwUserField : public SwValueField +class SW_DLLPUBLIC SwUserField : public SwValueField { USHORT nSubType; diff --git a/sw/prj/d.lst b/sw/prj/d.lst index 293b6cbc0119..09c417cd6f17 100644 --- a/sw/prj/d.lst +++ b/sw/prj/d.lst @@ -62,6 +62,7 @@ mkdir: %_DEST%\xml%_EXT%\uiconfig\modules\swreport\statusbar ..\%__SRC%\bin\sw?????.dll %_DEST%\bin%_EXT%\sw?????.dll ..\%__SRC%\bin\swd?????.dll %_DEST%\bin%_EXT%\swd?????.dll ..\%__SRC%\bin\swui?????.dll %_DEST%\bin%_EXT%\swui?????.dll +..\%__SRC%\bin\msword?????.dll %_DEST%\bin%_EXT%\msword?????.dll ..\%__SRC%\bin\sw*.res %_DEST%\bin%_EXT%\sw*.res ..\%__SRC%\lib\lib*.* %_DEST%\lib%_EXT%\lib*.* diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx index a1757429305b..6fce2c4a59f5 100644 --- a/sw/source/core/attr/hints.cxx +++ b/sw/source/core/attr/hints.cxx @@ -181,11 +181,14 @@ SfxPoolItem* SwMsgPoolItem::Clone( SfxItemPool* ) const * hole aus der Default-Attribut Tabelle ueber den Which-Wert * das entsprechende default Attribut. * Ist keines vorhanden, returnt ein 0-Pointer !!! - * inline (hintids.hxx) im PRODUCT. + * Used to be inlined (hintids.hxx) in PRODUCT. ******************************************************************************/ -#ifndef PRODUCT - - +#ifdef PRODUCT +const SfxPoolItem* GetDfltAttr( USHORT nWhich ) +{ + return aAttrTab[ nWhich - POOLATTR_BEGIN ]; +} +#else const SfxPoolItem* GetDfltAttr( USHORT nWhich ) { ASSERT_ID( nWhich < POOLATTR_END && nWhich >= POOLATTR_BEGIN, @@ -195,7 +198,6 @@ const SfxPoolItem* GetDfltAttr( USHORT nWhich ) ASSERT( pHt, "GetDfltFmtAttr(): Dflt == 0" ); return pHt; } - #endif diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 1086760db6ec..57d87d6ae4f4 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -1340,7 +1340,7 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, break; case FORMAT_RTF: - pRead = ReadRtf; + pRead = SwReaderWriter::GetReader( READER_WRITER_RTF ); break; case FORMAT_FILE: diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx index 259de63d225c..f1d781e4080b 100644 --- a/sw/source/core/edit/edglss.cxx +++ b/sw/source/core/edit/edglss.cxx @@ -315,7 +315,7 @@ BOOL SwEditShell::GetSelectedText( String &rBuf, int nHndlParaBrk ) aStream.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); #endif WriterRef xWrt; - SwIoSystem::GetWriter( String::CreateFromAscii( FILTER_TEXT ), String(), xWrt ); + SwReaderWriter::GetWriter( String::CreateFromAscii( FILTER_TEXT ), String(), xWrt ); if( xWrt.Is() ) { // Selektierte Bereiche in ein ASCII Dokument schreiben diff --git a/sw/source/core/inc/pamtyp.hxx b/sw/source/core/inc/pamtyp.hxx index 1bc775a4f396..2bf2b46dd066 100644 --- a/sw/source/core/inc/pamtyp.hxx +++ b/sw/source/core/inc/pamtyp.hxx @@ -59,7 +59,7 @@ const SwTxtAttr* GetBkwrdTxtHint( const SwpHints&, USHORT&, xub_StrLen ); BOOL GoNext(SwNode* pNd, SwIndex * pIdx, USHORT nMode ); BOOL GoPrevious(SwNode* pNd, SwIndex * pIdx, USHORT nMode ); -SwCntntNode* GoNextNds( SwNodeIndex * pIdx, BOOL ); +SW_DLLPUBLIC SwCntntNode* GoNextNds( SwNodeIndex * pIdx, BOOL ); SwCntntNode* GoPreviousNds( SwNodeIndex * pIdx, BOOL ); // --------- Funktionsdefinitionen fuer die SwCrsrShell -------------- diff --git a/sw/source/core/inc/tblrwcl.hxx b/sw/source/core/inc/tblrwcl.hxx index c8f473eb63a6..b9a614455edf 100644 --- a/sw/source/core/inc/tblrwcl.hxx +++ b/sw/source/core/inc/tblrwcl.hxx @@ -77,7 +77,7 @@ void _InsTblBox( SwDoc* pDoc, SwTableNode* pTblNd, SwTableLine* pLine, SwTableBoxFmt* pBoxFrmFmt, SwTableBox* pBox, USHORT nInsPos, USHORT nCnt = 1 ); -void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo = 0, +SW_DLLPUBLIC void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo = 0, BOOL bCalcNewSize = TRUE, const BOOL bCorrBorder = TRUE, SwShareBoxFmts* pShareFmts = 0 ); diff --git a/sw/source/core/sw3io/sw3convert.cxx b/sw/source/core/sw3io/sw3convert.cxx index c3c726b07275..5dea22089355 100644 --- a/sw/source/core/sw3io/sw3convert.cxx +++ b/sw/source/core/sw3io/sw3convert.cxx @@ -216,7 +216,7 @@ static OldFormats aOldGetSetExpFmt30[] = { NF_NUMERIC_START, 0 } // Tabellenende }; -void sw3io_ConvertFromOldField( SwDoc& rDoc, USHORT& rWhich, +SW_DLLPUBLIC void sw3io_ConvertFromOldField( SwDoc& rDoc, USHORT& rWhich, USHORT& rSubType, ULONG &rFmt, USHORT nVersion ) { @@ -323,7 +323,7 @@ void sw3io_ConvertFromOldField( SwDoc& rDoc, USHORT& rWhich, } } } -void sw3io_ConvertToOldField( const SwField* pFld, USHORT& rWhich, +SW_DLLPUBLIC void sw3io_ConvertToOldField( const SwField* pFld, USHORT& rWhich, ULONG& rFmt, ULONG nFFVersion ) { const OldFormats *pOldFmt = 0L; diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index c9da7ef96296..e798d6851ee6 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -284,7 +284,7 @@ void SwXTextCursor::getTextFromPam(SwPaM& aCrsr, OUString& rBuffer) #endif WriterRef xWrt; // TODO/MBA: looks like a BaseURL doesn't make sense here - SwIoSystem::GetWriter( C2S(FILTER_TEXT_DLG), String(), xWrt ); + SwReaderWriter::GetWriter( C2S(FILTER_TEXT_DLG), String(), xWrt ); if( xWrt.Is() ) { SwWriter aWriter( aStream, aCrsr ); diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index 131fca689dbc..05b1bb4eb97a 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -53,12 +53,8 @@ #include #include #include -#ifndef _DOCSH_HXX #include -#endif -#ifndef _WDOCSH_HXX #include -#endif #include #include #include @@ -70,22 +66,57 @@ #include #include #include -#ifndef _SWFLTOPT_HXX #include -#endif #include - -#ifndef _IODETECT_CXX -#include -#endif +#include using namespace utl; using rtl::OUString; using namespace com::sun::star::uno; -SwRead ReadRtf = 0, ReadAscii = 0, /*ReadSwg = 0, ReadSw3 = 0,*/ +SwRead ReadAscii = 0, /*ReadSwg = 0, ReadSw3 = 0,*/ ReadHTML = 0, ReadXML = 0; +Reader* GetRTFReader(); +Reader* GetWW8Reader(); + +// Note: if editing, please don't forget to modify also the enum +// ReaderWriterEnum and aFilterDetect in shellio.hxx +SwReaderWriterEntry aReaderWriter[] = +{ + SwReaderWriterEntry( &::GetRTFReader, &::GetRTFWriter, TRUE ), + SwReaderWriterEntry( 0, &::GetASCWriter, FALSE ), + SwReaderWriterEntry( &::GetWW8Reader, &::GetWW8Writer, TRUE ), + SwReaderWriterEntry( &::GetWW8Reader, &::GetWW8Writer, TRUE ), + SwReaderWriterEntry( &::GetRTFReader, &::GetRTFWriter, TRUE ), + SwReaderWriterEntry( 0, &::GetHTMLWriter, TRUE ), + SwReaderWriterEntry( 0, 0, TRUE ), + SwReaderWriterEntry( &::GetWW8Reader, 0, TRUE ), + SwReaderWriterEntry( 0, &::GetXMLWriter, TRUE ), + SwReaderWriterEntry( 0, &::GetASCWriter, TRUE ), + SwReaderWriterEntry( 0, &::GetASCWriter, TRUE ) +}; + +Reader* SwReaderWriterEntry::GetReader() +{ + if ( pReader ) + return pReader; + else if ( fnGetReader ) + { + pReader = (*fnGetReader)(); + return pReader; + } + return NULL; +} + +void SwReaderWriterEntry::GetWriter( const String& rNm, const String& rBaseURL, WriterRef& xWrt ) const +{ + if ( fnGetWriter ) + (*fnGetWriter)( rNm, rBaseURL, xWrt ); + else + xWrt = WriterRef(0); +} + /*SwRead SwGetReaderSw3() // SW_DLLPUBLIC { return ReadSw3; @@ -101,89 +132,75 @@ bool IsDocShellRegistered() return 0 != SwDocShell::_GetInterface(); } -inline void _SetFltPtr( USHORT& rPos, SwRead pReader - , const sal_Char* -#if OSL_DEBUG_LEVEL > 1 - pNm -#endif - /* pNm optimiert der Compiler weg, wird nur in der nicht PRODUCT benoetigt! */ - ) +inline void _SetFltPtr( USHORT rPos, SwRead pReader ) { -#if OSL_DEBUG_LEVEL > 1 - ASSERT( !strcmp( aReaderWriter[ rPos ].pName, pNm ), "falscher Filter" ); - (void) pNm; -#endif - aReaderWriter[ rPos++ ].pReader = pReader; + aReaderWriter[ rPos ].pReader = pReader; } void _InitFilter() { - SwRead pWW8Rd = new WW8Reader; - - USHORT nCnt = 0; - _SetFltPtr( nCnt, (ReadRtf = new RtfReader), FILTER_RTF ); - _SetFltPtr( nCnt, (ReadAscii = new AsciiReader), FILTER_BAS ); - _SetFltPtr( nCnt, pWW8Rd, sWW6 ); - _SetFltPtr( nCnt, pWW8Rd, FILTER_WW8 ); - _SetFltPtr( nCnt, ReadRtf, sRtfWH ); - _SetFltPtr( nCnt, (ReadHTML = new HTMLReader), sHTML); - _SetFltPtr( nCnt, new WW1Reader, sWW1 ); - _SetFltPtr( nCnt, pWW8Rd, sWW5 ); - _SetFltPtr( nCnt, (ReadXML = new XMLReader), FILTER_XML ); + _SetFltPtr( READER_WRITER_BAS, (ReadAscii = new AsciiReader) ); + _SetFltPtr( READER_WRITER_HTML, (ReadHTML = new HTMLReader) ); + _SetFltPtr( READER_WRITER_WW1, new WW1Reader ); + _SetFltPtr( READER_WRITER_XML, (ReadXML = new XMLReader) ); #ifdef NEW_WW97_EXPORT - aReaderWriter[ 8-3 ].fnGetWriter = &::GetWW8Writer; - aReaderWriter[ 9-3 ].fnGetWriter = &::GetWW8Writer; + aReaderWriter[ READER_WRITER_WW1 ].fnGetWriter = &::GetWW8Writer; + aReaderWriter[ READER_WRITER_WW5 ].fnGetWriter = &::GetWW8Writer; #endif - _SetFltPtr( nCnt, ReadAscii, FILTER_TEXT_DLG ); - _SetFltPtr( nCnt, ReadAscii, FILTER_TEXT ); - - ASSERT( MAXFILTER == nCnt, "Anzahl Filter ungleich der Definierten" ); + _SetFltPtr( READER_WRITER_TEXT_DLG, ReadAscii ); + _SetFltPtr( READER_WRITER_TEXT, ReadAscii ); } - - - void _FinitFilter() { // die Reader vernichten for( USHORT n = 0; n < MAXFILTER; ++n ) { - SwIoDetect& rIo = aReaderWriter[n]; - if( rIo.bDelReader && rIo.pReader ) - delete rIo.pReader; + SwReaderWriterEntry& rEntry = aReaderWriter[n]; + if( rEntry.bDelReader && rEntry.pReader ) + delete rEntry.pReader, rEntry.pReader = NULL; } } /* */ -void SwIoSystem::GetWriter( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) +namespace SwReaderWriter { + +Reader* GetReader( ReaderWriterEnum eReader ) +{ + return aReaderWriter[eReader].GetReader(); +} + +void GetWriter( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) { for( USHORT n = 0; n < MAXFILTER; ++n ) - if( aReaderWriter[n].IsFilter( rFltName ) ) + if( aFilterDetect[n].IsFilter( rFltName ) ) { aReaderWriter[n].GetWriter( rFltName, rBaseURL, xRet ); break; } } - -SwRead SwIoSystem::GetReader( const String& rFltName ) +SwRead GetReader( const String& rFltName ) { SwRead pRead = 0; for( USHORT n = 0; n < MAXFILTER; ++n ) - if( aReaderWriter[n].IsFilter( rFltName ) ) + if( aFilterDetect[n].IsFilter( rFltName ) ) { pRead = aReaderWriter[n].GetReader(); // fuer einige Reader noch eine Sonderbehandlung: - pRead->SetFltName( rFltName ); + if ( pRead ) + pRead->SetFltName( rFltName ); break; } return pRead; } +} // namespace SwReaderWriter + /* */ /////////////// die Storage Reader/Writer //////////////////////////////// @@ -937,4 +954,57 @@ void SwAsciiOptions::WriteUserData( String& rStr ) rStr += ','; } +extern "C" { static void SAL_CALL thisModule() {} } + +static oslGenericFunction GetMswordLibSymbol( const char *pSymbol ) +{ + static ::osl::Module aModule; + if ( aModule.is() || + aModule.loadRelative( &thisModule, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "msword" ) ) ) ) ) + { + return aModule.getFunctionSymbol( ::rtl::OUString::createFromAscii( pSymbol ) ); + } + + return NULL; +} + +Reader* GetRTFReader() +{ + FnGetReader pFunction = reinterpret_cast( GetMswordLibSymbol( "ImportRTF" ) ); + + if ( pFunction ) + return (*pFunction)(); + + return NULL; +} + +void GetRTFWriter( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) +{ + FnGetWriter pFunction = reinterpret_cast( GetMswordLibSymbol( "ExportRTF" ) ); + + if ( pFunction ) + (*pFunction)( rFltName, rBaseURL, xRet ); + else + xRet = WriterRef(0); +} + +Reader* GetWW8Reader() +{ + FnGetReader pFunction = reinterpret_cast( GetMswordLibSymbol( "ImportDOC" ) ); + + if ( pFunction ) + return (*pFunction)(); + + return NULL; +} + +void GetWW8Writer( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) +{ + FnGetWriter pFunction = reinterpret_cast( GetMswordLibSymbol( "ExportDOC" ) ); + if ( pFunction ) + (*pFunction)( rFltName, rBaseURL, xRet ); + else + xRet = WriterRef(0); +} diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx new file mode 100644 index 000000000000..71d5bddd7dc5 --- /dev/null +++ b/sw/source/filter/basflt/iodetect.cxx @@ -0,0 +1,595 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: iodetect.cxx,v $ + * $Revision: 1.31 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#include + +#include +#include +#include +#include +#include + +bool IsDocShellRegistered(); + +SwIoDetect aFilterDetect[] = +{ + SwIoDetect( FILTER_RTF, STRING_LEN ), + SwIoDetect( FILTER_BAS, STRING_LEN ), + SwIoDetect( sWW6, STRING_LEN ), + SwIoDetect( FILTER_WW8, STRING_LEN ), + SwIoDetect( sRtfWH, STRING_LEN ), + SwIoDetect( sHTML, 4 ), + SwIoDetect( sWW1, STRING_LEN ), + SwIoDetect( sWW5, STRING_LEN ), + SwIoDetect( FILTER_XML, 4 ), + SwIoDetect( FILTER_TEXT_DLG, 8 ), + SwIoDetect( FILTER_TEXT, 4 ) +}; + +const sal_Char* SwIoDetect::IsReader(const sal_Char* pHeader, ULONG nLen_, + const String & /*rFileName*/, const String& /*rUserData*/) const +{ + // Filter erkennung + struct W1_FIB + { + SVBT16 wIdent; // 0x0 int magic number + SVBT16 nFib; // 0x2 FIB version written + SVBT16 nProduct; // 0x4 product version written by + SVBT16 nlocale; // 0x6 language stamp---localized version; + SVBT16 pnNext; // 0x8 + SVBT16 fFlags; + + USHORT nFibGet() { return SVBT16ToShort(nFib); } + USHORT wIdentGet() { return SVBT16ToShort(wIdent); } + USHORT fFlagsGet() { return SVBT16ToShort(fFlags); } + // SVBT16 fComplex :1;// 0004 when 1, file is in complex, fast-saved format. + BOOL fComplexGet() { return static_cast< BOOL >((fFlagsGet() >> 2) & 1); } + }; + + int bRet = FALSE; + rtl::OString aName( pName ); + if ( sHTML == aName ) + bRet = HTMLParser::IsHTMLFormat( pHeader, TRUE, RTL_TEXTENCODING_DONTKNOW ); + else if ( FILTER_RTF == aName ) + bRet = 0 == strncmp( "{\\rtf", pHeader, 5 ); + else if ( sWW5 == aName ) + { + W1_FIB *pW1Header = (W1_FIB*)pHeader; + if (pW1Header->wIdentGet() == 0xA5DC && pW1Header->nFibGet() == 0x65) + bRet = true; /*WW5*/ + else if (pW1Header->wIdentGet() == 0xA5DB && pW1Header->nFibGet() == 0x2D) + bRet = true; /*WW2*/ + } + else if ( sWW1 == aName ) + { + bRet = (( ((W1_FIB*)pHeader)->wIdentGet() == 0xA59C + && ((W1_FIB*)pHeader)->nFibGet() == 0x21) + && ((W1_FIB*)pHeader)->fComplexGet() == 0); + } + else if ( FILTER_TEXT == aName ) + bRet = SwIoSystem::IsDetectableText(pHeader, nLen_); + else if ( FILTER_TEXT_DLG == aName) + bRet = SwIoSystem::IsDetectableText( pHeader, nLen_, 0, 0, 0, true); + return bRet ? pName : 0; +} + +const String SwIoSystem::GetSubStorageName( const SfxFilter& rFltr ) +{ + /* bei den StorageFiltern noch den SubStorageNamen setzen */ + const String& rUserData = rFltr.GetUserData(); + if( rUserData.EqualsAscii(FILTER_XML) || + rUserData.EqualsAscii(FILTER_XMLV) || + rUserData.EqualsAscii(FILTER_XMLVW) ) + return String::CreateFromAscii( + RTL_CONSTASCII_STRINGPARAM( "content.xml" )); + if( rUserData.EqualsAscii(sWW6) || rUserData.EqualsAscii(FILTER_WW8) ) + return String::CreateFromAscii( + RTL_CONSTASCII_STRINGPARAM( "WordDocument" )); + return String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "" )); +} + +const SfxFilter* SwIoSystem::GetFilterOfFormat(const String& rFmtNm, + const SfxFilterContainer* pCnt) +{ + SfxFilterContainer aCntSw( String::CreateFromAscii( sSWRITER ) ); + SfxFilterContainer aCntSwWeb( String::CreateFromAscii( sSWRITERWEB ) ); + const SfxFilterContainer* pFltCnt = pCnt ? pCnt : ( IsDocShellRegistered() ? &aCntSw : &aCntSwWeb ); + + do { + if( pFltCnt ) + { + SfxFilterMatcher aMatcher( pFltCnt->GetName() ); + SfxFilterMatcherIter aIter( &aMatcher ); + const SfxFilter* pFilter = aIter.First(); + while ( pFilter ) + { + if( pFilter->GetUserData() == rFmtNm ) + return pFilter; + pFilter = aIter.Next(); + } + } + if( pCnt || pFltCnt == &aCntSwWeb ) + break; + pFltCnt = &aCntSwWeb; + } while( TRUE ); + return 0; +} + +BOOL SwIoSystem::IsValidStgFilter( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const SfxFilter& rFilter) +{ + BOOL bRet = FALSE; + try + { + ULONG nStgFmtId = SotStorage::GetFormatID( rStg ); + bRet = rStg->isStreamElement( ::rtl::OUString::createFromAscii("content.xml") ); + if ( bRet ) + bRet = ( nStgFmtId && ( rFilter.GetFormat() == nStgFmtId ) ); + } + catch ( com::sun::star::uno::Exception& ) + { + } + + return bRet; +} + +BOOL SwIoSystem::IsValidStgFilter(SotStorage& rStg, const SfxFilter& rFilter) +{ + ULONG nStgFmtId = rStg.GetFormat(); + /*#i8409# We cannot trust the clipboard id anymore :-(*/ + if( rFilter.GetUserData().EqualsAscii(FILTER_WW8) || + rFilter.GetUserData().EqualsAscii(sWW6) ) + { + nStgFmtId = 0; + } + + BOOL bRet = SVSTREAM_OK == rStg.GetError() && + ( !nStgFmtId || rFilter.GetFormat() == nStgFmtId ) && + ( rStg.IsContained( SwIoSystem::GetSubStorageName( rFilter )) ); + if( bRet ) + { + /* Bug 53445 - es gibt Excel Docs ohne ClipBoardId! */ + /* Bug 62703 - und auch WinWord Docs ohne ClipBoardId! */ + if( rFilter.GetUserData().EqualsAscii(FILTER_WW8) || + rFilter.GetUserData().EqualsAscii(sWW6) ) + { + bRet = !((rStg.IsContained( String::CreateFromAscii("0Table" )) || + rStg.IsContained( String::CreateFromAscii("1Table" ))) ^ + rFilter.GetUserData().EqualsAscii(FILTER_WW8)); + if (bRet && !rFilter.IsAllowedAsTemplate()) + { + SotStorageStreamRef xRef = + rStg.OpenSotStream(String::CreateFromAscii("WordDocument"), + STREAM_STD_READ | STREAM_NOCREATE ); + xRef->Seek(10); + BYTE nByte; + *xRef >> nByte; + bRet = !(nByte & 1); + } + } + // else if( !rFilter.GetUserData().EqualsAscii(sCExcel) ) + // bRet = rFilter.GetFormat() == nStgFmtId; + } + return bRet; +} + +void TerminateBuffer(sal_Char *pBuffer, ULONG nBytesRead, ULONG nBufferLen) +{ + ASSERT(nBytesRead <= nBufferLen - 2, + "what you read must be less than the max + null termination"); + ASSERT(!(nBufferLen & 0x00000001), "nMaxReadBuf must be an even number"); + if (nBytesRead <= nBufferLen - 2) + { + pBuffer[nBytesRead] = '\0'; + pBuffer[nBytesRead+1] = '\0'; + if (nBytesRead & 0x00000001) + pBuffer[nBytesRead+2] = '\0'; + } +} + +/* Feststellen ob das File in dem entsprechenden Format vorliegt. */ +/* Z.z werden nur unsere eigene Filter unterstuetzt */ +BOOL SwIoSystem::IsFileFilter( SfxMedium& rMedium, const String& rFmtName, + const SfxFilter** ppFilter ) +{ + BOOL bRet = FALSE; + + SfxFilterContainer aCntSw( String::CreateFromAscii( sSWRITER ) ); + SfxFilterContainer aCntSwWeb( String::CreateFromAscii( sSWRITERWEB ) ); + const SfxFilterContainer& rFltContainer = IsDocShellRegistered() ? aCntSw : aCntSwWeb; + + com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStor; + SotStorageRef xStg; + if (rMedium.IsStorage()) + xStor = rMedium.GetStorage(); + else + { + SvStream* pStream = rMedium.GetInStream(); + if ( pStream && SotStorage::IsStorageFile(pStream) ) + xStg = new SotStorage( pStream, FALSE ); + } + + SfxFilterMatcher aMatcher( rFltContainer.GetName() ); + SfxFilterMatcherIter aIter( &aMatcher ); + const SfxFilter* pFltr = aIter.First(); + while ( pFltr ) + { + if( pFltr->GetUserData() == rFmtName ) + { + const String& rUserData = pFltr->GetUserData(); + if( 'C' == *rUserData.GetBuffer() ) + { + if ( xStor.is() ) + bRet = IsValidStgFilter( xStor, *pFltr ); + else if ( xStg.Is() ) + bRet = xStg.Is() && IsValidStgFilter( *xStg, *pFltr ); + bRet = bRet && (pFltr->GetUserData() == rFmtName); + } + else if( !xStg.Is() && !xStor.is() ) + { + SvStream* pStrm = rMedium.GetInStream(); + if( pStrm && !pStrm->GetError() ) + { + sal_Char aBuffer[4098]; + const ULONG nMaxRead = sizeof(aBuffer) - 2; + ULONG nBytesRead = pStrm->Read(aBuffer, nMaxRead); + pStrm->Seek(STREAM_SEEK_TO_BEGIN); + TerminateBuffer(aBuffer, nBytesRead, sizeof(aBuffer)); + for (USHORT i = 0; i < MAXFILTER; ++i) + { + if (aFilterDetect[i].IsFilter(rFmtName)) + { + bRet = 0 != aFilterDetect[i].IsReader( aBuffer, nBytesRead, + rMedium.GetPhysicalName(), rUserData ); + break; + } + } + } + } + + if( bRet && ppFilter ) + *ppFilter = pFltr; + } + + pFltr = aIter.Next(); + } + + return bRet; +} + +/* die Methode stellt fest, von welchem Typ der stream (File) ist. */ +/* Es wird versucht, eine dem Filter entsprechende Byte-Folge zu finden. */ +/* Wird kein entsprechender gefunden, wird zur Zeit der ASCII-Reader */ +/* returnt !! Der Returnwert ist der interne Filtername! */ +/* rPrefFltName ist der interne Name des Filters, den der Benutzer im */ +/* Open-Dialog eingestellt hat. */ +const SfxFilter* SwIoSystem::GetFileFilter(const String& rFileName, + const String& rPrefFltName, SfxMedium* pMedium) +{ + SfxFilterContainer aCntSw( String::CreateFromAscii( sSWRITER ) ); + SfxFilterContainer aCntSwWeb( String::CreateFromAscii( sSWRITERWEB ) ); + const SfxFilterContainer* pFCntnr = IsDocShellRegistered() ? &aCntSw : &aCntSwWeb; + + if( !pFCntnr ) + return 0; + + SfxFilterMatcher aMatcher( pFCntnr->GetName() ); + SfxFilterMatcherIter aIter( &aMatcher ); + const SfxFilter* pFilter = aIter.First(); + if ( !pFilter ) + return 0; + + if( pMedium ? ( pMedium->IsStorage() || SotStorage::IsStorageFile( pMedium->GetInStream() ) ) : SotStorage::IsStorageFile( rFileName ) ) + { + // package storage or OLEStorage based format + SotStorageRef xStg; + BOOL bDeleteMedium = FALSE; + if (!pMedium ) + { + INetURLObject aObj; + aObj.SetSmartProtocol( INET_PROT_FILE ); + aObj.SetSmartURL( rFileName ); + pMedium = new SfxMedium( aObj.GetMainURL( INetURLObject::NO_DECODE ), STREAM_STD_READ, FALSE ); + bDeleteMedium = TRUE; + } + + // templates should not get precedence over "normal" filters (#i35508, #i33168) + const SfxFilter* pTemplateFilter = 0; + const SfxFilter* pOldFilter = pFCntnr->GetFilter4FilterName( rPrefFltName ); + BOOL bLookForTemplate = pOldFilter && pOldFilter->IsOwnTemplateFormat(); + if ( pMedium->IsStorage() ) + { + com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStor = pMedium->GetStorage(); + if ( xStor.is() ) + { + while ( pFilter ) + { + if( 'C' == *pFilter->GetUserData().GetBuffer() && IsValidStgFilter( xStor, *pFilter ) ) + { + if ( pFilter->IsOwnTemplateFormat() && !bLookForTemplate ) + // found template filter; maybe there's a "normal" one also + pTemplateFilter = pFilter; + else + return pFilter; + } + + pFilter = aIter.Next(); + } + + // there's only a template filter that could be found + if ( pTemplateFilter ) + pFilter = pTemplateFilter; + } + } + else + { + SvStream* pStream = pMedium->GetInStream(); + if ( pStream && SotStorage::IsStorageFile(pStream) ) + xStg = new SotStorage( pStream, FALSE ); + + if( xStg.Is() && ( xStg->GetError() == SVSTREAM_OK ) ) + { + while ( pFilter ) + { + if( 'C' == *pFilter->GetUserData().GetBuffer() && IsValidStgFilter( *xStg, *pFilter ) ) + { + if ( pFilter->IsOwnTemplateFormat() && !bLookForTemplate ) + // found template filter; maybe there's a "normal" one also + pTemplateFilter = pFilter; + else + return pFilter; + } + + pFilter = aIter.Next(); + } + + // there's only a template filter that could be found + if ( pTemplateFilter ) + pFilter = pTemplateFilter; + + } + } + + return pFilter; + } + + sal_Char aBuffer[4098]; + const ULONG nMaxRead = sizeof(aBuffer) - 2; + ULONG nBytesRead = 0; + if (pMedium) + { + SvStream* pIStrm = pMedium->GetInStream(); + if( !pIStrm || SVSTREAM_OK != pIStrm->GetError() ) + return 0; + ULONG nCurrPos = pIStrm->Tell(); + nBytesRead = pIStrm->Read(aBuffer, nMaxRead); + pIStrm->Seek( nCurrPos ); + } + /* + else + { + SvFileStream aStrm( rFileName, STREAM_READ ); + + // ohne FileName oder ohne Stream gibts nur den ANSI-Filter + if( !rFileName.Len() || SVSTREAM_OK != aStrm.GetError() ) + return 0; + + nBytesRead = aStrm.Read(aBuffer, nMaxRead); + aStrm.Close(); + }*/ + + TerminateBuffer(aBuffer, nBytesRead, sizeof(aBuffer)); + + + /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ + /* suche nach dem bestimmten Filter, falls kein entsprechender */ + /* gefunden wird, so wird der ASCII-Filter returnt. */ + /* Gibt es Filter ohne einen Identifizierungs-String, so werden diese */ + /* nie erkannt und es wird auch der ASCII-Filter returnt. */ + /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ + { + const SfxFilter* pFilterTmp = 0; + const sal_Char* pNm; + for( USHORT n = 0; n < MAXFILTER; ++n ) + { + String sEmptyUserData; + pNm = aFilterDetect[n].IsReader(aBuffer, nBytesRead, rFileName, sEmptyUserData); + pFilterTmp = pNm ? SwIoSystem::GetFilterOfFormat(String::CreateFromAscii(pNm), pFCntnr) : 0; + if (pNm && pFilterTmp) + { + return pFilterTmp; + } + } + } + + /* Ok, bis jetzt kein Filter gefunden, also befrage mal die */ + /* "WORD 4 WORD" Filter */ + if( rFileName.Len() ) + { + if( pMedium ) + pMedium->CloseInStream(); + + } + return SwIoSystem::GetTextFilter( aBuffer, nBytesRead); +} + +bool SwIoSystem::IsDetectableText(const sal_Char* pBuf, ULONG &rLen, + CharSet *pCharSet, bool *pSwap, LineEnd *pLineEnd, bool bEncodedFilter) +{ + bool bSwap = false; + CharSet eCharSet = RTL_TEXTENCODING_DONTKNOW; + bool bLE = true; + ULONG nHead=0; + /*See if its a known unicode type*/ + if (rLen >= 2) + { + if (rLen > 2 && BYTE(pBuf[0]) == 0xEF && BYTE(pBuf[1]) == 0xBB && + BYTE(pBuf[2]) == 0xBF) + { + eCharSet = RTL_TEXTENCODING_UTF8; + nHead = 3; + } + else if (BYTE(pBuf[0]) == 0xFE && BYTE(pBuf[1]) == 0xFF) + { + eCharSet = RTL_TEXTENCODING_UCS2; + bLE = false; + nHead = 2; + } + else if (BYTE(pBuf[1]) == 0xFE && BYTE(pBuf[0]) == 0xFF) + { + eCharSet = RTL_TEXTENCODING_UCS2; + nHead = 2; + } + pBuf+=nHead; + rLen-=nHead; + } + + bool bCR = false, bLF = false, bNoNormalChar = false, + bIsBareUnicode = false; + + if (eCharSet != RTL_TEXTENCODING_DONTKNOW) + { + String sWork; + sal_Unicode *pNewBuf = sWork.AllocBuffer( static_cast< xub_StrLen >(rLen)); + sal_Size nNewLen; + if (eCharSet != RTL_TEXTENCODING_UCS2) + { + nNewLen = rLen; + rtl_TextToUnicodeConverter hConverter = + rtl_createTextToUnicodeConverter(eCharSet); + rtl_TextToUnicodeContext hContext = + rtl_createTextToUnicodeContext(hConverter); + + sal_Size nCntBytes; + sal_uInt32 nInfo; + nNewLen = rtl_convertTextToUnicode( hConverter, hContext, pBuf, + rLen, pNewBuf, nNewLen, + (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT | + RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT | + RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT), &nInfo, &nCntBytes); + + rtl_destroyTextToUnicodeContext(hConverter, hContext); + rtl_destroyTextToUnicodeConverter(hConverter); + } + else + { + nNewLen = rLen/2; + memcpy(pNewBuf, pBuf, rLen); +#ifdef OSL_LITENDIAN + bool bNativeLE = true; +#else + bool bNativeLE = false; +#endif + if (bLE != bNativeLE) + { + bSwap = true; + sal_Char* pF = (sal_Char*)pNewBuf; + sal_Char* pN = pF+1; + for(xub_StrLen n = 0; n < nNewLen; ++n, pF+=2, pN+=2) + { + sal_Char c = *pF; + *pF = *pN; + *pN = c; + } + } + } + + sWork.ReleaseBufferAccess( static_cast< xub_StrLen >(nNewLen) ); + pNewBuf = sWork.GetBufferAccess(); + + for (ULONG nCnt = 0; nCnt < nNewLen; ++nCnt, ++pNewBuf) + { + switch (*pNewBuf) + { + case 0xA: + bLF = true; + break; + case 0xD: + bCR = true; + break; + default: + break; + } + } + } + else + { + for( ULONG nCnt = 0; nCnt < rLen; ++nCnt, ++pBuf ) + { + switch (*pBuf) + { + case 0x0: + if( nCnt + 1 < rLen && !*(pBuf+1) ) + return 0; + bIsBareUnicode = true; + break; + case 0xA: + bLF = true; + break; + case 0xD: + bCR = true; + break; + case 0xC: + case 0x1A: + case 0x9: + break; + default: + if (0x20 > (BYTE)*pBuf) + bNoNormalChar = true; + break; + } + } + } + + LineEnd eSysLE = GetSystemLineEnd(); + LineEnd eLineEnd; + if (!bCR && !bLF) + eLineEnd = eSysLE; + else + eLineEnd = bCR ? ( bLF ? LINEEND_CRLF : LINEEND_CR ) : LINEEND_LF; + + if (pCharSet) + *pCharSet = eCharSet; + if (pSwap) + *pSwap = bSwap; + if (pLineEnd) + *pLineEnd = eLineEnd; + + return bEncodedFilter || (!bIsBareUnicode && eSysLE == eLineEnd); +} + +const SfxFilter* SwIoSystem::GetTextFilter( const sal_Char* pBuf, ULONG nLen) +{ + bool bAuto = IsDetectableText(pBuf, nLen); + const sal_Char* pNm = bAuto ? FILTER_TEXT : FILTER_TEXT_DLG; + return SwIoSystem::GetFilterOfFormat( String::CreateFromAscii(pNm), 0 ); +} diff --git a/sw/source/filter/basflt/makefile.mk b/sw/source/filter/basflt/makefile.mk index 480cbfe7f3ec..b2f848d33189 100644 --- a/sw/source/filter/basflt/makefile.mk +++ b/sw/source/filter/basflt/makefile.mk @@ -50,10 +50,11 @@ SLOFILES = \ $(SLO)$/docfact.obj \ $(SLO)$/fltini.obj \ $(SLO)$/shellio.obj \ - + $(SLO)$/iodetect.obj EXCEPTIONSFILES = \ - $(SLO)$/fltini.obj + $(SLO)$/fltini.obj \ + $(SLO)$/iodetect.obj # --- Tagets ------------------------------------------------------- diff --git a/sw/source/filter/inc/fltini.hxx b/sw/source/filter/inc/fltini.hxx index 17d886e99f7a..9d1f69e0d45b 100644 --- a/sw/source/filter/inc/fltini.hxx +++ b/sw/source/filter/inc/fltini.hxx @@ -56,16 +56,6 @@ class WW1Reader : public Reader virtual ULONG Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &); }; -class WW8Reader : public StgReader -{ - virtual ULONG Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &); -public: - virtual int GetReaderType(); - - virtual BOOL HasGlossaries() const; - virtual BOOL ReadGlossaries( SwTextBlocks&, BOOL bSaveRelFiles ) const; -}; - class XMLReader : public Reader { virtual ULONG Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &); @@ -91,7 +81,7 @@ void GetWW8Writer( const String&, const String&, WriterRef& ); // verarbeiten jetzt aber relative Werte bezogen auf das LR-Space-Item. // Das hat zur Folge, das bei allen Absaetzen die EInzuege der NumRule vom // Absatz-Einzug abgezogen werden muss. -class SwRelNumRuleSpaces +class SW_DLLPUBLIC SwRelNumRuleSpaces { SwNumRuleTbl* pNumRuleTbl; // Liste aller benannten NumRules BOOL bNewDoc; @@ -115,7 +105,7 @@ public: #define SW_SV_BRUSH_INVALID 5 // Get size of fly (if 'automatic' in WW) and check if not too small -void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor, +SW_DLLPUBLIC void CalculateFlySize(SfxItemSet& rFlySet, const SwNodeIndex& rAnchor, SwTwips nPageWidth); #endif diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx index e1390f21fa1c..3daf237e860d 100644 --- a/sw/source/filter/inc/fltshell.hxx +++ b/sw/source/filter/inc/fltshell.hxx @@ -82,16 +82,16 @@ public: BOOL bCopied; BOOL bConsumedByField; - SwFltStackEntry(const SwPosition & rStartPos, SfxPoolItem* pHt ); - SwFltStackEntry(const SwFltStackEntry& rEntry); - ~SwFltStackEntry(); + SW_DLLPUBLIC SwFltStackEntry(const SwPosition & rStartPos, SfxPoolItem* pHt ); + SW_DLLPUBLIC SwFltStackEntry(const SwFltStackEntry& rEntry); + SW_DLLPUBLIC ~SwFltStackEntry(); void SetStartPos(const SwPosition & rStartPos); - void SetEndPos( const SwPosition & rEndPos); - BOOL MakeRegion(SwDoc* pDoc, SwPaM& rRegion, BOOL bCheck ); + SW_DLLPUBLIC void SetEndPos( const SwPosition & rEndPos); + SW_DLLPUBLIC BOOL MakeRegion(SwDoc* pDoc, SwPaM& rRegion, BOOL bCheck ); }; -class SwFltControlStack +class SW_DLLPUBLIC SwFltControlStack { typedef std::deque Entries; typedef Entries::iterator myEIter; @@ -144,7 +144,7 @@ public: void DeleteAndDestroy(Entries::size_type nCnt); }; -class SwFltAnchor : public SfxPoolItem +class SW_DLLPUBLIC SwFltAnchor : public SfxPoolItem { SwFrmFmt* pFrmFmt; public: @@ -157,7 +157,7 @@ public: SwFrmFmt* GetFrmFmt() { return pFrmFmt; } }; -class SwFltRedline : public SfxPoolItem +class SW_DLLPUBLIC SwFltRedline : public SfxPoolItem { public: DateTime aStamp; @@ -194,7 +194,7 @@ public: virtual SfxPoolItem* Clone(SfxItemPool* = 0) const; }; -class SwFltBookmark : public SfxPoolItem +class SW_DLLPUBLIC SwFltBookmark : public SfxPoolItem { friend class SwFltShell; // darf aName und aVal uebersetzen long nHandle; @@ -220,7 +220,7 @@ public: long GetHandle() const { return nHandle; } }; -class SwFltTOX : public SfxPoolItem +class SW_DLLPUBLIC SwFltTOX : public SfxPoolItem { SwTOXBase* pTOXBase; USHORT nCols; @@ -608,7 +608,7 @@ public: const String& GetBaseURL() const { return sBaseURL; } }; -void UpdatePageDescs(SwDoc &rDoc, sal_uInt16 nInPageDescOffset); +SW_DLLPUBLIC void UpdatePageDescs(SwDoc &rDoc, sal_uInt16 nInPageDescOffset); #endif diff --git a/sw/source/filter/inc/wrt_fn.hxx b/sw/source/filter/inc/wrt_fn.hxx index 804b8bfbddd2..cafba9a86a90 100644 --- a/sw/source/filter/inc/wrt_fn.hxx +++ b/sw/source/filter/inc/wrt_fn.hxx @@ -42,8 +42,8 @@ class SfxItemSet; typedef Writer& (*FnAttrOut)( Writer&, const SfxPoolItem& ); typedef FnAttrOut SwAttrFnTab[ POOLATTR_END - POOLATTR_BEGIN ]; -Writer& Out( const SwAttrFnTab, const SfxPoolItem&, Writer& ); -Writer& Out_SfxItemSet( const SwAttrFnTab, Writer&, const SfxItemSet&, +SW_DLLPUBLIC Writer& Out( const SwAttrFnTab, const SfxPoolItem&, Writer& ); +SW_DLLPUBLIC Writer& Out_SfxItemSet( const SwAttrFnTab, Writer&, const SfxItemSet&, BOOL bDeep, BOOL bTstForDefault = TRUE ); @@ -61,7 +61,7 @@ RES_NODE_END typedef Writer& (*FnNodeOut)( Writer&, SwCntntNode& ); typedef FnNodeOut SwNodeFnTab[ RES_NODE_END - RES_NODE_BEGIN ]; -Writer& Out( const SwNodeFnTab, SwNode&, Writer & rWrt ); +SW_DLLPUBLIC Writer& Out( const SwNodeFnTab, SwNode&, Writer & rWrt ); diff --git a/sw/source/filter/inc/wrtswtbl.hxx b/sw/source/filter/inc/wrtswtbl.hxx index 4f58ca9cf536..8b851561292e 100644 --- a/sw/source/filter/inc/wrtswtbl.hxx +++ b/sw/source/filter/inc/wrtswtbl.hxx @@ -236,7 +236,7 @@ SV_DECL_PTRARR_SORT_DEL( SwWriteTableCols, SwWriteTableColPtr, 5, 5 ) //----------------------------------------------------------------------- -class SwWriteTable +class SW_DLLPUBLIC SwWriteTable { protected: SwWriteTableCols aCols; // alle Spalten diff --git a/sw/source/filter/makefile.mk b/sw/source/filter/makefile.mk index 0bde189fe6e7..0f8e016588cd 100644 --- a/sw/source/filter/makefile.mk +++ b/sw/source/filter/makefile.mk @@ -51,10 +51,8 @@ SUBLIBS= \ $(SLB)$/ascii.lib \ $(SLB)$/basflt.lib \ $(SLB)$/html.lib \ - $(SLB)$/rtf.lib \ $(SLB)$/writer.lib \ $(SLB)$/ww1.lib \ - $(SLB)$/ww8.lib \ $(SLB)$/xml.lib # ----------------------------------------------------------- diff --git a/sw/source/filter/rtf/makefile.mk b/sw/source/filter/rtf/makefile.mk index 20ce4fe38ad5..8c06c4bec352 100644 --- a/sw/source/filter/rtf/makefile.mk +++ b/sw/source/filter/rtf/makefile.mk @@ -38,6 +38,7 @@ TARGET=rtf .INCLUDE : $(PRJ)$/inc$/swpre.mk .INCLUDE : settings.mk +MAKING_LIBMSWORD=TRUE .INCLUDE : $(PRJ)$/inc$/sw.mk .IF "$(mydebug)" != "" diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index d2a83b6e8664..8d2b6853c85a 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -140,6 +140,11 @@ inline const SvxLRSpaceItem& GetLRSpace(const SfxItemSet& rSet,BOOL bInP=TRUE) /* */ +extern "C" SAL_DLLPUBLIC_EXPORT Reader* SAL_CALL ImportRTF() +{ + return new RtfReader(); +} + // Aufruf fuer die allg. Reader-Schnittstelle ULONG RtfReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, const String &) { diff --git a/sw/source/filter/rtf/swparrtf.hxx b/sw/source/filter/rtf/swparrtf.hxx index 96cb38ae9195..0829bc56dd32 100644 --- a/sw/source/filter/rtf/swparrtf.hxx +++ b/sw/source/filter/rtf/swparrtf.hxx @@ -81,6 +81,11 @@ class SwNodeNum; class SwTxtNode; struct SvxRTFPictureType; +class RtfReader: public Reader +{ + virtual ULONG Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &); +}; + class SwNodeIdx : public SvxNodeIdx { SwNodeIndex aIdx; diff --git a/sw/source/filter/rtf/wrtrtf.cxx b/sw/source/filter/rtf/wrtrtf.cxx index fb6d40acb71f..90fdd48e5fe0 100644 --- a/sw/source/filter/rtf/wrtrtf.cxx +++ b/sw/source/filter/rtf/wrtrtf.cxx @@ -1744,7 +1744,7 @@ RTFSaveData::~RTFSaveData() rWrt.bOutSection = bOldOutSection; } -void GetRTFWriter( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportRTF( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) { xRet = new SwRTFWriter( rFltName, rBaseURL ); } diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index 56ed6052903a..754eb862a343 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -638,6 +638,92 @@ const SfxPoolItem* SwFltControlStack::GetFmtAttr(const SwPosition& rPos, USHORT return &pNd->GetAttr(nWhich); } +void SwFltControlStack::Delete(const SwPaM &rPam) +{ + const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End(); + + if( !rPam.HasMark() || *pStt >= *pEnd ) + return; + + SwNodeIndex aStartNode(pStt->nNode, -1); + USHORT nStartIdx = pStt->nContent.GetIndex(); + SwNodeIndex aEndNode(pEnd->nNode, -1); + USHORT nEndIdx = pEnd->nContent.GetIndex(); + + //We don't support deleting content that is over one node, or removing a node. + ASSERT(aEndNode == aStartNode, "nodes must be the same, or this method extended"); + if (aEndNode != aStartNode) + return; + + for (USHORT nSize = static_cast< USHORT >(Count()); nSize > 0;) + { + SwFltStackEntry* pEntry = (*this)[--nSize]; + + bool bEntryStartAfterSelStart = + (pEntry->nMkNode == aStartNode && pEntry->nMkCntnt >= nStartIdx); + + bool bEntryStartBeforeSelEnd = + (pEntry->nMkNode == aEndNode && pEntry->nMkCntnt <= nEndIdx); + + bool bEntryEndAfterSelStart = false; + bool bEntryEndBeforeSelEnd = false; + if (!pEntry->bLocked) + { + bEntryEndAfterSelStart = + (pEntry->nPtNode == aStartNode && pEntry->nPtCntnt >= nStartIdx); + + bEntryEndBeforeSelEnd = + (pEntry->nPtNode == aEndNode && pEntry->nPtCntnt <= nEndIdx); + } + + bool bTotallyContained = false; + if ( + bEntryStartAfterSelStart && bEntryStartBeforeSelEnd && + bEntryEndAfterSelStart && bEntryEndBeforeSelEnd + ) + { + bTotallyContained = true; + } + + if (bTotallyContained) + { + //after start, before end, delete + DeleteAndDestroy(nSize); + continue; + } + + xub_StrLen nCntntDiff = nEndIdx - nStartIdx; + + //to be adjusted + if (bEntryStartAfterSelStart) + { + if (bEntryStartBeforeSelEnd) + { + //move start to new start + pEntry->nMkNode = aStartNode; + pEntry->nMkCntnt = nStartIdx; + } + else + pEntry->nMkCntnt = pEntry->nMkCntnt - nCntntDiff; + } + + if (bEntryEndAfterSelStart) + { + if (bEntryEndBeforeSelEnd) + { + pEntry->nPtNode = aStartNode; + pEntry->nPtCntnt = nStartIdx; + } + else + pEntry->nPtCntnt = pEntry->nPtCntnt - nCntntDiff; + } + + //That's what locked is, end equal to start, and nPtCntnt is invalid + if (pEntry->bLocked) + pEntry->nPtNode = pEntry->nMkNode; + } +} + //------ hier stehen die Methoden von SwFltAnchor ----------- SwFltAnchor::SwFltAnchor(SwFrmFmt* pFmt) : SfxPoolItem(RES_FLTR_ANCHOR), pFrmFmt(pFmt) diff --git a/sw/source/filter/ww8/makefile.mk b/sw/source/filter/ww8/makefile.mk index 7f59944c1454..6697ceaec4b1 100644 --- a/sw/source/filter/ww8/makefile.mk +++ b/sw/source/filter/ww8/makefile.mk @@ -38,6 +38,7 @@ TARGET=ww8 .INCLUDE : $(PRJ)$/inc$/swpre.mk .INCLUDE : settings.mk +MAKING_LIBMSWORD=TRUE .INCLUDE : $(PRJ)$/inc$/sw.mk .IF "$(mydebug)" != "" diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 96ec05af396c..b32d26fcfe9d 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -38,11 +38,7 @@ #include #include - -#ifndef __SGI_STL_ALGORITHM #include -#endif - #include #include // memcpy() @@ -88,9 +84,7 @@ #include #include #include -#ifndef _SWFLTOPT_HXX #include -#endif #include #include #include @@ -99,18 +93,14 @@ #include #include #include // Progress -#ifndef _STATSTR_HRC #include // ResId fuer Statusleiste -#endif #include #include #include #include "writerhelper.hxx" #include "writerwordglue.hxx" -#ifndef IDOCUMENTBOOKMARKACCESS_HXX_INCLUDED #include -#endif #include #include @@ -3044,7 +3034,7 @@ SwWW8Writer::~SwWW8Writer() delete pOleMap; } -void GetWW8Writer( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportDOC( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) { xRet = new SwWW8Writer( rFltName, rBaseURL ); } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 62437a16aa6a..23c7b6133f81 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -49,13 +49,9 @@ #include #include -#ifndef _SVX_TSTPITEM_HXX //autogen #include -#endif #include -#ifndef _SVX_SVDOBJ_HXX #include -#endif #include #include #include // SvxLRSpaceItem @@ -98,15 +94,11 @@ #include #include #include -#ifndef _SWFLTOPT_HXX #include -#endif #include #include #include // Progress -#ifndef _STATSTR_HRC #include // ResId fuer Statusleiste -#endif #include // ERR_WW8_... #include #include @@ -1060,92 +1052,6 @@ const SfxPoolItem* SwWW8FltControlStack::GetStackAttr(const SwPosition& rPos, return 0; } -void SwFltControlStack::Delete(const SwPaM &rPam) -{ - const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End(); - - if( !rPam.HasMark() || *pStt >= *pEnd ) - return; - - SwNodeIndex aStartNode(pStt->nNode, -1); - USHORT nStartIdx = pStt->nContent.GetIndex(); - SwNodeIndex aEndNode(pEnd->nNode, -1); - USHORT nEndIdx = pEnd->nContent.GetIndex(); - - //We don't support deleting content that is over one node, or removing a node. - ASSERT(aEndNode == aStartNode, "nodes must be the same, or this method extended"); - if (aEndNode != aStartNode) - return; - - for (USHORT nSize = static_cast< USHORT >(Count()); nSize > 0;) - { - SwFltStackEntry* pEntry = (*this)[--nSize]; - - bool bEntryStartAfterSelStart = - (pEntry->nMkNode == aStartNode && pEntry->nMkCntnt >= nStartIdx); - - bool bEntryStartBeforeSelEnd = - (pEntry->nMkNode == aEndNode && pEntry->nMkCntnt <= nEndIdx); - - bool bEntryEndAfterSelStart = false; - bool bEntryEndBeforeSelEnd = false; - if (!pEntry->bLocked) - { - bEntryEndAfterSelStart = - (pEntry->nPtNode == aStartNode && pEntry->nPtCntnt >= nStartIdx); - - bEntryEndBeforeSelEnd = - (pEntry->nPtNode == aEndNode && pEntry->nPtCntnt <= nEndIdx); - } - - bool bTotallyContained = false; - if ( - bEntryStartAfterSelStart && bEntryStartBeforeSelEnd && - bEntryEndAfterSelStart && bEntryEndBeforeSelEnd - ) - { - bTotallyContained = true; - } - - if (bTotallyContained) - { - //after start, before end, delete - DeleteAndDestroy(nSize); - continue; - } - - xub_StrLen nCntntDiff = nEndIdx - nStartIdx; - - //to be adjusted - if (bEntryStartAfterSelStart) - { - if (bEntryStartBeforeSelEnd) - { - //move start to new start - pEntry->nMkNode = aStartNode; - pEntry->nMkCntnt = nStartIdx; - } - else - pEntry->nMkCntnt = pEntry->nMkCntnt - nCntntDiff; - } - - if (bEntryEndAfterSelStart) - { - if (bEntryEndBeforeSelEnd) - { - pEntry->nPtNode = aStartNode; - pEntry->nPtCntnt = nStartIdx; - } - else - pEntry->nPtCntnt = pEntry->nPtCntnt - nCntntDiff; - } - - //That's what locked is, end equal to start, and nPtCntnt is invalid - if (pEntry->bLocked) - pEntry->nPtNode = pEntry->nMkNode; - } -} - bool SwWW8FltRefStack::IsFtnEdnBkmField(const SwFmtFld& rFmtFld, USHORT& rBkmNo) { const SwField* pFld = rFmtFld.GetFld(); @@ -4761,6 +4667,11 @@ ULONG SwWW8ImplReader::LoadDoc( SwPaM& rPaM,WW8Glossary *pGloss) return nErrRet; } +extern "C" SAL_DLLPUBLIC_EXPORT Reader* SAL_CALL ImportDOC() +{ + return new WW8Reader(); +} + ULONG WW8Reader::Read(SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, const String & /* FileName */) { USHORT nOldBuffSize = 32768; diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index d2bb67b78f1d..69113966b5b6 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -156,6 +156,16 @@ SV_DECL_PTRARR_DEL(WW8LFOInfos,WW8LFOInfo_Ptr,16,16) // SV_DECL_PTRARR_SORT_DEL(WW8AuthorInfos, WW8AuthorInfo_Ptr,16,16) SV_DECL_PTRARR_SORT_DEL(WW8OleMaps, WW8OleMap_Ptr,16,16) +class WW8Reader : public StgReader +{ + virtual ULONG Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &); +public: + virtual int GetReaderType(); + + virtual BOOL HasGlossaries() const; + virtual BOOL ReadGlossaries( SwTextBlocks&, BOOL bSaveRelFiles ) const; +}; + struct WW8OleMap { sal_uInt32 mnWWid; diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index 659ef01562d1..498c10133954 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -206,7 +206,7 @@ Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr, return 0; } String aFileName( rMedium.GetName() ); - SwRead pRead = SwIoSystem::GetReader( pFlt->GetUserData() ); + SwRead pRead = SwReaderWriter::GetReader( pFlt->GetUserData() ); if( !pRead ) return 0; @@ -602,7 +602,7 @@ BOOL SwDocShell::ConvertTo( SfxMedium& rMedium ) return FALSE; WriterRef xWriter; - SwIoSystem::GetWriter( pFlt->GetUserData(), rMedium.GetBaseURL( true ), xWriter ); + SwReaderWriter::GetWriter( pFlt->GetUserData(), rMedium.GetBaseURL( true ), xWriter ); if( !xWriter.Is() ) { // Der Filter ist nicht vorhanden InfoBox( 0, diff --git a/sw/source/ui/app/mainwn.cxx b/sw/source/ui/app/mainwn.cxx index dafe7bab08fd..815269e82044 100644 --- a/sw/source/ui/app/mainwn.cxx +++ b/sw/source/ui/app/mainwn.cxx @@ -33,7 +33,7 @@ - +#include #include #include #ifndef _SVARRAY_HXX diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx index b831fc410396..44c2aeeb6220 100644 --- a/sw/source/ui/dbui/mmlayoutpage.cxx +++ b/sw/source/ui/dbui/mmlayoutpage.cxx @@ -72,12 +72,10 @@ #include #include - #include #include #include - using namespace osl; using namespace svt; using namespace ::com::sun::star; @@ -132,7 +130,7 @@ SwMailMergeLayoutPage::SwMailMergeLayoutPage( SwMailMergeWizard* _pParent) : const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat( - String::CreateFromAscii( GetFILTER_XML() ), + String::CreateFromAscii( FILTER_XML ), SwDocShell::Factory().GetFilterContainer() ); //save the current document into a temporary file { diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 803ef93b9cdc..4a5884a9daeb 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -778,7 +778,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) INetURLObject(), utl::TempFile::CreateTempName(), URIHelper::GetMaybeFileHdl()); const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat( - String::CreateFromAscii( GetFILTER_XML() ), + String::CreateFromAscii( FILTER_XML ), SwDocShell::Factory().GetFilterContainer() ); uno::Sequence< beans::PropertyValue > aValues(1); @@ -1093,7 +1093,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) SfxFilterMatcher aMatcher( pFilterContainer->GetName() ); SfxFilterMatcherIter aIter( &aMatcher ); const SfxFilter* pFilter = aIter.First(); - String sFilterUserData( String::CreateFromAscii(GetFILTER_WW8())); + String sFilterUserData( String::CreateFromAscii( FILTER_WW8 )); while ( pFilter ) { if( pFilter->GetUserData() == sFilterUserData && pFilter->CanExport() ) @@ -1180,7 +1180,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) INetURLObject(), utl::TempFile::CreateTempName(), URIHelper::GetMaybeFileHdl()); const SfxFilter *pTargetSfxFlt = SwIoSystem::GetFilterOfFormat( - String::CreateFromAscii( GetFILTER_XML() ), + String::CreateFromAscii( FILTER_XML ), SwDocShell::Factory().GetFilterContainer() ); uno::Sequence< beans::PropertyValue > aValues(1); diff --git a/sw/source/ui/dochdl/gloshdl.cxx b/sw/source/ui/dochdl/gloshdl.cxx index a8ee568b7520..c98b76476c10 100644 --- a/sw/source/ui/dochdl/gloshdl.cxx +++ b/sw/source/ui/dochdl/gloshdl.cxx @@ -920,7 +920,7 @@ BOOL SwGlossaryHdl::ImportGlossaries( const String& rName ) { SwTextBlocks *pGlossary; pMed->SetFilter( pFilter ); - Reader* pR = SwIoSystem::GetReader( pFilter->GetUserData() ); + Reader* pR = SwReaderWriter::GetReader( pFilter->GetUserData() ); if( pR && 0 != ( pGlossary = pCurGrp ? pCurGrp : rStatGlossaries.GetGroupDoc(aCurGrp)) ) { diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 301c5722a73c..d575b1bf6917 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -1704,7 +1704,7 @@ int SwTransferable::_PasteFileContent( TransferableDataHelper& rData, { pStream = &xStrm; if( SOT_FORMAT_RTF == nFmt ) - pRead = ReadRtf; + pRead = SwReaderWriter::GetReader( READER_WRITER_RTF ); else if( !pRead ) { pRead = ReadHTML; diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 3d40ce80c918..3399ecb4e752 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -680,7 +680,7 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) SvtPathOptions aPathOpt; xFP->setDisplayDirectory(aPathOpt.GetWorkPath() ); - String sWW8( C2S(GetFILTER_WW8()) ); + String sWW8( C2S( FILTER_WW8 ) ); uno::Reference xFltMgr(xFP, UNO_QUERY); SfxFilterMatcher aMatcher( String::CreateFromAscii(SwDocShell::Factory().GetShortName()) ); diff --git a/sw/source/ui/ribbar/makefile.mk b/sw/source/ui/ribbar/makefile.mk index 9c2f4bb79763..fa0b6a9488df 100644 --- a/sw/source/ui/ribbar/makefile.mk +++ b/sw/source/ui/ribbar/makefile.mk @@ -52,7 +52,6 @@ SRC1FILES = \ SLOFILES = \ $(SLO)$/inputwin.obj \ $(SLO)$/tbxanchr.obj \ - $(SLO)$/tbxmgr.obj \ $(SLO)$/conrect.obj \ $(SLO)$/conform.obj \ $(SLO)$/conpoly.obj \ diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index ea42b91fd9b9..fe585e068aa4 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -71,43 +71,21 @@ #include #include #include -#ifndef _DOCSH_HXX #include -#endif -#ifndef _WDOCSH_HXX #include -#endif -#ifndef _SRCVIEW_HXX #include -#endif #include #include -#ifndef _ITEMDEF_HXX #include -#endif #include -#ifndef _CMDID_H #include // FN_ ... -#endif -#ifndef _HELPID_H #include -#endif -#ifndef _GLOBALS_HRC #include -#endif -#ifndef _SHELLS_HRC #include -#endif -#ifndef _POPUP_HRC #include -#endif -#ifndef _WEB_HRC #include -#endif -#ifndef _VIEW_HRC #include -#endif #include #include #include @@ -130,8 +108,9 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ui::dialogs; using namespace ::com::sun::star::i18n; using namespace ::com::sun::star::lang; -using ::rtl::OUString; using namespace ::sfx2; +using ::rtl::OUString; +using ::com::sun::star::util::SearchOptions; #define SWSRCVIEWFLAGS ( SFX_VIEW_MAXIMIZE_FIRST| \ diff --git a/sw/source/ui/uno/swdet2.cxx b/sw/source/ui/uno/swdet2.cxx index ed7f3d5d6298..aedd6e0f6c68 100644 --- a/sw/source/ui/uno/swdet2.cxx +++ b/sw/source/ui/uno/swdet2.cxx @@ -38,17 +38,12 @@ #include #include #include -#ifndef _MSGBOX_HXX //autogen #include -#endif #include #include -#include - -#undef _DLL_ +#include #include -#include "iodetect.cxx" #include #include @@ -58,16 +53,11 @@ #include - -USHORT AutoDetec( const String& FileName, USHORT & rVersion ); - bool IsDocShellRegistered() { return SvtModuleOptions().IsWriter(); } -extern const char __FAR_DATA sHTML[]; - //------------------------------------------------------------------------- ULONG SwFilterDetect::DetectFilter( SfxMedium& rMedium, const SfxFilter** ppFilter ) diff --git a/sw/util/makefile.mk b/sw/util/makefile.mk index 27c39e58b0c8..902068836660 100644 --- a/sw/util/makefile.mk +++ b/sw/util/makefile.mk @@ -160,7 +160,8 @@ SHL2STDLIBS= \ SHL2OBJS= $(SLO)$/swdetect.obj \ $(SLO)$/swdet2.obj \ - $(SLO)$/detreg.obj + $(SLO)$/detreg.obj \ + $(SLO)$/iodetect.obj .IF "$(product)"=="" SHL2OBJS+= \ @@ -310,4 +311,33 @@ SHL3OBJS += $(SLO)$/pchname.obj \ .ENDIF # "$(ENABLE_PCH)" != "" .ENDIF # "$(GUI)$(COM)" == "WNTMSC" +SHL4TARGET=msword$(DLLPOSTFIX) +SHL4VERSIONMAP=msword.map +SHL4LIBS=$(SLB)$/rtf.lib $(SLB)$/ww8.lib +SHL4DEPN=$(SHL1TARGETN) +SHL4DEF=$(MISC)$/$(SHL4TARGET).def +DEF4NAME=$(SHL4TARGET) + +SHL4STDLIBS= \ + $(ISWLIB) \ + $(SVXLIB) \ + $(SFXLIB) \ + $(GOODIESLIB) \ + $(BASEGFXLIB) \ + $(SVTOOLLIB) \ + $(TKLIB) \ + $(VCLLIB) \ + $(SVLLIB) \ + $(SOTLIB) \ + $(UNOTOOLSLIB) \ + $(TOOLSLIB) \ + $(I18NISOLANGLIB) \ + $(COMPHELPERLIB) \ + $(UCBHELPERLIB) \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(SALLIB) \ + $(ICUUCLIB) \ + $(I18NUTILLIB) + .INCLUDE : target.mk diff --git a/sw/util/msword.map b/sw/util/msword.map new file mode 100644 index 000000000000..53c3eaf213eb --- /dev/null +++ b/sw/util/msword.map @@ -0,0 +1,10 @@ +MSWORD_1_0 { + global: + ImportRTF; + ExportRTF; + ImportDOC; + ExportDOC; + + local: + *; +}; -- cgit