LCOV - code coverage report
Current view: top level - sw/source/filter/ww8 - wrtww8.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 71 96 74.0 %
Date: 2012-08-25 Functions: 70 93 75.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 13 53 24.5 %

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

Generated by: LCOV version 1.10