LCOV - code coverage report
Current view: top level - sw/source/filter/html - wrthtml.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 14 34 41.2 %
Date: 2012-08-25 Functions: 11 21 52.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 10 30.0 %

           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                 :            : #ifndef _WRTHTML_HXX
      29                 :            : #define _WRTHTML_HXX
      30                 :            : 
      31                 :            : #include <boost/ptr_container/ptr_vector.hpp>
      32                 :            : #include <boost/ptr_container/ptr_set.hpp>
      33                 :            : #include <vector>
      34                 :            : 
      35                 :            : #include <com/sun/star/container/XIndexContainer.hpp>
      36                 :            : #include <com/sun/star/form/XForm.hpp>
      37                 :            : #include <vcl/field.hxx>
      38                 :            : #include <i18npool/lang.h>
      39                 :            : #include <tools/stream.hxx>
      40                 :            : #include <o3tl/sorted_vector.hxx>
      41                 :            : 
      42                 :            : #include "shellio.hxx"
      43                 :            : #include "wrt_fn.hxx"
      44                 :            : 
      45                 :            : // einige Forward Deklarationen
      46                 :            : class Color;
      47                 :            : class SwFrmFmt;
      48                 :            : class SwFlyFrmFmt;
      49                 :            : class SwDrawFrmFmt;
      50                 :            : class SwFmtINetFmt;
      51                 :            : class SwFmtVertOrient;
      52                 :            : class SwFmtFtn;
      53                 :            : class SwStartNode;
      54                 :            : class SwTableNode;
      55                 :            : class SwPageDesc;
      56                 :            : class SwNodeIndex;
      57                 :            : class ImageMap;
      58                 :            : class SwNumRule;
      59                 :            : class SdrObject;
      60                 :            : class SvxBrushItem;
      61                 :            : class SvxFontItem;
      62                 :            : class SwHTMLNumRuleInfo;
      63                 :            : class SwHTMLPosFlyFrms;
      64                 :            : class SwTxtFtn;
      65                 :            : 
      66                 :            : typedef std::vector<SwTxtFtn *> SwHTMLTxtFtns;
      67                 :            : 
      68                 :            : extern SwAttrFnTab aHTMLAttrFnTab;
      69                 :            : 
      70                 :            : #define HTML_PARSPACE (MM50)
      71                 :            : 
      72                 :            : // Flags fuer die Ausgabe von Rahmen aller Art
      73                 :            : // BORDER geht nur bei OutHTML_Image
      74                 :            : // ANYSIZE gibt an, ob auch VAR_SIZE und MIN_SIZE angaben exportiert werden
      75                 :            : // ABSSIZE gibt an, ob Abstand und Umrandung ignoriert werden sollen
      76                 :            : const sal_uInt32 HTML_FRMOPT_ALIGN      = 1<<0;
      77                 :            : const sal_uInt32 HTML_FRMOPT_S_ALIGN    = 1<<1;
      78                 :            : 
      79                 :            : const sal_uInt32 HTML_FRMOPT_WIDTH      = 1<<2;
      80                 :            : const sal_uInt32 HTML_FRMOPT_HEIGHT         = 1<<3;
      81                 :            : const sal_uInt32 HTML_FRMOPT_SIZE       = HTML_FRMOPT_WIDTH|HTML_FRMOPT_HEIGHT;
      82                 :            : const sal_uInt32 HTML_FRMOPT_S_WIDTH    = 1<<4;
      83                 :            : const sal_uInt32 HTML_FRMOPT_S_HEIGHT   = 1<<5;
      84                 :            : const sal_uInt32 HTML_FRMOPT_S_SIZE     = HTML_FRMOPT_S_WIDTH|HTML_FRMOPT_S_HEIGHT;
      85                 :            : const sal_uInt32 HTML_FRMOPT_ANYSIZE    = 1<<6;
      86                 :            : const sal_uInt32 HTML_FRMOPT_ABSSIZE    = 1<<7;
      87                 :            : const sal_uInt32 HTML_FRMOPT_MARGINSIZE     = 1<<8;
      88                 :            : 
      89                 :            : const sal_uInt32 HTML_FRMOPT_SPACE      = 1<<9;
      90                 :            : const sal_uInt32 HTML_FRMOPT_S_SPACE    = 1<<10;
      91                 :            : 
      92                 :            : const sal_uInt32 HTML_FRMOPT_BORDER     = 1<<11;
      93                 :            : const sal_uInt32 HTML_FRMOPT_S_BORDER   = 1<<12;
      94                 :            : const sal_uInt32 HTML_FRMOPT_S_NOBORDER     = 1<<13;
      95                 :            : 
      96                 :            : const sal_uInt32 HTML_FRMOPT_S_BACKGROUND = 1<<14;
      97                 :            : 
      98                 :            : const sal_uInt32 HTML_FRMOPT_NAME           = 1<<15;
      99                 :            : const sal_uInt32 HTML_FRMOPT_ALT        = 1<<16;
     100                 :            : const sal_uInt32 HTML_FRMOPT_BRCLEAR    = 1<<17;
     101                 :            : const sal_uInt32 HTML_FRMOPT_S_PIXSIZE  = 1<<18;
     102                 :            : const sal_uInt32 HTML_FRMOPT_ID             = 1<<19;
     103                 :            : const sal_uInt32 HTML_FRMOPT_DIR            = 1<<20;
     104                 :            : 
     105                 :            : 
     106                 :            : const sal_uInt32 HTML_FRMOPTS_GENIMG_ALL    =
     107                 :            :     HTML_FRMOPT_ALT     |
     108                 :            :     HTML_FRMOPT_SIZE    |
     109                 :            :     HTML_FRMOPT_ABSSIZE |
     110                 :            :     HTML_FRMOPT_NAME;
     111                 :            : const sal_uInt32 HTML_FRMOPTS_GENIMG_CNTNR = HTML_FRMOPTS_GENIMG_ALL;
     112                 :            : const sal_uInt32 HTML_FRMOPTS_GENIMG    =
     113                 :            :     HTML_FRMOPTS_GENIMG_ALL |
     114                 :            :     HTML_FRMOPT_ALIGN       |
     115                 :            :     HTML_FRMOPT_SPACE       |
     116                 :            :     HTML_FRMOPT_BRCLEAR;
     117                 :            : 
     118                 :            : #define HTMLMODE_BLOCK_SPACER       0x00010000
     119                 :            : #define HTMLMODE_FLOAT_FRAME        0x00020000
     120                 :            : #define HTMLMODE_VERT_SPACER        0x00040000
     121                 :            : #define HTMLMODE_NBSP_IN_TABLES     0x00080000
     122                 :            : #define HTMLMODE_LSPACE_IN_NUMBUL   0x00100000
     123                 :            : #define HTMLMODE_NO_BR_AT_PAREND    0x00200000
     124                 :            : #define HTMLMODE_PRINT_EXT          0x00400000
     125                 :            : #define HTMLMODE_ABS_POS_FLY        0x00800000
     126                 :            : #define HTMLMODE_ABS_POS_DRAW       0x01000000
     127                 :            : #define HTMLMODE_FLY_MARGINS        0x02000000
     128                 :            : #define HTMLMODE_BORDER_NONE        0x04000000
     129                 :            : #define HTMLMODE_FONT_GENERIC       0x08000000
     130                 :            : #define HTMLMODE_FRSTLINE_IN_NUMBUL 0x10000000
     131                 :            : #define HTMLMODE_NO_CONTROL_CENTERING 0x20000000
     132                 :            : 
     133                 :            : #define HTML_DLCOLL_DD 0x4000
     134                 :            : #define HTML_DLCOLL_DT 0x8000
     135                 :            : 
     136                 :            : #define CSS1_FMT_ISTAG (USHRT_MAX)
     137                 :            : #define CSS1_FMT_CMPREF (USHRT_MAX-1)
     138                 :            : #define CSS1_FMT_SPECIAL (USHRT_MAX-1)
     139                 :            : 
     140                 :            : // Die folgenden Flags bestimmen nur, welche Descriptoren, Tags, Optionen etc.
     141                 :            : // ausgegeben werden ...
     142                 :            : // bit 0,1,2
     143                 :            : #define CSS1_OUTMODE_SPAN_NO_ON     0x0000U
     144                 :            : #define CSS1_OUTMODE_SPAN_TAG_ON    0x0001U
     145                 :            : #define CSS1_OUTMODE_STYLE_OPT_ON   0x0002U
     146                 :            : #define CSS1_OUTMODE_RULE_ON        0x0003U
     147                 :            : #define CSS1_OUTMODE_SPAN_TAG1_ON   0x0004U
     148                 :            : #define CSS1_OUTMODE_ANY_ON         0x0007U
     149                 :            : 
     150                 :            : // bit 3,4,5
     151                 :            : #define CSS1_OUTMODE_SPAN_NO_OFF    0x0000U
     152                 :            : #define CSS1_OUTMODE_SPAN_TAG_OFF   ((sal_uInt16)(0x0001U << 3))
     153                 :            : #define CSS1_OUTMODE_STYLE_OPT_OFF  ((sal_uInt16)(0x0002U << 3))
     154                 :            : #define CSS1_OUTMODE_RULE_OFF       ((sal_uInt16)(0x0003U << 3))
     155                 :            : #define CSS1_OUTMODE_SPAN_TAG1_OFF  ((sal_uInt16)(0x0004U << 3))
     156                 :            : #define CSS1_OUTMODE_ANY_OFF        ((sal_uInt16)(0x0007U << 3))
     157                 :            : 
     158                 :            : #define CSS1_OUTMODE_ONOFF(a) (CSS1_OUTMODE_##a##_ON|CSS1_OUTMODE_##a##_OFF)
     159                 :            : #define CSS1_OUTMODE_SPAN_TAG       CSS1_OUTMODE_ONOFF(SPAN_TAG)
     160                 :            : #define CSS1_OUTMODE_STYLE_OPT      CSS1_OUTMODE_ONOFF(STYLE_OPT)
     161                 :            : #define CSS1_OUTMODE_RULE           CSS1_OUTMODE_ONOFF(RULE)
     162                 :            : #define CSS1_OUTMODE_SPAN_TAG1      CSS1_OUTMODE_ONOFF(TAG1)
     163                 :            : 
     164                 :            : // Die folgenden Flags legen fest, was ausgegeben wird
     165                 :            : // bit 6,7,8,9
     166                 :            : #define CSS1_OUTMODE_TEMPLATE       0x0000U
     167                 :            : #define CSS1_OUTMODE_BODY           ((sal_uInt16)(0x0001U << 6))
     168                 :            : #define CSS1_OUTMODE_PARA           ((sal_uInt16)(0x0002U << 6))
     169                 :            : #define CSS1_OUTMODE_HINT           ((sal_uInt16)(0x0003U << 6))
     170                 :            : #define CSS1_OUTMODE_FRAME          ((sal_uInt16)(0x0004U << 6))
     171                 :            : #define CSS1_OUTMODE_TABLE          ((sal_uInt16)(0x0005U << 6))
     172                 :            : #define CSS1_OUTMODE_TABLEBOX       ((sal_uInt16)(0x0006U << 6))
     173                 :            : #define CSS1_OUTMODE_DROPCAP        ((sal_uInt16)(0x0007U << 6))
     174                 :            : #define CSS1_OUTMODE_SECTION        ((sal_uInt16)(0x0008U << 6))
     175                 :            : #define CSS1_OUTMODE_SOURCE         ((sal_uInt16)(0x000fU << 6))
     176                 :            : 
     177                 :            : // bit 10
     178                 :            : #define CSS1_OUTMODE_ENCODE         ((sal_uInt16)(0x0001U << 10))
     179                 :            : 
     180                 :            : // bit 11,12,13
     181                 :            : // don't care about script
     182                 :            : #define CSS1_OUTMODE_ANY_SCRIPT     0x0000U
     183                 :            : // no cjk or ctl items
     184                 :            : #define CSS1_OUTMODE_WESTERN        ((sal_uInt16)(0x0001U << 11))
     185                 :            : // no western or ctl items
     186                 :            : #define CSS1_OUTMODE_CJK            ((sal_uInt16)(0x0002U << 11))
     187                 :            : // no western or cjk items
     188                 :            : #define CSS1_OUTMODE_CTL            ((sal_uInt16)(0x0003U << 11))
     189                 :            : // no western, cjk or ctl items
     190                 :            : #define CSS1_OUTMODE_NO_SCRIPT      ((sal_uInt16)(0x0004U << 11))
     191                 :            : #define CSS1_OUTMODE_SCRIPT         ((sal_uInt16)(0x0007U << 11))
     192                 :            : 
     193                 :            : // der HTML-Writer
     194                 :            : struct HTMLControl
     195                 :            : {
     196                 :            :     // die Form, zu der das Control gehoert
     197                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > xFormComps;
     198                 :            :     sal_uLong nNdIdx;                   // der Node, in dem es verankert ist
     199                 :            :     xub_StrLen nCount;              // wie viele Controls sind in dem Node
     200                 :            : 
     201                 :            :     HTMLControl( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > & rForm,
     202                 :            :                  sal_uInt32 nIdx );
     203                 :            :     ~HTMLControl();
     204                 :            : 
     205                 :            :     // operatoren fuer das Sort-Array
     206                 :            :     bool operator==( const HTMLControl& rCtrl ) const
     207                 :            :     {
     208                 :            :         return nNdIdx == rCtrl.nNdIdx;
     209                 :            :     }
     210                 :          0 :     bool operator<( const HTMLControl& rCtrl ) const
     211                 :            :     {
     212                 :          0 :         return nNdIdx < rCtrl.nNdIdx;
     213                 :            :     }
     214                 :            : };
     215                 :            : 
     216                 :          2 : class HTMLControls : public o3tl::sorted_vector<HTMLControl*, o3tl::less_ptr_to<HTMLControl> > {
     217                 :            : public:
     218                 :            :     // will free any items still in the vector
     219         [ +  - ]:          2 :     ~HTMLControls() { DeleteAndDestroyAll(); }
     220                 :            : };
     221                 :            : 
     222                 :            : 
     223                 :            : typedef std::vector<SwFmtINetFmt*> INetFmts;
     224                 :            : 
     225                 :            : struct SwHTMLFmtInfo
     226                 :            : {
     227                 :            :     const SwFmt *pFmt;      // das Format selbst
     228                 :            :     const SwFmt *pRefFmt;   // das Vergleichs-Format
     229                 :            : 
     230                 :            :     rtl::OString aToken;          // das auszugebende Token
     231                 :            :     String aClass;          // die auszugebende Klasse
     232                 :            : 
     233                 :            :     SfxItemSet *pItemSet;   // der auszugebende Attribut-Set
     234                 :            : 
     235                 :            :     sal_Int32 nLeftMargin;      // ein par default-Werte fuer
     236                 :            :     sal_Int32 nRightMargin; // Absatz-Vorlagen
     237                 :            :     short nFirstLineIndent;
     238                 :            : 
     239                 :            :     sal_uInt16 nTopMargin;
     240                 :            :     sal_uInt16 nBottomMargin;
     241                 :            : 
     242                 :            :     sal_Bool bScriptDependent;
     243                 :            : 
     244                 :            :     // Konstruktor fuer einen Dummy zum Suchen
     245                 :          2 :     SwHTMLFmtInfo( const SwFmt *pF ) :
     246         [ +  - ]:          2 :         pFmt( pF ), pRefFmt(0), pItemSet( 0 ), nFirstLineIndent(0)
     247                 :          2 :     {}
     248                 :            : 
     249                 :            : 
     250                 :            :     // Konstruktor zum Erstellen der Format-Info
     251                 :            :     SwHTMLFmtInfo( const SwFmt *pFmt, SwDoc *pDoc, SwDoc *pTemlate,
     252                 :            :                    sal_Bool bOutStyles, LanguageType eDfltLang=LANGUAGE_DONTKNOW,
     253                 :            :                    sal_uInt16 nScript=CSS1_OUTMODE_ANY_SCRIPT,
     254                 :            :                    sal_Bool bHardDrop=sal_False );
     255                 :            :     ~SwHTMLFmtInfo();
     256                 :            : 
     257                 :            :     friend sal_Bool operator==( const SwHTMLFmtInfo& rInfo1,
     258                 :            :                             const SwHTMLFmtInfo& rInfo2 )
     259                 :            :     {
     260                 :            :         return (long)rInfo1.pFmt == (long)rInfo2.pFmt;
     261                 :            :     }
     262                 :            : 
     263                 :          0 :     friend sal_Bool operator<( const SwHTMLFmtInfo& rInfo1,
     264                 :            :                             const SwHTMLFmtInfo& rInfo2 )
     265                 :            :     {
     266                 :          0 :         return (long)rInfo1.pFmt < (long)rInfo2.pFmt;
     267                 :            :     }
     268                 :            : 
     269                 :            : };
     270                 :            : 
     271                 :            : typedef boost::ptr_set<SwHTMLFmtInfo> SwHTMLFmtInfos;
     272                 :            : 
     273                 :            : class IDocumentStylePoolAccess;
     274                 :            : 
     275                 :            : class SwHTMLWriter : public Writer
     276                 :            : {
     277                 :            :     SwHTMLPosFlyFrms *pHTMLPosFlyFrms;
     278                 :            :     SwHTMLNumRuleInfo *pNumRuleInfo;// aktuelle Numerierung
     279                 :            :     SwHTMLNumRuleInfo *pNextNumRuleInfo;
     280                 :            :     sal_uInt32 nHTMLMode;               // Beschreibung der Export-Konfiguration
     281                 :            : 
     282                 :            :     FieldUnit eCSS1Unit;
     283                 :            : 
     284                 :            :     sal_uInt16 OutHeaderAttrs();
     285                 :            :     const SwPageDesc *MakeHeader( sal_uInt16& rHeaderAtrs );
     286                 :            :     void GetControls();
     287                 :            : 
     288                 :            :     void AddLinkTarget( const String& rURL );
     289                 :            :     void CollectLinkTargets();
     290                 :            : 
     291                 :            : protected:
     292                 :            :     sal_uLong WriteStream();
     293                 :            : 
     294                 :            : public:
     295                 :            : #if defined(UNX)
     296                 :            :     static const sal_Char sNewLine;     // nur \012 oder \015
     297                 :            : #else
     298                 :            :     static const sal_Char sNewLine[];   // \015\012
     299                 :            : #endif
     300                 :            : 
     301                 :            :     std::vector<String> aImgMapNames;     // geschriebene Image Maps
     302                 :            :     std::set<String> aImplicitMarks;// implizite Stprungmarken
     303                 :            :     std::set<String> aNumRuleNames;// Names of exported num rules
     304                 :            :     std::set<String> aScriptParaStyles;// script dependent para styles
     305                 :            :     std::set<String> aScriptTextStyles;// script dependent text styles
     306                 :            :     boost::ptr_vector<String> aOutlineMarks;
     307                 :            :     std::vector<sal_uInt32> aOutlineMarkPoss;
     308                 :            :     HTMLControls aHTMLControls;     // die zu schreibenden ::com::sun::star::form::Forms
     309                 :            :     SwHTMLFmtInfos aChrFmtInfos;
     310                 :            :     SwHTMLFmtInfos aTxtCollInfos;
     311                 :            :     INetFmts aINetFmts;             // die "offenen" INet-Attribute
     312                 :            :     SwHTMLTxtFtns *pFootEndNotes;
     313                 :            : 
     314                 :            :     String aCSS1Selector;           // der Selektor eines Styles
     315                 :            :     String aNonConvertableCharacters;
     316                 :            :     String aBulletGrfs[MAXLEVEL];   // die Grafiken fuer Listen
     317                 :            : 
     318                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >  *pxFormComps; // die aktuelle Form
     319                 :            : 
     320                 :            :     SwDoc *pTemplate;               // die HTML-Vorlage
     321                 :            :     Color *pDfltColor;              // default Farbe
     322                 :            :     SwNodeIndex *pStartNdIdx;       // Index des ersten Absatz
     323                 :            :     const SwPageDesc *pCurrPageDesc;// Die aktuelle Seiten-Vorlage
     324                 :            :     const SwFmtFtn *pFmtFtn;
     325                 :            : 
     326                 :            :     sal_uInt32 aFontHeights[7];         // die Font-Hoehen 1-7
     327                 :            : 
     328                 :            :     sal_uInt32 nWarn;                   // Result-Code fuer Warnungen
     329                 :            :     sal_uInt32 nLastLFPos;              // letzte Position eines LF
     330                 :            : 
     331                 :            :     sal_uInt16 nLastParaToken;          // fuers Absaetze zusammenhalten
     332                 :            :     sal_Int32 nBkmkTabPos;              // akt. Position in der Bookmark-Tabelle
     333                 :            :     sal_uInt16 nImgMapCnt;              // zum eindeutig
     334                 :            :     sal_uInt16 nFormCntrlCnt;
     335                 :            :     sal_uInt16 nEndNote;
     336                 :            :     sal_uInt16 nFootNote;
     337                 :            :     sal_Int32 nLeftMargin;              // linker Einzug (z.B. aus Listen)
     338                 :            :     sal_Int32 nDfltLeftMargin;          // die dafaults, der nicht geschrieben
     339                 :            :     sal_Int32 nDfltRightMargin;     // werden muessen (aus der Vorlage)
     340                 :            :     short  nFirstLineIndent;        // Erstzeilen-Einzug (aus Listen)
     341                 :            :     short  nDfltFirstLineIndent;    // nicht zu schreibender default
     342                 :            :     sal_uInt16 nDfltTopMargin;          // die defaults, der nicht geschrieben
     343                 :            :     sal_uInt16 nDfltBottomMargin;       // werden muessen (aus der Vorlage)
     344                 :            :     sal_uInt16 nIndentLvl;              // wie weit ist eingerueckt?
     345                 :            :     xub_StrLen nWhishLineLen;           // wie lang darf eine Zeile werden?
     346                 :            :     sal_uInt16 nDefListLvl;             // welcher DL-Level existiert gerade
     347                 :            :     sal_Int32  nDefListMargin;          // Wie weit wird in DL eingerueckt
     348                 :            :     sal_uInt16 nHeaderFooterSpace;
     349                 :            :     sal_uInt16 nTxtAttrsToIgnore;
     350                 :            :     sal_uInt16 nExportMode;
     351                 :            :     sal_uInt16 nCSS1OutMode;
     352                 :            :     sal_uInt16 nCSS1Script;         // contains default script (that's the one
     353                 :            :                                     // that is not contained in class names)
     354                 :            :     sal_uInt16 nDirection;          // the current direction
     355                 :            : 
     356                 :            :     rtl_TextEncoding    eDestEnc;
     357                 :            :     LanguageType        eLang;
     358                 :            : 
     359                 :            :     // Beschreibung der Export-Konfiguration
     360                 :            :     // 0
     361                 :            :     sal_Bool bCfgOutStyles : 1;         // Styles exportieren
     362                 :            :     sal_Bool bCfgPreferStyles : 1;      // Styles herkoemmlichen Tags vorziehen
     363                 :            :     sal_Bool bCfgFormFeed : 1;          // Form-Feeds exportieren
     364                 :            :     sal_Bool bCfgStarBasic : 1;         // StarBasic exportieren
     365                 :            :     sal_Bool bCfgCpyLinkedGrfs : 1;
     366                 :            : 
     367                 :            :     // Beschreibung dessen, was exportiert wird
     368                 :            : 
     369                 :            :     sal_Bool bFirstLine : 1;            // wird die 1. Zeile ausgegeben ?
     370                 :            :     sal_Bool bTagOn : 1;                // Tag an oder aus/Attr-Start oder -Ende
     371                 :            : 
     372                 :            :     // Die folgenden beiden Flags geben an, wir Attribute exportiert werden:
     373                 :            :     // bTxtAttr bOutOpts
     374                 :            :     // 0        0           Style-Sheets
     375                 :            :     // 1        0           Hints: Jedes Attribut wird als eignes Tag
     376                 :            :     //                          geschrieben und es gibt ein End-Tag
     377                 :            :     // 0        1           (Absatz-)Attribute: Das Attribut wird als Option
     378                 :            :     //                          eines bereits geschrieben Tags exportiert. Es
     379                 :            :     //                          gibt kein End-Tag.
     380                 :            :     sal_Bool bTxtAttr : 1;
     381                 :            :     // 8
     382                 :            :     sal_Bool bOutOpts : 1;
     383                 :            : 
     384                 :            :     sal_Bool bOutTable : 1;             // wird der Tabelleninhalt geschrieben?
     385                 :            :     sal_Bool bOutHeader : 1;
     386                 :            :     sal_Bool bOutFooter : 1;
     387                 :            :     sal_Bool bOutFlyFrame : 1;
     388                 :            : 
     389                 :            :     // Flags fuer Style-Export
     390                 :            : 
     391                 :            :     sal_Bool bFirstCSS1Rule : 1;        // wurde schon eine Property ausgegeben
     392                 :            :     sal_Bool bFirstCSS1Property : 1;    // wurde schon eine Property ausgegeben
     393                 :            :     sal_Bool bPoolCollTextModified : 1; // die Textkoerper-Vorlage wurde
     394                 :            :                                     // modifiziert.
     395                 :            :     // 16
     396                 :            :     sal_Bool bCSS1IgnoreFirstPageDesc : 1;
     397                 :            : 
     398                 :            :     // was muss/kann/darf nicht ausgegeben werden?
     399                 :            : 
     400                 :            :     sal_Bool bNoAlign : 1;              // HTML-Tag erlaubt kein ALIGN=...
     401                 :            :     sal_Bool bClearLeft : 1;            // <BR CLEAR=LEFT> am Absatz-Ende ausg.
     402                 :            :     sal_Bool bClearRight : 1;           // <BR CLEAR=RIGHT> am Absatz-Ende ausg.
     403                 :            :     sal_Bool bLFPossible : 1;           // ein Zeilenumbruch darf eingef. werden
     404                 :            : 
     405                 :            :     // sonstiges
     406                 :            : 
     407                 :            :     sal_Bool bPreserveForm : 1;         // die aktuelle Form beibehalten
     408                 :            : 
     409                 :            :     sal_Bool bCfgNetscape4 : 1;         // Netscape4 Hacks
     410                 :            :     // 23
     411                 :            : 
     412                 :            :     SwHTMLWriter( const String& rBaseURL );
     413                 :            :     virtual ~SwHTMLWriter();
     414                 :            : 
     415                 :            :     void Out_SwDoc( SwPaM* );       // schreibe den makierten Bereich
     416                 :            : 
     417                 :            :     // gebe alle an in aktuellen Ansatz stehenden ::com::sun::star::text::Bookmarks aus
     418                 :            :     void OutAnchor( const String& rName );
     419                 :            :     void OutBookmarks();
     420                 :            :     void OutImplicitMark( const String& rMark, const sal_Char *pMarkType );
     421                 :            :     void OutHyperlinkHRefValue( const String& rURL );
     422                 :            : 
     423                 :            :     // gebe die evt. an der akt. Position stehenden FlyFrame aus.
     424                 :            :     sal_Bool OutFlyFrm( sal_uLong nNdIdx, xub_StrLen nCntntIdx,
     425                 :            :                         sal_uInt8 nPos, HTMLOutContext *pContext = 0 );
     426                 :            :     void OutFrmFmt( sal_uInt8 nType, const SwFrmFmt& rFmt,
     427                 :            :                     const SdrObject *pSdrObj );
     428                 :            : 
     429                 :            :     void OutForm( sal_Bool bTagOn=sal_True, const SwStartNode *pStNd=0 );
     430                 :            :     void OutHiddenForms();
     431                 :            :     void OutHiddenForm( const ::com::sun::star::uno::Reference<
     432                 :            :                                 ::com::sun::star::form::XForm > & rForm );
     433                 :            : 
     434                 :            :     void OutForm( sal_Bool bOn, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > & rFormComps );
     435                 :            :     void OutHiddenControls( const ::com::sun::star::uno::Reference<
     436                 :            :                 ::com::sun::star::container::XIndexContainer > & rFormComps,
     437                 :            :             const ::com::sun::star::uno::Reference<
     438                 :            :                 ::com::sun::star::beans::XPropertySet > & rPropSet );
     439                 :            :     sal_Bool HasControls() const;
     440                 :            : 
     441                 :            :     void OutFootEndNoteInfo();
     442                 :            :     void OutFootEndNotes();
     443                 :            :     String GetFootEndNoteSym( const SwFmtFtn& rFmtFtn );
     444                 :            :     void OutFootEndNoteSym( const SwFmtFtn& rFmtFtn, const String& rNum,
     445                 :            :                              sal_uInt16 nScript );
     446                 :            : 
     447                 :            :     void OutBasic();
     448                 :            : 
     449                 :            :     void OutAndSetDefList( sal_uInt16 nNewLvl );
     450                 :            : 
     451                 :            :     void OutStyleSheet( const SwPageDesc& rPageDesc, sal_Bool bUsed=sal_True );
     452                 :            : 
     453                 :            :     inline void OutCSS1_PropertyAscii( const sal_Char *pProp,
     454                 :            :                                        const sal_Char *pVal );
     455                 :            :     inline void OutCSS1_PropertyAscii( const sal_Char *pProp,
     456                 :            :                                        const rtl::OString& rVal );
     457                 :            :     inline void OutCSS1_Property( const sal_Char *pProp, const String& rVal );
     458                 :            :     void OutCSS1_Property( const sal_Char *pProp, const sal_Char *pVal,
     459                 :            :                            const String *pSVal );
     460                 :            :     void OutCSS1_UnitProperty( const sal_Char *pProp, long nVal );
     461                 :            :     void OutCSS1_PixelProperty( const sal_Char *pProp, long nVal, sal_Bool bVert );
     462                 :            :     void OutCSS1_SfxItemSet( const SfxItemSet& rItemSet, sal_Bool bDeep=sal_True );
     463                 :            : 
     464                 :            :     // BODY-Tag-Events aus der SFX-Konfigaurion
     465                 :            :     void OutBasicBodyEvents();
     466                 :            : 
     467                 :            :     // BACKGROUND/BGCOLOR-Option
     468                 :            :     void OutBackground( const SvxBrushItem *pBrushItem, String& rEmbGrfNm,
     469                 :            :                         sal_Bool bGraphic );
     470                 :            :     void OutBackground( const SfxItemSet& rItemSet, String &rEmbGrfName,
     471                 :            :                         sal_Bool bGraphic );
     472                 :            : 
     473                 :            :     void OutLanguage( LanguageType eLang );
     474                 :            :     sal_uInt16 GetHTMLDirection( sal_uInt16 nDir ) const;
     475                 :            :     sal_uInt16 GetHTMLDirection( const SfxItemSet& rItemSet ) const;
     476                 :            :     void OutDirection( sal_uInt16 nDir );
     477                 :            : 
     478                 :            :     // ALT/ALIGN/WIDTH/HEIGHT/HSPACE/VSPACE-Optionen des aktuellen
     479                 :            :     // Frame-Formats ausgeben und ggf. ein <BR CLEAR=...> vorne an
     480                 :            :     // rEndTags anhaengen
     481                 :            :     rtl::OString OutFrmFmtOptions( const SwFrmFmt& rFrmFmt, const String& rAltTxt,
     482                 :            :         sal_uInt32 nFrmOpts, const rtl::OString& rEndTags = rtl::OString() );
     483                 :            :     void OutCSS1_TableFrmFmtOptions( const SwFrmFmt& rFrmFmt );
     484                 :            :     void OutCSS1_TableCellBorderHack(const SwFrmFmt& rFrmFmt);
     485                 :            :     void OutCSS1_SectionFmtOptions( const SwFrmFmt& rFrmFmt );
     486                 :            :     void OutCSS1_FrmFmtOptions( const SwFrmFmt& rFrmFmt, sal_uInt32 nFrmOpts,
     487                 :            :                                 const SdrObject *pSdrObj=0,
     488                 :            :                                 const SfxItemSet *pItemSet=0 );
     489                 :            :     void OutCSS1_FrmFmtBackground( const SwFrmFmt& rFrmFmt );
     490                 :            : 
     491                 :            :     void ChangeParaToken( sal_uInt16 nNew );
     492                 :            : 
     493                 :          2 :     void IncIndentLevel() { nIndentLvl++; }
     494         [ +  - ]:          2 :     void DecIndentLevel() { if ( nIndentLvl ) nIndentLvl--; }
     495                 :            :     rtl::OString GetIndentString(sal_uInt16 nIncLvl = 0);
     496                 :            : 
     497                 :          2 :     xub_StrLen GetLineLen() { return (xub_StrLen)(Strm().Tell()-nLastLFPos); }
     498                 :            :     void OutNewLine( sal_Bool bCheck=sal_False );
     499                 :            : 
     500                 :            :     // fuer HTMLSaveData
     501                 :          0 :     SwPaM* GetEndPaM() { return pOrigPam; }
     502                 :          0 :     void SetEndPaM( SwPaM* pPam ) { pOrigPam = pPam; }
     503                 :            : 
     504                 :            :     sal_uInt32 ToPixel( sal_uInt32 nVal ) const;
     505                 :            : 
     506                 :            :     sal_uInt16 GuessFrmType( const SwFrmFmt& rFrmFmt,
     507                 :            :                          const SdrObject*& rpStrObj );
     508                 :            :     sal_uInt16 GuessOLENodeFrmType( const SwNode& rNd );
     509                 :            : 
     510                 :            :     void CollectFlyFrms();
     511                 :            : 
     512                 :            :     sal_uInt16 GetHTMLFontSize( sal_uInt32 nFontHeight ) const;
     513                 :            : 
     514                 :            :     // Die aktuelle Numerierungs-Information holen.
     515                 :          4 :     SwHTMLNumRuleInfo& GetNumInfo() { return *pNumRuleInfo; }
     516                 :            : 
     517                 :            :     // Die Numerierungs-Information des naechsten Absatz holen. Sie
     518                 :            :     // muss noch nicht vorhanden sein!
     519                 :          2 :     SwHTMLNumRuleInfo *GetNextNumInfo() { return pNextNumRuleInfo; }
     520                 :            : 
     521                 :            :     // Die Numerierungs-Information des naechsten Absatz setzen.
     522                 :          0 :     void SetNextNumInfo( SwHTMLNumRuleInfo *pNxt ) { pNextNumRuleInfo=pNxt; }
     523                 :            : 
     524                 :            :     // Die Numerierungs-Information des naeschten Absatz fuellen.
     525                 :            :     void FillNextNumInfo();
     526                 :            : 
     527                 :            :     // Die Numerierungs-Information des naeschten Absatz loeschen.
     528                 :            :     void ClearNextNumInfo();
     529                 :            : 
     530                 :            :     static const SdrObject *GetHTMLControl( const SwDrawFrmFmt& rFmt );
     531                 :            :     static const SdrObject *GetMarqueeTextObj( const SwDrawFrmFmt& rFmt );
     532                 :            :     static sal_uInt16 GetCSS1Selector( const SwFmt *pFmt, rtl::OString& rToken,
     533                 :            :                                    String& rClass, sal_uInt16& rRefPoolId,
     534                 :            :                                    String *pPseudo=0 );
     535                 :            : 
     536                 :            :     static const SwFmt *GetTemplateFmt( sal_uInt16 nPoolId, IDocumentStylePoolAccess* /*SwDoc*/ pTemplate );
     537                 :            :     static const SwFmt *GetParentFmt( const SwFmt& rFmt, sal_uInt16 nDeep );
     538                 :            : 
     539                 :            :     static void SubtractItemSet( SfxItemSet& rItemSet,
     540                 :            :                                  const SfxItemSet& rRefItemSet,
     541                 :            :                                  sal_Bool bSetDefaults,
     542                 :            :                                  sal_Bool bClearSame = sal_True,
     543                 :            :                                    const SfxItemSet *pRefScriptItemSet=0 );
     544                 :            :     static sal_Bool HasScriptDependentItems( const SfxItemSet& rItemSet,
     545                 :            :                                                sal_Bool bCheckDropCap );
     546                 :            : 
     547                 :            :     static void GetEEAttrsFromDrwObj( SfxItemSet& rItemSet,
     548                 :            :                                       const SdrObject *pObj,
     549                 :            :                                       sal_Bool bSetDefaults );
     550                 :            : 
     551                 :            :     static sal_uInt16 GetDefListLvl( const String& rNm, sal_uInt16 nPoolId );
     552                 :            : 
     553                 :          2 :     sal_uInt32 GetHTMLMode() const { return nHTMLMode; }
     554                 :         10 :     sal_Bool IsHTMLMode( sal_uInt32 nMode ) const { return (nHTMLMode & nMode) != 0; }
     555                 :            : 
     556                 :            :     inline sal_Bool IsCSS1Source( sal_uInt16 n ) const;
     557                 :            :     inline sal_Bool IsCSS1Script( sal_uInt16 n ) const;
     558                 :            : 
     559                 :            :     static const sal_Char *GetNumFormat( sal_uInt16 nFmt );
     560                 :            :     static void PrepareFontList( const SvxFontItem& rFontItem, String& rNames,
     561                 :            :                                  sal_Unicode cQuote, sal_Bool bGeneric );
     562                 :            :     static sal_uInt16 GetCSS1ScriptForScriptType( sal_uInt16 nScriptType );
     563                 :            :     static sal_uInt16 GetLangWhichIdFromScript( sal_uInt16 nScript );
     564                 :            : 
     565                 :          0 :     FieldUnit GetCSS1Unit() const { return eCSS1Unit; }
     566                 :            : };
     567                 :            : 
     568                 :         14 : inline sal_Bool SwHTMLWriter::IsCSS1Source( sal_uInt16 n ) const
     569                 :            : {
     570                 :         14 :     return n == (nCSS1OutMode & CSS1_OUTMODE_SOURCE);
     571                 :            : }
     572                 :            : 
     573                 :          0 : inline sal_Bool SwHTMLWriter::IsCSS1Script( sal_uInt16 n ) const
     574                 :            : {
     575                 :          0 :     sal_uInt16 nScript = (nCSS1OutMode & CSS1_OUTMODE_SCRIPT);
     576 [ #  # ][ #  # ]:          0 :     return CSS1_OUTMODE_ANY_SCRIPT == nScript || n == nScript;
     577                 :            : }
     578                 :            : 
     579                 :          0 : inline void SwHTMLWriter::OutCSS1_PropertyAscii( const sal_Char *pProp,
     580                 :            :                                                  const sal_Char *pVal )
     581                 :            : {
     582                 :          0 :     OutCSS1_Property( pProp, pVal, 0 );
     583                 :          0 : }
     584                 :            : 
     585                 :          0 : inline void SwHTMLWriter::OutCSS1_PropertyAscii( const sal_Char *pProp,
     586                 :            :                                                  const rtl::OString& rVal )
     587                 :            : {
     588                 :          0 :     OutCSS1_Property( pProp, rVal.getStr(), 0 );
     589                 :          0 : }
     590                 :            : 
     591                 :          0 : inline void SwHTMLWriter::OutCSS1_Property( const sal_Char *pProp,
     592                 :            :                                             const String& rVal )
     593                 :            : {
     594                 :          0 :     OutCSS1_Property( pProp, 0, &rVal );
     595                 :          0 : }
     596                 :            : 
     597                 :            : // Struktur speichert die aktuellen Daten des Writers zwischen, um
     598                 :            : // einen anderen Dokument-Teil auszugeben, wie z.B. Header/Footer
     599                 :            : // Mit den beiden USHORTs im CTOR wird ein neuer PaM erzeugt und auf
     600                 :            : // die Position im Dokument gesetzt.
     601                 :            : // Im Destructor werden alle Daten wieder restauriert und der angelegte
     602                 :            : // Pam wieder geloescht.
     603                 :            : 
     604                 :            : struct HTMLSaveData
     605                 :            : {
     606                 :            :     SwHTMLWriter& rWrt;
     607                 :            :     SwPaM* pOldPam, *pOldEnd;
     608                 :            :     SwHTMLNumRuleInfo *pOldNumRuleInfo;     // Owner = this
     609                 :            :     SwHTMLNumRuleInfo *pOldNextNumRuleInfo; // Owner = HTML-Writer
     610                 :            :     sal_uInt16 nOldDefListLvl;
     611                 :            :     sal_uInt16 nOldDirection;
     612                 :            :     sal_Bool bOldWriteAll : 1;
     613                 :            :     sal_Bool bOldOutHeader : 1;
     614                 :            :     sal_Bool bOldOutFooter : 1;
     615                 :            :     sal_Bool bOldOutFlyFrame : 1;
     616                 :            :     const SwFlyFrmFmt* pOldFlyFmt;
     617                 :            : 
     618                 :            :     HTMLSaveData( SwHTMLWriter&, sal_uLong nStt, sal_uLong nEnd,
     619                 :            :                   sal_Bool bSaveNum=sal_True,
     620                 :            :                      const SwFrmFmt *pFrmFmt=0  );
     621                 :            :     ~HTMLSaveData();
     622                 :            : };
     623                 :            : 
     624                 :            : 
     625                 :            : // einige Funktions-Deklarationen
     626                 :            : Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFmt,
     627                 :            :                                sal_Bool bInCntnr );
     628                 :            : Writer& OutHTML_FrmFmtOLENodeGrf( Writer& rWrt, const SwFrmFmt& rFmt,
     629                 :            :                                   sal_Bool bInCntnr );
     630                 :            : 
     631                 :            : Writer& OutHTML_SwTxtNode( Writer&, const SwCntntNode& );
     632                 :            : Writer& OutHTML_SwTblNode( Writer& , SwTableNode &, const SwFrmFmt *,
     633                 :            :                            const String* pCaption=0, sal_Bool bTopCaption=sal_False );
     634                 :            : 
     635                 :            : Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt, const SwDrawFrmFmt& rFmt,
     636                 :            :                                      const SdrObject& rSdrObj, sal_Bool bInCntnr );
     637                 :            : Writer& OutHTML_DrawFrmFmtAsMarquee( Writer& rWrt, const SwDrawFrmFmt& rFmt,
     638                 :            :                                      const SdrObject& rSdrObj );
     639                 :            : 
     640                 :            : Writer& OutHTML_HeaderFooter( Writer& rWrt, const SwFrmFmt& rFrmFmt,
     641                 :            :                               sal_Bool bHeader );
     642                 :            : 
     643                 :            : Writer& OutHTML_Image( Writer&, const SwFrmFmt& rFmt,
     644                 :            :                        const String& rGrfName, const String& rAlternateTxt,
     645                 :            :                        const Size& rRealSize, sal_uInt32 nFrmOpts,
     646                 :            :                        const sal_Char *pMarkType = 0,
     647                 :            :                        const ImageMap *pGenImgMap = 0 );
     648                 :            : Writer& OutHTML_BulletImage( Writer& rWrt, const sal_Char *pTag,
     649                 :            :                              const SvxBrushItem* pBrush, String &rGrfName,
     650                 :            :                              const Size &rSize,
     651                 :            :                              const SwFmtVertOrient* pVertOrient );
     652                 :            : 
     653                 :            : Writer& OutHTML_SwFmtFld( Writer& rWrt, const SfxPoolItem& rHt );
     654                 :            : Writer& OutHTML_SwFmtFtn( Writer& rWrt, const SfxPoolItem& rHt );
     655                 :            : Writer& OutHTML_INetFmt( Writer&, const SwFmtINetFmt& rINetFmt, sal_Bool bOn );
     656                 :            : 
     657                 :            : Writer& OutCSS1_BodyTagStyleOpt( Writer& rWrt, const SfxItemSet& rItemSet,
     658                 :            :                                  String aEmbBGGrfName );
     659                 :            : Writer& OutCSS1_ParaTagStyleOpt( Writer& rWrt, const SfxItemSet& rItemSet );
     660                 :            : 
     661                 :            : Writer& OutCSS1_HintSpanTag( Writer& rWrt, const SfxPoolItem& rHt );
     662                 :            : Writer& OutCSS1_HintStyleOpt( Writer& rWrt, const SfxPoolItem& rHt );
     663                 :            : 
     664                 :            : Writer& OutCSS1_TableBGStyleOpt( Writer& rWrt, const SfxPoolItem& rHt );
     665                 :            : Writer& OutCSS1_NumBulListStyleOpt( Writer& rWrt, const SwNumRule& rNumRule,
     666                 :            :                                     sal_uInt8 nLevel );
     667                 :            : 
     668                 :            : Writer& OutHTML_NumBulListStart( SwHTMLWriter& rWrt,
     669                 :            :                                  const SwHTMLNumRuleInfo& rInfo );
     670                 :            : Writer& OutHTML_NumBulListEnd( SwHTMLWriter& rWrt,
     671                 :            :                                const SwHTMLNumRuleInfo& rNextInfo );
     672                 :            : 
     673                 :            : Writer& OutCSS1_SvxBox( Writer& rWrt, const SfxPoolItem& rHt );
     674                 :            : 
     675                 :            : #endif  //  _WRTHTML_HXX
     676                 :            : 
     677                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10