LCOV - code coverage report
Current view: top level - libreoffice/sw/source/filter/ww8 - wrtww8.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 71 96 74.0 %
Date: 2012-12-17 Functions: 70 93 75.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef _WRTWW8_HXX
      21             : #define _WRTWW8_HXX
      22             : 
      23             : #include <tools/solar.h>        // UINTXX
      24             : #include <tools/gen.hxx>
      25             : #include <editeng/editdata.hxx>
      26             : 
      27             : #include <map>
      28             : #include <vector>
      29             : 
      30             : #include <shellio.hxx>
      31             : #include <wrt_fn.hxx>
      32             : 
      33             : #include "ww8struc.hxx"
      34             : #include "ww8scan.hxx"
      35             : #include "fields.hxx"
      36             : #include "types.hxx"
      37             : #include "writerhelper.hxx"
      38             : #include "../inc/msfilter.hxx"
      39             : #include <expfld.hxx>
      40             : 
      41             : // einige Forward Deklarationen
      42             : class SwWW8AttrIter;
      43             : namespace msfilter
      44             : {
      45             :     class MSCodec_Std97;
      46             : }
      47             : 
      48             : namespace editeng { class SvxBorderLine; }
      49             : 
      50             : class AttributeOutputBase;
      51             : class DocxAttributeOutput;
      52             : class RtfAttributeOutput;
      53             : class BitmapPalette;
      54             : class SwEscherEx;
      55             : class DateTime;
      56             : class Font;
      57             : class MSWordExportBase;
      58             : class SdrObject;
      59             : class SfxItemSet;
      60             : class SvStream;
      61             : class SvxFontItem;
      62             : class SvxBoxItem;
      63             : class SwAttrSet;
      64             : class SwCharFmt;
      65             : class SwCntntNode;
      66             : class SwField;
      67             : class SwFmt;
      68             : class SwFmtCntnt;
      69             : class SwFmtFtn;
      70             : class SwFrmFmt;
      71             : class SwGrfNode;
      72             : class SwModify;
      73             : class SwNumFmt;
      74             : class SwNumRule;
      75             : class SwNumRuleTbl;
      76             : class SwPageDesc;
      77             : class SwFmtPageDesc;
      78             : class SwOLENode;
      79             : class SwPostItField;
      80             : class SwRedlineData;
      81             : class SwSectionFmt;
      82             : class SwSectionNode;
      83             : class SwTableNode;
      84             : class SwTOXType;
      85             : class SwTxtFmtColl;
      86             : class SwTxtNode;
      87             : class SwWW8WrGrf;
      88             : class SwWW8Writer;
      89             : class MSWordStyles;
      90             : class WW8AttributeOutput;
      91             : class WW8Export;
      92             : class MSWordAttrIter;
      93             : class WW8_WrFkp;
      94             : class WW8_WrPlc0;
      95             : class WW8_WrPlc1;
      96             : class WW8_WrPlcFld;
      97             : class WW8_WrMagicTable;
      98             : class WW8_WrPlcFtnEdn;
      99             : class WW8_WrPlcPn;
     100             : class WW8_WrPlcAnnotations;
     101             : class MSWordSections;
     102             : class WW8_WrPlcTxtBoxes;
     103             : class WW8_WrPct;            // Verwaltung
     104             : class WW8_WrtBookmarks;
     105             : class WW8_WrtRedlineAuthor;
     106             : class SvxMSExportOLEObjects;
     107             : class SwMSConvertControls;
     108             : class WW8_WrPc;
     109             : 
     110             : namespace com { namespace sun { namespace star { namespace embed {
     111             : class XEmbeddedObject;
     112             : } } } }
     113             : typedef std::map<const com::sun::star::embed::XEmbeddedObject*, sal_Int32> WW8OleMap;
     114             : class SvStorageRef;
     115             : struct WW8_PdAttrDesc;
     116             : class SvxBrushItem;
     117             : 
     118             : #include "WW8TableInfo.hxx"
     119             : 
     120             : #define GRF_MAGIC_1 0x12    // 3 magic Bytes fuer PicLocFc-Attribute
     121             : #define GRF_MAGIC_2 0x34
     122             : #define GRF_MAGIC_3 0x56
     123             : #define GRF_MAGIC_321 0x563412L
     124             : 
     125             : #define OLE_PREVIEW_AS_EMF  //If we want to export ole2 previews as emf in ww8+
     126             : 
     127             : typedef sal_uInt8 FieldFlags;
     128             : namespace nsFieldFlags // for InsertField- Method
     129             : {
     130             :     const FieldFlags WRITEFIELD_START         = 0x01;
     131             :     const FieldFlags WRITEFIELD_CMD_START     = 0x02;
     132             :     const FieldFlags WRITEFIELD_CMD_END     = 0x04;
     133             :     const FieldFlags WRITEFIELD_END         = 0x10;
     134             :     const FieldFlags WRITEFIELD_CLOSE         = 0x20;
     135             :     const FieldFlags WRITEFIELD_ALL         = 0xFF;
     136             : }
     137             : 
     138             : enum TxtTypes  //enums for TextTypes
     139             : {
     140             :     TXT_MAINTEXT = 0, /*TXT_FTNEDN = 1,*/ TXT_HDFT = 2, TXT_FTN = 3,
     141             :     TXT_EDN = 4, TXT_ATN = 5, TXT_TXTBOX = 6, TXT_HFTXTBOX= 7
     142             : };
     143             : 
     144             : struct WW8_SepInfo
     145             : {
     146             :     const SwPageDesc* pPageDesc;
     147             :     const SwSectionFmt* pSectionFmt;
     148             :     const SwNode* pPDNd;
     149             :     const SwTxtNode* pNumNd;
     150             :     sal_uLong  nLnNumRestartNo;
     151             :     sal_uInt16 nPgRestartNo;
     152             : 
     153             :     WW8_SepInfo()
     154             :         : pPageDesc(0), pSectionFmt(0), pPDNd(0), pNumNd(0), nLnNumRestartNo(0), nPgRestartNo(0)
     155             : 
     156             :     {}
     157             : 
     158         116 :     WW8_SepInfo( const SwPageDesc* pPD, const SwSectionFmt* pFmt,
     159             :         sal_uLong nLnRestart, sal_uInt16 nPgRestart = 0, const SwNode* pNd = NULL )
     160             :         : pPageDesc( pPD ), pSectionFmt( pFmt ), pPDNd( pNd ), pNumNd( 0 ),
     161         116 :           nLnNumRestartNo( nLnRestart ), nPgRestartNo( nPgRestart )
     162         116 :     {}
     163             : 
     164             :     bool IsProtected() const;
     165             : };
     166             : 
     167             : /// Class to collect and output the sections/headers/footers.
     168             : // Plc fuer PageDescs -> Sepx ( Section Extensions )
     169             : class MSWordSections
     170             : {
     171             : protected:
     172             :     bool mbDocumentIsProtected;
     173             :     std::vector<WW8_SepInfo> aSects;
     174             : 
     175             :     void CheckForFacinPg( WW8Export& rWrt ) const;
     176             :     void WriteOlst( WW8Export& rWrt, const WW8_SepInfo& rSectionInfo );
     177             :     void NeedsDocumentProtected(const WW8_SepInfo &rInfo);
     178             : 
     179             :     //No copy, no assign
     180             :     MSWordSections( const MSWordSections& );
     181             :     MSWordSections& operator=( const MSWordSections& );
     182             : public:
     183             :     MSWordSections( MSWordExportBase& rExport );
     184             :     virtual ~MSWordSections();
     185             : 
     186             :     virtual bool HeaderFooterWritten();
     187             : 
     188             :     void AppendSection( const SwPageDesc* pPd,
     189             :                     const SwSectionFmt* pSectionFmt = 0,
     190             :                     sal_uLong nLnNumRestartNo = 0 );
     191             :     void AppendSection( const SwFmtPageDesc& rPd,
     192             :                     const SwNode& rNd,
     193             :                     const SwSectionFmt* pSectionFmt,
     194             :                     sal_uLong nLnNumRestartNo );
     195             :     void SetNum( const SwTxtNode* pNumNd );
     196             : 
     197             :     /// Number of columns based on the most recent WW8_SepInfo.
     198             :     sal_uInt16 CurrentNumberOfColumns( const SwDoc &rDoc ) const;
     199             : 
     200             :     /// Number of columns of the provided WW8_SepInfo.
     201             :     sal_uInt16 NumberOfColumns( const SwDoc &rDoc, const WW8_SepInfo& rInfo ) const;
     202             : 
     203          18 :     bool DocumentIsProtected() const { return mbDocumentIsProtected; }
     204             : 
     205             :     /// The most recent WW8_SepInfo.
     206             :     const WW8_SepInfo* CurrentSectionInfo();
     207             : 
     208             :     static void SetHeaderFlag( sal_uInt8& rHeadFootFlags, const SwFmt& rFmt,
     209             :                                   sal_uInt8 nFlag );
     210             :     static void SetFooterFlag( sal_uInt8& rHeadFootFlags, const SwFmt& rFmt,
     211             :                                    sal_uInt8 nFlag );
     212             : 
     213             :     /// Should we output borders?
     214             :     static int HasBorderItem( const SwFmt& rFmt );
     215             : };
     216             : 
     217             : class WW8_WrPlcSepx : public MSWordSections
     218             : {
     219             :     std::vector<WW8_CP> aCps;
     220             :     ::std::vector< ::boost::shared_ptr<WW8_PdAttrDesc> > m_SectionAttributes;
     221             :     // hack to prevent adding sections in endnotes
     222             :     bool m_bHeaderFooterWritten;
     223             :     WW8_WrPlc0* pTxtPos;        // Pos der einzelnen Header / Footer
     224             : 
     225             :     // No copy, no assign
     226             :     WW8_WrPlcSepx( const WW8_WrPlcSepx& );
     227             :     WW8_WrPlcSepx& operator=( const WW8_WrPlcSepx& );
     228             : 
     229             : public:
     230             :     WW8_WrPlcSepx( MSWordExportBase& rExport );
     231             :     ~WW8_WrPlcSepx();
     232             : 
     233             :     virtual bool HeaderFooterWritten(); // override
     234             : 
     235             :     void AppendSep( WW8_CP nStartCp,
     236             :                     const SwPageDesc* pPd,
     237             :                     const SwSectionFmt* pSectionFmt = 0,
     238             :                     sal_uLong nLnNumRestartNo = 0 );
     239             :     void AppendSep( WW8_CP nStartCp, const SwFmtPageDesc& rPd,
     240             :                     const SwNode& rNd,
     241             :                     const SwSectionFmt* pSectionFmt,
     242             :                     sal_uLong nLnNumRestartNo );
     243           8 :     void Finish( WW8_CP nEndCp ) { aCps.push_back( nEndCp ); }
     244             : 
     245             :     bool WriteKFTxt( WW8Export& rWrt );
     246             :     void WriteSepx( SvStream& rStrm ) const;
     247             :     void WritePlcSed( WW8Export& rWrt ) const;
     248             :     void WritePlcHdd( WW8Export& rWrt ) const;
     249             : 
     250             : private:
     251             :     void WriteFtnEndTxt( WW8Export& rWrt, sal_uLong nCpStt );
     252             : public:
     253             :     void OutHeaderFooter(WW8Export& rWrt, bool bHeader,
     254             :             const SwFmt& rFmt, sal_uLong& rCpPos, sal_uInt8 nHFFlags, sal_uInt8 nFlag,  sal_uInt8 nBreakCode);
     255             : };
     256             : 
     257             : //--------------------------------------------------------------------------
     258             : // class WW8_WrPct zum Aufbau der Piece-Table
     259             : //--------------------------------------------------------------------------
     260             : class WW8_WrPct
     261             : {
     262             :     boost::ptr_vector<WW8_WrPc > aPcts;
     263             :     WW8_FC nOldFc;
     264             :     bool bIsUni;
     265             : public:
     266             :     WW8_WrPct(WW8_FC nStartFc, bool bSaveUniCode);
     267             :     ~WW8_WrPct();
     268             :     void AppendPc(WW8_FC nStartFc, bool bIsUnicode);
     269             :     void WritePc( WW8Export& rWrt );
     270             :     void SetParaBreak();
     271         260 :     bool IsUnicode() const  { return bIsUni; }
     272             :     WW8_CP Fc2Cp( sal_uLong nFc ) const;
     273             : };
     274             : 
     275             : /// Collects and outputs fonts.
     276        5728 : class wwFont
     277             : {
     278             : //In some future land the stream could be converted to a nice stream interface
     279             : //and we could have harmony
     280             : private:
     281             :     sal_uInt8 maWW8_FFN[6];
     282             :     String msFamilyNm;
     283             :     String msAltNm;
     284             :     bool mbAlt;
     285             :     bool mbWrtWW8;
     286             :     FontPitch mePitch;
     287             :     FontFamily meFamily;
     288             :     rtl_TextEncoding meChrSet;
     289             : public:
     290             :     wwFont( const String &rFamilyName, FontPitch ePitch, FontFamily eFamily,
     291             :         rtl_TextEncoding eChrSet, bool bWrtWW8 );
     292             :     bool Write( SvStream *pTableStram ) const;
     293             :     void WriteDocx( DocxAttributeOutput* rAttrOutput ) const;
     294             :     void WriteRtf( const RtfAttributeOutput* rAttrOutput ) const;
     295           0 :     rtl::OUString GetFamilyName() const { return rtl::OUString( msFamilyNm ); }
     296             :     friend bool operator < (const wwFont &r1, const wwFont &r2);
     297             : };
     298             : 
     299         112 : class wwFontHelper
     300             : {
     301             : private:
     302             :     /// Keep track of fonts that need to be exported.
     303             :     ::std::map<wwFont, sal_uInt16> maFonts;
     304             :     bool mbWrtWW8;
     305             : 
     306             :     /// Convert from fast insertion map to linear vector in the order that we want to write.
     307             :     ::std::vector< const wwFont* > AsVector() const;
     308             : 
     309             : public:
     310         112 :     wwFontHelper() : mbWrtWW8(false), bLoadAllFonts(false) {}
     311             :     /// rDoc used only to get the initial standard font(s) in use.
     312             :     void InitFontTable(bool bWrtWW8, const SwDoc& rDoc);
     313             :     sal_uInt16 GetId(const Font& rFont);
     314             :     sal_uInt16 GetId(const SvxFontItem& rFont);
     315             :     sal_uInt16 GetId(const wwFont& rFont);
     316             :     void WriteFontTable( SvStream *pTableStream, WW8Fib& pFib );
     317             :     void WriteFontTable( DocxAttributeOutput& rAttrOutput );
     318             :     void WriteFontTable( const RtfAttributeOutput& rAttrOutput );
     319             : 
     320             :     /// If true, all fonts are loaded before processing the document.
     321             :     sal_uInt8 bLoadAllFonts: 1;
     322             : };
     323             : 
     324          12 : class DrawObj
     325             : {
     326             : public:
     327             :     WW8_CP mnCp;                // CP-Pos der Verweise
     328             :     sal_uInt32 mnShapeId;           // ShapeId for the SwFrmFmts
     329             :     sw::Frame maCntnt;          // the frame itself
     330             :     Point maParentPos;          // Points
     331             :     sal_Int32 mnThick;              // Border Thicknesses
     332             :     short mnDirection;          // If BiDi or not
     333             :     unsigned int mnHdFtIndex;   // 0 for main text, +1 for each subsequent
     334             :                                 // msword hd/ft
     335             : 
     336           4 :     DrawObj(const sw::Frame &rCntnt, WW8_CP nCp, Point aParentPos, short nDir,
     337             :             unsigned int nHdFtIndex)
     338             :         : mnCp(nCp), mnShapeId(0), maCntnt(rCntnt), maParentPos(aParentPos),
     339           4 :         mnThick(0), mnDirection(nDir), mnHdFtIndex(nHdFtIndex) {}
     340             :     void SetShapeDetails(sal_uInt32 nId, sal_Int32 nThick);
     341             :     DrawObj& operator=(const DrawObj &rOther);
     342             : };
     343             : 
     344             : typedef std::vector<DrawObj> DrawObjVector;
     345             : typedef DrawObjVector::iterator DrawObjIter;
     346             : typedef DrawObjVector::const_iterator cDrawObjIter;
     347             : 
     348             : typedef std::vector<DrawObj *> DrawObjPointerVector;
     349             : typedef DrawObjPointerVector::iterator DrawObjPointerIter;
     350             : 
     351             : class PlcDrawObj // PC for DrawObjects and Text-/OLE-/GRF-Boxes
     352             : {
     353             : private:
     354             :     DrawObjVector maDrawObjs;  // vector of drawobjs
     355             : protected:
     356             :     virtual void RegisterWithFib(WW8Fib &rFib, sal_uInt32 nStart,
     357             :         sal_uInt32 nLen) const = 0;
     358             :     virtual WW8_CP GetCpOffset(const WW8Fib &rFib) const = 0;
     359             : public:
     360          16 :     PlcDrawObj() {}
     361             :     void WritePlc( WW8Export& rWrt ) const;
     362             :     bool Append( WW8Export&, WW8_CP nCp, const sw::Frame& rFmt,
     363             :         const Point& rNdTopLeft );
     364          18 :     int size() { return maDrawObjs.size(); };
     365           6 :     DrawObjVector &GetObjArr() { return maDrawObjs; }
     366             :     virtual ~PlcDrawObj();
     367             : private:
     368             :     //No copying
     369             :     PlcDrawObj(const PlcDrawObj&);
     370             :     PlcDrawObj& operator=(const PlcDrawObj&);
     371             : };
     372             : 
     373          16 : class MainTxtPlcDrawObj : public PlcDrawObj
     374             : {
     375             : public:
     376           8 :     MainTxtPlcDrawObj() {}
     377             : private:
     378             :     virtual void RegisterWithFib(WW8Fib &rFib, sal_uInt32 nStart,
     379             :         sal_uInt32 nLen) const;
     380             :     virtual WW8_CP GetCpOffset(const WW8Fib &) const;
     381             : private:
     382             :     //No copying
     383             :     MainTxtPlcDrawObj(const MainTxtPlcDrawObj&);
     384             :     MainTxtPlcDrawObj& operator=(const MainTxtPlcDrawObj&);
     385             : };
     386             : 
     387          16 : class HdFtPlcDrawObj : public PlcDrawObj
     388             : {
     389             : public:
     390           8 :     HdFtPlcDrawObj() {}
     391             : private:
     392             :     virtual void RegisterWithFib(WW8Fib &rFib, sal_uInt32 nStart,
     393             :         sal_uInt32 nLen) const;
     394             :     virtual WW8_CP GetCpOffset(const WW8Fib &rFib) const;
     395             : private:
     396             :     //No copying
     397             :     HdFtPlcDrawObj(const HdFtPlcDrawObj&);
     398             :     HdFtPlcDrawObj& operator=(const HdFtPlcDrawObj&);
     399             : };
     400             : 
     401             : typedef ::std::pair<String, sal_uLong> aBookmarkPair;
     402             : typedef std::vector<aBookmarkPair> SwImplBookmarks;
     403             : typedef std::vector<aBookmarkPair>::iterator SwImplBookmarksIter;
     404             : 
     405           0 : class WW8_WrtRedlineAuthor : public sw::util::WrtRedlineAuthor
     406             : {
     407             :     public:
     408             :     virtual void Write(Writer &rWrt);
     409             : };
     410             : 
     411             : /** Structure that is used to save some of the WW8Export/DocxExport data.
     412             : 
     413             :     It is used to be able to recurse inside of the WW8Export/DocxExport (eg.
     414             :     for the needs of the tables) - you need to tall WriteText() from there with
     415             :     new values of PaM etc.
     416             : 
     417             :     It must contain all the stuff that might be saved either in WW8Export or in
     418             :     DocxExport, because it makes no sense to do it abstract, and specialize it
     419             :     for each of the cases.  If you implement other *Export, just add the needed
     420             :     members here, and store them in the appropriate SaveData() method.
     421             :  */
     422             : struct MSWordSaveData
     423             : {
     424             :     Point* pOldFlyOffset;
     425             :     RndStdIds eOldAnchorType;
     426             :     ww::bytes* pOOld;                ///< WW8Export only
     427             :     SwPaM* pOldPam, *pOldEnd;
     428             :     const sw::Frame* pOldFlyFmt;
     429             :     const SwPageDesc* pOldPageDesc;
     430             : 
     431             :     sal_uInt8 bOldWriteAll : 1;          ///< WW8Export only
     432             :     sal_uInt8 bOldOutTable : 1;
     433             :     sal_uInt8 bOldIsInTable: 1;
     434             :     sal_uInt8 bOldFlyFrmAttrs : 1;
     435             :     sal_uInt8 bOldStartTOX : 1;
     436             :     sal_uInt8 bOldInWriteTOX : 1;
     437             :     // bOutPageDesc muss nicht gesichert werden, da es nur nicht waehrend der
     438             :     // Ausgabe von Spezial-Texten veraendert wird.
     439             : };
     440             : 
     441             : /// Base class for WW8Export and DocxExport
     442             : class MSWordExportBase
     443             : {
     444             : public:
     445             :     wwFontHelper maFontHelper;
     446             :     std::vector<sal_uLong> maChapterFieldLocs;
     447             :     typedef std::vector<sal_uLong>::const_iterator mycCFIter;
     448             :     String aMainStg;
     449             :     std::vector<const SwTOXType*> aTOXArr;
     450             :     const SfxItemSet* pISet;    // fuer Doppel-Attribute
     451             :     WW8_WrPct*  pPiece;         // Pointer auf Piece-Table
     452             :     SwNumRuleTbl* pUsedNumTbl;  // alle used NumRules
     453             :     const SwTxtNode *mpTopNodeOfHdFtPage; ///< Top node of host page when in hd/ft
     454             :     std::map< sal_uInt16, sal_uInt16 > aRuleDuplicates; //map to Duplicated numrules
     455             :     std::stack< xub_StrLen > m_aCurrentCharPropStarts; ///< To remember the position in a run.
     456             :     WW8_WrtBookmarks* pBkmks;
     457             :     WW8_WrtRedlineAuthor* pRedlAuthors;
     458             :     BitmapPalette* pBmpPal;
     459             :     boost::shared_ptr<NfKeywordTable> pKeyMap;
     460             :     SvxMSExportOLEObjects* pOLEExp;
     461             :     SwMSConvertControls* pOCXExp;
     462             :     WW8OleMap m_aOleMap;    // To remember all already exported ole objects
     463             :     ww8::WW8TableInfo::Pointer_t mpTableInfo;
     464             : 
     465             :     sal_uInt16 nCharFmtStart;
     466             :     sal_uInt16 nFmtCollStart;
     467             :     sal_uInt16 nStyleBeforeFly;     ///< Style-Nummer des Nodes,
     468             :                                 ///<       in/an dem ein Fly verankert ist
     469             :     sal_uInt16 nLastFmtId;          ///< Style of last TxtNode in normal range
     470             :     sal_uInt16 nUniqueList;         ///< current number for creating unique list names
     471             :     unsigned int mnHdFtIndex;
     472             : 
     473             :     sal_uInt16 mnRedlineMode;       ///< Remember the original redline mode
     474             : 
     475             : public:
     476             :     /* implicit bookmark vector containing pairs of node indexes and bookmark names */
     477             :     SwImplBookmarks maImplicitBookmarks;
     478             :     sw::Frames maFrames;             // The floating frames in this document
     479             :     const SwPageDesc *pAktPageDesc;
     480             :     WW8_WrPlcPn* pPapPlc;
     481             :     WW8_WrPlcPn* pChpPlc;
     482             :     MSWordAttrIter* pChpIter;
     483             :     MSWordStyles* pStyles;
     484             :     WW8_WrPlcAnnotations* pAtn;
     485             :     WW8_WrPlcTxtBoxes *pTxtBxs, *pHFTxtBxs;
     486             : 
     487             :     const sw::Frame *mpParentFrame; //If set we are exporting content inside
     488             :                                     //a frame, e.g. a graphic node
     489             : 
     490             :     Point* pFlyOffset;              // zur Justierung eines im Writer als
     491             :     RndStdIds eNewAnchorType;       // Zeichen gebundenen Flys, der im WW
     492             :                                     // Absatzgebunden wird.
     493             : 
     494             :     WW8_WrPlcFld* pFldMain;         // Felder im Haupttext
     495             :     WW8_WrPlcFld* pFldHdFt;         // Felder in Header/Footer
     496             :     WW8_WrPlcFld* pFldFtn;          // Felder in FootNotes
     497             :     WW8_WrPlcFld* pFldEdn;          // Felder in EndNotes
     498             :     WW8_WrPlcFld* pFldAtn;          // Felder in Annotations
     499             :     WW8_WrPlcFld* pFldTxtBxs;       // fields in textboxes
     500             :     WW8_WrPlcFld* pFldHFTxtBxs;     // fields in header/footer textboxes
     501             :     WW8_WrMagicTable *pMagicTable;  // keeps track of table cell positions, and
     502             :                                     // marks those that contain graphics,
     503             :                                     // which is required to make word display
     504             :                                     // graphics inside tables
     505             :     SwWW8WrGrf* pGrf;
     506             :     const SwAttrSet* pStyAttr;      // StyleAttr fuer Tabulatoren
     507             :     const SwModify* pOutFmtNode;    // write Format or Node
     508             :     const SwFmt *pCurrentStyle;     // iff bStyDef=true, then this store the current style
     509             : 
     510             :     MainTxtPlcDrawObj *pSdrObjs;   // Draw-/Fly-Objects
     511             :     HdFtPlcDrawObj *pHFSdrObjs;     // Draw-/Fly-Objects in header or footer
     512             : 
     513             :     SwEscherEx* pEscher;            // escher export class
     514             :     // #i43447# - removed
     515             : //    SwTwips nFlyWidth, nFlyHeight;  // Fuer Anpassung Graphic
     516             : 
     517             :     sal_uInt8 nTxtTyp;
     518             : 
     519             :     sal_uInt8 bStyDef : 1;           // wird Style geschrieben ?
     520             :     sal_uInt8 bBreakBefore : 1;      // Breaks werden 2mal ausgegeben
     521             :     sal_uInt8 bOutKF : 1;            // Kopf/Fusstexte werden ausgegeben
     522             :     sal_uInt8 bOutFlyFrmAttrs : 1;   // Rahmen-Attr von Flys werden ausgegeben
     523             :     sal_uInt8 bOutPageDescs : 1;     ///< PageDescs (section properties) are being written
     524             :     sal_uInt8 bOutFirstPage : 1;     // write Attrset of FirstPageDesc
     525             :     sal_uInt8 bOutTable : 1;         // Tabelle wird ausgegeben
     526             :                                 //    ( wird zB bei Flys in Tabelle zurueckgesetzt )
     527             :     sal_uInt8 bOutGrf : 1;           // Grafik wird ausgegeben
     528             :     sal_uInt8 bInWriteEscher : 1;    // in write textboxes
     529             :     sal_uInt8 bStartTOX : 1;         // true: a TOX is startet
     530             :     sal_uInt8 bInWriteTOX : 1;       // true: all content are in a TOX
     531             :     sal_uInt8 bFtnAtTxtEnd : 1;      // true: all FTN at Textend
     532             :     sal_uInt8 bEndAtTxtEnd : 1;      // true: all END at Textend
     533             :     sal_uInt8 bHasHdr : 1;
     534             :     sal_uInt8 bHasFtr : 1;
     535             :     sal_uInt8 bSubstituteBullets : 1; // true: SubstituteBullet() gets called
     536             : 
     537             :     bool mbExportModeRTF;
     538             :     bool mbOutOutlineOnly;   // export outline nodes, only (send outline to clipboard/presentation)
     539             : 
     540             :     SwDoc *pDoc;
     541             :     SwPaM *pCurPam, *pOrigPam;
     542             : 
     543             :     /// Stack to remember the nesting (see MSWordSaveData for more)
     544             :     ::std::stack< MSWordSaveData > maSaveData;
     545             : 
     546             :     /// Used to split the runs according to the bookmarks start and ends
     547             :     typedef std::vector< ::sw::mark::IMark* > IMarkVector;
     548             :     IMarkVector m_rSortedMarksStart;
     549             :     IMarkVector m_rSortedMarksEnd;
     550             : 
     551             : public:
     552             :     /// The main function to export the document.
     553             :     void ExportDocument( bool bWriteAll );
     554             : 
     555             :     /// Iterate through the nodes and call the appropriate OutputNode() on them.
     556             :     void WriteText();
     557             : 
     558             :     /// Return whether cuurently exported node is in table.
     559             :     bool IsInTable() const;
     560             : 
     561             :     /// Set the pCurPam appropriately and call WriteText().
     562             :     ///
     563             :     /// Used to export paragraphs in footnotes/endnotes/etc.
     564             :     void WriteSpecialText( sal_uLong nStart, sal_uLong nEnd, sal_uInt8 nTTyp );
     565             : 
     566             :     /// Export the pool items to attributes (through an attribute output class).
     567             :     void ExportPoolItemsToCHP( sw::PoolItems &rItems, sal_uInt16 nScript );
     568             : 
     569             :     /// Return the numeric id of the numbering rule
     570             :     sal_uInt16 GetId( const SwNumRule& rNumRule );
     571             : 
     572             :     /// Return the numeric id of the style.
     573             :     sal_uInt16 GetId( const SwTxtFmtColl& rColl ) const;
     574             : 
     575             :     /// Return the numeric id of the style.
     576             :     sal_uInt16 GetId( const SwCharFmt& rFmt ) const;
     577             : 
     578             :     sal_uInt16 GetId( const SwTOXType& rTOXType );
     579             : 
     580             :     /// Return the numeric id of the font (and add it to the font list if needed)
     581         354 :     sal_uInt16 GetId( const SvxFontItem& rFont)
     582             :     {
     583         354 :         return maFontHelper.GetId(rFont);
     584             :     }
     585             :     /// @overload
     586           0 :     sal_uInt16 GetId( const wwFont& rFont)
     587             :     {
     588           0 :         return maFontHelper.GetId(rFont);
     589             :     }
     590             : 
     591             :     const SfxPoolItem& GetItem( sal_uInt16 nWhich ) const;
     592             : 
     593             :     /// Find the reference.
     594             :     bool HasRefToObject( sal_uInt16 nTyp, const rtl::OUString* pName, sal_uInt16 nSeqNo );
     595             : 
     596             :     /// Find the bookmark name.
     597             :     String GetBookmarkName( sal_uInt16 nTyp, const rtl::OUString* pName, sal_uInt16 nSeqNo );
     598             : 
     599             :     /// Add a bookmark converted to a Word name.
     600             :     void AppendWordBookmark( const String& rName );
     601             : 
     602             :     /// Use OutputItem() on an item set according to the parameters.
     603             :     void OutputItemSet( const SfxItemSet& rSet, bool bPapFmt, bool bChpFmt, sal_uInt16 nScript, bool bExportParentItemSet );
     604             : 
     605             :     short GetDefaultFrameDirection( ) const;
     606             : 
     607             :     /// Right to left?
     608             :     short TrueFrameDirection( const SwFrmFmt& rFlyFmt ) const;
     609             : 
     610             :     /// Right to left?
     611             :     short GetCurrentPageDirection() const;
     612             : 
     613             :     /// In case of numbering restart.
     614             : 
     615             :     /// List is set to restart at a particular value so for export make a
     616             :     /// completely new list based on this one and export that instead,
     617             :     /// which duplicates words behaviour in this respect.
     618             :     sal_uInt16 DuplicateNumRule( const SwNumRule *pRule, sal_uInt8 nLevel, sal_uInt16 nVal );
     619             : 
     620             :     /// Access to the attribute output class.
     621             :     virtual AttributeOutputBase& AttrOutput() const = 0;
     622             : 
     623             :     /// Access to the sections/headers/footres.
     624             :     virtual MSWordSections& Sections() const = 0;
     625             : 
     626             :     /// Determines if the format is expected to support unicode.
     627             :     virtual bool SupportsUnicode() const = 0;
     628             : 
     629             :     /// Used to filter out attributes that can be e.g. written to .doc but not to .docx
     630        1908 :     virtual bool ignoreAttributeForStyles( sal_uInt16 /*nWhich*/ ) const { return false; }
     631             : 
     632             :     /// Guess the script (asian/western).
     633             :     ///
     634             :     /// Sadly word does not have two different sizes for asian font size and
     635             :     /// western font size, it has two different fonts, but not sizes, so we
     636             :     /// have to use our guess as to the script used and disable the export of
     637             :     /// one type. The same occurs for font weight and posture (bold and
     638             :     /// italic).
     639             :     ///
     640             :     /// In addition WW7- has only one character language identifier while WW8+
     641             :     /// has two
     642             :     virtual bool CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich ) = 0;
     643             : 
     644             :     virtual void AppendBookmarks( const SwTxtNode& rNd, xub_StrLen nAktPos, xub_StrLen nLen ) = 0;
     645             : 
     646             :     virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false ) = 0;
     647             : 
     648             :     // FIXME probably a hack...
     649             :     virtual void WriteCR( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t() ) = 0;
     650             : 
     651             :     // FIXME definitely a hack, must not be here - it can't do anything
     652             :     // sensible for docx
     653             :     virtual void WriteChar( sal_Unicode c ) = 0;
     654             : 
     655             :     /// Output attributes.
     656             :     void OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpFmt, bool bFlyFmt = false );
     657             : 
     658             :     /// Getter for pISet.
     659         590 :     const SfxItemSet* GetCurItemSet() const { return pISet; }
     660             : 
     661             :     /// Setter for pISet.
     662         452 :     void SetCurItemSet( const SfxItemSet* pS ) { pISet = pS; }
     663             : 
     664             :     /// Remember some of the memebers so that we can recurse in WriteText().
     665             :     virtual void SaveData( sal_uLong nStt, sal_uLong nEnd );
     666             : 
     667             :     /// Restore what was saved in SaveData().
     668             :     virtual void RestoreData();
     669             : 
     670             :     /// The return value indicates, if a follow page desc is written.
     671             :     bool OutputFollowPageDesc( const SfxItemSet* pSet,
     672             :                                const SwTxtNode* pNd );
     673             : 
     674             :     /// Write header/footer text.
     675             :     void WriteHeaderFooterText( const SwFmt& rFmt, bool bHeader);
     676             : 
     677             :     /// Format of the section.
     678             :     const SwSectionFmt* GetSectionFormat( const SwNode& rNd ) const;
     679             : 
     680             :     /// Line number of the section start.
     681             :     sal_uLong GetSectionLineNo( const SfxItemSet* pSet, const SwNode& rNd ) const;
     682             : 
     683             :     /// Start new section.
     684             :     void OutputSectionBreaks( const SfxItemSet *pSet, const SwNode& rNd );
     685             : 
     686             :     /// Write section properties.
     687             :     ///
     688             :     /// pA is ignored for docx.
     689             :     void SectionProperties( const WW8_SepInfo& rSectionInfo, WW8_PdAttrDesc* pA = NULL );
     690             : 
     691             :     /// Output the numbering table.
     692             :     virtual void WriteNumbering() = 0;
     693             : 
     694             :     /// Write static data of SwNumRule - LSTF
     695             :     void NumberingDefinitions();
     696             : 
     697             :     /// Write all Levels for all SwNumRules - LVLF
     698             :     void AbstractNumberingDefinitions();
     699             : 
     700             :     // Convert the bullet according to the font.
     701             :     void SubstituteBullet( String& rNumStr, rtl_TextEncoding& rChrSet,
     702             :         String& rFontName ) const;
     703             : 
     704             :     /// No-op for the newer WW versions.
     705           0 :     virtual void OutputOlst( const SwNumRule& /*rRule*/ ) {}
     706             : 
     707             :     /// Setup the pA's info.
     708          50 :     virtual void SetupSectionPositions( WW8_PdAttrDesc* /*pA*/ ) {}
     709             : 
     710             :     /// Top node of host page when in header/footer.
     711         120 :     void SetHdFtPageRoot( const SwTxtNode *pNd ) { mpTopNodeOfHdFtPage = pNd; }
     712             : 
     713             :     /// Top node of host page when in header/footer.
     714          60 :     const SwTxtNode *GetHdFtPageRoot() const { return mpTopNodeOfHdFtPage; }
     715             : 
     716             :     /// Output the actual headers and footers.
     717             :     virtual void WriteHeadersFooters( sal_uInt8 nHeadFootFlags,
     718             :             const SwFrmFmt& rFmt, const SwFrmFmt& rLeftFmt, const SwFrmFmt& rFirstPageFmt,
     719             :         sal_uInt8 nBreakCode) = 0;
     720             : 
     721             :     /// Write the field
     722             :     virtual void OutputField( const SwField* pFld, ww::eField eFldType,
     723             :             const String& rFldCmd, sal_uInt8 nMode = nsFieldFlags::WRITEFIELD_ALL ) = 0;
     724             : 
     725             :     /// Write the data of the form field
     726             :     virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) = 0;
     727             :     virtual void WriteHyperlinkData( const ::sw::mark::IFieldmark& rFieldmark ) = 0;
     728             : 
     729             :     virtual void DoComboBox(const rtl::OUString &rName,
     730             :                     const rtl::OUString &rHelp,
     731             :                     const rtl::OUString &ToolTip,
     732             :                     const rtl::OUString &rSelected,
     733             :                     com::sun::star::uno::Sequence<rtl::OUString> &rListItems) = 0;
     734             : 
     735             :     virtual void DoFormText(const SwInputField * pFld) = 0;
     736             : 
     737             :     static bool NoPageBreakSection( const SfxItemSet *pSet );
     738             : 
     739             :     // Compute the number format for WW dates
     740             :     bool GetNumberFmt(const SwField& rFld, String& rStr);
     741             : 
     742             :     virtual sal_uLong ReplaceCr( sal_uInt8 nChar ) = 0;
     743             : 
     744             :     const SfxPoolItem* HasItem( sal_uInt16 nWhich ) const;
     745             : 
     746             : 
     747             : protected:
     748             :     /// Format-dependant part of the actual export.
     749             :     virtual void ExportDocument_Impl() = 0;
     750             : 
     751             :     /// Get the next position in the text node to output
     752             :     virtual xub_StrLen GetNextPos( SwWW8AttrIter* pAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos );
     753             : 
     754             :     /// Update the information for GetNextPos().
     755             :     virtual void UpdatePosition( SwWW8AttrIter* pAttrIter, xub_StrLen nAktPos, xub_StrLen nEnd );
     756             : 
     757             :     /// Output SwTxtNode
     758             :     virtual void OutputTextNode( const SwTxtNode& );
     759             : 
     760             :     /// Output SwTableNode
     761             :     void OutputTableNode( const SwTableNode& );
     762             : 
     763             :     /// Setup the chapter fields (maChapterFieldLocs).
     764             :     void GatherChapterFields();
     765             : 
     766             :     void AddLinkTarget( const String& rURL );
     767             :     void CollectOutlineBookmarks( const SwDoc &rDoc );
     768             : 
     769             :     bool SetAktPageDescFromNode(const SwNode &rNd);
     770             :     bool CntntContainsChapterField(const SwFmtCntnt &rCntnt) const;
     771             :     bool FmtHdFtContainsChapterField(const SwFrmFmt &rFmt) const;
     772             : 
     773             :     virtual void SectionBreaksAndFrames( const SwTxtNode& rNode ) = 0;
     774             : 
     775             :     virtual void PrepareNewPageDesc( const SfxItemSet* pSet,
     776             :                                      const SwNode& rNd,
     777             :                                      const SwFmtPageDesc* pNewPgDescFmt = 0,
     778             :                                      const SwPageDesc* pNewPgDesc = 0 ) = 0;
     779             : 
     780             :     /// Return value indicates if an inherited outline numbering is suppressed.
     781             :     virtual bool DisallowInheritingOutlineNumbering(const SwFmt &rFmt) = 0;
     782             : 
     783             : protected:
     784             :     /// Output SwStartNode
     785             :     virtual void OutputStartNode( const SwStartNode& );
     786             : 
     787             :     /// Output SwEndNode
     788             :     virtual void OutputEndNode( const SwEndNode& );
     789             : 
     790             :     /// Output SwGrfNode
     791             :     virtual void OutputGrfNode( const SwGrfNode& ) = 0;
     792             : 
     793             :     /// Output SwOLENode
     794             :     virtual void OutputOLENode( const SwOLENode& ) = 0;
     795             : 
     796             :     virtual void OutputLinkedOLE( const rtl::OUString& ) = 0;
     797             : 
     798             : 
     799             :     /// Output SwSectionNode
     800             :     virtual void OutputSectionNode( const SwSectionNode& );
     801             : 
     802             :     virtual void AppendSection( const SwPageDesc *pPageDesc, const SwSectionFmt* pFmt, sal_uLong nLnNum ) = 0;
     803             : 
     804             :     /// Call the right (virtual) function according to the type of the item.
     805             :     ///
     806             :     /// One of OutputTextNode(), OutputGrfNode(), or OutputOLENode()
     807             :     void OutputContentNode( const SwCntntNode& );
     808             : 
     809             :     /// Find the nearest bookmark from the current position.
     810             :     ///
     811             :     /// Returns false when there is no bookmark.
     812             :     bool NearestBookmark( xub_StrLen& rNearest, const xub_StrLen nAktPos, bool bNextPositionOnly );
     813             : 
     814             :     void GetSortedBookmarks( const SwTxtNode& rNd, xub_StrLen nAktPos,
     815             :                 xub_StrLen nLen );
     816             : 
     817             :     bool GetBookmarks( const SwTxtNode& rNd, xub_StrLen nStt, xub_StrLen nEnd,
     818             :             IMarkVector& rArr );
     819             : 
     820             :     const NfKeywordTable & GetNfKeywordTable();
     821             : 
     822             : public:
     823             :     MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam );
     824             :     virtual ~MSWordExportBase();
     825             : 
     826             :     // TODO move as much as possible here from WW8Export! ;-)
     827             : 
     828             :     static void CorrectTabStopInSet( SfxItemSet& rSet, sal_uInt16 nAbsLeft );
     829             : 
     830             : private:
     831             :     /// No copying.
     832             :     MSWordExportBase( const MSWordExportBase& );
     833             :     /// No copying.
     834             :     MSWordExportBase& operator=( const MSWordExportBase& );
     835             : };
     836             : 
     837             : /// The writer class that gets called for the WW8 filter.
     838             : class SwWW8Writer: public StgWriter
     839             : {
     840             : // friends to get access to m_pExport
     841             : // FIXME avoid that, this is probably not what we want
     842             : // (if yes, remove the friends, and provide here a GetExport() method)
     843             : friend void WW8_WrtRedlineAuthor::Write(Writer &rWrt);
     844             : 
     845             :     bool       m_bWrtWW8;
     846             :     WW8Export *m_pExport;
     847             :     SfxMedium *mpMedium;
     848             : 
     849             : public:
     850             :     SwWW8Writer( const String& rFltName, const String& rBaseURL );
     851             :     virtual ~SwWW8Writer();
     852             : 
     853             :     virtual sal_uLong WriteStorage();
     854             :     virtual sal_uLong WriteMedium( SfxMedium& );
     855             : 
     856             :     // TODO most probably we want to be able to get these in
     857             :     // MSExportFilterBase
     858             :     using Writer::getIDocumentSettingAccess;
     859             : 
     860             : public:
     861             :     static void InsUInt16(ww::bytes &rO, sal_uInt16 n);
     862             :     static void InsUInt32(ww::bytes &rO, sal_uInt32 n);
     863             :     static void InsAsString16(ww::bytes &rO, const String& rStr);
     864             :     static void InsAsString8(ww::bytes & O, const String& rStr,
     865             :         rtl_TextEncoding eCodeSet);
     866             : 
     867             :     static sal_uLong FillUntil( SvStream& rStrm, sal_uLong nEndPos = 0 );
     868             :     static void FillCount( SvStream& rStrm, sal_uLong nCount );
     869             : 
     870         180 :     static void WriteShort( SvStream& rStrm, sal_Int16 nVal ) { rStrm << nVal; }
     871             :     static void WriteShort( SvStream& rStrm, sal_uLong nPos, sal_Int16 nVal );
     872             : 
     873         268 :     static void WriteLong( SvStream& rStrm, sal_Int32 nVal ) { rStrm << nVal; }
     874             :     static void WriteLong( SvStream& rStrm, sal_uLong nPos, sal_Int32 nVal );
     875             : 
     876             :     static void WriteString16(SvStream& rStrm, const String& rStr,
     877             :         bool bAddZero);
     878             :     static void WriteString8(SvStream& rStrm, const String& rStr,
     879             :         bool bAddZero, rtl_TextEncoding eCodeSet);
     880             : 
     881             :     static void WriteString_xstz(SvStream& rStrm, const String& rStr, bool bAddZero);
     882             : 
     883             :     bool InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec );
     884             : 
     885             :     using StgWriter::Write;
     886             :     virtual sal_uLong Write( SwPaM&, SfxMedium&, const String* = 0 );
     887             : 
     888             : private:
     889             :     /// No copying.
     890             :     SwWW8Writer(const SwWW8Writer&);
     891             :     /// No copying.
     892             :     SwWW8Writer& operator=(const SwWW8Writer&);
     893             : };
     894             : 
     895             : /// Exporter of the binary Word file formats.
     896             : class WW8Export : public MSWordExportBase
     897             : {
     898             : public:
     899             :     ww::bytes* pO;                       ///< Buffer
     900             : 
     901             :     SvStream *pTableStrm, *pDataStrm;   ///< Streams for WW97 Export
     902             : 
     903             :     WW8Fib* pFib;                       ///< File Information Block
     904             :     WW8Dop* pDop;                       ///< DOcument Properties
     905             :     WW8_WrPlcFtnEdn *pFtn;              ///< Footnotes - structure to remember them, and output
     906             :     WW8_WrPlcFtnEdn *pEdn;              ///< Endnotes - structure to remember them, and output
     907             :     WW8_WrPlcSepx* pSepx;               ///< Sections/headers/footers
     908             : 
     909             :     sal_uInt8 bWrtWW8 : 1;                   ///< Write WW95 (false) or WW97 (true) file format
     910             : 
     911             : protected:
     912             :     SwWW8Writer        *m_pWriter;      ///< Pointer to the writer
     913             :     WW8AttributeOutput *m_pAttrOutput;  ///< Converting attributes to stream data
     914             : 
     915             : public:
     916             :     /// Access to the attribute output class.
     917             :     virtual AttributeOutputBase& AttrOutput() const;
     918             : 
     919             :     /// Access to the sections/headers/footres.
     920             :     virtual MSWordSections& Sections() const;
     921             : 
     922             :     /// False for WW6, true for WW8.
     923         278 :     virtual bool SupportsUnicode() const { return bWrtWW8; }
     924             : 
     925             : private:
     926             :     /// Format-dependant part of the actual export.
     927             :     virtual void ExportDocument_Impl();
     928             : 
     929             :     void PrepareStorage();
     930             :     void WriteFkpPlcUsw();
     931             :     void WriteMainText();
     932             :     void StoreDoc1();
     933             :     void Out_WwNumLvl( sal_uInt8 nWwLevel );
     934             :     void BuildAnlvBulletBase( WW8_ANLV& rAnlv, sal_uInt8*& rpCh, sal_uInt16& rCharLen,
     935             :                               const SwNumFmt& rFmt );
     936             :     static void BuildAnlvBase( WW8_ANLV& rAnlv, sal_uInt8*& rpCh, sal_uInt16& rCharLen,
     937             :                    const SwNumRule& rRul, const SwNumFmt& rFmt, sal_uInt8 nSwLevel );
     938             : 
     939             :     void Out_BorderLine(ww::bytes& rO, const ::editeng::SvxBorderLine* pLine,
     940             :         sal_uInt16 nDist, sal_uInt16 nSprmNo, bool bShadow);
     941             : 
     942             :     /// Output the numbering table.
     943             :     virtual void WriteNumbering();
     944             : 
     945             :     void OutOverrideListTab();
     946             :     void OutListNamesTab();
     947             : 
     948             :     void RestoreMacroCmds();
     949             : 
     950             :     void InitFontTable();
     951             : 
     952             :     void DoComboBox(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xPropSet);
     953             :     void DoCheckBox(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> xPropSet);
     954             : 
     955             : public:
     956             :     virtual void OutputOlst( const SwNumRule& rRule );
     957             : 
     958             :     /// Setup the pA's info.
     959             :     virtual void SetupSectionPositions( WW8_PdAttrDesc* pA );
     960             : 
     961             :     void Out_SwNumLvl( sal_uInt8 nSwLevel );
     962             :     void Out_NumRuleAnld( const SwNumRule& rRul, const SwNumFmt& rFmt,
     963             :                           sal_uInt8 nSwLevel );
     964             : 
     965             :     bool MiserableFormFieldExportHack(const SwFrmFmt& rFrmFmt);
     966             : 
     967           0 :     SvxMSExportOLEObjects& GetOLEExp()      { return *pOLEExp; }
     968           2 :     SwMSConvertControls& GetOCXExp()        { return *pOCXExp; }
     969           0 :     WW8OleMap& GetOLEMap()                  { return m_aOleMap; }
     970             :     void ExportDopTypography(WW8DopTypography &rTypo);
     971             : 
     972             :     sal_uInt16 AddRedlineAuthor( sal_uInt16 nId );
     973             : 
     974             :     void WriteFtnBegin( const SwFmtFtn& rFtn, ww::bytes* pO = 0 );
     975             :     void WritePostItBegin( ww::bytes* pO = 0 );
     976             :     const SvxBrushItem* GetCurrentPageBgBrush() const;
     977             :     SvxBrushItem TrueFrameBgBrush(const SwFrmFmt &rFlyFmt) const;
     978             : 
     979             :     /// Output all textframes anchored as character for the winword 7- format.
     980             :     void OutWW6FlyFrmsInCntnt( const SwTxtNode& rNd );
     981             : 
     982             :     void AppendFlyInFlys(const sw::Frame& rFrmFmt, const Point& rNdTopLeft);
     983             :     void WriteOutliner(const OutlinerParaObject& rOutliner, sal_uInt8 nTyp);
     984             :     void WriteSdrTextObj(const SdrObject& rObj, sal_uInt8 nTyp);
     985             : 
     986             :     sal_uInt32 GetSdrOrdNum( const SwFrmFmt& rFmt ) const;
     987             :     void CreateEscher();
     988             :     void WriteEscher();
     989             : 
     990             :     bool Out_SwNum(const SwTxtNode* pNd);
     991             : 
     992             :     /// Write the field
     993             :     virtual void OutputField( const SwField* pFld, ww::eField eFldType,
     994             :             const String& rFldCmd, sal_uInt8 nMode = nsFieldFlags::WRITEFIELD_ALL );
     995             : 
     996             :     void StartCommentOutput( const String& rName );
     997             :     void EndCommentOutput(   const String& rName );
     998             :     void OutGrf(const sw::Frame &rFrame);
     999             :     bool TestOleNeedsGraphic(const SwAttrSet& rSet, SvStorageRef xOleStg,
    1000             :         SvStorageRef xObjStg, String &rStorageName, SwOLENode *pOLENd);
    1001             : 
    1002             :     virtual void AppendBookmarks( const SwTxtNode& rNd, xub_StrLen nAktPos, xub_StrLen nLen );
    1003             :     virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false );
    1004             :     void MoveFieldMarks(sal_uLong nFrom, sal_uLong nTo);
    1005             : 
    1006             :     void WriteAsStringTable(const ::std::vector<rtl::OUString>&, sal_Int32& rfcSttbf,
    1007             :         sal_Int32& rlcbSttbf, sal_uInt16 nExtraLen = 0);
    1008             : 
    1009             :     virtual sal_uLong ReplaceCr( sal_uInt8 nChar );
    1010             : 
    1011             :     virtual void WriteCR( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t() );
    1012             :     void WriteChar( sal_Unicode c );
    1013             : 
    1014             :     void OutSwString(const String&, xub_StrLen nStt, xub_StrLen nLen,
    1015             :         bool bUnicode, rtl_TextEncoding eChrSet);
    1016             : 
    1017         158 :     WW8_CP Fc2Cp( sal_uLong nFc ) const          { return pPiece->Fc2Cp( nFc ); }
    1018             : 
    1019             :             // einige z.T. static halb-interne Funktions-Deklarationen
    1020             : 
    1021          36 :     void OutSprmBytes( sal_uInt8* pBytes, sal_uInt16 nSiz )
    1022          36 :                                 { pO->insert( pO->end(), pBytes, pBytes+nSiz ); }
    1023             : 
    1024          20 :     inline bool IsUnicode() const           { return pPiece->IsUnicode(); }
    1025             : 
    1026             :     virtual void SectionBreaksAndFrames( const SwTxtNode& rNode );
    1027             : 
    1028             :     /// Helper method for OutputSectionBreaks() and OutputFollowPageDesc().
    1029             :     // #i76300#
    1030             :     virtual void PrepareNewPageDesc( const SfxItemSet* pSet,
    1031             :                                      const SwNode& rNd,
    1032             :                                      const SwFmtPageDesc* pNewPgDescFmt = 0,
    1033             :                                      const SwPageDesc* pNewPgDesc = 0 );
    1034             : 
    1035             :     void Out_SwFmtBox(const SvxBoxItem& rBox, bool bShadow);
    1036             :     void Out_SwFmtTableBox( ww::bytes& rO, const SvxBoxItem * rBox );
    1037             :     sal_uInt8 TransCol( const Color& rCol );
    1038             :     bool TransBrush(const Color& rCol, WW8_SHD& rShd);
    1039             :     WW8_BRC TranslateBorderLine(const ::editeng::SvxBorderLine& pLine,
    1040             :         sal_uInt16 nDist, bool bShadow);
    1041             : 
    1042             :     // #i77805# - new return value indicates, if an inherited outline numbering is suppressed
    1043             :     virtual bool DisallowInheritingOutlineNumbering(const SwFmt &rFmt);
    1044             : 
    1045          12 :     unsigned int GetHdFtIndex() const { return mnHdFtIndex; }
    1046          16 :     void SetHdFtIndex(unsigned int nHdFtIndex) { mnHdFtIndex = nHdFtIndex; }
    1047          50 :     void IncrementHdFtIndex() { ++mnHdFtIndex; }
    1048             : 
    1049             :     static long GetDTTM( const DateTime& rDT );
    1050             : 
    1051             :     /// Convert the SVX numbering type to id
    1052             :     static sal_uInt8 GetNumId( sal_uInt16 eNumType );
    1053             : 
    1054             :     /// Guess the script (asian/western).
    1055             :     virtual bool CollapseScriptsforWordOk( sal_uInt16 nScript, sal_uInt16 nWhich );
    1056             : 
    1057             :     sal_uInt16 DupNumRuleWithLvlStart(const SwNumRule *pRule,sal_uInt8 nLvl,sal_uInt16 nVal);
    1058             : 
    1059             :     SwTwips CurrentPageWidth(SwTwips &rLeft, SwTwips &rRight) const;
    1060             : 
    1061             :     /// Nasty swap for bidi if neccessary
    1062             :     bool MiserableRTLFrmFmtHack(SwTwips &rLeft, SwTwips &rRight,
    1063             :         const sw::Frame &rFrmFmt);
    1064             : 
    1065        1898 :     void InsUInt16( sal_uInt16 n )      { SwWW8Writer::InsUInt16( *pO, n ); }
    1066          24 :     void InsUInt32( sal_uInt32 n )      { SwWW8Writer::InsUInt32( *pO, n ); }
    1067             :     void InsAsString16( const String& rStr )
    1068             :                         { SwWW8Writer::InsAsString16( *pO, rStr ); }
    1069             :     void InsAsString8( const String& rStr, rtl_TextEncoding eCodeSet )
    1070             :                         { SwWW8Writer::InsAsString8( *pO, rStr, eCodeSet ); }
    1071             :     void WriteStringAsPara( const String& rTxt, sal_uInt16 nStyleId = 0 );
    1072             : 
    1073             :     /// Setup the exporter.
    1074             :     WW8Export( SwWW8Writer *pWriter,
    1075             :             SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam,
    1076             :             bool bIsWW8 );
    1077             :     virtual ~WW8Export();
    1078             : 
    1079             :     virtual void DoComboBox(const rtl::OUString &rName,
    1080             :                     const rtl::OUString &rHelp,
    1081             :                     const rtl::OUString &ToolTip,
    1082             :                     const rtl::OUString &rSelected,
    1083             :                     com::sun::star::uno::Sequence<rtl::OUString> &rListItems);
    1084             : 
    1085             :     virtual void DoFormText(const SwInputField * pFld);
    1086             : 
    1087             :     void GetCurrentItems(ww::bytes &rItems) const;
    1088             : 
    1089             :     /// Write the data of the form field
    1090             :     virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark );
    1091             :     virtual void WriteHyperlinkData( const ::sw::mark::IFieldmark& rFieldmark );
    1092             : 
    1093             :     /// Fields.
    1094             :     WW8_WrPlcFld* CurrentFieldPlc() const;
    1095             : 
    1096         276 :     SwWW8Writer& GetWriter() const { return *m_pWriter; }
    1097         778 :     SvStream& Strm() const { return m_pWriter->Strm(); }
    1098             : 
    1099             :     /// Remember some of the memebers so that we can recurse in WriteText().
    1100             :     virtual void SaveData( sal_uLong nStt, sal_uLong nEnd );
    1101             : 
    1102             :     /// Restore what was saved in SaveData().
    1103             :     virtual void RestoreData();
    1104             : 
    1105             :     /// Output the actual headers and footers.
    1106             :     virtual void WriteHeadersFooters( sal_uInt8 nHeadFootFlags,
    1107             :             const SwFrmFmt& rFmt, const SwFrmFmt& rLeftFmt, const SwFrmFmt& rFirstPageFmt,
    1108             :         sal_uInt8 nBreakCode);
    1109             : 
    1110             : protected:
    1111             :     /// Output SwGrfNode
    1112             :     virtual void OutputGrfNode( const SwGrfNode& );
    1113             : 
    1114             :     /// Output SwOLENode
    1115             :     virtual void OutputOLENode( const SwOLENode& );
    1116             : 
    1117             :     virtual void OutputLinkedOLE( const rtl::OUString& );
    1118             : 
    1119             :     virtual void AppendSection( const SwPageDesc *pPageDesc, const SwSectionFmt* pFmt, sal_uLong nLnNum );
    1120             : 
    1121             : private:
    1122             :     /// No copying.
    1123             :     WW8Export(const WW8Export&);
    1124             :     /// No copying.
    1125             :     WW8Export& operator=(const WW8Export&);
    1126             : };
    1127             : 
    1128             : class WW8_WrPlcSubDoc   // Doppel-Plc fuer Foot-/Endnotes und Postits
    1129             : {
    1130             : private:
    1131             :     //No copying
    1132             :     WW8_WrPlcSubDoc(const WW8_WrPlcSubDoc&);
    1133             :     WW8_WrPlcSubDoc& operator=(const WW8_WrPlcSubDoc&);
    1134             : protected:
    1135             :     std::vector<WW8_CP> aCps;
    1136             :     std::vector<const void*> aCntnt;                // PTRARR von SwFmtFtn/PostIts/..
    1137             :     WW8_WrPlc0* pTxtPos;            // Pos der einzelnen Texte
    1138             : 
    1139             :     WW8_WrPlcSubDoc();
    1140             :     virtual ~WW8_WrPlcSubDoc();
    1141             : 
    1142             :     bool WriteGenericTxt( WW8Export& rWrt, sal_uInt8 nTTyp, WW8_CP& rCount );
    1143             :     void WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp, WW8_FC& rTxtStt,
    1144             :         sal_Int32& rTxtCnt, WW8_FC& rRefStt, sal_Int32& rRefCnt ) const;
    1145             : 
    1146             :     virtual const std::vector<sal_uInt32>* GetShapeIdArr() const;
    1147             : };
    1148             : 
    1149             : // Doppel-Plc fuer Footnotes/Endnotes
    1150          32 : class WW8_WrPlcFtnEdn : public WW8_WrPlcSubDoc
    1151             : {
    1152             : private:
    1153             :     sal_uInt8 nTyp;
    1154             : 
    1155             :     //No copying
    1156             :     WW8_WrPlcFtnEdn(const WW8_WrPlcFtnEdn&);
    1157             :     WW8_WrPlcFtnEdn& operator=(WW8_WrPlcFtnEdn &);
    1158             : public:
    1159          16 :     WW8_WrPlcFtnEdn( sal_uInt8 nTTyp ) : nTyp( nTTyp ) {}
    1160             : 
    1161             :     bool WriteTxt( WW8Export& rWrt );
    1162             :     void WritePlc( WW8Export& rWrt ) const;
    1163             : 
    1164             :     void Append( WW8_CP nCp, const SwFmtFtn& rFtn );
    1165             : };
    1166             : 
    1167           0 : struct WW8_Annotation
    1168             : {
    1169             :     const OutlinerParaObject* mpRichText;
    1170             :     String msSimpleText;
    1171             :     String msOwner;
    1172             :     DateTime maDateTime;
    1173             :     WW8_Annotation(const SwPostItField* pPostIt);
    1174             :     WW8_Annotation(const SwRedlineData* pRedline);
    1175             : };
    1176             : 
    1177             : class WW8_WrPlcAnnotations : public WW8_WrPlcSubDoc  // Doppel-Plc fuer PostIts
    1178             : {
    1179             : private:
    1180             :     //No copying
    1181             :     WW8_WrPlcAnnotations(const WW8_WrPlcAnnotations&);
    1182             :     WW8_WrPlcAnnotations& operator=(WW8_WrPlcAnnotations&);
    1183             :     std::set<const SwRedlineData*> maProcessedRedlines;
    1184             : public:
    1185           8 :     WW8_WrPlcAnnotations() {}
    1186             :     ~WW8_WrPlcAnnotations();
    1187             : 
    1188             :     void Append( WW8_CP nCp, const SwPostItField* pPostIt );
    1189             :     void Append( WW8_CP nCp, const SwRedlineData* pRedLine );
    1190             :     bool IsNewRedlineComment( const SwRedlineData* pRedLine );
    1191             :     bool WriteTxt( WW8Export& rWrt );
    1192             :     void WritePlc( WW8Export& rWrt ) const;
    1193             : };
    1194             : 
    1195          32 : class WW8_WrPlcTxtBoxes : public WW8_WrPlcSubDoc // Doppel-Plc fuer Textboxen
    1196             : {                        // Rahmen/DrawTextboxes!
    1197             : private:
    1198             :     sal_uInt8 nTyp;
    1199             :     std::vector<sal_uInt32> aShapeIds;        // VARARR of ShapeIds for the SwFrmFmts
    1200             :     virtual const std::vector<sal_uInt32>* GetShapeIdArr() const;
    1201             : 
    1202             :     //No copying
    1203             :     WW8_WrPlcTxtBoxes(const WW8_WrPlcTxtBoxes&);
    1204             :     WW8_WrPlcTxtBoxes& operator=(WW8_WrPlcTxtBoxes&);
    1205             : public:
    1206          16 :     WW8_WrPlcTxtBoxes( sal_uInt8 nTTyp ) : nTyp( nTTyp ) {}
    1207             : 
    1208             :     bool WriteTxt( WW8Export& rWrt );
    1209             :     void WritePlc( WW8Export& rWrt ) const;
    1210             :     void Append( const SdrObject& rObj, sal_uInt32 nShapeId );
    1211           2 :     sal_uInt16 Count() const { return aCntnt.size(); }
    1212           0 :     sal_uInt16 GetPos( const void* p ) const
    1213             :     {
    1214             :         std::vector<const void*>::const_iterator it
    1215           0 :             = std::find( aCntnt.begin(), aCntnt.end(), p );
    1216           0 :         return it == aCntnt.end() ? USHRT_MAX : it - aCntnt.begin();
    1217             :     }
    1218             : };
    1219             : 
    1220             : // Plc fuer Chpx und Papx ( incl PN-Plc )
    1221             : typedef boost::ptr_vector<WW8_WrFkp> WW8_WrFkpPtrs;
    1222             : 
    1223             : class WW8_WrPlcPn                   // Plc fuer Page Numbers
    1224             : {
    1225             : private:
    1226             :     WW8Export& rWrt;
    1227             :     WW8_WrFkpPtrs aFkps;            // PTRARR
    1228             :     sal_uInt16 nFkpStartPage;
    1229             :     ePLCFT ePlc;
    1230             :     bool bWrtWW8;                   // Fuer Writererkennung
    1231             :     sal_uInt16 nMark;
    1232             : 
    1233             :     //No copying
    1234             :     WW8_WrPlcPn(const WW8_WrPlcPn&);
    1235             :     WW8_WrPlcPn& operator=(const WW8_WrPlcPn&);
    1236             : public:
    1237             :     WW8_WrPlcPn( WW8Export& rWrt, ePLCFT ePl, WW8_FC nStartFc );
    1238             :     ~WW8_WrPlcPn();
    1239             :     void AppendFkpEntry(WW8_FC nEndFc,short nVarLen = 0,const sal_uInt8* pSprms = 0);
    1240             :     void WriteFkps();
    1241             :     void WritePlc();
    1242             :     sal_uInt8 *CopyLastSprms(sal_uInt8 &rLen);
    1243             : };
    1244             : 
    1245             : // class WW8_WrPlc1 ist erstmal nur fuer Felder
    1246             : class WW8_WrPlc1
    1247             : {
    1248             : private:
    1249             :     std::vector<WW8_CP> aPos;
    1250             :     sal_uInt8* pData;                // Inhalte ( Strukturen )
    1251             :     sal_uLong nDataLen;
    1252             :     sal_uInt16 nStructSiz;
    1253             : 
    1254             :     //No copying
    1255             :     WW8_WrPlc1(const WW8_WrPlc1&);
    1256             :     WW8_WrPlc1& operator=(const WW8_WrPlc1&);
    1257             : protected:
    1258          72 :     sal_uInt16 Count() const { return aPos.size(); }
    1259             :     void Write( SvStream& rStrm );
    1260             :     WW8_CP Prev() const;
    1261             : public:
    1262             :     WW8_WrPlc1( sal_uInt16 nStructSz );
    1263             :     ~WW8_WrPlc1();
    1264             :     void Append( WW8_CP nCp, const void* pData );
    1265             :     void Finish( sal_uLong nLastCp, sal_uLong nStartCp );
    1266             : };
    1267             : 
    1268             : // class WW8_WrPlcFld ist fuer Felder
    1269          56 : class WW8_WrPlcFld : public WW8_WrPlc1
    1270             : {
    1271             : private:
    1272             :     sal_uInt8 nTxtTyp;
    1273             :     sal_uInt16 nResults;
    1274             : 
    1275             :     //No copying
    1276             :     WW8_WrPlcFld(const WW8_WrPlcFld&);
    1277             :     WW8_WrPlcFld& operator=(const WW8_WrPlcFld&);
    1278             : public:
    1279          56 :     WW8_WrPlcFld( sal_uInt16 nStructSz, sal_uInt8 nTTyp )
    1280          56 :         : WW8_WrPlc1( nStructSz ), nTxtTyp( nTTyp ), nResults(0)
    1281          56 :     {}
    1282             :     bool Write( WW8Export& rWrt );
    1283           2 :     void ResultAdded() { ++nResults; }
    1284         188 :     sal_uInt16 ResultCount() const { return nResults; }
    1285             : };
    1286             : 
    1287           8 : class WW8_WrMagicTable : public WW8_WrPlc1
    1288             : {
    1289             : private:
    1290             :     //No copying
    1291             :     WW8_WrMagicTable(const WW8_WrMagicTable&);
    1292             :     WW8_WrMagicTable& operator=(const WW8_WrMagicTable&);
    1293             : public:
    1294           8 :     WW8_WrMagicTable() : WW8_WrPlc1( 4 ) {Append(0,0);}
    1295             :     void Append( WW8_CP nCp, sal_uLong nData );
    1296             :     bool Write( WW8Export& rWrt );
    1297             : };
    1298             : 
    1299           0 : class GraphicDetails
    1300             : {
    1301             : public:
    1302             :     sw::Frame maFly;            // Umgebende FlyFrms dazu
    1303             :     sal_uLong mnPos;                // FilePos der Grafiken
    1304             :     sal_uInt16 mnWid;               // Breite der Grafiken
    1305             :     sal_uInt16 mnHei;               // Hoehe der Grafiken
    1306             : 
    1307           0 :     GraphicDetails(const sw::Frame &rFly, sal_uInt16 nWid, sal_uInt16 nHei)
    1308           0 :         : maFly(rFly), mnPos(0), mnWid(nWid), mnHei(nHei)
    1309           0 :     {}
    1310             :     GraphicDetails& operator=(const GraphicDetails& rOther);
    1311             : 
    1312           0 :     bool operator==(const GraphicDetails& rIn) const
    1313             :     {
    1314             :         return (
    1315             :                  (mnWid == rIn.mnWid) && (mnHei == rIn.mnHei) &&
    1316           0 :                  (maFly.RefersToSameFrameAs(rIn.maFly))
    1317           0 :                );
    1318             :     }
    1319             : };
    1320             : 
    1321             : // class SwWW8WrGrf sammelt Grafiken und gibt sie aus
    1322           8 : class SwWW8WrGrf
    1323             : {
    1324             : private:
    1325             :     /// for access to the variables
    1326             :     WW8Export& rWrt;
    1327             : 
    1328             :     std::vector<GraphicDetails> maDetails;
    1329             :     typedef std::vector<GraphicDetails>::iterator myiter;
    1330             :     sal_uInt16 mnIdx;       // Index in File-Positionen
    1331             : 
    1332             :     void WritePICFHeader(SvStream& rStrm, const sw::Frame &rFly,
    1333             :             sal_uInt16 mm, sal_uInt16 nWidth, sal_uInt16 nHeight,
    1334             :             const SwAttrSet* pAttrSet = 0);
    1335             :     void WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem);
    1336             :     void WriteGrfFromGrfNode(SvStream& rStrm, const SwGrfNode &rNd,
    1337             :         const sw::Frame &rFly, sal_uInt16 nWidth, sal_uInt16 nHeight);
    1338             : 
    1339             :     //No copying
    1340             :     SwWW8WrGrf(const SwWW8WrGrf&);
    1341             :     SwWW8WrGrf& operator=(const SwWW8WrGrf&);
    1342             : public:
    1343           8 :     SwWW8WrGrf( WW8Export& rW ) : rWrt( rW ), mnIdx( 0 ) {}
    1344             :     void Insert(const sw::Frame &rFly);
    1345             :     void Write();
    1346           0 :     sal_uLong GetFPos()
    1347           0 :         { return (mnIdx < maDetails.size()) ? maDetails[mnIdx++].mnPos : 0; }
    1348             : };
    1349             : 
    1350             : /** The class MSWordAttrIter is a helper class to build the Fkp.chpx.
    1351             :     This class may be overloaded for output the SwTxtAttrs and the
    1352             :     EditEngineTxtAttrs.
    1353             : */
    1354             : class MSWordAttrIter
    1355             : {
    1356             : private:
    1357             :     MSWordAttrIter* pOld;
    1358             :     //No copying
    1359             :     MSWordAttrIter(const MSWordAttrIter&);
    1360             :     MSWordAttrIter& operator=(const MSWordAttrIter&);
    1361             : protected:
    1362             :     MSWordExportBase& m_rExport;
    1363             : public:
    1364             :     MSWordAttrIter( MSWordExportBase& rExport );
    1365             :     virtual ~MSWordAttrIter();
    1366             : 
    1367             :     virtual const SfxPoolItem* HasTextItem( sal_uInt16 nWhich ) const = 0;
    1368             :     virtual const SfxPoolItem& GetItem( sal_uInt16 nWhich ) const = 0;
    1369             : };
    1370             : 
    1371             : /// Used to export formatted text associated to drawings.
    1372           2 : class MSWord_SdrAttrIter : public MSWordAttrIter
    1373             : {
    1374             : private:
    1375             :     const EditTextObject* pEditObj;
    1376             :     const SfxItemPool* pEditPool;
    1377             :     std::vector<EECharAttrib> aTxtAtrArr;
    1378             :     std::vector<const EECharAttrib*> aChrTxtAtrArr;
    1379             :     std::vector<rtl_TextEncoding> aChrSetArr;
    1380             :     sal_uInt16 nPara;
    1381             :     xub_StrLen nAktSwPos;
    1382             :     xub_StrLen nTmpSwPos;                   // for HasItem()
    1383             :     rtl_TextEncoding eNdChrSet;
    1384             :     sal_uInt16 nScript;
    1385             :     sal_uInt8 mnTyp;
    1386             : 
    1387             :     xub_StrLen SearchNext( xub_StrLen nStartPos );
    1388             :     void SetCharSet(const EECharAttrib& rTxtAttr, bool bStart);
    1389             : 
    1390             :     //No copying
    1391             :     MSWord_SdrAttrIter(const MSWord_SdrAttrIter&);
    1392             :     MSWord_SdrAttrIter& operator=(const MSWord_SdrAttrIter&);
    1393             : public:
    1394             :     MSWord_SdrAttrIter( MSWordExportBase& rWr, const EditTextObject& rEditObj,
    1395             :         sal_uInt8 nType );
    1396             :     void NextPara( sal_uInt16 nPar );
    1397             :     void OutParaAttr(bool bCharAttr);
    1398             :     void OutEEField(const SfxPoolItem& rHt);
    1399             : 
    1400             :     bool IsTxtAttr(xub_StrLen nSwPos);
    1401             : 
    1402           2 :     void NextPos() { if ( nAktSwPos < STRING_NOTFOUND ) nAktSwPos = SearchNext( nAktSwPos + 1 ); }
    1403             : 
    1404             :     void OutAttr( xub_StrLen nSwPos );
    1405             :     virtual const SfxPoolItem* HasTextItem( sal_uInt16 nWhich ) const;
    1406             :     virtual const SfxPoolItem& GetItem( sal_uInt16 nWhich ) const;
    1407             :     bool OutAttrWithRange(xub_StrLen nPos);
    1408           2 :     xub_StrLen WhereNext() const                { return nAktSwPos; }
    1409             :     rtl_TextEncoding GetNextCharSet() const;
    1410           2 :     rtl_TextEncoding GetNodeCharSet() const     { return eNdChrSet; }
    1411             : };
    1412             : 
    1413             : // Die Klasse SwWW8AttrIter ist eine Hilfe zum Aufbauen der Fkp.chpx.
    1414             : // Dabei werden nur Zeichen-Attribute beachtet; Absatz-Attribute brauchen
    1415             : // diese Behandlung nicht.
    1416             : // Die Absatz- und Textattribute des Writers kommen rein, und es wird
    1417             : // mit Where() die naechste Position geliefert, an der sich die Attribute
    1418             : // aendern. IsTxtAtr() sagt, ob sich an der mit Where() gelieferten Position
    1419             : // ein Attribut ohne Ende und mit \xff im Text befindet.
    1420             : // Mit OutAttr() werden die Attribute an der angegebenen SwPos
    1421             : // ausgegeben.
    1422         390 : class SwWW8AttrIter : public MSWordAttrIter
    1423             : {
    1424             : private:
    1425             :     const SwTxtNode& rNd;
    1426             : 
    1427             :     sw::util::CharRuns maCharRuns;
    1428             :     sw::util::cCharRunIter maCharRunIter;
    1429             : 
    1430             :     rtl_TextEncoding meChrSet;
    1431             :     sal_uInt16 mnScript;
    1432             :     bool mbCharIsRTL;
    1433             : 
    1434             :     const SwRedline* pCurRedline;
    1435             :     xub_StrLen nAktSwPos;
    1436             :     sal_uInt16 nCurRedlinePos;
    1437             : 
    1438             :     bool mbParaIsRTL;
    1439             : 
    1440             :     const SwFmtDrop &mrSwFmtDrop;
    1441             : 
    1442             :     sw::Frames maFlyFrms;     // #i2916#
    1443             :     sw::FrameIter maFlyIter;
    1444             : 
    1445             :     xub_StrLen SearchNext( xub_StrLen nStartPos );
    1446             :     void FieldVanish( const String& rTxt );
    1447             : 
    1448             :     void OutSwFmtRefMark(const SwFmtRefMark& rAttr, bool bStart);
    1449             : 
    1450             :     void IterToCurrent();
    1451             : 
    1452             :     //No copying
    1453             :     SwWW8AttrIter(const SwWW8AttrIter&);
    1454             :     SwWW8AttrIter& operator=(const SwWW8AttrIter&);
    1455             : public:
    1456             :     SwWW8AttrIter( MSWordExportBase& rWr, const SwTxtNode& rNd );
    1457             : 
    1458             :     bool IsTxtAttr( xub_StrLen nSwPos );
    1459             :     bool IsRedlineAtEnd( xub_StrLen nPos ) const;
    1460             :     bool IsDropCap( int nSwPos );
    1461             :     bool RequiresImplicitBookmark();
    1462             : 
    1463         456 :     void NextPos() { if ( nAktSwPos < STRING_NOTFOUND ) nAktSwPos = SearchNext( nAktSwPos + 1 ); }
    1464             : 
    1465             :     void OutAttr( xub_StrLen nSwPos, bool bRuby = false );
    1466             :     virtual const SfxPoolItem* HasTextItem( sal_uInt16 nWhich ) const;
    1467             :     virtual const SfxPoolItem& GetItem( sal_uInt16 nWhich ) const;
    1468             :     int OutAttrWithRange(xub_StrLen nPos);
    1469             :     const SwRedlineData* GetRedline( xub_StrLen nPos );
    1470             :     void OutFlys(xub_StrLen nSwPos);
    1471             : 
    1472         924 :     xub_StrLen WhereNext() const    { return nAktSwPos; }
    1473        1232 :     sal_uInt16 GetScript() const { return mnScript; }
    1474         458 :     bool IsCharRTL() const { return mbCharIsRTL; }
    1475         536 :     bool IsParaRTL() const { return mbParaIsRTL; }
    1476         848 :     rtl_TextEncoding GetCharSet() const { return meChrSet; }
    1477             :     String GetSnippet(const String &rStr, xub_StrLen nAktPos,
    1478             :         xub_StrLen nLen) const;
    1479           0 :     const SwFmtDrop& GetSwFmtDrop() const { return mrSwFmtDrop; }
    1480             : };
    1481             : 
    1482             : /// Class to collect and output the styles table.
    1483             : class MSWordStyles
    1484             : {
    1485             :     MSWordExportBase& m_rExport;
    1486             :     SwFmt** pFmtA;
    1487             :     sal_uInt16 nUsedSlots;
    1488             : 
    1489             :     /// Create the style table, called from the constructor.
    1490             :     void BuildStylesTable();
    1491             : 
    1492             :     /// Get slot number during building the style table.
    1493             :     sal_uInt16 BuildGetSlot( const SwFmt& rFmt );
    1494             : 
    1495             :     /// Return information about one style.
    1496             :     void GetStyleData( SwFmt* pFmt, bool& bFmtColl, sal_uInt16& nBase, sal_uInt16& nNext );
    1497             : 
    1498             :     /// Outputs attributes of one style.
    1499             :     void WriteProperties( const SwFmt* pFmt, bool bPap, sal_uInt16 nPos, bool bInsDefCharSiz );
    1500             : 
    1501             :     sal_uInt16 GetWWId( const SwFmt& rFmt ) const;
    1502             : 
    1503             :     void SetStyleDefaults( const SwFmt& rFmt, bool bPap );
    1504             : 
    1505             :     /// Outputs one style - called (in a loop) from OutputStylesTable().
    1506             :     void OutputStyle( SwFmt* pFmt, sal_uInt16 nPos );
    1507             : 
    1508             :     // No copying
    1509             :     MSWordStyles( const MSWordStyles& );
    1510             :     MSWordStyles& operator=( const MSWordStyles& );
    1511             : 
    1512             : public:
    1513             :     MSWordStyles( MSWordExportBase& rExport );
    1514             :     ~MSWordStyles();
    1515             : 
    1516             :     /// Output the styles table.
    1517             :     void OutputStylesTable();
    1518             : 
    1519             :     /// Get id of the style (rFmt).
    1520             :     sal_uInt16 GetSlot( const SwFmt& rFmt ) const;
    1521             : 
    1522          50 :     const SwFmt* GetSwFmt() const { return (*pFmtA); }
    1523             : };
    1524             : 
    1525             : sal_Int16 GetWordFirstLineOffset(const SwNumFmt &rFmt);
    1526             : //A bit of a bag on the side for now
    1527             : String FieldString(ww::eField eIndex);
    1528             : String BookmarkToWord(const String &rBookmark);
    1529             : 
    1530             : class WW8SHDLong
    1531             : {
    1532             :     sal_uInt32 m_cvFore;
    1533             :     sal_uInt32 m_cvBack;
    1534             :     sal_uInt16 m_ipat;
    1535             : 
    1536             : public:
    1537           0 :     WW8SHDLong() : m_cvFore(0), m_cvBack(0), m_ipat(0) {}
    1538           0 :     virtual ~WW8SHDLong() {}
    1539             : 
    1540             :     void Write(WW8Export & rExport);
    1541           0 :     void setCvFore(sal_uInt32 cvFore) { m_cvFore = cvFore; }
    1542           0 :     void setCvBack(sal_uInt32 cvBack) { m_cvBack = cvBack; }
    1543             :     void setIPat(sal_uInt16 ipat) { m_ipat = ipat; }
    1544             : };
    1545             : 
    1546             : #endif  //  _WRTWW8_HXX
    1547             : 
    1548             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10