This is an automated email from the ASF dual-hosted git repository. mseidel pushed a commit to branch AOO42X in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push: new 2e5a9e16ca Maintenance cleanup 2e5a9e16ca is described below commit 2e5a9e16ca7183442c7784b02769c09d09776e6a Author: mseidel <msei...@apache.org> AuthorDate: Mon Aug 28 21:50:26 2023 +0200 Maintenance cleanup (cherry picked from commit 681286523c50f34f13f05f7b87ce0c70e28295de) --- main/sw/source/filter/rtf/swparrtf.hxx | 359 +++++----- main/sw/source/filter/ww8/docxexport.cxx | 868 ++++++++++++------------- main/sw/source/filter/ww8/docxexport.hxx | 209 +++--- main/sw/source/filter/ww8/docxexportfilter.cxx | 182 +++--- main/sw/source/filter/ww8/docxexportfilter.hxx | 39 +- main/tools/source/string/debugprint.cxx | 20 +- main/writerfilter/source/filter/RtfFilter.cxx | 108 +-- 7 files changed, 893 insertions(+), 892 deletions(-) diff --git a/main/sw/source/filter/rtf/swparrtf.hxx b/main/sw/source/filter/rtf/swparrtf.hxx index 6b946b6119..f70f036999 100644 --- a/main/sw/source/filter/rtf/swparrtf.hxx +++ b/main/sw/source/filter/rtf/swparrtf.hxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,20 +7,19 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ #ifndef _SWPARRTF_HXX #define _SWPARRTF_HXX @@ -41,14 +40,14 @@ #include <editeng/boxitem.hxx> #include <redline.hxx> -#include <fltshell.hxx> // fuer den Attribut Stack +#include <fltshell.hxx> // fuer den Attribut Stack #include <ndindex.hxx> #include "../inc/msfilter.hxx" #include <svx/svdobj.hxx> extern void GetLineIndex(SvxBoxItem &rBox, short nLineThickness, short nSpace, sal_uInt8 nCol, short nIdx, - sal_uInt16 nOOIndex, sal_uInt16 nWWIndex, short *pSize); + sal_uInt16 nOOIndex, sal_uInt16 nWWIndex, short *pSize); class Font; class Graphic; @@ -71,9 +70,9 @@ struct SvxRTFPictureType; class RtfReader: public Reader { - virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &); + virtual sal_uLong Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &); public: - virtual sal_uLong Read( SvStream* pStrm, SwDoc &, const String& rBaseURL, SwPaM &); + virtual sal_uLong Read( SvStream* pStrm, SwDoc &, const String& rBaseURL, SwPaM &); }; class SwNodeIdx : public SvxNodeIdx @@ -88,15 +87,15 @@ public: class BookmarkPosition { public: - SwNodeIndex maMkNode; - xub_StrLen mnMkCntnt; - BookmarkPosition(const SwPaM &rPaM); - BookmarkPosition(const BookmarkPosition &rEntry); + SwNodeIndex maMkNode; + xub_StrLen mnMkCntnt; + BookmarkPosition(const SwPaM &rPaM); + BookmarkPosition(const BookmarkPosition &rEntry); bool operator==(const BookmarkPosition); private: - //No assignment - BookmarkPosition& operator=(const BookmarkPosition&); + // No assignment + BookmarkPosition& operator=(const BookmarkPosition&); }; @@ -158,50 +157,50 @@ typedef std::deque< SwListEntry > SwListArr; struct DocPageInformation { SvxBoxItem maBox; - long mnPaperw; - long mnPaperh; - long mnMargl; - long mnMargr; - long mnMargt; - long mnMargb; - long mnGutter; - long mnPgnStart; - bool mbFacingp; - bool mbLandscape; - bool mbRTLdoc; - DocPageInformation(); + long mnPaperw; + long mnPaperh; + long mnMargl; + long mnMargr; + long mnMargt; + long mnMargb; + long mnGutter; + long mnPgnStart; + bool mbFacingp; + bool mbLandscape; + bool mbRTLdoc; + DocPageInformation(); }; struct SectPageInformation { - std::vector<long> maColumns; + std::vector<long> maColumns; SvxBoxItem maBox; - SvxNumberType maNumType; - SwPageDesc *mpTitlePageHdFt; - SwPageDesc *mpPageHdFt; - long mnPgwsxn; - long mnPghsxn; - long mnMarglsxn; - long mnMargrsxn; - long mnMargtsxn; - long mnMargbsxn; - long mnGutterxsn; - long mnHeadery; - long mnFootery; - long mnPgnStarts; - long mnCols; - long mnColsx; - long mnStextflow; - int mnBkc; - bool mbLndscpsxn; - bool mbTitlepg; - bool mbFacpgsxn; - bool mbRTLsection; - bool mbPgnrestart; - bool mbTitlePageHdFtUsed; - bool mbPageHdFtUsed; - SectPageInformation(const DocPageInformation &rDoc); - SectPageInformation(const SectPageInformation &rSect); + SvxNumberType maNumType; + SwPageDesc *mpTitlePageHdFt; + SwPageDesc *mpPageHdFt; + long mnPgwsxn; + long mnPghsxn; + long mnMarglsxn; + long mnMargrsxn; + long mnMargtsxn; + long mnMargbsxn; + long mnGutterxsn; + long mnHeadery; + long mnFootery; + long mnPgnStarts; + long mnCols; + long mnColsx; + long mnStextflow; + int mnBkc; + bool mbLndscpsxn; + bool mbTitlepg; + bool mbFacpgsxn; + bool mbRTLsection; + bool mbPgnrestart; + bool mbTitlePageHdFtUsed; + bool mbPageHdFtUsed; + SectPageInformation(const DocPageInformation &rDoc); + SectPageInformation(const SectPageInformation &rSect); }; class rtfSection @@ -211,65 +210,65 @@ public: const SectPageInformation &rPageInfo); SwNodeIndex maStart; SectPageInformation maPageInfo; - SwSection *mpSection; - SwPageDesc *mpTitlePage; - SwPageDesc *mpPage; - - bool IsContinous() const { return maPageInfo.mnBkc == 0; } - long NoCols() const { return maPageInfo.mnCols; } - long StandardColSeperation() const { return maPageInfo.mnColsx; } - bool HasTitlePage() const { return maPageInfo.mbTitlepg; } - long PageStartAt() const { return maPageInfo.mnPgnStarts; } - bool PageRestartNo() const { return maPageInfo.mbPgnrestart; } - bool IsBiDi() const { return maPageInfo.mbRTLsection; } - long GetPageWidth() const { return maPageInfo.mnPgwsxn; } - long GetPageHeight() const { return maPageInfo.mnPghsxn; } - long GetPageLeft() const { return maPageInfo.mnMarglsxn; } - long GetPageRight() const { return maPageInfo.mnMargrsxn; } - bool IsLandScape() const { return maPageInfo.mbLndscpsxn; } + SwSection *mpSection; + SwPageDesc *mpTitlePage; + SwPageDesc *mpPage; + + bool IsContinous() const { return maPageInfo.mnBkc == 0; } + long NoCols() const { return maPageInfo.mnCols; } + long StandardColSeperation() const { return maPageInfo.mnColsx; } + bool HasTitlePage() const { return maPageInfo.mbTitlepg; } + long PageStartAt() const { return maPageInfo.mnPgnStarts; } + bool PageRestartNo() const { return maPageInfo.mbPgnrestart; } + bool IsBiDi() const { return maPageInfo.mbRTLsection; } + long GetPageWidth() const { return maPageInfo.mnPgwsxn; } + long GetPageHeight() const { return maPageInfo.mnPghsxn; } + long GetPageLeft() const { return maPageInfo.mnMarglsxn; } + long GetPageRight() const { return maPageInfo.mnMargrsxn; } + bool IsLandScape() const { return maPageInfo.mbLndscpsxn; } }; class rtfSections { private: - SwRTFParser &mrReader; - std::deque<rtfSection> maSegments; - typedef std::deque<rtfSection>::iterator mySegIter; - typedef std::deque<rtfSection>::reverse_iterator mySegrIter; - - struct wwULSpaceData - { - bool bHasHeader, bHasFooter; - short nSwHLo, nHdUL, nSwFUp, nFtUL, nSwUp, nSwLo; - wwULSpaceData() : bHasHeader(false), bHasFooter(false) {} - }; - - void SetSegmentToPageDesc(const rtfSection &rSection, bool bTitlePage, - bool bIgnoreCols); - SwSectionFmt *InsertSection(SwPaM& rMyPaM, rtfSection &rSection); - void SetPage(SwPageDesc &rInPageDesc, SwFrmFmt &rFmt, - const rtfSection &rSection, bool bIgnoreCols); - void GetPageULData(const rtfSection &rSection, bool bFirst, - wwULSpaceData& rData); - void SetPageULSpaceItems(SwFrmFmt &rFmt, wwULSpaceData& rData); - bool SetCols(SwFrmFmt &rFmt, const rtfSection &rSection, - sal_uInt16 nNettoWidth); - void SetHdFt(rtfSection &rSection); - void CopyFrom(const SwPageDesc &rFrom, SwPageDesc &rDest); - void MoveFrom(SwPageDesc &rFrom, SwPageDesc &rDest); + SwRTFParser &mrReader; + std::deque<rtfSection> maSegments; + typedef std::deque<rtfSection>::iterator mySegIter; + typedef std::deque<rtfSection>::reverse_iterator mySegrIter; + + struct wwULSpaceData + { + bool bHasHeader, bHasFooter; + short nSwHLo, nHdUL, nSwFUp, nFtUL, nSwUp, nSwLo; + wwULSpaceData() : bHasHeader(false), bHasFooter(false) {} + }; + + void SetSegmentToPageDesc(const rtfSection &rSection, bool bTitlePage, + bool bIgnoreCols); + SwSectionFmt *InsertSection(SwPaM& rMyPaM, rtfSection &rSection); + void SetPage(SwPageDesc &rInPageDesc, SwFrmFmt &rFmt, + const rtfSection &rSection, bool bIgnoreCols); + void GetPageULData(const rtfSection &rSection, bool bFirst, + wwULSpaceData& rData); + void SetPageULSpaceItems(SwFrmFmt &rFmt, wwULSpaceData& rData); + bool SetCols(SwFrmFmt &rFmt, const rtfSection &rSection, + sal_uInt16 nNettoWidth); + void SetHdFt(rtfSection &rSection); + void CopyFrom(const SwPageDesc &rFrom, SwPageDesc &rDest); + void MoveFrom(SwPageDesc &rFrom, SwPageDesc &rDest); public: - bool empty() const { return maSegments.empty(); } - int size() const { return maSegments.size(); } - void push_back(const rtfSection &rSect); - void pop_back() { maSegments.pop_back(); } - rtfSection& back() { return maSegments.back(); } - const rtfSection& back() const { return maSegments.back(); } - void InsertSegments(bool bIsNewDoc); - rtfSections(SwRTFParser &rReader) : mrReader(rReader) {} - std::vector<sal_uInt16> maDummyPageNos; - typedef std::vector<sal_uInt16>::reverse_iterator myrDummyIter; - void PrependedInlineNode(const SwPosition &rPos, - const SwNode &rNode); + bool empty() const { return maSegments.empty(); } + int size() const { return maSegments.size(); } + void push_back(const rtfSection &rSect); + void pop_back() { maSegments.pop_back(); } + rtfSection& back() { return maSegments.back(); } + const rtfSection& back() const { return maSegments.back(); } + void InsertSegments(bool bIsNewDoc); + rtfSections(SwRTFParser &rReader) : mrReader(rReader) {} + std::vector<sal_uInt16> maDummyPageNos; + typedef std::vector<sal_uInt16>::reverse_iterator myrDummyIter; + void PrependedInlineNode(const SwPosition &rPos, + const SwNode &rNode); }; @@ -277,84 +276,84 @@ public: class SwRTFParser : public SvxRTFParser { - /* - Knows which writer style a given word style should be imported as. - */ - sw::util::ParaStyleMapper maParaStyleMapper; - sw::util::CharStyleMapper maCharStyleMapper; + /* + Knows which writer style a given word style should be imported as. + */ + sw::util::ParaStyleMapper maParaStyleMapper; + sw::util::CharStyleMapper maCharStyleMapper; - std::vector<String> aRevTbl; + std::vector<String> aRevTbl; - friend class rtfSections; - DocPageInformation maPageDefaults; - rtfSections maSegments; + friend class rtfSections; + DocPageInformation maPageDefaults; + rtfSections maSegments; - sw::util::InsertedTablesManager maInsertedTables; + sw::util::InsertedTablesManager maInsertedTables; SwRTFStyleTbl aTxtCollTbl; SwRTFCharStyleTbl aCharFmtTbl; - SwFlySaveArr aFlyArr; // Flys als Letzes im Doc setzen - SvBools aMergeBoxes; // Flags fuer gemergte Zellen + SwFlySaveArr aFlyArr; // Flys als Letzes im Doc setzen + SvBools aMergeBoxes; // Flags fuer gemergte Zellen SwListArr aListArr; SvPtrarr aRubyCharFmts; BookmarkPosition* mpBookmarkStart; - sw::util::RedlineStack *mpRedlineStack; - sw::util::AuthorInfos* pAuthorInfos; + sw::util::RedlineStack *mpRedlineStack; + sw::util::AuthorInfos* pAuthorInfos; SfxItemSet* pGrfAttrSet; SwTableNode* pTableNode, *pOldTblNd; // fuers Lesen von Tabellen: akt. Tab SwNodeIndex* pSttNdIdx; SwNodeIndex* pRegionEndIdx; SwDoc* pDoc; - SwPaM* pPam; // SwPosition duerfte doch reichen, oder ?? - SwRelNumRuleSpaces* pRelNumRule; // Liste aller benannten NumRules + SwPaM* pPam; // SwPosition duerfte doch reichen, oder ?? + SwRelNumRuleSpaces* pRelNumRule; // Liste aller benannten NumRules - String sNestedFieldStr; - SwFltRedline *pRedlineInsert; - SwFltRedline *pRedlineDelete; + String sNestedFieldStr; + SwFltRedline *pRedlineInsert; + SwFltRedline *pRedlineDelete; - String sBaseURL; + String sBaseURL; sal_uInt16 nAktPageDesc, nAktFirstPageDesc; - sal_uInt16 m_nCurrentBox; - sal_uInt16 nInsTblRow; // beim nach \row kein \pard -> neue Line anlegen - sal_uInt16 nNewNumSectDef; // jeder SectionWechsel kann neue Rules definieren - sal_uInt16 nRowsToRepeat; + sal_uInt16 m_nCurrentBox; + sal_uInt16 nInsTblRow; // beim nach \row kein \pard -> neue Line anlegen + sal_uInt16 nNewNumSectDef; // jeder SectionWechsel kann neue Rules definieren + sal_uInt16 nRowsToRepeat; bool bSwPageDesc; - bool bReadSwFly; // lese Swg-Fly (wichtig fuer Bitmaps!) - // --> OD 2008-12-22 #i83368# - bool mbReadCellWhileReadSwFly; - // <-- - bool mbReadNoTbl; // verhinder Tabelle in Tabelle/FootNote - bool mbIsFootnote; - bool bFootnoteAutoNum; // automatische Numerierung ? - bool bStyleTabValid; // Styles schon erzeugt ? - bool bInPgDscTbl; // beim PageDescTbl lesen - bool bNewNumList; // Word 7.0 NumList gelesen, 6.0 ueberspringen - bool bFirstContinue; // 1.Call ins Continue - bool bContainsPara; // If there is no paragraph in the section - bool bContainsTablePara; // If there is an table in this section - bool bForceNewTable; // Forces a beginning of a new table - bool bNestedField; - bool bTrowdRead; // True, iff an \trowd definition was read after the last \row - - int nReadFlyDepth; + bool bReadSwFly; // lese Swg-Fly (wichtig fuer Bitmaps!) + // --> OD 2008-12-22 #i83368# + bool mbReadCellWhileReadSwFly; + // <-- + bool mbReadNoTbl; // verhinder Tabelle in Tabelle/FootNote + bool mbIsFootnote; + bool bFootnoteAutoNum; // automatische Numerierung ? + bool bStyleTabValid; // Styles schon erzeugt ? + bool bInPgDscTbl; // beim PageDescTbl lesen + bool bNewNumList; // Word 7.0 NumList gelesen, 6.0 ueberspringen + bool bFirstContinue; // 1.Call ins Continue + bool bContainsPara; // If there is no paragraph in the section + bool bContainsTablePara; // If there is an table in this section + bool bForceNewTable; // Forces a beginning of a new table + bool bNestedField; + bool bTrowdRead; // True, if a \trowd definition was read after the last \row + + int nReadFlyDepth; int nZOrder; - /* - #i9243# - In a footnote tables are not possible (for some obscure reason!) - */ - bool CantUseTables() const { return mbReadNoTbl || mbIsFootnote; } + /* + #i9243# + In a footnote tables are not possible (for some obscure reason!) + */ + bool CantUseTables() const { return mbReadNoTbl || mbIsFootnote; } virtual void InsertPara(); virtual void InsertText(); virtual void MovePos( int bForward = sal_True ); virtual void SetEndPrevPara( SvxNodeIdx*& rpNodePos, xub_StrLen& rCntPos ); - void EnterEnvironment(); - void LeaveEnvironment(); + void EnterEnvironment(); + void LeaveEnvironment(); - SwFmtPageDesc* GetCurrentPageDesc(SwPaM *pPam); + SwFmtPageDesc* GetCurrentPageDesc(SwPaM *pPam); void CheckInsNewTblLine(); // setze RTF-Werte auf Swg-Werte @@ -362,17 +361,17 @@ class SwRTFParser : public SvxRTFParser virtual void ReadInfo( const sal_Char* pChkForVerNo = 0 ); - void ReadUserProperties(); + void ReadUserProperties(); void ReadListLevel( SwNumRule& rRule, sal_uInt8 nLvl ); void SetBorderLine(SvxBoxItem& rBox, sal_uInt16 nLine); void ReadListTable(); - sal_uInt16 ReadRevTbl(); - void ReadShpRslt(); - void ReadShpTxt(String &shpTxt); - void ReadDrawingObject(); + sal_uInt16 ReadRevTbl(); + void ReadShpRslt(); + void ReadShpTxt(String &shpTxt); + void ReadDrawingObject(); void InsertShpObject(SdrObject* pStroke, int nZOrder); - void ReadShapeObject(); + void ReadShapeObject(); void ReadListOverrideTable(); SwNumRule *ReadNumSecLevel( int nToken ); SwNumRule* GetNumRuleOfListNo( long nListNo, @@ -389,7 +388,7 @@ class SwRTFParser : public SvxRTFParser void SetStyleAttr( SfxItemSet& rCollSet, const SfxItemSet& rStyleSet, const SfxItemSet& rDerivedSet ); - SwTxtFmtColl* MakeStyle( sal_uInt16 nNo, const SvxRTFStyleType& rStyle ); + SwTxtFmtColl* MakeStyle( sal_uInt16 nNo, const SvxRTFStyleType& rStyle ); SwCharFmt* MakeCharStyle( sal_uInt16 nNo, const SvxRTFStyleType& rStyle ); void MakeStyleTab(); @@ -399,16 +398,16 @@ class SwRTFParser : public SvxRTFParser void InsPicture( const String& rNm, const Graphic* = 0, const SvxRTFPictureType* = 0 ); void _SetPictureSize( const SwNoTxtNode& rNd, const SwNodeIndex& rAnchor, - SfxItemSet& rSet, const SvxRTFPictureType* = 0 ); + SfxItemSet& rSet, const SvxRTFPictureType* = 0 ); void SetFlysInDoc(); - void GetPageSize( Size& rSize ); // Groesse der PagePrintArea + void GetPageSize( Size& rSize ); // Groesse der PagePrintArea // fuers Einlesen von Tabellen void GotoNextBox(); void NewTblLine(); - void DelLastNode(); // loesche den letzten Node (Tabelle/Fly/Ftn/..) + void DelLastNode(); // loesche den letzten Node (Tabelle/Fly/Ftn/..) void AddNumRule( SwNumRule* pRule ); void SetNumRelSpaces(); @@ -416,7 +415,7 @@ class SwRTFParser : public SvxRTFParser const SwNodeIndex& rEnd ); void SetNumLSpace( SwTxtNode& rNd, const SwNodeNum& rNum, const SwNumRule& rRule ); - long GetSafePos(long nPos); + long GetSafePos(long nPos); protected: // wird fuer jedes Token gerufen, das in CallParser erkannt wird @@ -428,13 +427,13 @@ protected: virtual void ReadOLEData(); #endif virtual void SetAttrInDoc( SvxRTFItemStackType &rSet ); - virtual bool UncompressableStackEntry(const SvxRTFItemStackType &rSet) const; + virtual bool UncompressableStackEntry(const SvxRTFItemStackType &rSet) const; // fuer Tokens, die im ReadAttr nicht ausgewertet werden virtual void UnknownAttrToken( int nToken, SfxItemSet* pSet ); void ReadPrtData(); void ReadField(); - void ReadXEField(); + void ReadXEField(); void ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc = 0 ); void ReadDocControls( int nToken ); void SetPageInformationAsDefault(const DocPageInformation &rInfo); @@ -443,22 +442,22 @@ protected: void ReadFly( int nToken, SfxItemSet* pFillSet = 0 ); void ReadTable( int nToken ); void ReadPageDescTbl(); - void SkipPageDescTbl(); - bool IsBorderToken(int nToken); + void SkipPageDescTbl(); + bool IsBorderToken(int nToken); - const String& GetBaseURL() const { return sBaseURL;} + const String& GetBaseURL() const { return sBaseURL;} virtual ~SwRTFParser(); public: SwRTFParser( SwDoc* pD, - ::com::sun::star::uno::Reference< - ::com::sun::star::document::XDocumentProperties> i_xDocProps, - const SwPaM& rCrsr, SvStream& rIn, - const String& rBaseURL, - int bReadNewDoc = sal_True ); + ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties> i_xDocProps, + const SwPaM& rCrsr, SvStream& rIn, + const String& rBaseURL, + int bReadNewDoc = sal_True ); - virtual SvParserState CallParser(); // Aufruf des Parsers + virtual SvParserState CallParser(); // Aufruf des Parsers virtual int IsEndPara( SvxNodeIdx* pNd, xub_StrLen nCnt ) const; // fuers asynchrone lesen aus dem SvStream @@ -470,4 +469,4 @@ public: #endif -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ +/* vim: set noet sw=4 ts=4: */ diff --git a/main/sw/source/filter/ww8/docxexport.cxx b/main/sw/source/filter/ww8/docxexport.cxx index 99fcbe8eb9..5caba89441 100644 --- a/main/sw/source/filter/ww8/docxexport.cxx +++ b/main/sw/source/filter/ww8/docxexport.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -71,599 +71,599 @@ using sw::mark::IMark; AttributeOutputBase& DocxExport::AttrOutput() const { - return *m_pAttrOutput; + return *m_pAttrOutput; } MSWordSections& DocxExport::Sections() const { - return *m_pSections; + return *m_pSections; } bool DocxExport::CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich ) { - // TODO FIXME is this actually true for docx? - this is ~copied from WW8 - if ( nScript == i18n::ScriptType::ASIAN ) - { - // for asian in ww8, there is only one fontsize - // and one fontstyle (posture/weight) - switch ( nWhich ) - { - case RES_CHRATR_FONTSIZE: - case RES_CHRATR_POSTURE: - case RES_CHRATR_WEIGHT: - return false; - default: - break; - } - } - else if ( nScript != i18n::ScriptType::COMPLEX ) - { - // for western in ww8, there is only one fontsize - // and one fontstyle (posture/weight) - switch ( nWhich ) - { - case RES_CHRATR_CJK_FONTSIZE: - case RES_CHRATR_CJK_POSTURE: - case RES_CHRATR_CJK_WEIGHT: - return false; - default: - break; - } - } - return true; + // TODO FIXME is this actually true for docx? - this is ~copied from WW8 + if ( nScript == i18n::ScriptType::ASIAN ) + { + // for asian in ww8, there is only one fontsize + // and one fontstyle (posture/weight) + switch ( nWhich ) + { + case RES_CHRATR_FONTSIZE: + case RES_CHRATR_POSTURE: + case RES_CHRATR_WEIGHT: + return false; + default: + break; + } + } + else if ( nScript != i18n::ScriptType::COMPLEX ) + { + // for western in ww8, there is only one fontsize + // and one fontstyle (posture/weight) + switch ( nWhich ) + { + case RES_CHRATR_CJK_FONTSIZE: + case RES_CHRATR_CJK_POSTURE: + case RES_CHRATR_CJK_WEIGHT: + return false; + default: + break; + } + } + return true; } void DocxExport::AppendBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen ) { - std::vector< OUString > aStarts; - std::vector< OUString > aEnds; - - IMarkVector aMarks; - if ( GetBookmarks( rNode, nAktPos, nAktPos + nLen, aMarks ) ) - { - for ( IMarkVector::const_iterator it = aMarks.begin(), end = aMarks.end(); - it < end; ++it ) - { - IMark* pMark = (*it); - - xub_StrLen nStart = pMark->GetMarkStart().nContent.GetIndex(); - xub_StrLen nEnd = pMark->GetMarkEnd().nContent.GetIndex(); - - if ( nStart == nAktPos ) - aStarts.push_back( pMark->GetName() ); - - if ( nEnd == nAktPos ) - aEnds.push_back( pMark->GetName() ); - } - } - - m_pAttrOutput->WriteBookmarks_Impl( aStarts, aEnds ); + std::vector< OUString > aStarts; + std::vector< OUString > aEnds; + + IMarkVector aMarks; + if ( GetBookmarks( rNode, nAktPos, nAktPos + nLen, aMarks ) ) + { + for ( IMarkVector::const_iterator it = aMarks.begin(), end = aMarks.end(); + it < end; ++it ) + { + IMark* pMark = (*it); + + xub_StrLen nStart = pMark->GetMarkStart().nContent.GetIndex(); + xub_StrLen nEnd = pMark->GetMarkEnd().nContent.GetIndex(); + + if ( nStart == nAktPos ) + aStarts.push_back( pMark->GetName() ); + + if ( nEnd == nAktPos ) + aEnds.push_back( pMark->GetName() ); + } + } + + m_pAttrOutput->WriteBookmarks_Impl( aStarts, aEnds ); } void DocxExport::AppendBookmark( const OUString& rName, bool /*bSkip*/ ) { - std::vector< OUString > aStarts; - std::vector< OUString > aEnds; + std::vector< OUString > aStarts; + std::vector< OUString > aEnds; - aStarts.push_back( rName ); - aEnds.push_back( rName ); + aStarts.push_back( rName ); + aEnds.push_back( rName ); - m_pAttrOutput->WriteBookmarks_Impl( aStarts, aEnds ); + m_pAttrOutput->WriteBookmarks_Impl( aStarts, aEnds ); } ::rtl::OString DocxExport::AddRelation( const OUString& rType, const OUString& rTarget, const OUString& rMode ) { - OUString sId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), - rType, rTarget, rMode ); + OUString sId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + rType, rTarget, rMode ); - return ::rtl::OUStringToOString( sId, RTL_TEXTENCODING_UTF8 ); + return ::rtl::OUStringToOString( sId, RTL_TEXTENCODING_UTF8 ); } bool DocxExport::DisallowInheritingOutlineNumbering( const SwFmt& rFmt ) { - bool bRet( false ); + bool bRet( false ); - if (SFX_ITEM_SET != rFmt.GetItemState(RES_PARATR_NUMRULE, false)) - { - if (const SwFmt *pParent = rFmt.DerivedFrom()) - { + if (SFX_ITEM_SET != rFmt.GetItemState(RES_PARATR_NUMRULE, false)) + { + if (const SwFmt *pParent = rFmt.DerivedFrom()) + { if (((const SwTxtFmtColl*)pParent)->IsAssignedToListLevelOfOutlineStyle()) - { - ::sax_fastparser::FSHelperPtr pSerializer = m_pAttrOutput->GetSerializer( ); - // Level 9 disables the outline - pSerializer->singleElementNS( XML_w, XML_outlineLvl, - FSNS( XML_w, XML_val ), "9" , - FSEND ); - - bRet = true; - } - } - } - - return bRet; + { + ::sax_fastparser::FSHelperPtr pSerializer = m_pAttrOutput->GetSerializer( ); + // Level 9 disables the outline + pSerializer->singleElementNS( XML_w, XML_outlineLvl, + FSNS( XML_w, XML_val ), "9" , + FSEND ); + + bRet = true; + } + } + } + + return bRet; } void DocxExport::WriteHeadersFooters( sal_uInt8 nHeadFootFlags, - const SwFrmFmt& rFmt, const SwFrmFmt& rLeftFmt, const SwFrmFmt& rFirstPageFmt ) + const SwFrmFmt& rFmt, const SwFrmFmt& rLeftFmt, const SwFrmFmt& rFirstPageFmt ) { - // headers - if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_EVEN ) - WriteHeaderFooter( rLeftFmt, true, "even" ); + // headers + if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_EVEN ) + WriteHeaderFooter( rLeftFmt, true, "even" ); - if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_ODD ) - WriteHeaderFooter( rFmt, true, "default" ); + if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_ODD ) + WriteHeaderFooter( rFmt, true, "default" ); - if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_FIRST ) - WriteHeaderFooter( rFirstPageFmt, true, "first" ); + if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_FIRST ) + WriteHeaderFooter( rFirstPageFmt, true, "first" ); - // footers - if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_EVEN ) - WriteHeaderFooter( rLeftFmt, false, "even" ); + // footers + if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_EVEN ) + WriteHeaderFooter( rLeftFmt, false, "even" ); - if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_ODD ) - WriteHeaderFooter( rFmt, false, "default" ); + if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_ODD ) + WriteHeaderFooter( rFmt, false, "default" ); - if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_FIRST ) - WriteHeaderFooter( rFirstPageFmt, false, "first" ); + if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_FIRST ) + WriteHeaderFooter( rFirstPageFmt, false, "first" ); } void DocxExport::OutputField( const SwField* pFld, ww::eField eFldType, const String& rFldCmd, sal_uInt8 nMode ) { - m_pAttrOutput->WriteField_Impl( pFld, eFldType, rFldCmd, nMode ); + m_pAttrOutput->WriteField_Impl( pFld, eFldType, rFldCmd, nMode ); } void DocxExport::WriteFormData( const ::sw::mark::IFieldmark& /*rFieldmark*/ ) { - OSL_TRACE( "TODO DocxExport::WriteFormData()\n" ); + OSL_TRACE( "TODO DocxExport::WriteFormData()\n" ); } void DocxExport::DoComboBox(const rtl::OUString& rName, - const rtl::OUString& rHelp, - const rtl::OUString& rToolTip, - const rtl::OUString& rSelected, - uno::Sequence<rtl::OUString>& rListItems) + const rtl::OUString& rHelp, + const rtl::OUString& rToolTip, + const rtl::OUString& rSelected, + uno::Sequence<rtl::OUString>& rListItems) { - m_pDocumentFS->startElementNS( XML_w, XML_ffData, FSEND ); - - m_pDocumentFS->singleElementNS( XML_w, XML_name, - FSNS( XML_w, XML_val ), OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr(), - FSEND ); - - m_pDocumentFS->singleElementNS( XML_w, XML_enabled, FSEND ); - - if ( rHelp.getLength( ) > 0 ) - m_pDocumentFS->singleElementNS( XML_w, XML_helpText, - FSNS( XML_w, XML_val ), OUStringToOString( rHelp, RTL_TEXTENCODING_UTF8 ).getStr(), - FSEND ); - - if ( rToolTip.getLength( ) > 0 ) - m_pDocumentFS->singleElementNS( XML_w, XML_statusText, - FSNS( XML_w, XML_val ), OUStringToOString( rToolTip, RTL_TEXTENCODING_UTF8 ).getStr(), - FSEND ); - - m_pDocumentFS->startElementNS( XML_w, XML_ddList, FSEND ); - - // Output the 0-based index of the selected value - sal_uInt32 nListItems = rListItems.getLength(); - sal_Int32 nId = 0; - sal_uInt32 nI = 0; - while ( ( nI < nListItems ) && ( nId == 0 ) ) - { - if ( rListItems[nI] == rSelected ) - nId = nI; - nI++; - } - - m_pDocumentFS->singleElementNS( XML_w, XML_result, - FSNS( XML_w, XML_val ), rtl::OString::valueOf( nId ).getStr( ), - FSEND ); - - // Loop over the entries - - for (sal_uInt32 i = 0; i < nListItems; i++) - { - m_pDocumentFS->singleElementNS( XML_w, XML_listEntry, - FSNS( XML_w, XML_val ), OUStringToOString( rListItems[i], RTL_TEXTENCODING_UTF8 ).getStr(), - FSEND ); - } - - m_pDocumentFS->endElementNS( XML_w, XML_ddList ); - - m_pDocumentFS->endElementNS( XML_w, XML_ffData ); + m_pDocumentFS->startElementNS( XML_w, XML_ffData, FSEND ); + + m_pDocumentFS->singleElementNS( XML_w, XML_name, + FSNS( XML_w, XML_val ), OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ).getStr(), + FSEND ); + + m_pDocumentFS->singleElementNS( XML_w, XML_enabled, FSEND ); + + if ( rHelp.getLength( ) > 0 ) + m_pDocumentFS->singleElementNS( XML_w, XML_helpText, + FSNS( XML_w, XML_val ), OUStringToOString( rHelp, RTL_TEXTENCODING_UTF8 ).getStr(), + FSEND ); + + if ( rToolTip.getLength( ) > 0 ) + m_pDocumentFS->singleElementNS( XML_w, XML_statusText, + FSNS( XML_w, XML_val ), OUStringToOString( rToolTip, RTL_TEXTENCODING_UTF8 ).getStr(), + FSEND ); + + m_pDocumentFS->startElementNS( XML_w, XML_ddList, FSEND ); + + // Output the 0-based index of the selected value + sal_uInt32 nListItems = rListItems.getLength(); + sal_Int32 nId = 0; + sal_uInt32 nI = 0; + while ( ( nI < nListItems ) && ( nId == 0 ) ) + { + if ( rListItems[nI] == rSelected ) + nId = nI; + nI++; + } + + m_pDocumentFS->singleElementNS( XML_w, XML_result, + FSNS( XML_w, XML_val ), rtl::OString::valueOf( nId ).getStr( ), + FSEND ); + + // Loop over the entries + + for (sal_uInt32 i = 0; i < nListItems; i++) + { + m_pDocumentFS->singleElementNS( XML_w, XML_listEntry, + FSNS( XML_w, XML_val ), OUStringToOString( rListItems[i], RTL_TEXTENCODING_UTF8 ).getStr(), + FSEND ); + } + + m_pDocumentFS->endElementNS( XML_w, XML_ddList ); + + m_pDocumentFS->endElementNS( XML_w, XML_ffData ); } void DocxExport::DoFormText(const SwInputField* /*pFld*/) { - OSL_TRACE( "TODO DocxExport::ForFormText()\n" ); + OSL_TRACE( "TODO DocxExport::ForFormText()\n" ); } void DocxExport::ExportDocument_Impl() { - InitStyles(); + InitStyles(); + + // init sections + m_pSections = new MSWordSections( *this ); - // init sections - m_pSections = new MSWordSections( *this ); + WriteMainText(); - WriteMainText(); + WriteFootnotesEndnotes(); - WriteFootnotesEndnotes(); - - WriteNumbering(); + WriteNumbering(); - WriteFonts(); + WriteFonts(); - delete pStyles, pStyles = NULL; - delete m_pSections, m_pSections = NULL; + delete pStyles, pStyles = NULL; + delete m_pSections, m_pSections = NULL; } void DocxExport::OutputPageSectionBreaks( const SwTxtNode& ) { - OSL_TRACE( "TODO DocxExport::OutputPageSectionBreaks( const SwTxtNode& )\n" ); + OSL_TRACE( "TODO DocxExport::OutputPageSectionBreaks( const SwTxtNode& )\n" ); } void DocxExport::AppendSection( const SwPageDesc *pPageDesc, const SwSectionFmt* pFmt, sal_uLong nLnNum ) { - AttrOutput().SectionBreak( msword::PageBreak, m_pSections->CurrentSectionInfo() ); - m_pSections->AppendSection( pPageDesc, pFmt, nLnNum ); + AttrOutput().SectionBreak( msword::PageBreak, m_pSections->CurrentSectionInfo() ); + m_pSections->AppendSection( pPageDesc, pFmt, nLnNum ); } void DocxExport::OutputEndNode( const SwEndNode& rEndNode ) { - MSWordExportBase::OutputEndNode( rEndNode ); - - if ( TXT_MAINTEXT == nTxtTyp && rEndNode.StartOfSectionNode()->IsSectionNode() ) - { - // this originally comes from WW8Export::WriteText(), and looks like it - // could have some code common with SectionNode()... - - const SwSection& rSect = rEndNode.StartOfSectionNode()->GetSectionNode()->GetSection(); - if ( bStartTOX && TOX_CONTENT_SECTION == rSect.GetType() ) - bStartTOX = false; - - SwNodeIndex aIdx( rEndNode, 1 ); - const SwNode& rNd = aIdx.GetNode(); - if ( rNd.IsEndNode() && rNd.StartOfSectionNode()->IsSectionNode() ) - return; - - if ( !rNd.IsSectionNode() && !bIsInTable ) // No sections in table - { - const SwSectionFmt* pParentFmt = rSect.GetFmt()->GetParent(); - if( !pParentFmt ) - pParentFmt = (SwSectionFmt*)0xFFFFFFFF; - - sal_uLong nRstLnNum; - if( rNd.IsCntntNode() ) - nRstLnNum = const_cast< SwCntntNode* >( rNd.GetCntntNode() )->GetSwAttrSet().GetLineNumber().GetStartValue(); - else - nRstLnNum = 0; - - AttrOutput().SectionBreak( msword::PageBreak, m_pSections->CurrentSectionInfo( ) ); - m_pSections->AppendSection( pAktPageDesc, pParentFmt, nRstLnNum ); - } - } + MSWordExportBase::OutputEndNode( rEndNode ); + + if ( TXT_MAINTEXT == nTxtTyp && rEndNode.StartOfSectionNode()->IsSectionNode() ) + { + // this originally comes from WW8Export::WriteText(), and looks like it + // could have some code common with SectionNode()... + + const SwSection& rSect = rEndNode.StartOfSectionNode()->GetSectionNode()->GetSection(); + if ( bStartTOX && TOX_CONTENT_SECTION == rSect.GetType() ) + bStartTOX = false; + + SwNodeIndex aIdx( rEndNode, 1 ); + const SwNode& rNd = aIdx.GetNode(); + if ( rNd.IsEndNode() && rNd.StartOfSectionNode()->IsSectionNode() ) + return; + + if ( !rNd.IsSectionNode() && !bIsInTable ) // No sections in table + { + const SwSectionFmt* pParentFmt = rSect.GetFmt()->GetParent(); + if( !pParentFmt ) + pParentFmt = (SwSectionFmt*)0xFFFFFFFF; + + sal_uLong nRstLnNum; + if( rNd.IsCntntNode() ) + nRstLnNum = const_cast< SwCntntNode* >( rNd.GetCntntNode() )->GetSwAttrSet().GetLineNumber().GetStartValue(); + else + nRstLnNum = 0; + + AttrOutput().SectionBreak( msword::PageBreak, m_pSections->CurrentSectionInfo( ) ); + m_pSections->AppendSection( pAktPageDesc, pParentFmt, nRstLnNum ); + } + } } void DocxExport::OutputTableNode( const SwTableNode& ) { - OSL_TRACE( "TODO DocxExport::OutputTableNode( const SwTableNode& )\n" ); + OSL_TRACE( "TODO DocxExport::OutputTableNode( const SwTableNode& )\n" ); } void DocxExport::OutputGrfNode( const SwGrfNode& ) { - OSL_TRACE( "TODO DocxExport::OutputGrfNode( const SwGrfNode& )\n" ); + OSL_TRACE( "TODO DocxExport::OutputGrfNode( const SwGrfNode& )\n" ); } void DocxExport::OutputOLENode( const SwOLENode& ) { - OSL_TRACE( "TODO DocxExport::OutputOLENode( const SwOLENode& )\n" ); + OSL_TRACE( "TODO DocxExport::OutputOLENode( const SwOLENode& )\n" ); } sal_uLong DocxExport::ReplaceCr( sal_uInt8 ) { - // Completely unused for Docx export... only here for code sharing - // purpose with binary export - return 0; + // Completely unused for Docx export... only here for code sharing + // purpose with binary export + return 0; } void DocxExport::PrepareNewPageDesc( const SfxItemSet* pSet, - const SwNode& rNd, const SwFmtPageDesc* pNewPgDescFmt, - const SwPageDesc* pNewPgDesc ) + const SwNode& rNd, const SwFmtPageDesc* pNewPgDescFmt, + const SwPageDesc* pNewPgDesc ) { - // tell the attribute output that we are ready to write the section - // break [has to be output inside paragraph properties] - AttrOutput().SectionBreak( msword::PageBreak, m_pSections->CurrentSectionInfo() ); + // tell the attribute output that we are ready to write the section + // break [has to be output inside paragraph properties] + AttrOutput().SectionBreak( msword::PageBreak, m_pSections->CurrentSectionInfo() ); - const SwSectionFmt* pFmt = GetSectionFormat( rNd ); - const sal_uLong nLnNm = GetSectionLineNo( pSet, rNd ); + const SwSectionFmt* pFmt = GetSectionFormat( rNd ); + const sal_uLong nLnNm = GetSectionLineNo( pSet, rNd ); - ASSERT( pNewPgDescFmt || pNewPgDesc, "Neither page desc format nor page desc provided." ); + ASSERT( pNewPgDescFmt || pNewPgDesc, "Neither page desc format nor page desc provided." ); - if ( pNewPgDescFmt ) - { - m_pSections->AppendSection( *pNewPgDescFmt, rNd, pFmt, nLnNm ); - } - else if ( pNewPgDesc ) - { - m_pSections->AppendSection( pNewPgDesc, rNd, pFmt, nLnNm ); - } + if ( pNewPgDescFmt ) + { + m_pSections->AppendSection( *pNewPgDescFmt, rNd, pFmt, nLnNm ); + } + else if ( pNewPgDesc ) + { + m_pSections->AppendSection( pNewPgDesc, rNd, pFmt, nLnNm ); + } } void DocxExport::InitStyles() { - pStyles = new MSWordStyles( *this ); + pStyles = new MSWordStyles( *this ); - // setup word/styles.xml and the relations + content type - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), - S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" ), - S( "styles.xml" ) ); + // setup word/styles.xml and the relations + content type + m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" ), + S( "styles.xml" ) ); - ::sax_fastparser::FSHelperPtr pStylesFS = - m_pFilter->openOutputStreamWithSerializer( S( "word/styles.xml" ), - S( "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" ) ); + ::sax_fastparser::FSHelperPtr pStylesFS = + m_pFilter->openOutputStreamWithSerializer( S( "word/styles.xml" ), + S( "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" ) ); - // switch the serializer to redirect the output to word/styles.xml - m_pAttrOutput->SetSerializer( pStylesFS ); + // switch the serializer to redirect the output to word/styles.xml + m_pAttrOutput->SetSerializer( pStylesFS ); - // do the work - pStyles->OutputStylesTable(); + // do the work + pStyles->OutputStylesTable(); - // switch the serializer back - m_pAttrOutput->SetSerializer( m_pDocumentFS ); + // switch the serializer back + m_pAttrOutput->SetSerializer( m_pDocumentFS ); } void DocxExport::WriteFootnotesEndnotes() { - if ( m_pAttrOutput->HasFootnotes() ) - { - // setup word/styles.xml and the relations + content type - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), - S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" ), - S( "footnotes.xml" ) ); - - ::sax_fastparser::FSHelperPtr pFootnotesFS = - m_pFilter->openOutputStreamWithSerializer( S( "word/footnotes.xml" ), - S( "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml" ) ); - - // switch the serializer to redirect the output to word/footnotes.xml - m_pAttrOutput->SetSerializer( pFootnotesFS ); - - // do the work - m_pAttrOutput->FootnotesEndnotes( true ); - - // switch the serializer back - m_pAttrOutput->SetSerializer( m_pDocumentFS ); - } - - if ( m_pAttrOutput->HasEndnotes() ) - { - // setup word/styles.xml and the relations + content type - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), - S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes" ), - S( "endnotes.xml" ) ); - - ::sax_fastparser::FSHelperPtr pEndnotesFS = - m_pFilter->openOutputStreamWithSerializer( S( "word/endnotes.xml" ), - S( "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml" ) ); - - // switch the serializer to redirect the output to word/endnotes.xml - m_pAttrOutput->SetSerializer( pEndnotesFS ); - - // do the work - m_pAttrOutput->FootnotesEndnotes( false ); - - // switch the serializer back - m_pAttrOutput->SetSerializer( m_pDocumentFS ); - } + if ( m_pAttrOutput->HasFootnotes() ) + { + // setup word/styles.xml and the relations + content type + m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" ), + S( "footnotes.xml" ) ); + + ::sax_fastparser::FSHelperPtr pFootnotesFS = + m_pFilter->openOutputStreamWithSerializer( S( "word/footnotes.xml" ), + S( "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml" ) ); + + // switch the serializer to redirect the output to word/footnotes.xml + m_pAttrOutput->SetSerializer( pFootnotesFS ); + + // do the work + m_pAttrOutput->FootnotesEndnotes( true ); + + // switch the serializer back + m_pAttrOutput->SetSerializer( m_pDocumentFS ); + } + + if ( m_pAttrOutput->HasEndnotes() ) + { + // setup word/styles.xml and the relations + content type + m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes" ), + S( "endnotes.xml" ) ); + + ::sax_fastparser::FSHelperPtr pEndnotesFS = + m_pFilter->openOutputStreamWithSerializer( S( "word/endnotes.xml" ), + S( "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml" ) ); + + // switch the serializer to redirect the output to word/endnotes.xml + m_pAttrOutput->SetSerializer( pEndnotesFS ); + + // do the work + m_pAttrOutput->FootnotesEndnotes( false ); + + // switch the serializer back + m_pAttrOutput->SetSerializer( m_pDocumentFS ); + } } void DocxExport::WriteNumbering() { - if ( !pUsedNumTbl ) - return; // no numbering is used + if ( !pUsedNumTbl ) + return; // no numbering is used - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), - S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" ), - S( "numbering.xml" ) ); + m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" ), + S( "numbering.xml" ) ); - ::sax_fastparser::FSHelperPtr pNumberingFS = m_pFilter->openOutputStreamWithSerializer( S( "word/numbering.xml" ), - S( "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml" ) ); + ::sax_fastparser::FSHelperPtr pNumberingFS = m_pFilter->openOutputStreamWithSerializer( S( "word/numbering.xml" ), + S( "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml" ) ); - // switch the serializer to redirect the output to word/nubering.xml - m_pAttrOutput->SetSerializer( pNumberingFS ); + // switch the serializer to redirect the output to word/nubering.xml + m_pAttrOutput->SetSerializer( pNumberingFS ); - pNumberingFS->startElementNS( XML_w, XML_numbering, - FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main", - FSEND ); + pNumberingFS->startElementNS( XML_w, XML_numbering, + FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main", + FSEND ); - AbstractNumberingDefinitions(); + AbstractNumberingDefinitions(); - NumberingDefinitions(); + NumberingDefinitions(); - pNumberingFS->endElementNS( XML_w, XML_numbering ); + pNumberingFS->endElementNS( XML_w, XML_numbering ); - // switch the serializer back - m_pAttrOutput->SetSerializer( m_pDocumentFS ); + // switch the serializer back + m_pAttrOutput->SetSerializer( m_pDocumentFS ); } void DocxExport::WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char* pType ) { - // setup the xml stream - OUString aRelId; - ::sax_fastparser::FSHelperPtr pFS; - if ( bHeader ) - { - OUString aName( OUStringBuffer().appendAscii( "header" ).append( ++m_nHeaders ).appendAscii( ".xml" ).makeStringAndClear() ); - - aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), - S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" ), - aName ); - - pFS = m_pFilter->openOutputStreamWithSerializer( OUStringBuffer().appendAscii( "word/" ).append( aName ).makeStringAndClear(), - S( "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" ) ); - - pFS->startElementNS( XML_w, XML_hdr, - FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main", - FSEND ); - } - else - { - OUString aName( OUStringBuffer().appendAscii( "footer" ).append( ++m_nFooters ).appendAscii( ".xml" ).makeStringAndClear() ); - - aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), - S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" ), - aName ); - - pFS = m_pFilter->openOutputStreamWithSerializer( OUStringBuffer().appendAscii( "word/" ).append( aName ).makeStringAndClear(), - S( "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" ) ); - - pFS->startElementNS( XML_w, XML_ftr, - FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main", - FSEND ); - } - - // switch the serializer to redirect the output to word/styles.xml - m_pAttrOutput->SetSerializer( pFS ); - - // do the work - WriteHeaderFooterText( rFmt, bHeader ); - - // switch the serializer back - m_pAttrOutput->SetSerializer( m_pDocumentFS ); - - // close the tag - sal_Int32 nReference; - if ( bHeader ) - { - pFS->endElementNS( XML_w, XML_hdr ); - nReference = XML_headerReference; - } - else - { - pFS->endElementNS( XML_w, XML_ftr ); - nReference = XML_footerReference; - } - - // and write the reference - m_pDocumentFS->singleElementNS( XML_w, nReference, - FSNS( XML_w, XML_type ), pType, - FSNS( XML_r, XML_id ), rtl::OUStringToOString( aRelId, RTL_TEXTENCODING_UTF8 ).getStr(), - FSEND ); + // setup the xml stream + OUString aRelId; + ::sax_fastparser::FSHelperPtr pFS; + if ( bHeader ) + { + OUString aName( OUStringBuffer().appendAscii( "header" ).append( ++m_nHeaders ).appendAscii( ".xml" ).makeStringAndClear() ); + + aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" ), + aName ); + + pFS = m_pFilter->openOutputStreamWithSerializer( OUStringBuffer().appendAscii( "word/" ).append( aName ).makeStringAndClear(), + S( "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" ) ); + + pFS->startElementNS( XML_w, XML_hdr, + FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main", + FSEND ); + } + else + { + OUString aName( OUStringBuffer().appendAscii( "footer" ).append( ++m_nFooters ).appendAscii( ".xml" ).makeStringAndClear() ); + + aRelId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" ), + aName ); + + pFS = m_pFilter->openOutputStreamWithSerializer( OUStringBuffer().appendAscii( "word/" ).append( aName ).makeStringAndClear(), + S( "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" ) ); + + pFS->startElementNS( XML_w, XML_ftr, + FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main", + FSEND ); + } + + // switch the serializer to redirect the output to word/styles.xml + m_pAttrOutput->SetSerializer( pFS ); + + // do the work + WriteHeaderFooterText( rFmt, bHeader ); + + // switch the serializer back + m_pAttrOutput->SetSerializer( m_pDocumentFS ); + + // close the tag + sal_Int32 nReference; + if ( bHeader ) + { + pFS->endElementNS( XML_w, XML_hdr ); + nReference = XML_headerReference; + } + else + { + pFS->endElementNS( XML_w, XML_ftr ); + nReference = XML_footerReference; + } + + // and write the reference + m_pDocumentFS->singleElementNS( XML_w, nReference, + FSNS( XML_w, XML_type ), pType, + FSNS( XML_r, XML_id ), rtl::OUStringToOString( aRelId, RTL_TEXTENCODING_UTF8 ).getStr(), + FSEND ); } void DocxExport::WriteFonts() { - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), - S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" ), - S( "fontTable.xml" ) ); + m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" ), + S( "fontTable.xml" ) ); - ::sax_fastparser::FSHelperPtr pFS = m_pFilter->openOutputStreamWithSerializer( - S( "word/fontTable.xml" ), - S( "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml" ) ); + ::sax_fastparser::FSHelperPtr pFS = m_pFilter->openOutputStreamWithSerializer( + S( "word/fontTable.xml" ), + S( "application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml" ) ); - pFS->startElementNS( XML_w, XML_fonts, - FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main", - FSEND ); + pFS->startElementNS( XML_w, XML_fonts, + FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main", + FSEND ); - // switch the serializer to redirect the output to word/styles.xml - m_pAttrOutput->SetSerializer( pFS ); + // switch the serializer to redirect the output to word/styles.xml + m_pAttrOutput->SetSerializer( pFS ); - // do the work - maFontHelper.WriteFontTable( *m_pAttrOutput ); + // do the work + maFontHelper.WriteFontTable( *m_pAttrOutput ); - // switch the serializer back - m_pAttrOutput->SetSerializer( m_pDocumentFS ); + // switch the serializer back + m_pAttrOutput->SetSerializer( m_pDocumentFS ); - pFS->endElementNS( XML_w, XML_fonts ); + pFS->endElementNS( XML_w, XML_fonts ); } -void DocxExport::WriteProperties( ) +void DocxExport::WriteProperties( ) { - // Write the core properties - SwDocShell* pDocShell( pDoc->GetDocShell( ) ); - uno::Reference<document::XDocumentProperties> xDocProps; - if ( pDocShell ) - { - uno::Reference<document::XDocumentPropertiesSupplier> xDPS( - pDocShell->GetModel( ), uno::UNO_QUERY ); - xDocProps = xDPS->getDocumentProperties(); - } - - m_pFilter->exportDocumentProperties( xDocProps ); + // Write the core properties + SwDocShell* pDocShell( pDoc->GetDocShell( ) ); + uno::Reference<document::XDocumentProperties> xDocProps; + if ( pDocShell ) + { + uno::Reference<document::XDocumentPropertiesSupplier> xDPS( + pDocShell->GetModel( ), uno::UNO_QUERY ); + xDocProps = xDPS->getDocumentProperties(); + } + + m_pFilter->exportDocumentProperties( xDocProps ); } VMLExport& DocxExport::VMLExporter() { - return *m_pVMLExport; + return *m_pVMLExport; } void DocxExport::WriteMainText() { - // setup the namespaces - m_pDocumentFS->startElementNS( XML_w, XML_document, - FSNS( XML_xmlns, XML_o ), "urn:schemas-microsoft-com:office:office", - FSNS( XML_xmlns, XML_r ), "http://schemas.openxmlformats.org/officeDocument/2006/relationships", - FSNS( XML_xmlns, XML_v ), "urn:schemas-microsoft-com:vml", - FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main", - FSNS( XML_xmlns, XML_w10 ), "urn:schemas-microsoft-com:office:word", - FSNS( XML_xmlns, XML_wp ), "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", - FSEND ); - - // body - m_pDocumentFS->startElementNS( XML_w, XML_body, FSEND ); - - pCurPam->GetPoint()->nNode = pDoc->GetNodes().GetEndOfContent().StartOfSectionNode()->GetIndex(); - - // the text - WriteText(); - - // the last section info - const WW8_SepInfo *pSectionInfo = m_pSections? m_pSections->CurrentSectionInfo(): NULL; - if ( pSectionInfo ) - SectionProperties( *pSectionInfo ); - - // finish body and document - m_pDocumentFS->endElementNS( XML_w, XML_body ); - m_pDocumentFS->endElementNS( XML_w, XML_document ); + // setup the namespaces + m_pDocumentFS->startElementNS( XML_w, XML_document, + FSNS( XML_xmlns, XML_o ), "urn:schemas-microsoft-com:office:office", + FSNS( XML_xmlns, XML_r ), "http://schemas.openxmlformats.org/officeDocument/2006/relationships", + FSNS( XML_xmlns, XML_v ), "urn:schemas-microsoft-com:vml", + FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main", + FSNS( XML_xmlns, XML_w10 ), "urn:schemas-microsoft-com:office:word", + FSNS( XML_xmlns, XML_wp ), "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", + FSEND ); + + // body + m_pDocumentFS->startElementNS( XML_w, XML_body, FSEND ); + + pCurPam->GetPoint()->nNode = pDoc->GetNodes().GetEndOfContent().StartOfSectionNode()->GetIndex(); + + // the text + WriteText(); + + // the last section info + const WW8_SepInfo *pSectionInfo = m_pSections? m_pSections->CurrentSectionInfo(): NULL; + if ( pSectionInfo ) + SectionProperties( *pSectionInfo ); + + // finish body and document + m_pDocumentFS->endElementNS( XML_w, XML_body ); + m_pDocumentFS->endElementNS( XML_w, XML_document ); } DocxExport::DocxExport( DocxExportFilter *pFilter, SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam ) - : MSWordExportBase( pDocument, pCurrentPam, pOriginalPam ), - m_pFilter( pFilter ), - m_pAttrOutput( NULL ), - m_pSections( NULL ), - m_nHeaders( 0 ), - m_nFooters( 0 ), - m_pVMLExport( NULL ) + : MSWordExportBase( pDocument, pCurrentPam, pOriginalPam ), + m_pFilter( pFilter ), + m_pAttrOutput( NULL ), + m_pSections( NULL ), + m_nHeaders( 0 ), + m_nFooters( 0 ), + m_pVMLExport( NULL ) { - // Write the document properies - WriteProperties( ); + // Write the document properies + WriteProperties( ); - // relations for the document - m_pFilter->addRelation( S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" ), - S( "word/document.xml" ) ); + // relations for the document + m_pFilter->addRelation( S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" ), + S( "word/document.xml" ) ); - // the actual document - m_pDocumentFS = m_pFilter->openOutputStreamWithSerializer( S( "word/document.xml" ), - S( "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" ) ); + // the actual document + m_pDocumentFS = m_pFilter->openOutputStreamWithSerializer( S( "word/document.xml" ), + S( "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" ) ); - // the DrawingML access - m_pDrawingML = new oox::drawingml::DrawingML( m_pDocumentFS, m_pFilter, oox::drawingml::DrawingML::DOCUMENT_DOCX ); + // the DrawingML access + m_pDrawingML = new oox::drawingml::DrawingML( m_pDocumentFS, m_pFilter, oox::drawingml::DrawingML::DOCUMENT_DOCX ); - // the attribute output for the document - m_pAttrOutput = new DocxAttributeOutput( *this, m_pDocumentFS, m_pDrawingML ); + // the attribute output for the document + m_pAttrOutput = new DocxAttributeOutput( *this, m_pDocumentFS, m_pDrawingML ); - // the related VMLExport - m_pVMLExport = new VMLExport( m_pDocumentFS ); + // the related VMLExport + m_pVMLExport = new VMLExport( m_pDocumentFS ); } DocxExport::~DocxExport() { - delete m_pVMLExport, m_pVMLExport = NULL; - delete m_pAttrOutput, m_pAttrOutput = NULL; - delete m_pDrawingML, m_pDrawingML = NULL; + delete m_pVMLExport, m_pVMLExport = NULL; + delete m_pAttrOutput, m_pAttrOutput = NULL; + delete m_pDrawingML, m_pDrawingML = NULL; } -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ +/* vim: set noet sw=4 ts=4: */ diff --git a/main/sw/source/filter/ww8/docxexport.hxx b/main/sw/source/filter/ww8/docxexport.hxx index d1f6814ad7..47f9eddee8 100644 --- a/main/sw/source/filter/ww8/docxexport.hxx +++ b/main/sw/source/filter/ww8/docxexport.hxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -44,156 +44,157 @@ class SwSectionNode; class SwNumRuleTbl; namespace oox { - namespace drawingml { class DrawingML; } - namespace vml { class VMLExport; } + namespace drawingml { class DrawingML; } + namespace vml { class VMLExport; } } -/// The class that does all the actual DOCX export-related work. +// The class that does all the actual DOCX export-related work. class DocxExport : public MSWordExportBase { - /// Pointer to the filter that owns us. - DocxExportFilter *m_pFilter; + // Pointer to the filter that owns us. + DocxExportFilter *m_pFilter; - /// Fast serializer for the document output. - ::sax_fastparser::FSHelperPtr m_pDocumentFS; + // Fast serializer for the document output. + ::sax_fastparser::FSHelperPtr m_pDocumentFS; - /// Access to the DrawingML writer. - oox::drawingml::DrawingML *m_pDrawingML; + // Access to the DrawingML writer. + oox::drawingml::DrawingML *m_pDrawingML; - /// Attribute output for document. - DocxAttributeOutput *m_pAttrOutput; + // Attribute output for document. + DocxAttributeOutput *m_pAttrOutput; - /// Sections/headers/footers - MSWordSections *m_pSections; + // Sections/headers/footers + MSWordSections *m_pSections; - /// Header counter. - sal_Int32 m_nHeaders; + // Header counter. + sal_Int32 m_nHeaders; - /// Footer counter. - sal_Int32 m_nFooters; + // Footer counter. + sal_Int32 m_nFooters; - /// Exporter of the VML shapes. - oox::vml::VMLExport *m_pVMLExport; + // Exporter of the VML shapes. + oox::vml::VMLExport *m_pVMLExport; public: - /// Access to the attribute output class. - virtual AttributeOutputBase& AttrOutput() const; + // Access to the attribute output class. + virtual AttributeOutputBase& AttrOutput() const; - /// Access to the sections/headers/footres. - virtual MSWordSections& Sections() const; + // Access to the sections/headers/footres. + virtual MSWordSections& Sections() const; - /// Hack, unfortunately necessary at some places for now. - /// FIXME remove it when possible. - virtual bool HackIsWW8OrHigher() const { return true; } + // Hack, unfortunately necessary at some places for now. + // FIXME remove it when possible. + virtual bool HackIsWW8OrHigher() const { return true; } - /// Guess the script (asian/western). - virtual bool CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich ); + // Guess the script (asian/western). + virtual bool CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich ); - virtual void AppendBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen ); + virtual void AppendBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen ); - virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false ); + virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false ); - /// Returns the relationd id - rtl::OString AddRelation( const rtl::OUString& rType, const rtl::OUString& rTarget, const rtl::OUString& rMode ); + // Returns the relationd id + rtl::OString AddRelation( const rtl::OUString& rType, const rtl::OUString& rTarget, const rtl::OUString& rMode ); - virtual void WriteCR( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t()*/ ) { /* FIXME no-op for docx, most probably should not even be in MSWordExportBase */ } - virtual void WriteChar( sal_Unicode ) { /* FIXME */ fprintf( stderr, "HACK! WriteChar() has nothing to do for docx.\n" ); } + virtual void WriteCR( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t()*/ ) { /* FIXME no-op for docx, most probably should not even be in MSWordExportBase */ } + virtual void WriteChar( sal_Unicode ) { /* FIXME */ fprintf( stderr, "HACK! WriteChar() has nothing to do for docx.\n" ); } - /// Return value indicates if an inherited outline numbering is suppressed. - virtual bool DisallowInheritingOutlineNumbering( const SwFmt &rFmt ); + // Return value indicates if an inherited outline numbering is suppressed. + virtual bool DisallowInheritingOutlineNumbering( const SwFmt &rFmt ); - /// Output the actual headers and footers. - virtual void WriteHeadersFooters( sal_uInt8 nHeadFootFlags, - const SwFrmFmt& rFmt, const SwFrmFmt& rLeftFmt, const SwFrmFmt& rFirstPageFmt ); + // Output the actual headers and footers. + virtual void WriteHeadersFooters( sal_uInt8 nHeadFootFlags, + const SwFrmFmt& rFmt, const SwFrmFmt& rLeftFmt, const SwFrmFmt& rFirstPageFmt ); - /// Write the field - virtual void OutputField( const SwField* pFld, ww::eField eFldType, - const String& rFldCmd, sal_uInt8 nMode = nsFieldFlags::WRITEFIELD_ALL ); + // Write the field + virtual void OutputField( const SwField* pFld, ww::eField eFldType, + const String& rFldCmd, sal_uInt8 nMode = nsFieldFlags::WRITEFIELD_ALL ); - /// Write the data of the form field - virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ); - - virtual void DoComboBox(const rtl::OUString &rName, - const rtl::OUString &rHelp, - const rtl::OUString &ToolTip, - const rtl::OUString &rSelected, - com::sun::star::uno::Sequence<rtl::OUString> &rListItems); + // Write the data of the form field + virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ); - virtual void DoFormText(const SwInputField * pFld); - - virtual sal_uLong ReplaceCr( sal_uInt8 nChar ); + virtual void DoComboBox(const rtl::OUString &rName, + const rtl::OUString &rHelp, + const rtl::OUString &ToolTip, + const rtl::OUString &rSelected, + com::sun::star::uno::Sequence<rtl::OUString> &rListItems); + + virtual void DoFormText(const SwInputField * pFld); + + virtual sal_uLong ReplaceCr( sal_uInt8 nChar ); protected: - /// Format-dependant part of the actual export. - virtual void ExportDocument_Impl(); + // Format-dependent part of the actual export. + virtual void ExportDocument_Impl(); - /// Output page/section breaks - virtual void OutputPageSectionBreaks( const SwTxtNode& ); - - /// Output SwEndNode - virtual void OutputEndNode( const SwEndNode& ); + // Output page/section breaks + virtual void OutputPageSectionBreaks( const SwTxtNode& ); - /// Output SwTableNode - virtual void OutputTableNode( const SwTableNode& ); + // Output SwEndNode + virtual void OutputEndNode( const SwEndNode& ); - /// Output SwGrfNode - virtual void OutputGrfNode( const SwGrfNode& ); + // Output SwTableNode + virtual void OutputTableNode( const SwTableNode& ); - /// Output SwOLENode - virtual void OutputOLENode( const SwOLENode& ); + // Output SwGrfNode + virtual void OutputGrfNode( const SwGrfNode& ); + // Output SwOLENode + virtual void OutputOLENode( const SwOLENode& ); - virtual void AppendSection( const SwPageDesc *pPageDesc, const SwSectionFmt* pFmt, sal_uLong nLnNum ); - virtual void SectionBreaksAndFrames( const SwTxtNode& rNode ) {} + virtual void AppendSection( const SwPageDesc *pPageDesc, const SwSectionFmt* pFmt, sal_uLong nLnNum ); - /// Get ready for a new section. - virtual void PrepareNewPageDesc( const SfxItemSet* pSet, - const SwNode& rNd, - const SwFmtPageDesc* pNewPgDescFmt = 0, - const SwPageDesc* pNewPgDesc = 0 ); + virtual void SectionBreaksAndFrames( const SwTxtNode& rNode ) {} + + // Get ready for a new section. + virtual void PrepareNewPageDesc( const SfxItemSet* pSet, + const SwNode& rNd, + const SwFmtPageDesc* pNewPgDescFmt = 0, + const SwPageDesc* pNewPgDesc = 0 ); private: - /// Setup pStyles and write styles.xml - void InitStyles(); + // Setup pStyles and write styles.xml + void InitStyles(); - /// Write footnotes.xml and endnotes.xml. - void WriteFootnotesEndnotes(); + // Write footnotes.xml and endnotes.xml. + void WriteFootnotesEndnotes(); - /// Write the numbering table. - virtual void WriteNumbering(); + // Write the numbering table. + virtual void WriteNumbering(); - /// Write reference to a header/foorter + the actual xml containing the text. - void WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char* pType ); + // Write reference to a header/foorter + the actual xml containing the text. + void WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char* pType ); - /// Write word/fontTable.xml. - void WriteFonts(); + // Write word/fontTable.xml. + void WriteFonts(); - /// Write docProps/core.xml - void WriteProperties(); + // Write docProps/core.xml + void WriteProperties(); public: - /// FIXME this is temporary, remotely reminding the method of the same - /// name in WW8Export. - void WriteMainText(); + // FIXME this is temporary, remotely reminding the method of the same + // name in WW8Export. + void WriteMainText(); - /// Pass the pDocument, pCurrentPam and pOriginalPam to the base class. - DocxExport( DocxExportFilter *pFilter, SwDoc *pDocument, - SwPaM *pCurrentPam, SwPaM *pOriginalPam ); + // Pass the pDocument, pCurrentPam and pOriginalPam to the base class. + DocxExport( DocxExportFilter *pFilter, SwDoc *pDocument, + SwPaM *pCurrentPam, SwPaM *pOriginalPam ); - /// Destructor. - virtual ~DocxExport(); + // Destructor. + virtual ~DocxExport(); - /// Reference to the VMLExport instance for the main document. - oox::vml::VMLExport& VMLExporter(); + // Reference to the VMLExport instance for the main document. + oox::vml::VMLExport& VMLExporter(); private: - /// No copying. - DocxExport( const DocxExport& ); + // No copying. + DocxExport( const DocxExport& ); - /// No copying. - DocxExport& operator=( const DocxExport& ); + // No copying. + DocxExport& operator=( const DocxExport& ); }; #endif // _DOCXEXPORT_HXX_ -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ + +/* vim: set noet sw=4 ts=4: */ diff --git a/main/sw/source/filter/ww8/docxexportfilter.cxx b/main/sw/source/filter/ww8/docxexportfilter.cxx index 1818f63225..17d6814b8b 100644 --- a/main/sw/source/filter/ww8/docxexportfilter.cxx +++ b/main/sw/source/filter/ww8/docxexportfilter.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -39,52 +39,52 @@ using ::rtl::OUString; #define S( x ) OUString( RTL_CONSTASCII_USTRINGPARAM( x ) ) DocxExportFilter::DocxExportFilter( const uno::Reference< lang::XMultiServiceFactory >& rMSF ) - : oox::core::XmlFilterBase( rMSF ) + : oox::core::XmlFilterBase( rMSF ) { } bool DocxExportFilter::exportDocument() { - OSL_TRACE(, "DocxExportFilter::exportDocument()\n" ); // DEBUG remove me - - // get SwDoc* - uno::Reference< uno::XInterface > xIfc( getModel(), uno::UNO_QUERY ); - SwXTextDocument *pTxtDoc = dynamic_cast< SwXTextDocument * >( xIfc.get() ); - if ( !pTxtDoc ) - return false; - - SwDoc *pDoc = pTxtDoc->GetDocShell()->GetDoc(); - if ( !pDoc ) - return false; - - // get SwPaM* - // FIXME so far we get SwPaM for the entire document; probably we should - // be able to output just the selection as well - though no idea how to - // get the correct SwPaM* then... - SwPaM aPam( pDoc->GetNodes().GetEndOfContent() ); - aPam.SetMark(); - aPam.Move( fnMoveBackward, fnGoDoc ); - - SwPaM *pCurPam = new SwPaM( *aPam.End(), *aPam.Start() ); - - // export the document - // (in a separate block so that it's destructed before the commit) - { - DocxExport aExport( this, pDoc, pCurPam, &aPam ); - aExport.ExportDocument( true ); // FIXME support exporting selection only - } - - commit(); - - // delete the pCurPam - if ( pCurPam ) - { - while ( pCurPam->GetNext() != pCurPam ) - delete pCurPam->GetNext(); - delete pCurPam; - } - - return true; + OSL_TRACE(, "DocxExportFilter::exportDocument()\n" ); // DEBUG remove me + + // get SwDoc* + uno::Reference< uno::XInterface > xIfc( getModel(), uno::UNO_QUERY ); + SwXTextDocument *pTxtDoc = dynamic_cast< SwXTextDocument * >( xIfc.get() ); + if ( !pTxtDoc ) + return false; + + SwDoc *pDoc = pTxtDoc->GetDocShell()->GetDoc(); + if ( !pDoc ) + return false; + + // get SwPaM* + // FIXME so far we get SwPaM for the entire document; probably we should + // be able to output just the selection as well - though no idea how to + // get the correct SwPaM* then... + SwPaM aPam( pDoc->GetNodes().GetEndOfContent() ); + aPam.SetMark(); + aPam.Move( fnMoveBackward, fnGoDoc ); + + SwPaM *pCurPam = new SwPaM( *aPam.End(), *aPam.Start() ); + + // export the document + // (in a separate block so that it's destructed before the commit) + { + DocxExport aExport( this, pDoc, pCurPam, &aPam ); + aExport.ExportDocument( true ); // FIXME support exporting selection only + } + + commit(); + + // delete the pCurPam + if ( pCurPam ) + { + while ( pCurPam->GetNext() != pCurPam ) + delete pCurPam->GetNext(); + delete pCurPam; + } + + return true; } ////////////////////////////////////////////////////////////////////////// @@ -95,24 +95,24 @@ bool DocxExportFilter::exportDocument() OUString DocxExport_getImplementationName() { - return OUString( RTL_CONSTASCII_USTRINGPARAM( IMPL_NAME ) ); + return OUString( RTL_CONSTASCII_USTRINGPARAM( IMPL_NAME ) ); } OUString DocxExportFilter::implGetImplementationName() const { - return DocxExport_getImplementationName(); + return DocxExport_getImplementationName(); } uno::Sequence< OUString > SAL_CALL DocxExport_getSupportedServiceNames() throw() { - const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.ExportFilter" ) ); - const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); - return aSeq; + const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.ExportFilter" ) ); + const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); + return aSeq; } uno::Reference< uno::XInterface > SAL_CALL DocxExport_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception ) { - return (cppu::OWeakObject*) new DocxExportFilter( rSMgr ); + return (cppu::OWeakObject*) new DocxExportFilter( rSMgr ); } #ifdef __cplusplus @@ -122,7 +122,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) { - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } // ------------------------ @@ -131,48 +131,48 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ ) { - OSL_TRACE("%s, pImplName is '%s'", OSL_THIS_FUNC, pImplName); - uno::Reference< lang::XSingleServiceFactory > xFactory; - void* pRet = 0; - - if ( rtl_str_compare( pImplName, IMPL_NAME ) == 0 ) - { - const OUString aServiceName( OUString::createFromAscii( IMPL_NAME ) ); - - xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( - reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), - DocxExport_getImplementationName(), - DocxExport_createInstance, - DocxExport_getSupportedServiceNames() ) ); - } else if ( rtl_str_compare( pImplName, IMPL_NAME_RTFEXPORT ) == 0 ) { - const OUString aServiceName( OUString::createFromAscii( IMPL_NAME_RTFEXPORT ) ); - - xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( - reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), - RtfExport_getImplementationName(), - RtfExport_createInstance, - RtfExport_getSupportedServiceNames() ) ); - } else if ( rtl_str_compare( pImplName, IMPL_NAME_RTFIMPORT ) == 0 ) { - const OUString aServiceName( OUString::createFromAscii( IMPL_NAME_RTFIMPORT ) ); - - xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( - reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), - RtfImport_getImplementationName(), - RtfImport_createInstance, - RtfImport_getSupportedServiceNames() ) ); - } - - if ( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - - return pRet; + OSL_TRACE("%s, pImplName is '%s'", OSL_THIS_FUNC, pImplName); + uno::Reference< lang::XSingleServiceFactory > xFactory; + void* pRet = 0; + + if ( rtl_str_compare( pImplName, IMPL_NAME ) == 0 ) + { + const OUString aServiceName( OUString::createFromAscii( IMPL_NAME ) ); + + xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( + reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), + DocxExport_getImplementationName(), + DocxExport_createInstance, + DocxExport_getSupportedServiceNames() ) ); + } else if ( rtl_str_compare( pImplName, IMPL_NAME_RTFEXPORT ) == 0 ) { + const OUString aServiceName( OUString::createFromAscii( IMPL_NAME_RTFEXPORT ) ); + + xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( + reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), + RtfExport_getImplementationName(), + RtfExport_createInstance, + RtfExport_getSupportedServiceNames() ) ); + } else if ( rtl_str_compare( pImplName, IMPL_NAME_RTFIMPORT ) == 0 ) { + const OUString aServiceName( OUString::createFromAscii( IMPL_NAME_RTFIMPORT ) ); + + xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( + reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), + RtfImport_getImplementationName(), + RtfImport_createInstance, + RtfImport_getSupportedServiceNames() ) ); + } + + if ( xFactory.is() ) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + + return pRet; } #ifdef __cplusplus } #endif -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ +/* vim: set noet sw=4 ts=4: */ diff --git a/main/sw/source/filter/ww8/docxexportfilter.hxx b/main/sw/source/filter/ww8/docxexportfilter.hxx index fd827ddbcf..db41e8335d 100644 --- a/main/sw/source/filter/ww8/docxexportfilter.hxx +++ b/main/sw/source/filter/ww8/docxexportfilter.hxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -30,29 +30,30 @@ #include <com/sun/star/beans/PropertyValue.hpp> -/// The physical access to the DOCX document (for writing). +// The physical access to the DOCX document (for writing). class DocxExportFilter : public oox::core::XmlFilterBase { public: - DocxExportFilter( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rMSF ); + DocxExportFilter( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rMSF ); - // FIXME these should not even exist for the export-only filter! - // For now, let's just do empty implementations of those. - virtual bool importDocument() { return false; } - virtual const ::oox::drawingml::Theme* getCurrentTheme() const { return NULL; } - virtual sal_Int32 getSchemeClr( sal_Int32 ) const { return 0; } - virtual const ::oox::vml::DrawingPtr getDrawings() { return ::oox::vml::DrawingPtr(); } - virtual ::oox::drawingml::chart::ChartConverter& getChartConverter() { static ::oox::drawingml::chart::ChartConverter aConverter; return aConverter; } - virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles() { return ::oox::drawingml::table::TableStyleListPtr(); } + // FIXME these should not even exist for the export-only filter! + // For now, let's just do empty implementations of those. + virtual bool importDocument() { return false; } + virtual const ::oox::drawingml::Theme* getCurrentTheme() const { return NULL; } + virtual sal_Int32 getSchemeClr( sal_Int32 ) const { return 0; } + virtual const ::oox::vml::DrawingPtr getDrawings() { return ::oox::vml::DrawingPtr(); } + virtual ::oox::drawingml::chart::ChartConverter& getChartConverter() { static ::oox::drawingml::chart::ChartConverter aConverter; return aConverter; } + virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles() { return ::oox::drawingml::table::TableStyleListPtr(); } - // Actual export of the DOCX document - virtual bool exportDocument(); + // Actual export of the DOCX document + virtual bool exportDocument(); private: - /// Implementatio of the filter abstract method. - virtual ::rtl::OUString implGetImplementationName() const; + // Implementation of the filter abstract method. + virtual ::rtl::OUString implGetImplementationName() const; }; #endif // _DOCXEXPORTFILTER_HXX_ -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ + +/* vim: set noet sw=4 ts=4: */ diff --git a/main/tools/source/string/debugprint.cxx b/main/tools/source/string/debugprint.cxx index a8e3d6bea5..4615d8bec0 100644 --- a/main/tools/source/string/debugprint.cxx +++ b/main/tools/source/string/debugprint.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -30,15 +30,15 @@ const sal_Char *dbg_dump(const ByteString &rStr) { - static ByteString aStr; - aStr = rStr; - aStr.Append(static_cast<char>(0)); - return aStr.GetBuffer(); + static ByteString aStr; + aStr = rStr; + aStr.Append(static_cast<char>(0)); + return aStr.GetBuffer(); } const sal_Char *dbg_dump(const UniString &rStr) { - return dbg_dump(ByteString(rStr, RTL_TEXTENCODING_UTF8)); + return dbg_dump(ByteString(rStr, RTL_TEXTENCODING_UTF8)); } -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ +/* vim: set noet sw=4 ts=4: */ diff --git a/main/writerfilter/source/filter/RtfFilter.cxx b/main/writerfilter/source/filter/RtfFilter.cxx index 2f930dc50e..90a59db6b8 100644 --- a/main/writerfilter/source/filter/RtfFilter.cxx +++ b/main/writerfilter/source/filter/RtfFilter.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,16 +7,16 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ @@ -32,8 +32,8 @@ using namespace ::rtl; using namespace ::cppu; using namespace ::com::sun::star; -RtfFilter::RtfFilter( const uno::Reference< uno::XComponentContext >& rxContext) : - m_xContext( rxContext ) +RtfFilter::RtfFilter( const uno::Reference< uno::XComponentContext >& rxContext) : + m_xContext( rxContext ) { } @@ -42,36 +42,36 @@ RtfFilter::~RtfFilter() } sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescriptor ) - throw (uno::RuntimeException) + throw (uno::RuntimeException) { - OSL_TRACE("%s", OSL_THIS_FUNC); - if( m_xSrcDoc.is() ) - { - uno::Reference< lang::XMultiServiceFactory > xMSF(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW); - uno::Reference< uno::XInterface > xIfc( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.RtfExport" ))), uno::UNO_QUERY_THROW); - if (!xIfc.is()) - return sal_False; - uno::Reference< document::XExporter > xExprtr(xIfc, uno::UNO_QUERY_THROW); - uno::Reference< document::XFilter > xFltr(xIfc, uno::UNO_QUERY_THROW); - if (!xExprtr.is() || !xFltr.is()) - return sal_False; - xExprtr->setSourceDocument(m_xSrcDoc); - return xFltr->filter(aDescriptor); - } - else if ( m_xDstDoc.is() ) - { - uno::Reference< lang::XMultiServiceFactory > xMSF(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW); - uno::Reference< uno::XInterface > xIfc( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.RtfImport" ))), uno::UNO_QUERY_THROW); - if (!xIfc.is()) - return sal_False; - uno::Reference< document::XImporter > xImprtr(xIfc, uno::UNO_QUERY_THROW); - uno::Reference< document::XFilter > xFltr(xIfc, uno::UNO_QUERY_THROW); - if (!xImprtr.is() || !xFltr.is()) - return sal_False; - xImprtr->setTargetDocument(m_xDstDoc); - return xFltr->filter(aDescriptor); - } - return sal_False; + OSL_TRACE("%s", OSL_THIS_FUNC); + if( m_xSrcDoc.is() ) + { + uno::Reference< lang::XMultiServiceFactory > xMSF(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW); + uno::Reference< uno::XInterface > xIfc( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.RtfExport" ))), uno::UNO_QUERY_THROW); + if (!xIfc.is()) + return sal_False; + uno::Reference< document::XExporter > xExprtr(xIfc, uno::UNO_QUERY_THROW); + uno::Reference< document::XFilter > xFltr(xIfc, uno::UNO_QUERY_THROW); + if (!xExprtr.is() || !xFltr.is()) + return sal_False; + xExprtr->setSourceDocument(m_xSrcDoc); + return xFltr->filter(aDescriptor); + } + else if ( m_xDstDoc.is() ) + { + uno::Reference< lang::XMultiServiceFactory > xMSF(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW); + uno::Reference< uno::XInterface > xIfc( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.RtfImport" ))), uno::UNO_QUERY_THROW); + if (!xIfc.is()) + return sal_False; + uno::Reference< document::XImporter > xImprtr(xIfc, uno::UNO_QUERY_THROW); + uno::Reference< document::XFilter > xFltr(xIfc, uno::UNO_QUERY_THROW); + if (!xImprtr.is() || !xFltr.is()) + return sal_False; + xImprtr->setTargetDocument(m_xDstDoc); + return xFltr->filter(aDescriptor); + } + return sal_False; } void RtfFilter::cancel( ) throw (uno::RuntimeException) @@ -79,63 +79,63 @@ void RtfFilter::cancel( ) throw (uno::RuntimeException) } void RtfFilter::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc ) - throw (lang::IllegalArgumentException, uno::RuntimeException) + throw (lang::IllegalArgumentException, uno::RuntimeException) { - m_xSrcDoc = xDoc; + m_xSrcDoc = xDoc; } void RtfFilter::setTargetDocument( const uno::Reference< lang::XComponent >& xDoc ) - throw (lang::IllegalArgumentException, uno::RuntimeException) + throw (lang::IllegalArgumentException, uno::RuntimeException) { - m_xDstDoc = xDoc; + m_xDstDoc = xDoc; } void RtfFilter::initialize( const uno::Sequence< uno::Any >& /*aArguments*/ ) throw (uno::Exception, uno::RuntimeException) { - // The DOCX exporter here extracts 'type' of the filter, ie 'Word' or - // 'Word Template' but we don't need it for RTF. + // The DOCX exporter here extracts 'type' of the filter, i.e. 'Word' or + // 'Word Template' but we don't need it for RTF. } OUString RtfFilter::getImplementationName( ) throw (uno::RuntimeException) { - return RtfFilter_getImplementationName(); + return RtfFilter_getImplementationName(); } #define SERVICE_NAME1 "com.sun.star.document.ImportFilter" #define SERVICE_NAME2 "com.sun.star.document.ExportFilter" sal_Bool RtfFilter::supportsService( const OUString& rServiceName ) throw (uno::RuntimeException) { - return (rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME1 ) ) || - rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME2 ) )); + return (rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME1 ) ) || + rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME2 ) )); } uno::Sequence< OUString > RtfFilter::getSupportedServiceNames( ) throw (uno::RuntimeException) { - return RtfFilter_getSupportedServiceNames(); + return RtfFilter_getSupportedServiceNames(); } /* Helpers, used by shared lib exports. */ OUString RtfFilter_getImplementationName () throw (uno::RuntimeException) { - return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.RtfFilter" ) ); + return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.RtfFilter" ) ); } uno::Sequence< OUString > RtfFilter_getSupportedServiceNames( ) throw (uno::RuntimeException) { - uno::Sequence < OUString > aRet(2); - OUString* pArray = aRet.getArray(); - pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) ); - pArray[1] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) ); - return aRet; + uno::Sequence < OUString > aRet(2); + OUString* pArray = aRet.getArray(); + pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) ); + pArray[1] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) ); + return aRet; } #undef SERVICE_NAME1 #undef SERVICE_NAME2 uno::Reference< uno::XInterface > RtfFilter_createInstance( const uno::Reference< uno::XComponentContext >& xContext) - throw( uno::Exception ) + throw( uno::Exception ) { - return (cppu::OWeakObject*) new RtfFilter( xContext ); + return (cppu::OWeakObject*) new RtfFilter( xContext ); } -/* vi:set shiftwidth=4 expandtab: */ +/* vim: set noet sw=4 ts=4: */