LCOV - code coverage report
Current view: top level - sw/source/filter/html - wrthtml.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 41 41 100.0 %
Date: 2015-06-13 12:38:46 Functions: 21 21 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11