LCOV - code coverage report
Current view: top level - sw/source/filter/html - htmlcss1.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 172 1184 14.5 %
Date: 2012-08-25 Functions: 18 49 36.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 130 1784 7.3 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "hintids.hxx"
      30                 :            : #include <svl/itemiter.hxx>
      31                 :            : #include <svl/whiter.hxx>
      32                 :            : #include <svl/urihelper.hxx>
      33                 :            : #include <i18npool/mslangid.hxx>
      34                 :            : #include <sfx2/docfile.hxx>
      35                 :            : #include <vcl/svapp.hxx>
      36                 :            : #include <editeng/fhgtitem.hxx>
      37                 :            : #include <editeng/brshitem.hxx>
      38                 :            : #include <editeng/lrspitem.hxx>
      39                 :            : #include <editeng/ulspitem.hxx>
      40                 :            : #include <editeng/boxitem.hxx>
      41                 :            : #include <editeng/flstitem.hxx>
      42                 :            : #include <editeng/brkitem.hxx>
      43                 :            : #include <editeng/keepitem.hxx>
      44                 :            : #include <editeng/fontitem.hxx>
      45                 :            : #include <editeng/langitem.hxx>
      46                 :            : #include <editeng/frmdiritem.hxx>
      47                 :            : #include <svtools/htmltokn.h>
      48                 :            : #include <svtools/htmlkywd.hxx>
      49                 :            : #include <fmtpdsc.hxx>
      50                 :            : #include <fmtanchr.hxx>
      51                 :            : #include <fmtornt.hxx>
      52                 :            : #include <fmtsrnd.hxx>
      53                 :            : #include <fmtfsize.hxx>
      54                 :            : #include "frmatr.hxx"
      55                 :            : #include <charfmt.hxx>
      56                 :            : #include <docary.hxx>
      57                 :            : #include <svx/svxids.hrc>
      58                 :            : 
      59                 :            : #include "doc.hxx"
      60                 :            : #include "pam.hxx"
      61                 :            : #include "ndtxt.hxx"
      62                 :            : #include "poolfmt.hxx"
      63                 :            : #include "docsh.hxx"
      64                 :            : #include "paratr.hxx"
      65                 :            : #include "pagedesc.hxx"
      66                 :            : #include "css1kywd.hxx"
      67                 :            : #include "swcss1.hxx"
      68                 :            : #include "htmlnum.hxx"
      69                 :            : #include "swhtml.hxx"
      70                 :            : #include <numrule.hxx>
      71                 :            : 
      72                 :            : using namespace ::com::sun::star;
      73                 :            : 
      74                 :            : 
      75                 :            : // Wie viele Zeilen/Zeichen sind fuer DropCaps erlaubt?
      76                 :            : // (Gibt es vielleicht woanders entsprechende Werte?)
      77                 :            : #define MAX_DROPCAP_LINES 9
      78                 :            : #define MAX_DROPCAP_CHARS 9
      79                 :            : 
      80                 :            : void lcl_swcss1_setEncoding( SwFmt& rFmt, rtl_TextEncoding eEnc );
      81                 :            : 
      82                 :            : 
      83                 :            : // Implementierung des SwCSS1Parsers (eigentlich swcss1.cxx)
      84                 :            : static struct SwCSS1ItemIds
      85                 :            : {
      86                 :            :     sal_uInt16 nFmtBreak;
      87                 :            :     sal_uInt16 nFmtPageDesc;
      88                 :            :     sal_uInt16 nFmtKeep;
      89                 :            : 
      90                 :         73 :     SwCSS1ItemIds() :
      91                 :            :         nFmtBreak( RES_BREAK ),
      92                 :            :         nFmtPageDesc( RES_PAGEDESC ),
      93                 :         73 :         nFmtKeep( RES_KEEP )
      94                 :         73 :     {}
      95                 :            : 
      96                 :         73 : } aItemIds;
      97                 :            : 
      98                 :          2 : void SwCSS1Parser::ChgPageDesc( const SwPageDesc *pPageDesc,
      99                 :            :                                 const SwPageDesc& rNewPageDesc )
     100                 :            : {
     101                 :          2 :     sal_uInt16 nPageDescs = pDoc->GetPageDescCnt();
     102                 :            :     sal_uInt16 i;
     103         [ +  - ]:          4 :     for( i=0; i<nPageDescs; i++ )
     104         [ +  + ]:          4 :         if( pPageDesc == &pDoc->GetPageDesc(i) )
     105                 :            :         {
     106                 :          2 :             pDoc->ChgPageDesc( i, rNewPageDesc );
     107                 :          2 :             return;
     108                 :            :         }
     109                 :            : 
     110                 :            :     OSL_ENSURE( i<nPageDescs, "Seitenvorlage nicht gefunden" );
     111                 :            : }
     112                 :            : 
     113                 :          2 : SwCSS1Parser::SwCSS1Parser( SwDoc *pD, sal_uInt32 aFHeights[7], const String& rBaseURL, sal_Bool bNewDoc ) :
     114                 :          2 :     SvxCSS1Parser( pD->GetAttrPool(), rBaseURL, MM50/2,
     115                 :            :                    (sal_uInt16*)&aItemIds, sizeof(aItemIds) / sizeof(sal_uInt16) ),
     116                 :            :     pDoc( pD ),
     117                 :            :     nDropCapCnt( 0 ),
     118                 :            :     bIsNewDoc( bNewDoc ),
     119                 :            :     bBodyBGColorSet( sal_False ),
     120                 :            :     bBodyBackgroundSet( sal_False ),
     121                 :            :     bBodyTextSet( sal_False ),
     122                 :            :     bBodyLinkSet( sal_False ),
     123                 :            :     bBodyVLinkSet( sal_False ),
     124                 :            :     bSetFirstPageDesc( sal_False ),
     125                 :            :     bSetRightPageDesc( sal_False ),
     126                 :            :     bTableHeaderTxtCollSet( sal_False ),
     127                 :            :     bTableTxtCollSet( sal_False ),
     128                 :          2 :     bLinkCharFmtsSet( sal_False )
     129                 :            : {
     130                 :          2 :     aFontHeights[0] = aFHeights[0];
     131                 :          2 :     aFontHeights[1] = aFHeights[1];
     132                 :          2 :     aFontHeights[2] = aFHeights[2];
     133                 :          2 :     aFontHeights[3] = aFHeights[3];
     134                 :          2 :     aFontHeights[4] = aFHeights[4];
     135                 :          2 :     aFontHeights[5] = aFHeights[5];
     136                 :          2 :     aFontHeights[6] = aFHeights[6];
     137                 :          2 : }
     138                 :            : 
     139                 :          2 : SwCSS1Parser::~SwCSS1Parser()
     140                 :            : {
     141         [ -  + ]:          4 : }
     142                 :            : 
     143                 :            : 
     144                 :            : 
     145                 :            : // Feature: PrintExt
     146                 :          0 : sal_Bool SwCSS1Parser::SetFmtBreak( SfxItemSet& rItemSet,
     147                 :            :                                 const SvxCSS1PropertyInfo& rPropInfo )
     148                 :            : {
     149                 :          0 :     SvxBreak eBreak = SVX_BREAK_NONE;
     150                 :          0 :     sal_Bool bKeep = sal_False;
     151                 :          0 :     sal_Bool bSetKeep = sal_False, bSetBreak = sal_False, bSetPageDesc = sal_False;
     152                 :          0 :     const SwPageDesc *pPageDesc = 0;
     153   [ #  #  #  #  :          0 :     switch( rPropInfo.ePageBreakBefore )
                      # ]
     154                 :            :     {
     155                 :            :     case SVX_CSS1_PBREAK_ALWAYS:
     156                 :          0 :         eBreak = SVX_BREAK_PAGE_BEFORE;
     157                 :          0 :         bSetBreak = sal_True;
     158                 :          0 :         break;
     159                 :            :     case SVX_CSS1_PBREAK_LEFT:
     160                 :          0 :         pPageDesc = GetLeftPageDesc( sal_True );
     161                 :          0 :         bSetPageDesc = sal_True;
     162                 :          0 :         break;
     163                 :            :     case SVX_CSS1_PBREAK_RIGHT:
     164                 :          0 :         pPageDesc = GetRightPageDesc( sal_True );
     165                 :          0 :         bSetPageDesc = sal_True;
     166                 :          0 :         break;
     167                 :            :     case SVX_CSS1_PBREAK_AUTO:
     168                 :          0 :         bSetBreak = bSetPageDesc = sal_True;
     169                 :          0 :         break;
     170                 :            :     default:
     171                 :            :         ;
     172                 :            :     }
     173   [ #  #  #  # ]:          0 :     switch( rPropInfo.ePageBreakAfter )
     174                 :            :     {
     175                 :            :     case SVX_CSS1_PBREAK_ALWAYS:
     176                 :            :     case SVX_CSS1_PBREAK_LEFT:
     177                 :            :     case SVX_CSS1_PBREAK_RIGHT:
     178                 :            :         // LEFT/RIGHT koennte man auch am Absatz davor setzen
     179                 :          0 :         eBreak = SVX_BREAK_PAGE_AFTER;
     180                 :          0 :         bSetBreak = sal_True;
     181                 :          0 :         break;
     182                 :            :     case SVX_CSS1_PBREAK_AUTO:
     183                 :          0 :         bSetBreak = bSetKeep = bSetPageDesc = sal_True;
     184                 :          0 :         break;
     185                 :            :     case SVX_CSS1_PBREAK_AVOID:
     186                 :          0 :         bKeep = bSetKeep = sal_True;
     187                 :          0 :         break;
     188                 :            :     default:
     189                 :            :         ;
     190                 :            :     }
     191                 :            : 
     192         [ #  # ]:          0 :     if( bSetBreak )
     193         [ #  # ]:          0 :         rItemSet.Put( SvxFmtBreakItem( eBreak, RES_BREAK ) );
     194         [ #  # ]:          0 :     if( bSetPageDesc )
     195         [ #  # ]:          0 :         rItemSet.Put( SwFmtPageDesc( pPageDesc ) );
     196         [ #  # ]:          0 :     if( bSetKeep )
     197         [ #  # ]:          0 :         rItemSet.Put( SvxFmtKeepItem( bKeep, RES_KEEP ) );
     198                 :            : 
     199                 :          0 :     return bSetBreak;
     200                 :            : }
     201                 :            : // /Feature: PrintExt
     202                 :            : 
     203                 :          0 : static void SetCharFmtAttrs( SwCharFmt *pCharFmt, SfxItemSet& rItemSet )
     204                 :            : {
     205                 :            :     const SfxPoolItem *pItem;
     206                 :            :     static sal_uInt16 aWhichIds[3] = { RES_CHRATR_FONTSIZE,RES_CHRATR_CJK_FONTSIZE,
     207                 :            :                                    RES_CHRATR_CTL_FONTSIZE };
     208         [ #  # ]:          0 :        for( sal_uInt16 i=0; i<3; i++ )
     209                 :            :     {
     210   [ #  #  #  # ]:          0 :         if( SFX_ITEM_SET == rItemSet.GetItemState( aWhichIds[i], sal_False,
                 [ #  # ]
     211         [ #  # ]:          0 :                                                    &pItem ) &&
     212                 :          0 :             ((const SvxFontHeightItem *)pItem)->GetProp() != 100)
     213                 :            :         {
     214                 :            :             // %-Angaben beim FontHeight-Item werden nicht unterstuetzt
     215         [ #  # ]:          0 :             rItemSet.ClearItem( aWhichIds[i] );
     216                 :            :         }
     217                 :            :     }
     218                 :            : 
     219         [ #  # ]:          0 :     pCharFmt->SetFmtAttr( rItemSet );
     220                 :            : 
     221 [ #  # ][ #  # ]:          0 :     if( SFX_ITEM_SET == rItemSet.GetItemState( RES_BACKGROUND, sal_False, &pItem ) )
     222                 :            :     {
     223                 :            :         // Ein Brush-Item mit RES_BACKGROUND muss noch in eines mit
     224                 :            :         // RES_CHRATR_BACKGROUND gewandelt werden
     225                 :            : 
     226         [ #  # ]:          0 :         SvxBrushItem aBrushItem( *(const SvxBrushItem *)pItem );
     227                 :          0 :         aBrushItem.SetWhich( RES_CHRATR_BACKGROUND );
     228 [ #  # ][ #  # ]:          0 :         pCharFmt->SetFmtAttr( aBrushItem );
     229                 :            :     }
     230                 :          0 : }
     231                 :            : 
     232                 :          2 : void SwCSS1Parser::SetLinkCharFmts()
     233                 :            : {
     234                 :            :     OSL_ENSURE( !bLinkCharFmtsSet, "Aufruf von SetLinkCharFmts unnoetig" );
     235                 :            : 
     236                 :            :     SvxCSS1MapEntry *pStyleEntry =
     237 [ +  - ][ +  - ]:          2 :         GetTag( rtl::OUString(OOO_STRING_SVTOOLS_HTML_anchor) );
                 [ +  - ]
     238                 :          2 :     SwCharFmt *pUnvisited = 0, *pVisited = 0;
     239         [ -  + ]:          2 :     if( pStyleEntry )
     240                 :            :     {
     241                 :          0 :         SfxItemSet& rItemSet = pStyleEntry->GetItemSet();
     242                 :            :         sal_Bool bColorSet = (SFX_ITEM_SET==rItemSet.GetItemState(RES_CHRATR_COLOR,
     243         [ #  # ]:          0 :                                                               sal_False));
     244         [ #  # ]:          0 :         pUnvisited = GetCharFmtFromPool( RES_POOLCHR_INET_NORMAL );
     245         [ #  # ]:          0 :         SetCharFmtAttrs( pUnvisited, rItemSet );
     246                 :          0 :         bBodyLinkSet |= bColorSet;
     247                 :            : 
     248         [ #  # ]:          0 :         pVisited = GetCharFmtFromPool( RES_POOLCHR_INET_VISIT );
     249         [ #  # ]:          0 :         SetCharFmtAttrs( pVisited, rItemSet );
     250                 :          0 :         bBodyVLinkSet |= bColorSet;
     251                 :            :     }
     252                 :            : 
     253         [ +  - ]:          2 :     String sTmp( rtl::OUString(OOO_STRING_SVTOOLS_HTML_anchor) );
     254         [ +  - ]:          2 :     sTmp.Append( ':' );
     255         [ +  - ]:          2 :     sTmp.AppendAscii( sCSS1_link );
     256         [ +  - ]:          2 :     pStyleEntry = GetTag( sTmp );
     257         [ -  + ]:          2 :     if( pStyleEntry )
     258                 :            :     {
     259                 :          0 :         SfxItemSet& rItemSet = pStyleEntry->GetItemSet();
     260                 :            :         sal_Bool bColorSet = (SFX_ITEM_SET==rItemSet.GetItemState(RES_CHRATR_COLOR,
     261         [ #  # ]:          0 :                                                               sal_False));
     262         [ #  # ]:          0 :         if( !pUnvisited )
     263         [ #  # ]:          0 :             pUnvisited = GetCharFmtFromPool( RES_POOLCHR_INET_NORMAL );
     264         [ #  # ]:          0 :         SetCharFmtAttrs( pUnvisited, rItemSet );
     265                 :          0 :         bBodyLinkSet |= bColorSet;
     266                 :            :     }
     267                 :            : 
     268         [ +  - ]:          2 :     sTmp.AssignAscii( OOO_STRING_SVTOOLS_HTML_anchor );
     269         [ +  - ]:          2 :     sTmp.Assign( ':' );
     270         [ +  - ]:          2 :     sTmp.AppendAscii( sCSS1_visited );
     271         [ +  - ]:          2 :     pStyleEntry = GetTag( sTmp );
     272         [ -  + ]:          2 :     if( pStyleEntry )
     273                 :            :     {
     274                 :          0 :         SfxItemSet& rItemSet = pStyleEntry->GetItemSet();
     275                 :            :         sal_Bool bColorSet = (SFX_ITEM_SET==rItemSet.GetItemState(RES_CHRATR_COLOR,
     276         [ #  # ]:          0 :                                                               sal_False));
     277         [ #  # ]:          0 :         if( !pVisited )
     278         [ #  # ]:          0 :             pVisited = GetCharFmtFromPool( RES_POOLCHR_INET_VISIT );
     279         [ #  # ]:          0 :         SetCharFmtAttrs( pVisited, rItemSet );
     280                 :          0 :         bBodyVLinkSet |= bColorSet;
     281                 :            :     }
     282                 :            : 
     283         [ +  - ]:          2 :     bLinkCharFmtsSet = sal_True;
     284                 :          2 : }
     285                 :            : 
     286                 :          0 : static void SetTxtCollAttrs( SwTxtFmtColl *pColl, SfxItemSet& rItemSet,
     287                 :            :                              SvxCSS1PropertyInfo& rPropInfo,
     288                 :            :                              SwCSS1Parser *pCSS1Parser )
     289                 :            : {
     290                 :          0 :     const SfxItemSet& rCollItemSet = pColl->GetAttrSet();
     291                 :            :     const SfxPoolItem *pCollItem, *pItem;
     292                 :            : 
     293                 :            :     // linker, rechter Rand und Erstzeilen-Einzug
     294 [ #  # ][ #  # ]:          0 :     if( (rPropInfo.bLeftMargin || rPropInfo.bRightMargin ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     295                 :            :          rPropInfo.bTextIndent) &&
     296                 :          0 :         (!rPropInfo.bLeftMargin || !rPropInfo.bRightMargin ||
     297                 :          0 :          !rPropInfo.bTextIndent) &&
     298         [ #  # ]:          0 :         SFX_ITEM_SET == rCollItemSet.GetItemState(RES_LR_SPACE,sal_True,&pCollItem) &&
     299         [ #  # ]:          0 :         SFX_ITEM_SET == rItemSet.GetItemState(RES_LR_SPACE,sal_False,&pItem) )
     300                 :            :     {
     301                 :          0 :         const SvxLRSpaceItem *pLRItem = (const SvxLRSpaceItem *)pItem;
     302                 :            : 
     303         [ #  # ]:          0 :         SvxLRSpaceItem aLRItem( *((const SvxLRSpaceItem *)pCollItem) );
     304         [ #  # ]:          0 :         if( rPropInfo.bLeftMargin )
     305         [ #  # ]:          0 :             aLRItem.SetTxtLeft( pLRItem->GetTxtLeft() );
     306         [ #  # ]:          0 :         if( rPropInfo.bRightMargin )
     307                 :          0 :             aLRItem.SetRight( pLRItem->GetRight() );
     308         [ #  # ]:          0 :         if( rPropInfo.bTextIndent )
     309         [ #  # ]:          0 :             aLRItem.SetTxtFirstLineOfst( pLRItem->GetTxtFirstLineOfst() );
     310                 :            : 
     311 [ #  # ][ #  # ]:          0 :         rItemSet.Put( aLRItem );
     312                 :            :     }
     313                 :            : 
     314                 :            :     // oberer und unterer Rand
     315 [ #  # ][ #  # ]:          0 :     if( (rPropInfo.bTopMargin || rPropInfo.bBottomMargin) &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     316                 :          0 :         (!rPropInfo.bTopMargin || !rPropInfo.bBottomMargin) &&
     317                 :            :         SFX_ITEM_SET == rCollItemSet.GetItemState(RES_UL_SPACE,sal_True,
     318         [ #  # ]:          0 :                                                   &pCollItem) &&
     319         [ #  # ]:          0 :         SFX_ITEM_SET == rItemSet.GetItemState(RES_UL_SPACE,sal_False,&pItem) )
     320                 :            :     {
     321                 :          0 :         const SvxULSpaceItem *pULItem = (const SvxULSpaceItem *)pItem;
     322                 :            : 
     323         [ #  # ]:          0 :         SvxULSpaceItem aULItem( *((const SvxULSpaceItem *)pCollItem) );
     324         [ #  # ]:          0 :         if( rPropInfo.bTopMargin )
     325                 :          0 :             aULItem.SetUpper( pULItem->GetUpper() );
     326         [ #  # ]:          0 :         if( rPropInfo.bBottomMargin )
     327                 :          0 :             aULItem.SetLower( pULItem->GetLower() );
     328                 :            : 
     329 [ #  # ][ #  # ]:          0 :         rItemSet.Put( aULItem );
     330                 :            :     }
     331                 :            : 
     332                 :            :     static sal_uInt16 aWhichIds[3] = { RES_CHRATR_FONTSIZE,RES_CHRATR_CJK_FONTSIZE,
     333                 :            :                                    RES_CHRATR_CTL_FONTSIZE };
     334         [ #  # ]:          0 :        for( sal_uInt16 i=0; i<3; i++ )
     335                 :            :     {
     336   [ #  #  #  # ]:          0 :         if( SFX_ITEM_SET == rItemSet.GetItemState( aWhichIds[i], sal_False,
                 [ #  # ]
     337         [ #  # ]:          0 :                                                    &pItem ) &&
     338                 :          0 :             ((const SvxFontHeightItem *)pItem)->GetProp() != 100)
     339                 :            :         {
     340                 :            :             // %-Angaben beim FontHeight-Item werden nicht unterstuetzt
     341         [ #  # ]:          0 :             rItemSet.ClearItem( aWhichIds[i] );
     342                 :            :         }
     343                 :            :     }
     344                 :            : 
     345                 :            : // Feature: PrintExt
     346         [ #  # ]:          0 :     pCSS1Parser->SetFmtBreak( rItemSet, rPropInfo );
     347                 :            : // /Feature: PrintExt
     348                 :            : 
     349         [ #  # ]:          0 :     pColl->SetFmtAttr( rItemSet );
     350                 :          0 : }
     351                 :            : 
     352                 :          4 : void SwCSS1Parser::SetTableTxtColl( sal_Bool bHeader )
     353                 :            : {
     354                 :            :     OSL_ENSURE( !(bHeader ? bTableHeaderTxtCollSet : bTableTxtCollSet),
     355                 :            :             "Aufruf von SetTableTxtColl unnoetig" );
     356                 :            : 
     357                 :            :     sal_uInt16 nPoolId;
     358         [ +  - ]:          4 :     String sTag;
     359         [ +  + ]:          4 :     if( bHeader )
     360                 :            :     {
     361                 :          2 :         nPoolId = RES_POOLCOLL_TABLE_HDLN;
     362         [ +  - ]:          2 :         sTag.AssignAscii( OOO_STRING_SVTOOLS_HTML_tableheader );
     363                 :            :     }
     364                 :            :     else
     365                 :            :     {
     366                 :          2 :         nPoolId = RES_POOLCOLL_TABLE;
     367         [ +  - ]:          2 :         sTag.AssignAscii( OOO_STRING_SVTOOLS_HTML_tabledata );
     368                 :            :     }
     369                 :            : 
     370                 :          4 :     SwTxtFmtColl *pColl = 0;
     371                 :            : 
     372                 :            :     // The following entries will never be used again and may be changed.
     373         [ +  - ]:          4 :     SvxCSS1MapEntry *pStyleEntry = GetTag( sTag );
     374         [ -  + ]:          4 :     if( pStyleEntry )
     375                 :            :     {
     376         [ #  # ]:          0 :         pColl = GetTxtFmtColl( nPoolId, aEmptyStr );
     377                 :          0 :         SetTxtCollAttrs( pColl, pStyleEntry->GetItemSet(),
     378         [ #  # ]:          0 :                          pStyleEntry->GetPropertyInfo(), this );
     379                 :            :     }
     380                 :            : 
     381         [ +  - ]:          4 :     String sTmp( sTag );
     382         [ +  - ]:          4 :     sTmp.Append( ' ' );
     383         [ +  - ]:          4 :     sTmp.AppendAscii( OOO_STRING_SVTOOLS_HTML_parabreak );
     384         [ +  - ]:          4 :     pStyleEntry = GetTag( sTmp );
     385         [ -  + ]:          4 :     if( pStyleEntry )
     386                 :            :     {
     387         [ #  # ]:          0 :         if( !pColl )
     388         [ #  # ]:          0 :             pColl = GetTxtFmtColl( nPoolId, aEmptyStr );
     389                 :          0 :         SetTxtCollAttrs( pColl, pStyleEntry->GetItemSet(),
     390         [ #  # ]:          0 :                          pStyleEntry->GetPropertyInfo(), this );
     391                 :            :     }
     392                 :            : 
     393         [ +  + ]:          4 :     if( bHeader )
     394                 :          2 :         bTableHeaderTxtCollSet = sal_True;
     395                 :            :     else
     396 [ +  - ][ +  - ]:          4 :         bTableTxtCollSet = sal_True;
     397                 :          4 : }
     398                 :            : 
     399                 :          2 : void SwCSS1Parser::SetPageDescAttrs( const SvxBrushItem *pBrush,
     400                 :            :                                      SfxItemSet *pItemSet2 )
     401                 :            : {
     402         [ +  - ]:          2 :     SvxBrushItem aBrushItem( RES_BACKGROUND );
     403         [ +  - ]:          2 :     SvxBoxItem aBoxItem( RES_BOX );
     404         [ +  - ]:          2 :     SvxFrameDirectionItem aFrmDirItem(FRMDIR_ENVIRONMENT, RES_FRAMEDIR);
     405                 :          2 :     sal_Bool bSetBrush = pBrush!=0, bSetBox = sal_False, bSetFrmDir = sal_False;
     406         [ -  + ]:          2 :     if( pBrush )
     407         [ #  # ]:          0 :         aBrushItem = *pBrush;
     408                 :            : 
     409         [ +  - ]:          2 :     if( pItemSet2 )
     410                 :            :     {
     411                 :          2 :         const SfxPoolItem *pItem = 0;
     412         [ -  + ]:          2 :         if( SFX_ITEM_SET == pItemSet2->GetItemState( RES_BACKGROUND, sal_False,
     413         [ +  - ]:          2 :                                                    &pItem ) )
     414                 :            :         {
     415                 :            :             // ein Hintergrund wird gesetzt
     416         [ #  # ]:          0 :             aBrushItem = *((const SvxBrushItem *)pItem);
     417         [ #  # ]:          0 :             pItemSet2->ClearItem( RES_BACKGROUND );
     418                 :          0 :             bSetBrush = sal_True;
     419                 :            :         }
     420                 :            : 
     421 [ +  - ][ -  + ]:          2 :         if( SFX_ITEM_SET == pItemSet2->GetItemState( RES_BOX, sal_False, &pItem ) )
     422                 :            :         {
     423                 :            :             // eine Umrandung wird gesetzt
     424         [ #  # ]:          0 :             aBoxItem = *((const SvxBoxItem *)pItem);
     425         [ #  # ]:          0 :             pItemSet2->ClearItem( RES_BOX );
     426                 :          0 :             bSetBox = sal_True;
     427                 :            :         }
     428                 :            : 
     429 [ +  - ][ -  + ]:          2 :         if( SFX_ITEM_SET == pItemSet2->GetItemState( RES_BOX, sal_False, &pItem ) )
     430                 :            :         {
     431                 :            :             // eine Umrandung wird gesetzt
     432         [ #  # ]:          0 :             aBoxItem = *((const SvxBoxItem *)pItem);
     433         [ #  # ]:          0 :             pItemSet2->ClearItem( RES_BOX );
     434                 :          0 :             bSetBox = sal_True;
     435                 :            :         }
     436                 :            : 
     437 [ +  - ][ +  - ]:          2 :         if( SFX_ITEM_SET == pItemSet2->GetItemState( RES_FRAMEDIR, sal_False, &pItem ) )
     438                 :            :         {
     439                 :            :             // eine Umrandung wird gesetzt
     440                 :          2 :             aFrmDirItem = *static_cast< const SvxFrameDirectionItem *>( pItem );
     441         [ +  - ]:          2 :             pItemSet2->ClearItem( RES_FRAMEDIR );
     442                 :          2 :             bSetFrmDir = sal_True;
     443                 :            :         }
     444                 :            :     }
     445                 :            : 
     446 [ +  - ][ +  - ]:          2 :     if( bSetBrush || bSetBox || bSetFrmDir )
                 [ +  - ]
     447                 :            :     {
     448                 :            :         static sal_uInt16 aPoolIds[] = { RES_POOLPAGE_HTML, RES_POOLPAGE_FIRST,
     449                 :            :                                      RES_POOLPAGE_LEFT, RES_POOLPAGE_RIGHT };
     450         [ +  + ]:         10 :         for( sal_uInt16 i=0; i<4; i++ )
     451                 :            :         {
     452         [ +  - ]:          8 :             const SwPageDesc *pPageDesc = GetPageDesc( aPoolIds[i], sal_False );
     453         [ +  + ]:          8 :             if( pPageDesc )
     454                 :            :             {
     455         [ +  - ]:          2 :                 SwPageDesc aNewPageDesc( *pPageDesc );
     456                 :          2 :                 SwFrmFmt &rMaster = aNewPageDesc.GetMaster();
     457         [ -  + ]:          2 :                 if( bSetBrush )
     458         [ #  # ]:          0 :                     rMaster.SetFmtAttr( aBrushItem );
     459         [ -  + ]:          2 :                 if( bSetBox )
     460         [ #  # ]:          0 :                     rMaster.SetFmtAttr( aBoxItem );
     461         [ +  - ]:          2 :                 if( bSetFrmDir )
     462         [ +  - ]:          2 :                     rMaster.SetFmtAttr( aFrmDirItem );
     463                 :            : 
     464 [ +  - ][ +  - ]:          2 :                 ChgPageDesc( pPageDesc, aNewPageDesc );
     465                 :            :             }
     466                 :            :         }
     467 [ +  - ][ +  - ]:          2 :     }
                 [ +  - ]
     468                 :          2 : }
     469                 :            : 
     470                 :            : // Feature: PrintExt
     471                 :          0 : void SwCSS1Parser::SetPageDescAttrs( const SwPageDesc *pPageDesc,
     472                 :            :                                      SfxItemSet& rItemSet,
     473                 :            :                                      const SvxCSS1PropertyInfo& rPropInfo )
     474                 :            : {
     475         [ #  # ]:          0 :     if( !pPageDesc )
     476                 :          0 :         return;
     477                 :            : 
     478         [ #  # ]:          0 :     SwPageDesc aNewPageDesc( *pPageDesc );
     479                 :          0 :     SwFrmFmt &rMaster = aNewPageDesc.GetMaster();
     480                 :          0 :     const SfxItemSet& rPageItemSet = rMaster.GetAttrSet();
     481                 :            :     const SfxPoolItem *pPageItem, *pItem;
     482                 :          0 :     sal_Bool bChanged = sal_False;
     483                 :            : 
     484                 :            :     // linker, rechter Rand und Erstzeilen-Einzug
     485 [ #  # ][ #  # ]:          0 :     if( (rPropInfo.bLeftMargin || rPropInfo.bRightMargin) &&
         [ #  # ][ #  # ]
     486         [ #  # ]:          0 :         SFX_ITEM_SET == rItemSet.GetItemState(RES_LR_SPACE,sal_False,&pItem) )
     487                 :            :     {
     488 [ #  # ][ #  # ]:          0 :         if( (!rPropInfo.bLeftMargin || !rPropInfo.bRightMargin) &&
         [ #  # ][ #  # ]
     489                 :            :             SFX_ITEM_SET == rPageItemSet.GetItemState(RES_LR_SPACE,
     490         [ #  # ]:          0 :                                                       sal_True,&pPageItem) )
     491                 :            :         {
     492                 :          0 :             const SvxLRSpaceItem *pLRItem = (const SvxLRSpaceItem *)pItem;
     493                 :            : 
     494         [ #  # ]:          0 :             SvxLRSpaceItem aLRItem( *((const SvxLRSpaceItem *)pPageItem) );
     495         [ #  # ]:          0 :             if( rPropInfo.bLeftMargin )
     496                 :          0 :                 aLRItem.SetLeft( pLRItem->GetLeft() );
     497         [ #  # ]:          0 :             if( rPropInfo.bRightMargin )
     498                 :          0 :                 aLRItem.SetRight( pLRItem->GetRight() );
     499                 :            : 
     500 [ #  # ][ #  # ]:          0 :             rMaster.SetFmtAttr( aLRItem );
     501                 :            :         }
     502                 :            :         else
     503                 :            :         {
     504         [ #  # ]:          0 :             rMaster.SetFmtAttr( *pItem );
     505                 :            :         }
     506                 :          0 :         bChanged = sal_True;
     507                 :            :     }
     508                 :            : 
     509                 :            :     // oberer und unterer Rand
     510 [ #  # ][ #  # ]:          0 :     if( (rPropInfo.bTopMargin || rPropInfo.bBottomMargin) &&
         [ #  # ][ #  # ]
     511         [ #  # ]:          0 :         SFX_ITEM_SET == rItemSet.GetItemState(RES_UL_SPACE,sal_False,&pItem) )
     512                 :            :     {
     513 [ #  # ][ #  # ]:          0 :         if( (!rPropInfo.bTopMargin || !rPropInfo.bBottomMargin) &&
         [ #  # ][ #  # ]
     514                 :            :             SFX_ITEM_SET == rPageItemSet.GetItemState(RES_UL_SPACE,
     515         [ #  # ]:          0 :                                                       sal_True,&pPageItem) )
     516                 :            :         {
     517                 :          0 :             const SvxULSpaceItem *pULItem = (const SvxULSpaceItem *)pItem;
     518                 :            : 
     519         [ #  # ]:          0 :             SvxULSpaceItem aULItem( *((const SvxULSpaceItem *)pPageItem) );
     520         [ #  # ]:          0 :             if( rPropInfo.bTopMargin )
     521                 :          0 :                 aULItem.SetUpper( pULItem->GetUpper() );
     522         [ #  # ]:          0 :             if( rPropInfo.bBottomMargin )
     523                 :          0 :                 aULItem.SetLower( pULItem->GetLower() );
     524                 :            : 
     525 [ #  # ][ #  # ]:          0 :             rMaster.SetFmtAttr( aULItem );
     526                 :            :         }
     527                 :            :         else
     528                 :            :         {
     529         [ #  # ]:          0 :             rMaster.SetFmtAttr( *pItem );
     530                 :            :         }
     531                 :          0 :         bChanged = sal_True;
     532                 :            :     }
     533                 :            : 
     534                 :            :     // die Groesse
     535         [ #  # ]:          0 :     if( rPropInfo.eSizeType != SVX_CSS1_STYPE_NONE )
     536                 :            :     {
     537         [ #  # ]:          0 :         if( rPropInfo.eSizeType == SVX_CSS1_STYPE_TWIP )
     538                 :            :         {
     539                 :            :             rMaster.SetFmtAttr( SwFmtFrmSize( ATT_FIX_SIZE, rPropInfo.nWidth,
     540 [ #  # ][ #  # ]:          0 :                                            rPropInfo.nHeight ) );
                 [ #  # ]
     541                 :          0 :             bChanged = sal_True;
     542                 :            :         }
     543                 :            :         else
     544                 :            :         {
     545                 :            :             // Bei "size: auto|portrait|landscape" bleibt die bisherige
     546                 :            :             // Groesse der Vorlage erhalten. Bei "landscape" und "portrait"
     547                 :            :             // wird das Landscape-Flag gesetzt und evtl. die Breite/Hoehe
     548                 :            :             // vertauscht.
     549 [ #  # ][ #  # ]:          0 :             SwFmtFrmSize aFrmSz( rMaster.GetFrmSize() );
     550                 :          0 :             sal_Bool bLandscape = aNewPageDesc.GetLandscape();
     551 [ #  # ][ #  # ]:          0 :             if( ( bLandscape &&
         [ #  # ][ #  # ]
     552                 :            :                   rPropInfo.eSizeType == SVX_CSS1_STYPE_PORTRAIT ) ||
     553                 :            :                 ( !bLandscape &&
     554                 :            :                   rPropInfo.eSizeType == SVX_CSS1_STYPE_LANDSCAPE ) )
     555                 :            :             {
     556                 :          0 :                 SwTwips nTmp = aFrmSz.GetHeight();
     557                 :          0 :                 aFrmSz.SetHeight( aFrmSz.GetWidth() );
     558                 :          0 :                 aFrmSz.SetWidth( nTmp );
     559         [ #  # ]:          0 :                 rMaster.SetFmtAttr( aFrmSz );
     560                 :          0 :                 aNewPageDesc.SetLandscape( !bLandscape );
     561                 :          0 :                 bChanged = sal_True;
     562         [ #  # ]:          0 :             }
     563                 :            :         }
     564                 :            :     }
     565                 :            : 
     566                 :            :     // Geht das wirklich?
     567 [ #  # ][ #  # ]:          0 :     if( SFX_ITEM_SET == rItemSet.GetItemState( RES_BACKGROUND, sal_False, &pItem ) )
     568                 :            :     {
     569                 :            :         // eine Umrandung wird gesetzt
     570         [ #  # ]:          0 :         rMaster.SetFmtAttr( *pItem );
     571         [ #  # ]:          0 :         rItemSet.ClearItem( RES_BACKGROUND );
     572                 :          0 :         bChanged = sal_True;
     573                 :            :     }
     574                 :            : 
     575         [ #  # ]:          0 :     if( bChanged )
     576 [ #  # ][ #  # ]:          0 :         ChgPageDesc( pPageDesc, aNewPageDesc );
     577                 :            : }
     578                 :            : // /Feature: PrintExt
     579                 :            : 
     580                 :          2 : const SvxBrushItem& SwCSS1Parser::GetPageDescBackground() const
     581                 :            : {
     582                 :          2 :     return pDoc->GetPageDescFromPool( RES_POOLPAGE_HTML, false )
     583                 :          2 :         ->GetMaster().GetBackground();
     584                 :            : }
     585                 :            : 
     586                 :          0 : sal_uInt16 SwCSS1Parser::GetScriptFromClass( String& rClass,
     587                 :            :                                       sal_Bool bSubClassOnly )
     588                 :            : {
     589                 :          0 :     sal_uInt16 nScriptFlags = CSS1_SCRIPT_ALL;
     590                 :          0 :     xub_StrLen nLen = rClass.Len();
     591         [ #  # ]:          0 :     xub_StrLen nPos = nLen > 4 ? rClass.SearchBackward( '-' ) : STRING_NOTFOUND;
     592                 :            : 
     593         [ #  # ]:          0 :     if( STRING_NOTFOUND == nPos )
     594                 :            :     {
     595         [ #  # ]:          0 :         if( bSubClassOnly )
     596                 :          0 :             return nScriptFlags;
     597                 :          0 :         nPos = 0;
     598                 :            :     }
     599                 :            :     else
     600                 :            :     {
     601                 :          0 :         nPos++;
     602                 :          0 :         nLen = nLen - nPos;
     603                 :            :     }
     604                 :            : 
     605      [ #  #  # ]:          0 :     switch( nLen )
     606                 :            :     {
     607                 :            :     case 3:
     608         [ #  # ]:          0 :         if( rClass.EqualsIgnoreCaseAscii( "cjk", nPos, 3 ) )
     609                 :            :         {
     610                 :          0 :             nScriptFlags = CSS1_SCRIPT_CJK;
     611                 :            :         }
     612         [ #  # ]:          0 :         else if( rClass.EqualsIgnoreCaseAscii( "ctl", nPos, 3 ) )
     613                 :            :         {
     614                 :          0 :             nScriptFlags = CSS1_SCRIPT_CTL;
     615                 :            :         }
     616                 :          0 :         break;
     617                 :            :     case 7:
     618         [ #  # ]:          0 :         if( rClass.EqualsIgnoreCaseAscii( "western", nPos, 7 ) )
     619                 :            :         {
     620                 :          0 :             nScriptFlags = CSS1_SCRIPT_WESTERN;
     621                 :            :         }
     622                 :          0 :         break;
     623                 :            :     }
     624         [ #  # ]:          0 :     if( CSS1_SCRIPT_ALL != nScriptFlags )
     625                 :            :     {
     626         [ #  # ]:          0 :         if( nPos )
     627                 :            :         {
     628                 :          0 :             rClass.Erase( nPos-1 );
     629                 :            :         }
     630                 :            :         else
     631                 :            :         {
     632                 :          0 :             rClass.Erase();
     633                 :            :         }
     634                 :            :     }
     635                 :            : 
     636                 :          0 :     return nScriptFlags;
     637                 :            : }
     638                 :            : 
     639                 :          0 : static CSS1SelectorType GetTokenAndClass( const CSS1Selector *pSelector,
     640                 :            :                               String& rToken, String& rClass,
     641                 :            :                               sal_uInt16& rScriptFlags )
     642                 :            : {
     643                 :          0 :     rToken = pSelector->GetString();
     644                 :          0 :     rClass.Erase();
     645                 :          0 :     rScriptFlags = CSS1_SCRIPT_ALL;
     646                 :            : 
     647                 :          0 :     CSS1SelectorType eType = pSelector->GetType();
     648         [ #  # ]:          0 :     if( CSS1_SELTYPE_ELEM_CLASS==eType  )
     649                 :            :     {
     650                 :          0 :         xub_StrLen nPos = rToken.Search( '.' );
     651                 :            :         OSL_ENSURE( nPos != STRING_NOTFOUND, "kein Punkt in Class-Selektor???" );
     652         [ #  # ]:          0 :         if( nPos != STRING_NOTFOUND )
     653                 :            :         {
     654         [ #  # ]:          0 :             rClass = rToken.Copy( nPos+1 );
     655                 :          0 :             rToken.Erase( nPos );
     656                 :            : 
     657                 :          0 :             rScriptFlags = SwCSS1Parser::GetScriptFromClass( rClass, sal_False );
     658         [ #  # ]:          0 :             if( !rClass.Len() )
     659                 :          0 :                 eType = CSS1_SELTYPE_ELEMENT;
     660                 :            :         }
     661                 :            :     }
     662                 :            : 
     663                 :          0 :     rToken.ToUpperAscii();
     664                 :          0 :     return eType;
     665                 :            : }
     666                 :            : 
     667                 :            : extern sal_Bool lcl_css1atr_equalFontItems( const SfxPoolItem& r1, const SfxPoolItem& r2 );
     668                 :            : 
     669                 :          0 : static void RemoveScriptItems( SfxItemSet& rItemSet, sal_uInt16 nScript,
     670                 :            :                                const SfxItemSet *pParentItemSet = 0 )
     671                 :            : {
     672                 :            :     static sal_uInt16 aWhichIds[3][5] =
     673                 :            :     {
     674                 :            :         { RES_CHRATR_FONT, RES_CHRATR_FONTSIZE, RES_CHRATR_LANGUAGE,
     675                 :            :             RES_CHRATR_POSTURE, RES_CHRATR_WEIGHT },
     676                 :            :         { RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CJK_LANGUAGE,
     677                 :            :             RES_CHRATR_CJK_POSTURE, RES_CHRATR_CJK_WEIGHT },
     678                 :            :         { RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONTSIZE, RES_CHRATR_CTL_LANGUAGE,
     679                 :            :             RES_CHRATR_CTL_POSTURE, RES_CHRATR_CTL_WEIGHT }
     680                 :            :     };
     681                 :            : 
     682                 :          0 :     sal_uInt16 aClearItems[3] = { sal_False, sal_False, sal_False };
     683   [ #  #  #  #  :          0 :     switch( nScript )
                      # ]
     684                 :            :     {
     685                 :            :     case CSS1_SCRIPT_WESTERN:
     686                 :          0 :         aClearItems[1] = aClearItems[2] =  sal_True;
     687                 :          0 :         break;
     688                 :            :     case CSS1_SCRIPT_CJK:
     689                 :          0 :         aClearItems[0] = aClearItems[2] =  sal_True;
     690                 :          0 :         break;
     691                 :            :     case CSS1_SCRIPT_CTL:
     692                 :          0 :         aClearItems[0] = aClearItems[1] =  sal_True;
     693                 :          0 :         break;
     694                 :            :     case CSS1_SCRIPT_ALL:
     695                 :          0 :         break;
     696                 :            :     default:
     697                 :            :         OSL_ENSURE( aClearItems[0], "unknown script type" );
     698                 :          0 :         break;
     699                 :            :        }
     700                 :            : 
     701         [ #  # ]:          0 :     for( sal_uInt16 j=0; j < 3; j++ )
     702                 :            :     {
     703         [ #  # ]:          0 :         for( sal_uInt16 i=0; i < 5; i++ )
     704                 :            :         {
     705                 :          0 :             sal_uInt16 nWhich = aWhichIds[j][i];
     706                 :            :             const SfxPoolItem *pItem;
     707 [ #  # ][ #  # ]:          0 :             if( aClearItems[j] ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     708                 :            :                 (pParentItemSet &&
     709         [ #  # ]:          0 :                  SFX_ITEM_SET == rItemSet.GetItemState( nWhich, sal_False, &pItem ) &&
     710 [ #  # ][ #  # ]:          0 :                  (0==i ? lcl_css1atr_equalFontItems( *pItem, pParentItemSet->Get(nWhich, sal_True ) )
     711 [ #  # ][ #  # ]:          0 :                         : *pItem == pParentItemSet->Get(nWhich, sal_True ) ) ) )
                 [ #  # ]
     712                 :            :             {
     713         [ #  # ]:          0 :                 rItemSet.ClearItem( nWhich );
     714                 :            :             }
     715                 :            :         }
     716                 :            :     }
     717                 :          0 : }
     718                 :            : 
     719                 :          0 : sal_Bool SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector,
     720                 :            :                                 SfxItemSet& rItemSet,
     721                 :            :                                 SvxCSS1PropertyInfo& rPropInfo )
     722                 :            : {
     723         [ #  # ]:          0 :     if( !bIsNewDoc )
     724                 :          0 :         return sal_True;
     725                 :            : 
     726                 :          0 :     CSS1SelectorType eSelType = pSelector->GetType();
     727                 :          0 :     const CSS1Selector *pNext = pSelector->GetNext();
     728                 :            : 
     729 [ #  # ][ #  # ]:          0 :     if( CSS1_SELTYPE_ID==eSelType && !pNext )
     730                 :            :     {
     731         [ #  # ]:          0 :         InsertId( pSelector->GetString(), rItemSet, rPropInfo );
     732                 :            :     }
     733 [ #  # ][ #  # ]:          0 :     else if( CSS1_SELTYPE_CLASS==eSelType && !pNext )
     734                 :            :     {
     735         [ #  # ]:          0 :         String aClass( pSelector->GetString() );
     736         [ #  # ]:          0 :         sal_uInt16 nScript = GetScriptFromClass( aClass );
     737         [ #  # ]:          0 :         if( CSS1_SCRIPT_ALL != nScript )
     738                 :            :         {
     739         [ #  # ]:          0 :             SfxItemSet aScriptItemSet( rItemSet );
     740         [ #  # ]:          0 :             RemoveScriptItems( aScriptItemSet, nScript );
     741 [ #  # ][ #  # ]:          0 :             InsertClass( aClass, aScriptItemSet, rPropInfo );
     742                 :            :         }
     743                 :            :         else
     744                 :            :         {
     745         [ #  # ]:          0 :             InsertClass( aClass, rItemSet, rPropInfo );
     746         [ #  # ]:          0 :         }
     747                 :            :     }
     748         [ #  # ]:          0 :     else if( CSS1_SELTYPE_PAGE==eSelType )
     749                 :            :     {
     750   [ #  #  #  # ]:          0 :         if( !pNext ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     751                 :          0 :             (CSS1_SELTYPE_PSEUDO == pNext->GetType() &&
     752         [ #  # ]:          0 :             (pNext->GetString().EqualsIgnoreCaseAscii(sCSS1_left) ||
     753         [ #  # ]:          0 :              pNext->GetString().EqualsIgnoreCaseAscii(sCSS1_right) ||
     754         [ #  # ]:          0 :              pNext->GetString().EqualsIgnoreCaseAscii(sCSS1_first)) ) )
     755                 :            :         {
     756         [ #  # ]:          0 :             String aName;
     757         [ #  # ]:          0 :             if( pNext )
     758         [ #  # ]:          0 :                 aName = pNext->GetString();
     759                 :            :             InsertPage( aName,
     760                 :            :                         pNext != 0,
     761 [ #  # ][ #  # ]:          0 :                         rItemSet, rPropInfo );
     762                 :            :         }
     763                 :            :     }
     764                 :            : 
     765 [ #  # ][ #  # ]:          0 :     if( CSS1_SELTYPE_ELEMENT != eSelType &&
     766                 :            :         CSS1_SELTYPE_ELEM_CLASS != eSelType)
     767                 :          0 :         return sal_True;
     768                 :            : 
     769                 :            :     // Token und Class zu dem Selektor holen
     770 [ #  # ][ #  # ]:          0 :     String aToken2, aClass;
     771                 :            :     sal_uInt16 nScript;
     772         [ #  # ]:          0 :     eSelType = GetTokenAndClass( pSelector, aToken2, aClass, nScript );
     773         [ #  # ]:          0 :     int nToken2 = GetHTMLToken( aToken2 );
     774                 :            : 
     775                 :            :     // und noch ein ganz par Infos zum naechsten Element
     776                 :            :     CSS1SelectorType eNextType = pNext ? pNext->GetType()
     777         [ #  # ]:          0 :                                        : CSS1_SELTYPE_ELEMENT;
     778                 :            : 
     779                 :            :     // Erstmal ein par Spezialfaelle
     780         [ #  # ]:          0 :     if( CSS1_SELTYPE_ELEMENT==eSelType )
     781                 :            :     {
     782      [ #  #  # ]:          0 :         switch( nToken2 )
     783                 :            :         {
     784                 :            :         case HTML_ANCHOR_ON:
     785         [ #  # ]:          0 :             if( !pNext )
     786                 :            :             {
     787         [ #  # ]:          0 :                 InsertTag( aToken2, rItemSet, rPropInfo );
     788                 :          0 :                 return sal_False;
     789                 :            :             }
     790 [ #  # ][ #  # ]:          0 :             else if( pNext && CSS1_SELTYPE_PSEUDO == eNextType )
     791                 :            :             {
     792                 :            :                 // vielleicht A:visited oder A:link
     793                 :            : 
     794         [ #  # ]:          0 :                 String aPseudo( pNext->GetString() );
     795         [ #  # ]:          0 :                 aPseudo.ToLowerAscii();
     796                 :            : 
     797                 :          0 :                 sal_Bool bInsert = sal_False;
     798      [ #  #  # ]:          0 :                 switch( aPseudo.GetChar( 0 ))
     799                 :            :                 {
     800                 :            :                     case 'l':
     801 [ #  # ][ #  # ]:          0 :                         if( aPseudo.EqualsAscii(sCSS1_link) )
     802                 :            :                         {
     803                 :          0 :                             bInsert = sal_True;
     804                 :            :                         }
     805                 :          0 :                         break;
     806                 :            :                     case 'v':
     807 [ #  # ][ #  # ]:          0 :                         if( aPseudo.EqualsAscii(sCSS1_visited) )
     808                 :            :                         {
     809                 :          0 :                             bInsert = sal_True;
     810                 :            :                         }
     811                 :          0 :                         break;
     812                 :            :                 }
     813         [ #  # ]:          0 :                 if( bInsert )
     814                 :            :                 {
     815         [ #  # ]:          0 :                     String sTmp( aToken2 );
     816 [ #  # ][ #  # ]:          0 :                     (sTmp += ':') += aPseudo;
     817         [ #  # ]:          0 :                     if( CSS1_SCRIPT_ALL != nScript )
     818                 :            :                     {
     819         [ #  # ]:          0 :                         SfxItemSet aScriptItemSet( rItemSet );
     820         [ #  # ]:          0 :                         RemoveScriptItems( aScriptItemSet, nScript );
     821 [ #  # ][ #  # ]:          0 :                         InsertTag( sTmp, aScriptItemSet, rPropInfo );
     822                 :            :                     }
     823                 :            :                     else
     824                 :            :                     {
     825         [ #  # ]:          0 :                         InsertTag( sTmp, rItemSet, rPropInfo );
     826                 :            :                     }
     827         [ #  # ]:          0 :                     return sal_False;
     828 [ #  # ][ #  # ]:          0 :                 }
     829                 :            :             }
     830                 :          0 :             break;
     831                 :            :         case HTML_BODY_ON:
     832         [ #  # ]:          0 :             if( !pNext )
     833                 :            :             {
     834                 :            :                 // BODY
     835                 :            : 
     836                 :            :                 // Den Hintergrund muessen wir vor dem Setzen abfragen,
     837                 :            :                 // denn in SetPageDescAttrs wird er geloescht.
     838                 :            :                 const SfxPoolItem *pItem;
     839 [ #  # ][ #  # ]:          0 :                 if( SFX_ITEM_SET==rItemSet.GetItemState(RES_BACKGROUND,sal_False,&pItem) )
     840                 :            :                 {
     841                 :            :                     const SvxBrushItem *pBrushItem =
     842                 :          0 :                         (const SvxBrushItem *)pItem;
     843                 :            : 
     844                 :            :                     /// Body has a background color, if it is not "no fill"/"auto fill"
     845         [ #  # ]:          0 :                     if( pBrushItem->GetColor() != COL_TRANSPARENT )
     846                 :          0 :                         bBodyBGColorSet = sal_True;
     847         [ #  # ]:          0 :                     if( GPOS_NONE != pBrushItem->GetGraphicPos() )
     848                 :          0 :                         bBodyBackgroundSet = sal_True;
     849                 :            :                 }
     850                 :            : 
     851                 :            :                 // Border and Padding
     852         [ #  # ]:          0 :                 rPropInfo.SetBoxItem( rItemSet, MIN_BORDER_DIST );
     853                 :            : 
     854                 :            :                 // Ein par Attribute muessen an der Seitenvorlage gesetzt werden,
     855                 :            :                 // und zwar die, die nicht vererbt werden
     856         [ #  # ]:          0 :                 SetPageDescAttrs( 0, &rItemSet );
     857                 :            : 
     858                 :            :                 // alle noch uebrigen Optionen koennen an der Standard-Vorlage
     859                 :            :                 // gesetzt werden und gelten dann automatisch als defaults
     860 [ #  # ][ #  # ]:          0 :                 if( SFX_ITEM_SET==rItemSet.GetItemState(RES_CHRATR_COLOR,sal_False) )
     861                 :          0 :                     bBodyTextSet = sal_True;
     862                 :            :                 SetTxtCollAttrs(
     863                 :            :                     GetTxtCollFromPool( RES_POOLCOLL_STANDARD ),
     864 [ #  # ][ #  # ]:          0 :                     rItemSet, rPropInfo, this );
     865                 :            : 
     866                 :          0 :                 return sal_False;
     867                 :            :             }
     868                 :          0 :             break;
     869                 :            :         }
     870                 :            :     }
     871 [ #  # ][ #  # ]:          0 :     else if( CSS1_SELTYPE_ELEM_CLASS==eSelType &&  HTML_ANCHOR_ON==nToken2 &&
           [ #  #  #  #  
             #  #  #  # ]
                 [ #  # ]
     872                 :          0 :              !pNext && aClass.Len() >= 9 &&
     873                 :          0 :              ('s' == aClass.GetChar(0) || 'S' == aClass.GetChar(0)) )
     874                 :            :     {
     875                 :          0 :         sal_uInt16 nPoolFmtId = 0;
     876 [ #  # ][ #  # ]:          0 :         if( aClass.EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_sdendnote_sym) )
     877                 :          0 :             nPoolFmtId = RES_POOLCHR_ENDNOTE;
     878 [ #  # ][ #  # ]:          0 :         else if( aClass.EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_sdfootnote_sym) )
     879                 :          0 :             nPoolFmtId = RES_POOLCHR_FOOTNOTE;
     880         [ #  # ]:          0 :         if( nPoolFmtId )
     881                 :            :         {
     882         [ #  # ]:          0 :             if( CSS1_SCRIPT_ALL == nScript )
     883                 :            :             {
     884 [ #  # ][ #  # ]:          0 :                 SetCharFmtAttrs( GetCharFmtFromPool(nPoolFmtId), rItemSet );
     885                 :            :             }
     886                 :            :             else
     887                 :            :             {
     888         [ #  # ]:          0 :                 SfxItemSet aScriptItemSet( rItemSet );
     889         [ #  # ]:          0 :                 RemoveScriptItems( aScriptItemSet, nScript );
     890                 :            :                 SetCharFmtAttrs( GetCharFmtFromPool(nPoolFmtId),
     891 [ #  # ][ #  # ]:          0 :                                  aScriptItemSet);
                 [ #  # ]
     892                 :            :             }
     893                 :          0 :             return sal_False;
     894                 :            :         }
     895                 :            :     }
     896                 :            : 
     897                 :            :     // Jetzt werden die Selektoren verarbeitet, die zu einer Absatz-Vorlage
     898                 :            :     // gehoehren
     899                 :          0 :     sal_uInt16 nPoolCollId = 0;
     900   [ #  #  #  #  :          0 :     switch( nToken2 )
          #  #  #  #  #  
             #  #  #  #  
                      # ]
     901                 :            :     {
     902                 :            :     case HTML_HEAD1_ON:
     903                 :          0 :         nPoolCollId = RES_POOLCOLL_HEADLINE1;
     904                 :          0 :         break;
     905                 :            :     case HTML_HEAD2_ON:
     906                 :          0 :         nPoolCollId = RES_POOLCOLL_HEADLINE2;
     907                 :          0 :         break;
     908                 :            :     case HTML_HEAD3_ON:
     909                 :          0 :         nPoolCollId = RES_POOLCOLL_HEADLINE3;
     910                 :          0 :         break;
     911                 :            :     case HTML_HEAD4_ON:
     912                 :          0 :         nPoolCollId = RES_POOLCOLL_HEADLINE4;
     913                 :          0 :         break;
     914                 :            :     case HTML_HEAD5_ON:
     915                 :          0 :         nPoolCollId = RES_POOLCOLL_HEADLINE5;
     916                 :          0 :         break;
     917                 :            :     case HTML_HEAD6_ON:
     918                 :          0 :         nPoolCollId = RES_POOLCOLL_HEADLINE6;
     919                 :          0 :         break;
     920                 :            :     case HTML_PARABREAK_ON:
     921   [ #  #  #  #  :          0 :         if( aClass.Len() >= 9 &&
           #  # ][ #  # ]
     922                 :          0 :             ('s' == aClass.GetChar(0) || 'S' == aClass.GetChar(0)) )
     923                 :            :         {
     924 [ #  # ][ #  # ]:          0 :             if( aClass.EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_sdendnote) )
     925                 :          0 :                 nPoolCollId = RES_POOLCOLL_ENDNOTE;
     926 [ #  # ][ #  # ]:          0 :             else if( aClass.EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_sdfootnote) )
     927                 :          0 :                 nPoolCollId = RES_POOLCOLL_FOOTNOTE;
     928                 :            : 
     929         [ #  # ]:          0 :             if( nPoolCollId )
     930         [ #  # ]:          0 :                 aClass = aEmptyStr;
     931                 :            :             else
     932                 :          0 :                 nPoolCollId = RES_POOLCOLL_TEXT;
     933                 :            :         }
     934                 :            :         else
     935                 :            :         {
     936                 :          0 :             nPoolCollId = RES_POOLCOLL_TEXT;
     937                 :            :         }
     938                 :          0 :         break;
     939                 :            :     case HTML_ADDRESS_ON:
     940                 :          0 :         nPoolCollId = RES_POOLCOLL_SENDADRESS;
     941                 :          0 :         break;
     942                 :            :     case HTML_BLOCKQUOTE_ON:
     943                 :          0 :         nPoolCollId = RES_POOLCOLL_HTML_BLOCKQUOTE;
     944                 :          0 :         break;
     945                 :            :     case HTML_DT_ON:
     946                 :          0 :         nPoolCollId = RES_POOLCOLL_HTML_DT;
     947                 :          0 :         break;
     948                 :            :     case HTML_DD_ON:
     949                 :          0 :         nPoolCollId = RES_POOLCOLL_HTML_DD;
     950                 :          0 :         break;
     951                 :            :     case HTML_PREFORMTXT_ON:
     952                 :          0 :         nPoolCollId = RES_POOLCOLL_HTML_PRE;
     953                 :          0 :         break;
     954                 :            :     case HTML_TABLEHEADER_ON:
     955                 :            :     case HTML_TABLEDATA_ON:
     956 [ #  # ][ #  # ]:          0 :         if( CSS1_SELTYPE_ELEMENT==eSelType && !pNext )
     957                 :            :         {
     958         [ #  # ]:          0 :             InsertTag( aToken2, rItemSet, rPropInfo );
     959                 :          0 :             return sal_False;
     960                 :            :         }
     961 [ #  # ][ #  # ]:          0 :         else if( CSS1_SELTYPE_ELEMENT==eSelType && pNext &&
         [ #  # ][ #  # ]
     962                 :            :                  (CSS1_SELTYPE_ELEMENT==eNextType ||
     963                 :            :                   CSS1_SELTYPE_ELEM_CLASS==eNextType) )
     964                 :            :         {
     965                 :            :             // nicht TH und TD, aber TH P und TD P
     966 [ #  # ][ #  # ]:          0 :             String aSubToken, aSubClass;
     967         [ #  # ]:          0 :             GetTokenAndClass( pNext, aSubToken, aSubClass, nScript );
     968 [ #  # ][ #  # ]:          0 :             if( HTML_PARABREAK_ON == GetHTMLToken( aSubToken ) )
     969                 :            :             {
     970         [ #  # ]:          0 :                 aClass = aSubClass;
     971                 :          0 :                 pNext = pNext->GetNext();
     972         [ #  # ]:          0 :                 eNextType = pNext ? pNext->GetType() : CSS1_SELTYPE_ELEMENT;
     973                 :            : 
     974 [ #  # ][ #  # ]:          0 :                 if( aClass.Len() || pNext )
                 [ #  # ]
     975                 :            :                 {
     976                 :            :                     nPoolCollId = static_cast< sal_uInt16 >(
     977                 :            :                         HTML_TABLEHEADER_ON == nToken2 ? RES_POOLCOLL_TABLE_HDLN
     978         [ #  # ]:          0 :                                                       : RES_POOLCOLL_TABLE );
     979                 :            :                 }
     980                 :            :                 else
     981                 :            :                 {
     982         [ #  # ]:          0 :                     String sTmp( aToken2 );
     983         [ #  # ]:          0 :                     sTmp += ' ';
     984         [ #  # ]:          0 :                     sTmp.AppendAscii( OOO_STRING_SVTOOLS_HTML_parabreak );
     985                 :            : 
     986         [ #  # ]:          0 :                     if( CSS1_SCRIPT_ALL == nScript )
     987                 :            :                     {
     988         [ #  # ]:          0 :                         InsertTag( sTmp, rItemSet, rPropInfo );
     989                 :            :                     }
     990                 :            :                     else
     991                 :            :                     {
     992         [ #  # ]:          0 :                         SfxItemSet aScriptItemSet( rItemSet );
     993         [ #  # ]:          0 :                         RemoveScriptItems( aScriptItemSet, nScript );
     994 [ #  # ][ #  # ]:          0 :                         InsertTag( sTmp, aScriptItemSet, rPropInfo );
     995                 :            :                     }
     996                 :            : 
     997         [ #  # ]:          0 :                     return sal_False;
     998                 :            :                 }
     999 [ #  # ][ #  # ]:          0 :             }
         [ #  # ][ #  # ]
    1000                 :            :         }
    1001                 :          0 :         break;
    1002                 :            : 
    1003                 :            :         default:
    1004                 :            :             ;
    1005                 :            :     }
    1006                 :            : 
    1007         [ #  # ]:          0 :     if( nPoolCollId )
    1008                 :            :     {
    1009 [ #  # ][ #  # ]:          0 :         if( !pNext ||
         [ #  # ][ #  # ]
                 [ #  # ]
    1010                 :            :             (CSS1_SELTYPE_PSEUDO==eNextType &&
    1011         [ #  # ]:          0 :              pNext->GetString().EqualsIgnoreCaseAscii(sCSS1_first_letter) &&
    1012                 :            :              SVX_ADJUST_LEFT == rPropInfo.eFloat) )
    1013                 :            :         {
    1014                 :            :             // Entweder kein zusammengesetzter Selektor oder
    1015                 :            :             // ein X:first-line { float: left; ... }
    1016                 :            : 
    1017                 :            :             // Die Vorlage Suchen bzw. Anlegen
    1018         [ #  # ]:          0 :             SwTxtFmtColl *pColl = GetTxtFmtColl( nPoolCollId, aEmptyStr );
    1019                 :          0 :             SwTxtFmtColl* pParentColl = 0;
    1020         [ #  # ]:          0 :             if( aClass.Len() )
    1021                 :            :             {
    1022         [ #  # ]:          0 :                 String aName( pColl->GetName() );
    1023         [ #  # ]:          0 :                 AddClassName( aName, aClass );
    1024                 :            : 
    1025                 :          0 :                 pParentColl = pColl;
    1026         [ #  # ]:          0 :                 pColl = pDoc->FindTxtFmtCollByName( aName );
    1027         [ #  # ]:          0 :                 if( !pColl )
    1028 [ #  # ][ #  # ]:          0 :                     pColl = pDoc->MakeTxtFmtColl( aName, pParentColl );
    1029                 :            :             }
    1030         [ #  # ]:          0 :             if( !pNext )
    1031                 :            :             {
    1032                 :            :                 // nur die Attribute an der Vorlage setzen
    1033                 :            :                 const SfxPoolItem *pItem;
    1034                 :          0 :                 const SvxBoxItem *pBoxItem = 0;
    1035         [ #  # ]:          0 :                 if( SFX_ITEM_SET ==
    1036         [ #  # ]:          0 :                         pColl->GetAttrSet().GetItemState(RES_BOX,sal_True,&pItem) )
    1037                 :          0 :                     pBoxItem = (const SvxBoxItem *)pItem;
    1038         [ #  # ]:          0 :                 rPropInfo.SetBoxItem( rItemSet, MIN_BORDER_DIST, pBoxItem );
    1039 [ #  # ][ #  # ]:          0 :                 if( CSS1_SCRIPT_ALL == nScript && !pParentColl )
    1040                 :            :                 {
    1041         [ #  # ]:          0 :                     SetTxtCollAttrs( pColl, rItemSet, rPropInfo, this );
    1042                 :            :                 }
    1043                 :            :                 else
    1044                 :            :                 {
    1045         [ #  # ]:          0 :                     SfxItemSet aScriptItemSet( rItemSet );
    1046                 :            :                     RemoveScriptItems( aScriptItemSet, nScript,
    1047 [ #  # ][ #  # ]:          0 :                                        pParentColl ? &pParentColl->GetAttrSet() : 0 );
    1048 [ #  # ][ #  # ]:          0 :                     SetTxtCollAttrs( pColl, aScriptItemSet, rPropInfo, this );
    1049                 :            :                 }
    1050                 :            :             }
    1051                 :            :             else
    1052                 :            :             {
    1053                 :            :                 // ein Drop-Cap-Attribut basteln
    1054 [ #  # ][ #  # ]:          0 :                 SwFmtDrop aDrop( pColl->GetDrop() );
    1055                 :          0 :                 aDrop.GetChars() = 1;
    1056                 :            : 
    1057                 :            :                 // die Attribute in das DropCap-Attribut einfuegen
    1058         [ #  # ]:          0 :                 if( CSS1_SCRIPT_ALL == nScript )
    1059                 :            :                 {
    1060         [ #  # ]:          0 :                     FillDropCap( aDrop, rItemSet, &pColl->GetName() );
    1061                 :            :                 }
    1062                 :            :                 else
    1063                 :            :                 {
    1064         [ #  # ]:          0 :                     SfxItemSet aScriptItemSet( rItemSet );
    1065         [ #  # ]:          0 :                     if( CSS1_SCRIPT_WESTERN != nScript )
    1066                 :            :                     {
    1067         [ #  # ]:          0 :                         aScriptItemSet.ClearItem( RES_CHRATR_FONT );
    1068         [ #  # ]:          0 :                         aScriptItemSet.ClearItem( RES_CHRATR_LANGUAGE );
    1069         [ #  # ]:          0 :                         aScriptItemSet.ClearItem( RES_CHRATR_POSTURE );
    1070         [ #  # ]:          0 :                         aScriptItemSet.ClearItem( RES_CHRATR_WEIGHT );
    1071                 :            :                     }
    1072         [ #  # ]:          0 :                     if( CSS1_SCRIPT_CJK != nScript )
    1073                 :            :                     {
    1074         [ #  # ]:          0 :                         aScriptItemSet.ClearItem( RES_CHRATR_CJK_FONT );
    1075         [ #  # ]:          0 :                         aScriptItemSet.ClearItem( RES_CHRATR_CJK_LANGUAGE );
    1076         [ #  # ]:          0 :                         aScriptItemSet.ClearItem( RES_CHRATR_CJK_POSTURE );
    1077         [ #  # ]:          0 :                         aScriptItemSet.ClearItem( RES_CHRATR_CJK_WEIGHT );
    1078                 :            :                     }
    1079         [ #  # ]:          0 :                     if( CSS1_SCRIPT_CTL != nScript )
    1080                 :            :                     {
    1081         [ #  # ]:          0 :                         aScriptItemSet.ClearItem( RES_CHRATR_CTL_FONT );
    1082         [ #  # ]:          0 :                         aScriptItemSet.ClearItem( RES_CHRATR_CTL_LANGUAGE );
    1083         [ #  # ]:          0 :                         aScriptItemSet.ClearItem( RES_CHRATR_CTL_POSTURE );
    1084         [ #  # ]:          0 :                         aScriptItemSet.ClearItem( RES_CHRATR_CTL_WEIGHT );
    1085                 :            :                     }
    1086 [ #  # ][ #  # ]:          0 :                     FillDropCap( aDrop, aScriptItemSet, &pColl->GetName() );
    1087                 :            :                 }
    1088                 :            : 
    1089                 :            :                 // Das Attribut nur setzen, wenn float: left angegeben wurde
    1090                 :            :                 // und das Initial ueber mehrere Zeilen geht. Sonst wird die
    1091                 :            :                 // ggf. angelegte Zeichen-Vorlage spaeter ueber den Namen
    1092                 :            :                 // gesucht und gesetzt.
    1093 [ #  # ][ #  # ]:          0 :                 if( aDrop.GetLines() > 1 &&
         [ #  # ][ #  # ]
    1094                 :            :                     (SVX_ADJUST_LEFT == rPropInfo.eFloat  ||
    1095                 :            :                      CSS1_SCRIPT_ALL == nScript) )
    1096                 :            :                 {
    1097         [ #  # ]:          0 :                     pColl->SetFmtAttr( aDrop );
    1098         [ #  # ]:          0 :                 }
    1099                 :            :             }
    1100                 :            : 
    1101                 :          0 :             return sal_False;
    1102                 :            :         }
    1103                 :            : 
    1104                 :          0 :         return sal_True;
    1105                 :            :     }
    1106                 :            : 
    1107                 :            :     // Jetzt werden die Selektoten verarbeitet, die zu einer Zechenvorlage
    1108                 :            :     // gehoehren. Zusammengesetzte gibt es hier allerdings nich nicht.
    1109         [ #  # ]:          0 :     if( pNext )
    1110                 :          0 :         return sal_True;
    1111                 :            : 
    1112         [ #  # ]:          0 :     SwCharFmt *pCFmt = GetChrFmt( static_cast< sal_uInt16 >(nToken2), aEmptyStr );
    1113         [ #  # ]:          0 :     if( pCFmt )
    1114                 :            :     {
    1115                 :          0 :         SwCharFmt *pParentCFmt = 0;
    1116         [ #  # ]:          0 :         if( aClass.Len() )
    1117                 :            :         {
    1118         [ #  # ]:          0 :             String aName( pCFmt->GetName() );
    1119         [ #  # ]:          0 :             AddClassName( aName, aClass );
    1120                 :          0 :             pParentCFmt = pCFmt;
    1121                 :            : 
    1122         [ #  # ]:          0 :             pCFmt = pDoc->FindCharFmtByName( aName );
    1123         [ #  # ]:          0 :             if( !pCFmt )
    1124                 :            :             {
    1125         [ #  # ]:          0 :                 pCFmt = pDoc->MakeCharFmt( aName, pParentCFmt );
    1126                 :          0 :                 pCFmt->SetAuto( sal_False );
    1127         [ #  # ]:          0 :             }
    1128                 :            :         }
    1129                 :            : 
    1130 [ #  # ][ #  # ]:          0 :         if( CSS1_SCRIPT_ALL == nScript && !pParentCFmt )
    1131                 :            :         {
    1132         [ #  # ]:          0 :             SetCharFmtAttrs( pCFmt, rItemSet );
    1133                 :            :         }
    1134                 :            :         else
    1135                 :            :         {
    1136         [ #  # ]:          0 :             SfxItemSet aScriptItemSet( rItemSet );
    1137                 :            :             RemoveScriptItems( aScriptItemSet, nScript,
    1138 [ #  # ][ #  # ]:          0 :                                pParentCFmt ? &pParentCFmt->GetAttrSet() : 0 );
    1139 [ #  # ][ #  # ]:          0 :             SetCharFmtAttrs( pCFmt, aScriptItemSet );
    1140                 :            :         }
    1141                 :          0 :         return sal_False;
    1142                 :            :     }
    1143                 :            : 
    1144 [ #  # ][ #  # ]:          0 :     return sal_True;
    1145                 :            : }
    1146                 :            : 
    1147                 :          0 : sal_uInt32 SwCSS1Parser::GetFontHeight( sal_uInt16 nSize ) const
    1148                 :            : {
    1149         [ #  # ]:          0 :     return aFontHeights[ nSize>6 ? 6 : nSize ];
    1150                 :            : }
    1151                 :            : 
    1152                 :          0 : const FontList *SwCSS1Parser::GetFontList() const
    1153                 :            : {
    1154                 :          0 :     const FontList *pFList = 0;
    1155                 :          0 :     SwDocShell *pDocSh = pDoc->GetDocShell();
    1156         [ #  # ]:          0 :     if( pDocSh )
    1157                 :            :     {
    1158                 :            :         const SvxFontListItem *pFListItem =
    1159                 :          0 :             (const SvxFontListItem *)pDocSh->GetItem(SID_ATTR_CHAR_FONTLIST);
    1160         [ #  # ]:          0 :         if( pFListItem )
    1161                 :          0 :             pFList = pFListItem->GetFontList();
    1162                 :            :     }
    1163                 :            : 
    1164                 :          0 :     return pFList;
    1165                 :            : }
    1166                 :            : 
    1167                 :            : 
    1168                 :          0 : SwCharFmt* SwCSS1Parser::GetChrFmt( sal_uInt16 nToken2, const String& rClass ) const
    1169                 :            : {
    1170                 :            :     // die entsprechende Vorlage suchen
    1171                 :          0 :     sal_uInt16 nPoolId = 0;
    1172                 :          0 :     const sal_Char* sName = 0;
    1173   [ #  #  #  #  :          0 :     switch( nToken2 )
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
    1174                 :            :     {
    1175                 :          0 :     case HTML_EMPHASIS_ON:      nPoolId = RES_POOLCHR_HTML_EMPHASIS;    break;
    1176                 :          0 :     case HTML_CITIATION_ON:     nPoolId = RES_POOLCHR_HTML_CITIATION;   break;
    1177                 :          0 :     case HTML_STRONG_ON:        nPoolId = RES_POOLCHR_HTML_STRONG;      break;
    1178                 :          0 :     case HTML_CODE_ON:          nPoolId = RES_POOLCHR_HTML_CODE;        break;
    1179                 :          0 :     case HTML_SAMPLE_ON:        nPoolId = RES_POOLCHR_HTML_SAMPLE;      break;
    1180                 :          0 :     case HTML_KEYBOARD_ON:      nPoolId = RES_POOLCHR_HTML_KEYBOARD;    break;
    1181                 :          0 :     case HTML_VARIABLE_ON:      nPoolId = RES_POOLCHR_HTML_VARIABLE;    break;
    1182                 :          0 :     case HTML_DEFINSTANCE_ON:   nPoolId = RES_POOLCHR_HTML_DEFINSTANCE; break;
    1183                 :          0 :     case HTML_TELETYPE_ON:      nPoolId = RES_POOLCHR_HTML_TELETYPE;    break;
    1184                 :            : 
    1185                 :          0 :     case HTML_SHORTQUOTE_ON:    sName = OOO_STRING_SVTOOLS_HTML_shortquote;     break;
    1186                 :          0 :     case HTML_LANGUAGE_ON:      sName = OOO_STRING_SVTOOLS_HTML_language;   break;
    1187                 :          0 :     case HTML_AUTHOR_ON:        sName = OOO_STRING_SVTOOLS_HTML_author;         break;
    1188                 :          0 :     case HTML_PERSON_ON:        sName = OOO_STRING_SVTOOLS_HTML_person;         break;
    1189                 :          0 :     case HTML_ACRONYM_ON:       sName = OOO_STRING_SVTOOLS_HTML_acronym;        break;
    1190                 :          0 :     case HTML_ABBREVIATION_ON:  sName = OOO_STRING_SVTOOLS_HTML_abbreviation;   break;
    1191                 :          0 :     case HTML_INSERTEDTEXT_ON:  sName = OOO_STRING_SVTOOLS_HTML_insertedtext;   break;
    1192                 :          0 :     case HTML_DELETEDTEXT_ON:   sName = OOO_STRING_SVTOOLS_HTML_deletedtext;    break;
    1193                 :            :     }
    1194                 :            : 
    1195                 :            :     // die Vorlage suchen oder anlegen (geht nur mit Namen)
    1196 [ #  # ][ #  # ]:          0 :     if( !nPoolId && !sName )
    1197                 :          0 :         return 0;
    1198                 :            : 
    1199                 :            :     // Die Vorlage (ohne Class) suchen oder anlegen
    1200                 :          0 :     SwCharFmt *pCFmt = 0;
    1201         [ #  # ]:          0 :     if( nPoolId )
    1202                 :            :     {
    1203         [ #  # ]:          0 :         pCFmt = GetCharFmtFromPool( nPoolId );
    1204                 :            :     }
    1205                 :            :     else
    1206                 :            :     {
    1207         [ #  # ]:          0 :         String sCName( rtl::OUString::createFromAscii(sName) );
    1208         [ #  # ]:          0 :         pCFmt = pDoc->FindCharFmtByName( sCName );
    1209         [ #  # ]:          0 :         if( !pCFmt )
    1210                 :            :         {
    1211         [ #  # ]:          0 :             pCFmt = pDoc->MakeCharFmt( sCName, pDoc->GetDfltCharFmt() );
    1212                 :          0 :             pCFmt->SetAuto( sal_False );
    1213         [ #  # ]:          0 :         }
    1214                 :            :     }
    1215                 :            : 
    1216                 :            :     OSL_ENSURE( pCFmt, "Keine Zeichen-Vorlage???" );
    1217                 :            : 
    1218                 :            :     // Wenn es eine Klasse gibt, die Klassen-Vorlage suchen aber nicht
    1219                 :            :     // neu anlegen.
    1220         [ #  # ]:          0 :     String aClass( rClass );
    1221         [ #  # ]:          0 :     GetScriptFromClass( aClass, sal_False );
    1222         [ #  # ]:          0 :     if( aClass.Len() )
    1223                 :            :     {
    1224         [ #  # ]:          0 :         String aTmp( pCFmt->GetName() );
    1225         [ #  # ]:          0 :         AddClassName( aTmp, aClass );
    1226         [ #  # ]:          0 :         SwCharFmt *pClassCFmt = pDoc->FindCharFmtByName( aTmp );
    1227         [ #  # ]:          0 :         if( pClassCFmt )
    1228                 :            :         {
    1229                 :          0 :             pCFmt = pClassCFmt;
    1230                 :            :         }
    1231                 :            :         else
    1232                 :            :         {
    1233         [ #  # ]:          0 :             const SvxCSS1MapEntry *pClass = GetClass( aClass );
    1234         [ #  # ]:          0 :             if( pClass )
    1235                 :            :             {
    1236         [ #  # ]:          0 :                 pCFmt = pDoc->MakeCharFmt( aTmp, pCFmt );
    1237                 :          0 :                 pCFmt->SetAuto( sal_False );
    1238         [ #  # ]:          0 :                 SfxItemSet aItemSet( pClass->GetItemSet() );
    1239 [ #  # ][ #  # ]:          0 :                 SetCharFmtAttrs( pCFmt, aItemSet );
    1240                 :            :             }
    1241         [ #  # ]:          0 :         }
    1242                 :            :     }
    1243                 :            : 
    1244         [ #  # ]:          0 :     return pCFmt;
    1245                 :            : }
    1246                 :            : 
    1247                 :            : 
    1248                 :            : 
    1249                 :          8 : SwTxtFmtColl *SwCSS1Parser::GetTxtCollFromPool( sal_uInt16 nPoolId ) const
    1250                 :            : {
    1251                 :          8 :     sal_uInt16 nOldArrLen = pDoc->GetTxtFmtColls()->size();
    1252                 :            : 
    1253                 :          8 :     SwTxtFmtColl *pColl = pDoc->GetTxtCollFromPool( nPoolId, false );
    1254                 :            : 
    1255         [ +  - ]:          8 :     if( bIsNewDoc )
    1256                 :            :     {
    1257                 :          8 :         sal_uInt16 nArrLen = pDoc->GetTxtFmtColls()->size();
    1258         [ -  + ]:          8 :         for( sal_uInt16 i=nOldArrLen; i<nArrLen; i++ )
    1259                 :          0 :             lcl_swcss1_setEncoding( *(*pDoc->GetTxtFmtColls())[i],
    1260                 :          0 :                                     GetDfltEncoding() );
    1261                 :            :     }
    1262                 :            : 
    1263                 :          8 :     return pColl;
    1264                 :            : }
    1265                 :            : 
    1266                 :          0 : SwCharFmt *SwCSS1Parser::GetCharFmtFromPool( sal_uInt16 nPoolId ) const
    1267                 :            : {
    1268                 :          0 :     sal_uInt16 nOldArrLen = pDoc->GetCharFmts()->size();
    1269                 :            : 
    1270                 :          0 :     SwCharFmt *pCharFmt = pDoc->GetCharFmtFromPool( nPoolId );
    1271                 :            : 
    1272         [ #  # ]:          0 :     if( bIsNewDoc )
    1273                 :            :     {
    1274                 :          0 :         sal_uInt16 nArrLen = pDoc->GetCharFmts()->size();
    1275                 :            : 
    1276         [ #  # ]:          0 :         for( sal_uInt16 i=nOldArrLen; i<nArrLen; i++ )
    1277                 :          0 :             lcl_swcss1_setEncoding( *(*pDoc->GetCharFmts())[i],
    1278                 :          0 :                                     GetDfltEncoding() );
    1279                 :            :     }
    1280                 :            : 
    1281                 :          0 :     return pCharFmt;
    1282                 :            : }
    1283                 :            : 
    1284                 :          0 : SwTxtFmtColl *SwCSS1Parser::GetTxtFmtColl( sal_uInt16 nTxtColl,
    1285                 :            :                                            const String& rClass )
    1286                 :            : {
    1287                 :          0 :     SwTxtFmtColl* pColl = 0;
    1288                 :            : 
    1289         [ #  # ]:          0 :     String aClass( rClass );
    1290         [ #  # ]:          0 :     GetScriptFromClass( aClass, sal_False );
    1291 [ #  # ][ #  #  :          0 :     if( RES_POOLCOLL_TEXT == nTxtColl && aClass.Len() >= 9 &&
             #  #  #  # ]
                 [ #  # ]
    1292                 :          0 :         ('s' == aClass.GetChar(0) || 'S' == aClass.GetChar(0) ) )
    1293                 :            :     {
    1294 [ #  # ][ #  # ]:          0 :         if( aClass.EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_sdendnote) )
    1295                 :            :         {
    1296                 :          0 :             nTxtColl = RES_POOLCOLL_ENDNOTE;
    1297         [ #  # ]:          0 :             aClass = aEmptyStr;
    1298                 :            :         }
    1299 [ #  # ][ #  # ]:          0 :         else if( aClass.EqualsIgnoreCaseAscii(OOO_STRING_SVTOOLS_HTML_sdfootnote) )
    1300                 :            :         {
    1301                 :          0 :             nTxtColl = RES_POOLCOLL_FOOTNOTE;
    1302         [ #  # ]:          0 :             aClass = aEmptyStr;
    1303                 :            :         }
    1304                 :            :     }
    1305                 :            : 
    1306         [ #  # ]:          0 :     String sName;
    1307         [ #  # ]:          0 :     if( USER_FMT & nTxtColl )       // eine vom Reader angelegte
    1308                 :            :     {
    1309                 :            :         OSL_ENSURE( !this, "Wo kommt die Benutzer-Vorlage her?" );
    1310         [ #  # ]:          0 :         pColl = GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
    1311                 :            :     }
    1312                 :            :     else
    1313                 :            :     {
    1314         [ #  # ]:          0 :         pColl = GetTxtCollFromPool( nTxtColl );
    1315                 :            :     }
    1316                 :            : 
    1317                 :            :     OSL_ENSURE( pColl, "Keine Absatz-Vorlage???" );
    1318         [ #  # ]:          0 :     if( aClass.Len() )
    1319                 :            :     {
    1320         [ #  # ]:          0 :         String aTmp( pColl->GetName() );
    1321         [ #  # ]:          0 :         AddClassName( aTmp, aClass );
    1322         [ #  # ]:          0 :         SwTxtFmtColl* pClassColl = pDoc->FindTxtFmtCollByName( aTmp );
    1323                 :            : 
    1324 [ #  # ][ #  # ]:          0 :         if( !pClassColl &&
                 [ #  # ]
    1325                 :            :             (nTxtColl==RES_POOLCOLL_TABLE ||
    1326                 :            :              nTxtColl==RES_POOLCOLL_TABLE_HDLN) )
    1327                 :            :         {
    1328                 :            :             // Wenn dieser Fall eintritt, dann wurde ein <TD><P CLASS=foo>
    1329                 :            :             // gelesen, aber die TD.foo Vorlage nicht gefunden. Dann muessen
    1330                 :            :             // wir P.foo nehmen, wenn es sie gibt.
    1331                 :            :             SwTxtFmtColl* pCollText =
    1332         [ #  # ]:          0 :                 GetTxtCollFromPool( RES_POOLCOLL_TEXT );
    1333         [ #  # ]:          0 :             aTmp = pCollText->GetName();
    1334         [ #  # ]:          0 :             AddClassName( aTmp, aClass );
    1335         [ #  # ]:          0 :             pClassColl = pDoc->FindTxtFmtCollByName( aTmp );
    1336                 :            :         }
    1337                 :            : 
    1338         [ #  # ]:          0 :         if( pClassColl )
    1339                 :            :         {
    1340                 :          0 :             pColl = pClassColl;
    1341                 :            :         }
    1342                 :            :         else
    1343                 :            :         {
    1344         [ #  # ]:          0 :             const SvxCSS1MapEntry *pClass = GetClass( aClass );
    1345         [ #  # ]:          0 :             if( pClass )
    1346                 :            :             {
    1347         [ #  # ]:          0 :                 pColl = pDoc->MakeTxtFmtColl( aTmp, pColl );
    1348         [ #  # ]:          0 :                 SfxItemSet aItemSet( pClass->GetItemSet() );
    1349         [ #  # ]:          0 :                 SvxCSS1PropertyInfo aPropInfo( pClass->GetPropertyInfo() );
    1350         [ #  # ]:          0 :                 aPropInfo.SetBoxItem( aItemSet, MIN_BORDER_DIST );
    1351                 :          0 :                 sal_Bool bPositioned = MayBePositioned( pClass->GetPropertyInfo() );
    1352         [ #  # ]:          0 :                 if( bPositioned )
    1353         [ #  # ]:          0 :                     aItemSet.ClearItem( RES_BACKGROUND );
    1354                 :            :                 SetTxtCollAttrs( pColl, aItemSet, aPropInfo,
    1355 [ #  # ][ #  # ]:          0 :                                  this );
                 [ #  # ]
    1356                 :            :             }
    1357         [ #  # ]:          0 :         }
    1358                 :            : 
    1359                 :            :     }
    1360                 :            : 
    1361         [ #  # ]:          0 :     if( pColl )
    1362         [ #  # ]:          0 :         lcl_swcss1_setEncoding( *pColl, GetDfltEncoding() );
    1363                 :            : 
    1364 [ #  # ][ #  # ]:          0 :     return pColl;
    1365                 :            : }
    1366                 :            : 
    1367                 :          0 : SwPageDesc *SwCSS1Parser::GetMasterPageDesc()
    1368                 :            : {
    1369                 :          0 :     return pDoc->GetPageDescFromPool( RES_POOLPAGE_HTML, false );
    1370                 :            : }
    1371                 :            : 
    1372                 :          6 : static SwPageDesc *FindPageDesc( SwDoc *pDoc, sal_uInt16 nPoolId, sal_uInt16& rPage )
    1373                 :            : {
    1374                 :          6 :     sal_uInt16 nPageDescs = pDoc->GetPageDescCnt();
    1375   [ +  +  +  - ]:         24 :     for( rPage=0; rPage < nPageDescs &&
                 [ +  + ]
    1376                 :         12 :          pDoc->GetPageDesc(rPage).GetPoolFmtId() != nPoolId; rPage++ )
    1377                 :            :          ;
    1378                 :            : 
    1379         [ -  + ]:          6 :     return rPage < nPageDescs ? &pDoc->GetPageDesc( rPage ) : 0;
    1380                 :            : }
    1381                 :            : 
    1382                 :          8 : const SwPageDesc *SwCSS1Parser::GetPageDesc( sal_uInt16 nPoolId, sal_Bool bCreate )
    1383                 :            : {
    1384         [ +  + ]:          8 :     if( RES_POOLPAGE_HTML == nPoolId )
    1385         [ +  - ]:          2 :         return pDoc->GetPageDescFromPool( RES_POOLPAGE_HTML, false );
    1386                 :            : 
    1387                 :            :     sal_uInt16 nPage;
    1388         [ +  - ]:          6 :     const SwPageDesc *pPageDesc = FindPageDesc( pDoc, nPoolId, nPage );
    1389 [ +  - ][ -  + ]:          6 :     if( !pPageDesc && bCreate )
    1390                 :            :     {
    1391                 :            :         // Die erste Seite wird aus der rechten Seite erzeugt, wenn es die
    1392                 :            :         // gibt.
    1393                 :          0 :         SwPageDesc *pMasterPageDesc = 0;
    1394         [ #  # ]:          0 :         if( RES_POOLPAGE_FIRST == nPoolId )
    1395         [ #  # ]:          0 :             pMasterPageDesc = FindPageDesc( pDoc, RES_POOLPAGE_RIGHT, nPage );
    1396         [ #  # ]:          0 :         if( !pMasterPageDesc )
    1397         [ #  # ]:          0 :             pMasterPageDesc = pDoc->GetPageDescFromPool( RES_POOLPAGE_HTML, false );
    1398                 :            : 
    1399                 :            :         // Die neue Seitenvorlage entsteht aus dem Master durch kopieren.
    1400                 :            :         SwPageDesc *pNewPageDesc = pDoc->
    1401         [ #  # ]:          0 :             GetPageDescFromPool( nPoolId, false );
    1402                 :            : 
    1403                 :            :         // dazu brauchen wir auch die Nummer der neuen Vorlage
    1404         [ #  # ]:          0 :         pPageDesc = FindPageDesc( pDoc, nPoolId, nPage );
    1405                 :            :         OSL_ENSURE( pPageDesc==pNewPageDesc, "Seitenvorlage nicht gefunden" );
    1406                 :            : 
    1407         [ #  # ]:          0 :         pDoc->CopyPageDesc( *pMasterPageDesc, *pNewPageDesc, sal_False );
    1408                 :            : 
    1409                 :            :         // Die Vorlagen an ihren neuen Zweck anpassen.
    1410                 :          0 :         const SwPageDesc *pFollow = 0;
    1411                 :          0 :         sal_Bool bSetFollowFollow = sal_False;
    1412   [ #  #  #  # ]:          0 :         switch( nPoolId )
    1413                 :            :         {
    1414                 :            :         case RES_POOLPAGE_FIRST:
    1415                 :            :             // Wenn es schon eine linke Seite gibt, dann ist das die
    1416                 :            :             // Folge-Vorlage, sonst ist es die HTML-Vorlage.
    1417         [ #  # ]:          0 :             pFollow = GetLeftPageDesc();
    1418         [ #  # ]:          0 :             if( !pFollow )
    1419                 :          0 :                 pFollow = pMasterPageDesc;
    1420                 :          0 :             break;
    1421                 :            : 
    1422                 :            :         case RES_POOLPAGE_RIGHT:
    1423                 :            :             // Wenn die linke Vorlage schon angelegt ist, passiert hier gar
    1424                 :            :             // nichts. Sonst wird die linke Vorlage angelegt und sorgt auch
    1425                 :            :             // fuer die richtige Verkettung mit der rechten Voralge.
    1426         [ #  # ]:          0 :             GetLeftPageDesc( sal_True );
    1427                 :          0 :             break;
    1428                 :            : 
    1429                 :            :         case RES_POOLPAGE_LEFT:
    1430                 :            :             // Die rechte Vorlage wird angelegt, wenn sie noch nicht existiert.
    1431                 :            :             // Es findet aber keine Verkettung statt.
    1432                 :            :             // Wenn schon eine erste Seitenvorlage existiert, wird die linke
    1433                 :            :             // Vorlage die Folge-Vorlage der ersten Seite.
    1434         [ #  # ]:          0 :             pFollow = GetRightPageDesc( sal_True );
    1435                 :          0 :             bSetFollowFollow = sal_True;
    1436                 :            :             {
    1437         [ #  # ]:          0 :                 const SwPageDesc *pFirstPageDesc = GetFirstPageDesc();
    1438         [ #  # ]:          0 :                 if( pFirstPageDesc )
    1439                 :            :                 {
    1440         [ #  # ]:          0 :                     SwPageDesc aNewFirstPageDesc( *pFirstPageDesc );
    1441                 :          0 :                     aNewFirstPageDesc.SetFollow( pNewPageDesc );
    1442 [ #  # ][ #  # ]:          0 :                     ChgPageDesc( pFirstPageDesc, aNewFirstPageDesc );
    1443                 :            :                 }
    1444                 :            :             }
    1445                 :          0 :             break;
    1446                 :            :         }
    1447                 :            : 
    1448         [ #  # ]:          0 :         if( pFollow )
    1449                 :            :         {
    1450         [ #  # ]:          0 :             SwPageDesc aNewPageDesc( *pNewPageDesc );
    1451                 :          0 :             aNewPageDesc.SetFollow( pFollow );
    1452         [ #  # ]:          0 :             ChgPageDesc( pNewPageDesc, aNewPageDesc );
    1453                 :            : 
    1454         [ #  # ]:          0 :             if( bSetFollowFollow )
    1455                 :            :             {
    1456         [ #  # ]:          0 :                 SwPageDesc aNewFollowPageDesc( *pFollow );
    1457                 :          0 :                 aNewFollowPageDesc.SetFollow( pNewPageDesc );
    1458 [ #  # ][ #  # ]:          0 :                 ChgPageDesc( pFollow, aNewFollowPageDesc );
    1459         [ #  # ]:          0 :             }
    1460                 :            :         }
    1461                 :          0 :         pPageDesc = pNewPageDesc;
    1462                 :            :     }
    1463                 :            : 
    1464                 :          8 :     return pPageDesc;
    1465                 :            : }
    1466                 :            : 
    1467                 :            : 
    1468                 :          0 : sal_Bool SwCSS1Parser::MayBePositioned( const SvxCSS1PropertyInfo& rPropInfo,
    1469                 :            :                                     sal_Bool bAutoWidth )
    1470                 :            : {
    1471                 :            :     // abs-pos
    1472                 :            :     // left/top none    auto    twip    perc
    1473                 :            :     //
    1474                 :            :     // none     Z       Z       -       -
    1475                 :            :     // auto     Z       Z       -       -
    1476                 :            :     // twip     Z       Z       S/R     -
    1477                 :            :     // perc     -       -       -       -
    1478                 :            :     //
    1479                 :            :     // - das Tag wird absolut positioniert und left/top sind beide
    1480                 :            :     //   gegeben und enthalten auch keine %-Angabe, oder
    1481                 :            :     // - das Tag soll fliessen, und
    1482                 :            :     // - es wurde eine Breite angegeben (in beiden Faellen noetig)
    1483                 :            :     return ( ( SVX_CSS1_POS_ABSOLUTE     == rPropInfo.ePosition &&
    1484                 :            :                SVX_CSS1_LTYPE_PERCENTAGE != rPropInfo.eLeftType &&
    1485                 :            :                SVX_CSS1_LTYPE_PERCENTAGE != rPropInfo.eTopType &&
    1486                 :            :               (SVX_CSS1_LTYPE_TWIP       == rPropInfo.eLeftType ||
    1487                 :            :                SVX_CSS1_LTYPE_TWIP       != rPropInfo.eTopType) ) ||
    1488                 :            :              ( SVX_ADJUST_END            != rPropInfo.eFloat  ) ) &&
    1489                 :            :            ( bAutoWidth ||
    1490                 :            :              SVX_CSS1_LTYPE_TWIP         == rPropInfo.eWidthType ||
    1491 [ #  # ][ #  # ]:          0 :              SVX_CSS1_LTYPE_PERCENTAGE   == rPropInfo.eWidthType );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1492                 :            : }
    1493                 :            : 
    1494                 :            : 
    1495                 :            : 
    1496                 :          0 : void SwCSS1Parser::AddClassName( String& rFmtName, const String& rClass )
    1497                 :            : {
    1498                 :            :     OSL_ENSURE( rClass.Len(), "Style-Klasse ohne Laenge?" );
    1499                 :            : 
    1500                 :          0 :     (rFmtName += '.') += rClass;
    1501                 :          0 : }
    1502                 :            : 
    1503                 :            : 
    1504                 :          0 : void SwCSS1Parser::FillDropCap( SwFmtDrop& rDrop,
    1505                 :            :                                 SfxItemSet& rItemSet,
    1506                 :            :                                 const String *pName )
    1507                 :            : {
    1508                 :            :     // die Anzahl der Zeilen entspricht in etwa einer %-Angabe
    1509                 :            :     // fuer die Hoehe (was passiert mit absoluten Hoehen???)
    1510                 :          0 :     sal_uInt8 nLines = rDrop.GetLines();
    1511                 :            :     const SfxPoolItem *pItem;
    1512 [ #  # ][ #  # ]:          0 :     if( SFX_ITEM_SET == rItemSet.GetItemState( RES_CHRATR_FONTSIZE, sal_False, &pItem ) )
    1513                 :            :     {
    1514                 :          0 :         sal_uInt16 nProp = ((const SvxFontHeightItem *)pItem)->GetProp();
    1515                 :          0 :         nLines = (sal_uInt8)((nProp + 50) / 100);
    1516         [ #  # ]:          0 :         if( nLines < 1 )
    1517                 :          0 :             nLines = 1;
    1518         [ #  # ]:          0 :         else if( nLines > MAX_DROPCAP_LINES )
    1519                 :          0 :             nLines = MAX_DROPCAP_LINES;
    1520                 :            : 
    1521                 :            :         // Nur wenn nLines>1 ist, wird das Attribut auch gesetzt. Dann
    1522                 :            :         // brauchen wir die Font-Hoehe aber auch nicht in der Zeichen-Vorlage.
    1523         [ #  # ]:          0 :         if( nLines > 1 )
    1524                 :            :         {
    1525         [ #  # ]:          0 :             rItemSet.ClearItem( RES_CHRATR_FONTSIZE );
    1526         [ #  # ]:          0 :             rItemSet.ClearItem( RES_CHRATR_CJK_FONTSIZE );
    1527         [ #  # ]:          0 :             rItemSet.ClearItem( RES_CHRATR_CTL_FONTSIZE );
    1528                 :            :         }
    1529                 :            :     }
    1530                 :            : 
    1531                 :            :     // Bei harter Attributierung (pName==0) koennen wir aufhoehren, wenn
    1532                 :            :     // das Initial nur ueber eine Zeile geht.
    1533         [ #  # ]:          0 :     if( nLines<=1 )
    1534                 :          0 :         return;
    1535                 :            : 
    1536                 :          0 :     rDrop.GetLines() = nLines;
    1537                 :            : 
    1538                 :            :     // ein rechter Rand wird der Abstand zum Text!
    1539 [ #  # ][ #  # ]:          0 :     if( SFX_ITEM_SET == rItemSet.GetItemState( RES_LR_SPACE, sal_False, &pItem ) )
    1540                 :            :     {
    1541                 :          0 :         rDrop.GetDistance() = static_cast< sal_uInt16 >(
    1542                 :          0 :             ((const SvxLRSpaceItem *)pItem)->GetRight() );
    1543         [ #  # ]:          0 :         rItemSet.ClearItem( RES_LR_SPACE );
    1544                 :            :     }
    1545                 :            : 
    1546                 :            :     // Fuer alle anderen Attribute eine Zeichen-Vorlage anlegen
    1547         [ #  # ]:          0 :     if( rItemSet.Count() )
    1548                 :            :     {
    1549                 :          0 :         SwCharFmt *pCFmt = 0;
    1550         [ #  # ]:          0 :         String aName;
    1551         [ #  # ]:          0 :         if( pName )
    1552                 :            :         {
    1553         [ #  # ]:          0 :             aName = *pName;
    1554         [ #  # ]:          0 :             AddFirstLetterExt( aName );
    1555         [ #  # ]:          0 :             pCFmt = pDoc->FindCharFmtByName( aName );
    1556                 :            :         }
    1557                 :            :         else
    1558                 :            :         {
    1559         [ #  # ]:          0 :             do
    1560                 :            :             {
    1561         [ #  # ]:          0 :                 aName.AssignAscii( sCSS1_first_letter );
    1562         [ #  # ]:          0 :                 aName.Append( ' ' );
    1563                 :            :                 aName.Append(
    1564 [ #  # ][ #  # ]:          0 :                     String::CreateFromInt32( (sal_Int32)(++nDropCapCnt) ) );
                 [ #  # ]
    1565                 :            :             }
    1566         [ #  # ]:          0 :             while( pDoc->FindCharFmtByName(aName) );
    1567                 :            :         }
    1568                 :            : 
    1569         [ #  # ]:          0 :         if( !pCFmt )
    1570                 :            :         {
    1571         [ #  # ]:          0 :             pCFmt = pDoc->MakeCharFmt( aName, pDoc->GetDfltCharFmt() );
    1572                 :          0 :             pCFmt->SetAuto( sal_False );
    1573                 :            :         }
    1574         [ #  # ]:          0 :         SetCharFmtAttrs( pCFmt, rItemSet );
    1575                 :            : 
    1576                 :            :         // Die Zeichenvorlage braucht nur im Attribut gesetzt werden, wenn
    1577                 :            :         // auch das Attribut gesetzt wird.
    1578         [ #  # ]:          0 :         if( nLines > 1 )
    1579 [ #  # ][ #  # ]:          0 :             rDrop.SetCharFmt( pCFmt );
    1580                 :            :     }
    1581                 :            : }
    1582                 :            : 
    1583                 :            : 
    1584                 :            : // CSS1-sezifisches des SwHTMLParsers
    1585                 :            : 
    1586                 :          0 : _HTMLAttr **SwHTMLParser::GetAttrTabEntry( sal_uInt16 nWhich )
    1587                 :            : {
    1588                 :            :     // den zu dem Item gehoehrenden Tabellen-Eintrag ermitteln ...
    1589                 :          0 :     _HTMLAttr **ppAttr = 0;
    1590   [ #  #  #  #  :          0 :     switch( nWhich )
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                #  #  # ]
    1591                 :            :     {
    1592                 :            :     case RES_CHRATR_BLINK:
    1593                 :          0 :         ppAttr = &aAttrTab.pBlink;
    1594                 :          0 :         break;
    1595                 :            :     case RES_CHRATR_CASEMAP:
    1596                 :          0 :         ppAttr = &aAttrTab.pCaseMap;
    1597                 :          0 :         break;
    1598                 :            :     case RES_CHRATR_COLOR:
    1599                 :          0 :         ppAttr = &aAttrTab.pFontColor;
    1600                 :          0 :         break;
    1601                 :            :     case RES_CHRATR_CROSSEDOUT:
    1602                 :          0 :         ppAttr = &aAttrTab.pStrike;
    1603                 :          0 :         break;
    1604                 :            :     case RES_CHRATR_ESCAPEMENT:
    1605                 :          0 :         ppAttr = &aAttrTab.pEscapement;
    1606                 :          0 :         break;
    1607                 :            :     case RES_CHRATR_FONT:
    1608                 :          0 :         ppAttr = &aAttrTab.pFont;
    1609                 :          0 :         break;
    1610                 :            :     case RES_CHRATR_CJK_FONT:
    1611                 :          0 :         ppAttr = &aAttrTab.pFontCJK;
    1612                 :          0 :         break;
    1613                 :            :     case RES_CHRATR_CTL_FONT:
    1614                 :          0 :         ppAttr = &aAttrTab.pFontCTL;
    1615                 :          0 :         break;
    1616                 :            :     case RES_CHRATR_FONTSIZE:
    1617                 :          0 :         ppAttr = &aAttrTab.pFontHeight;
    1618                 :          0 :         break;
    1619                 :            :     case RES_CHRATR_CJK_FONTSIZE:
    1620                 :          0 :         ppAttr = &aAttrTab.pFontHeightCJK;
    1621                 :          0 :         break;
    1622                 :            :     case RES_CHRATR_CTL_FONTSIZE:
    1623                 :          0 :         ppAttr = &aAttrTab.pFontHeightCTL;
    1624                 :          0 :         break;
    1625                 :            :     case RES_CHRATR_KERNING:
    1626                 :          0 :         ppAttr = &aAttrTab.pKerning;
    1627                 :          0 :         break;
    1628                 :            :     case RES_CHRATR_POSTURE:
    1629                 :          0 :         ppAttr = &aAttrTab.pItalic;
    1630                 :          0 :         break;
    1631                 :            :     case RES_CHRATR_CJK_POSTURE:
    1632                 :          0 :         ppAttr = &aAttrTab.pItalicCJK;
    1633                 :          0 :         break;
    1634                 :            :     case RES_CHRATR_CTL_POSTURE:
    1635                 :          0 :         ppAttr = &aAttrTab.pItalicCTL;
    1636                 :          0 :         break;
    1637                 :            :     case RES_CHRATR_UNDERLINE:
    1638                 :          0 :         ppAttr = &aAttrTab.pUnderline;
    1639                 :          0 :         break;
    1640                 :            :     case RES_CHRATR_WEIGHT:
    1641                 :          0 :         ppAttr = &aAttrTab.pBold;
    1642                 :          0 :         break;
    1643                 :            :     case RES_CHRATR_CJK_WEIGHT:
    1644                 :          0 :         ppAttr = &aAttrTab.pBoldCJK;
    1645                 :          0 :         break;
    1646                 :            :     case RES_CHRATR_CTL_WEIGHT:
    1647                 :          0 :         ppAttr = &aAttrTab.pBoldCTL;
    1648                 :          0 :         break;
    1649                 :            :     case RES_CHRATR_BACKGROUND:
    1650                 :          0 :         ppAttr = &aAttrTab.pCharBrush;
    1651                 :          0 :         break;
    1652                 :            : 
    1653                 :            :     case RES_PARATR_LINESPACING:
    1654                 :          0 :         ppAttr = &aAttrTab.pLineSpacing;
    1655                 :          0 :         break;
    1656                 :            :     case RES_PARATR_ADJUST:
    1657                 :          0 :         ppAttr = &aAttrTab.pAdjust;
    1658                 :          0 :         break;
    1659                 :            : 
    1660                 :            :     case RES_LR_SPACE:
    1661                 :          0 :         ppAttr = &aAttrTab.pLRSpace;
    1662                 :          0 :         break;
    1663                 :            :     case RES_UL_SPACE:
    1664                 :          0 :         ppAttr = &aAttrTab.pULSpace;
    1665                 :          0 :         break;
    1666                 :            :     case RES_BOX:
    1667                 :          0 :         ppAttr = &aAttrTab.pBox;
    1668                 :          0 :         break;
    1669                 :            :     case RES_BACKGROUND:
    1670                 :          0 :         ppAttr = &aAttrTab.pBrush;
    1671                 :          0 :         break;
    1672                 :            :     case RES_BREAK:
    1673                 :          0 :         ppAttr = &aAttrTab.pBreak;
    1674                 :          0 :         break;
    1675                 :            :     case RES_PAGEDESC:
    1676                 :          0 :         ppAttr = &aAttrTab.pPageDesc;
    1677                 :          0 :         break;
    1678                 :            :     case RES_PARATR_SPLIT:
    1679                 :          0 :         ppAttr = &aAttrTab.pSplit;
    1680                 :          0 :         break;
    1681                 :            :     case RES_PARATR_WIDOWS:
    1682                 :          0 :         ppAttr = &aAttrTab.pWidows;
    1683                 :          0 :         break;
    1684                 :            :     case RES_PARATR_ORPHANS:
    1685                 :          0 :         ppAttr = &aAttrTab.pOrphans;
    1686                 :          0 :         break;
    1687                 :            :     case RES_KEEP:
    1688                 :          0 :         ppAttr = &aAttrTab.pKeep;
    1689                 :          0 :         break;
    1690                 :            : 
    1691                 :            :     case RES_CHRATR_LANGUAGE:
    1692                 :          0 :         ppAttr = &aAttrTab.pLanguage;
    1693                 :          0 :         break;
    1694                 :            :     case RES_CHRATR_CJK_LANGUAGE:
    1695                 :          0 :         ppAttr = &aAttrTab.pLanguageCJK;
    1696                 :          0 :         break;
    1697                 :            :     case RES_CHRATR_CTL_LANGUAGE:
    1698                 :          0 :         ppAttr = &aAttrTab.pLanguageCTL;
    1699                 :          0 :         break;
    1700                 :            : 
    1701                 :            :     case RES_FRAMEDIR:
    1702                 :          0 :         ppAttr = &aAttrTab.pDirection;
    1703                 :          0 :         break;
    1704                 :            :     }
    1705                 :            : 
    1706                 :          0 :     return ppAttr;
    1707                 :            : }
    1708                 :            : 
    1709                 :          0 : void SwHTMLParser::NewStyle()
    1710                 :            : {
    1711         [ #  # ]:          0 :     String sType;
    1712                 :            : 
    1713         [ #  # ]:          0 :     const HTMLOptions& rOptions2 = GetOptions();
    1714         [ #  # ]:          0 :     for (size_t i = rOptions2.size(); i; )
    1715                 :            :     {
    1716         [ #  # ]:          0 :         const HTMLOption& rOption = rOptions2[--i];
    1717         [ #  # ]:          0 :         if( HTML_O_TYPE == rOption.GetToken() )
    1718         [ #  # ]:          0 :             sType = rOption.GetString();
    1719                 :            :     }
    1720                 :            : 
    1721                 :          0 :     bIgnoreRawData = sType.Len() &&
    1722 [ #  # ][ #  # ]:          0 :                      !sType.GetToken(0,';').EqualsAscii(sCSS_mimetype);
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
    1723                 :          0 : }
    1724                 :            : 
    1725                 :          0 : void SwHTMLParser::EndStyle()
    1726                 :            : {
    1727                 :          0 :     bIgnoreRawData = sal_False;
    1728                 :            : 
    1729         [ #  # ]:          0 :     if( aStyleSource.Len() )
    1730                 :            :     {
    1731                 :          0 :         pCSS1Parser->ParseStyleSheet( aStyleSource );
    1732                 :          0 :         aStyleSource.Erase();
    1733                 :            :     }
    1734                 :          0 : }
    1735                 :            : 
    1736                 :          0 : sal_Bool SwHTMLParser::FileDownload( const String& rURL,
    1737                 :            :                                  String& rStr )
    1738                 :            : {
    1739                 :            :     // View wegschmeissen (wegen Reschedule)
    1740         [ #  # ]:          0 :     ViewShell *pOldVSh = CallEndAction();
    1741                 :            : 
    1742                 :            :     // Ein Medium anlegen
    1743         [ #  # ]:          0 :     SfxMedium aDLMedium( rURL, STREAM_READ | STREAM_SHARE_DENYWRITE );
    1744                 :            : 
    1745         [ #  # ]:          0 :     SvStream* pStream = aDLMedium.GetInStream();
    1746         [ #  # ]:          0 :     if( pStream )
    1747                 :            :     {
    1748         [ #  # ]:          0 :         SvMemoryStream aStream;
    1749         [ #  # ]:          0 :         aStream << *pStream;
    1750                 :            : 
    1751         [ #  # ]:          0 :         aStream.Seek( STREAM_SEEK_TO_END );
    1752                 :            :         OSL_ENSURE( aStream.Tell() < STRING_MAXLEN,
    1753                 :            :                     "File zu lang fuer einen String, Ende abgeschnitten" );
    1754                 :          0 :         xub_StrLen nLen = aStream.Tell() < STRING_MAXLEN
    1755                 :          0 :                         ? (xub_StrLen)aStream.Tell()
    1756         [ #  # ]:          0 :                         : STRING_MAXLEN;
    1757                 :            : 
    1758         [ #  # ]:          0 :         rStr = String( (const sal_Char *)aStream.GetData(), nLen,
    1759 [ #  # ][ #  # ]:          0 :                        GetSrcEncoding() );
         [ #  # ][ #  # ]
    1760                 :            :     }
    1761                 :            : 
    1762                 :            : 
    1763                 :            :     // wurde abgebrochen?
    1764 [ #  # ][ #  # ]:          0 :     if( ( pDoc->GetDocShell() && pDoc->GetDocShell()->IsAbortingImport() )
         [ #  # ][ #  # ]
                 [ #  # ]
    1765         [ #  # ]:          0 :         || 1 == pDoc->getReferenceCount() )
    1766                 :            :     {
    1767                 :            :         // wurde der Import vom SFX abgebrochen?
    1768                 :          0 :         eState = SVPAR_ERROR;
    1769                 :          0 :         pStream = 0;
    1770                 :            :     }
    1771                 :            : 
    1772                 :            :     // recreate View
    1773         [ #  # ]:          0 :     ViewShell *const pVSh = CallStartAction( pOldVSh );
    1774                 :            :     OSL_ENSURE( pOldVSh == pVSh, "FileDownload: ViewShell changed on us" );
    1775                 :            :     (void) pVSh;
    1776                 :            : 
    1777         [ #  # ]:          0 :     return pStream!=0;
    1778                 :            : }
    1779                 :            : 
    1780                 :          0 : void SwHTMLParser::InsertLink()
    1781                 :            : {
    1782                 :          0 :     sal_Bool bFinishDownload = sal_False;
    1783         [ #  # ]:          0 :     if( pPendStack )
    1784                 :            :     {
    1785                 :            :         OSL_ENSURE( ShouldFinishFileDownload(),
    1786                 :            :                 "Pending-Stack ohne File-Download?" );
    1787                 :            : 
    1788                 :          0 :         SwPendingStack* pTmp = pPendStack->pNext;
    1789                 :          0 :         delete pPendStack;
    1790                 :          0 :         pPendStack = pTmp;
    1791                 :            :         OSL_ENSURE( !pPendStack, "Wo kommt der Pending-Stack her?" );
    1792                 :            : 
    1793                 :          0 :         bFinishDownload = sal_True;
    1794                 :            :     }
    1795                 :            :     else
    1796                 :            :     {
    1797 [ #  # ][ #  # ]:          0 :         String sRel, sHRef, sType;
                 [ #  # ]
    1798                 :            : 
    1799         [ #  # ]:          0 :         const HTMLOptions& rOptions2 = GetOptions();
    1800         [ #  # ]:          0 :         for (size_t i = rOptions2.size(); i; )
    1801                 :            :         {
    1802         [ #  # ]:          0 :             const HTMLOption& rOption = rOptions2[--i];
    1803   [ #  #  #  # ]:          0 :             switch( rOption.GetToken() )
    1804                 :            :             {
    1805                 :            :                 case HTML_O_REL:
    1806         [ #  # ]:          0 :                     sRel = rOption.GetString();
    1807                 :          0 :                     break;
    1808                 :            :                 case HTML_O_HREF:
    1809 [ #  # ][ #  # ]:          0 :                     sHRef = URIHelper::SmartRel2Abs( INetURLObject( sBaseURL ), rOption.GetString(), Link(), false );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1810                 :          0 :                     break;
    1811                 :            :                 case HTML_O_TYPE:
    1812         [ #  # ]:          0 :                     sType = rOption.GetString();
    1813                 :          0 :                     break;
    1814                 :            :             }
    1815                 :            :         }
    1816                 :            : 
    1817 [ #  # ][ #  # ]:          0 :         if( sHRef.Len() && sRel.EqualsIgnoreCaseAscii( "STYLESHEET" ) &&
           [ #  #  #  # ]
         [ #  # ][ #  # ]
    1818                 :          0 :             ( !sType.Len() ||
    1819 [ #  # ][ #  # ]:          0 :               sType.GetToken(0,';').EqualsAscii(sCSS_mimetype) ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1820                 :            :         {
    1821         [ #  # ]:          0 :             if( GetMedium() )
    1822                 :            :             {
    1823                 :            :                 // Download des Style-Source starten
    1824 [ #  # ][ #  # ]:          0 :                 StartFileDownload(sHRef);
    1825         [ #  # ]:          0 :                 if( IsParserWorking() )
    1826                 :            :                 {
    1827                 :            :                     // Der Style wurde synchron geladen und wir koennen
    1828                 :            :                     // es direkt aufrufen.
    1829                 :          0 :                     bFinishDownload = sal_True;
    1830                 :            :                 }
    1831                 :            :                 else
    1832                 :            :                 {
    1833                 :            :                     // Der Style wird asynchron geladen und ist erst beim
    1834                 :            :                     // naechsten Continue-Aufruf da. Wir muessen deshalb einen
    1835                 :            :                     // Pending-Stack anlegen, damit wir hierher zurueckkehren
    1836         [ #  # ]:          0 :                     pPendStack = new SwPendingStack( HTML_LINK, pPendStack );
    1837                 :            :                 }
    1838                 :            :             }
    1839                 :            :             else
    1840                 :            :             {
    1841                 :            :                 // File synchron holen
    1842         [ #  # ]:          0 :                 String sSource;
    1843 [ #  # ][ #  # ]:          0 :                 if( FileDownload( sHRef, sSource ) )
    1844 [ #  # ][ #  # ]:          0 :                     pCSS1Parser->ParseStyleSheet( sSource );
    1845                 :            :             }
    1846 [ #  # ][ #  # ]:          0 :         }
                 [ #  # ]
    1847                 :            :     }
    1848                 :            : 
    1849         [ #  # ]:          0 :     if( bFinishDownload )
    1850                 :            :     {
    1851         [ #  # ]:          0 :         String sSource;
    1852 [ #  # ][ #  # ]:          0 :         if( FinishFileDownload(sSource) && sSource.Len() )
         [ #  # ][ #  # ]
    1853 [ #  # ][ #  # ]:          0 :             pCSS1Parser->ParseStyleSheet( sSource );
    1854                 :            :     }
    1855                 :          0 : }
    1856                 :            : 
    1857                 :          0 : sal_Bool SwCSS1Parser::ParseStyleSheet( const String& rIn )
    1858                 :            : {
    1859         [ #  # ]:          0 :     if( !SvxCSS1Parser::ParseStyleSheet( rIn ) )
    1860                 :          0 :         return sal_False;
    1861                 :            : 
    1862                 :            :     SwPageDesc *pMasterPageDesc =
    1863                 :          0 :         pDoc->GetPageDescFromPool( RES_POOLPAGE_HTML, false );
    1864                 :            : 
    1865                 :          0 :     SvxCSS1MapEntry *pPageEntry = GetPage( aEmptyStr, false );
    1866         [ #  # ]:          0 :     if( pPageEntry )
    1867                 :            :     {
    1868                 :            :         // @page (wirkt auf alle Seiten, die es schon gibt
    1869                 :            : 
    1870                 :          0 :         SetPageDescAttrs( pMasterPageDesc, pPageEntry->GetItemSet(),
    1871                 :          0 :                           pPageEntry->GetPropertyInfo() );
    1872                 :            : 
    1873                 :            :         // Fuer alle anderen Seiten-Vorlagen, die es schon gibt,
    1874                 :            :         // muessen die Attribute auch noch gesetzt werden
    1875                 :            : 
    1876                 :          0 :         SetPageDescAttrs( GetFirstPageDesc(), pPageEntry->GetItemSet(),
    1877                 :          0 :                           pPageEntry->GetPropertyInfo() );
    1878                 :          0 :         SetPageDescAttrs( GetLeftPageDesc(), pPageEntry->GetItemSet(),
    1879                 :          0 :                           pPageEntry->GetPropertyInfo() );
    1880                 :          0 :         SetPageDescAttrs( GetRightPageDesc(), pPageEntry->GetItemSet(),
    1881                 :          0 :                           pPageEntry->GetPropertyInfo() );
    1882                 :            : 
    1883                 :            :     }
    1884                 :            : 
    1885 [ #  # ][ #  # ]:          0 :     pPageEntry = GetPage( rtl::OUString::createFromAscii(sCSS1_first), sal_True );
                 [ #  # ]
    1886         [ #  # ]:          0 :     if( pPageEntry )
    1887                 :            :     {
    1888                 :          0 :         SetPageDescAttrs( GetFirstPageDesc(sal_True), pPageEntry->GetItemSet(),
    1889                 :          0 :                           pPageEntry->GetPropertyInfo() );
    1890                 :          0 :         bSetFirstPageDesc = sal_True;
    1891                 :            :     }
    1892                 :            : 
    1893 [ #  # ][ #  # ]:          0 :     pPageEntry = GetPage( rtl::OUString::createFromAscii(sCSS1_right), sal_True );
                 [ #  # ]
    1894         [ #  # ]:          0 :     if( pPageEntry )
    1895                 :            :     {
    1896                 :          0 :         SetPageDescAttrs( GetRightPageDesc(sal_True), pPageEntry->GetItemSet(),
    1897                 :          0 :                           pPageEntry->GetPropertyInfo() );
    1898                 :          0 :         bSetRightPageDesc = sal_True;
    1899                 :            :     }
    1900                 :            : 
    1901 [ #  # ][ #  # ]:          0 :     pPageEntry = GetPage( rtl::OUString::createFromAscii(sCSS1_left), sal_True );
                 [ #  # ]
    1902         [ #  # ]:          0 :     if( pPageEntry )
    1903                 :          0 :         SetPageDescAttrs( GetLeftPageDesc(sal_True), pPageEntry->GetItemSet(),
    1904                 :          0 :                           pPageEntry->GetPropertyInfo() );
    1905                 :            : 
    1906                 :          0 :     return sal_True;
    1907                 :            : }
    1908                 :            : 
    1909                 :          2 : sal_Bool SwHTMLParser::ParseStyleOptions( const String &rStyle,
    1910                 :            :                                       const String &rId,
    1911                 :            :                                       const String &rClass,
    1912                 :            :                                       SfxItemSet &rItemSet,
    1913                 :            :                                       SvxCSS1PropertyInfo &rPropInfo,
    1914                 :            :                                          const String *pLang,
    1915                 :            :                                          const String *pDir )
    1916                 :            : {
    1917                 :          2 :     sal_Bool bRet = sal_False;
    1918                 :            : 
    1919         [ -  + ]:          2 :     if( rClass.Len() )
    1920                 :            :     {
    1921         [ #  # ]:          0 :         String aClass( rClass );
    1922         [ #  # ]:          0 :         SwCSS1Parser::GetScriptFromClass( aClass );
    1923         [ #  # ]:          0 :         const SvxCSS1MapEntry *pClass = pCSS1Parser->GetClass( aClass );
    1924         [ #  # ]:          0 :         if( pClass )
    1925                 :            :         {
    1926                 :          0 :             pCSS1Parser->MergeStyles( pClass->GetItemSet(),
    1927                 :          0 :                                       pClass->GetPropertyInfo(),
    1928         [ #  # ]:          0 :                                       rItemSet, rPropInfo, sal_False );
    1929                 :          0 :             bRet = sal_True;
    1930         [ #  # ]:          0 :         }
    1931                 :            :     }
    1932                 :            : 
    1933         [ -  + ]:          2 :     if( rId.Len() )
    1934                 :            :     {
    1935                 :          0 :         const SvxCSS1MapEntry *pId = pCSS1Parser->GetId( rId );
    1936         [ #  # ]:          0 :         if( pId )
    1937                 :          0 :             pCSS1Parser->MergeStyles( pId->GetItemSet(),
    1938                 :          0 :                                       pId->GetPropertyInfo(),
    1939                 :          0 :                                       rItemSet, rPropInfo, rClass.Len()!=0 );
    1940                 :          0 :         rPropInfo.aId = rId;
    1941                 :          0 :         bRet = sal_True;
    1942                 :            :     }
    1943                 :            : 
    1944         [ -  + ]:          2 :     if( rStyle.Len() )
    1945                 :            :     {
    1946                 :          0 :         pCSS1Parser->ParseStyleOption( rStyle, rItemSet, rPropInfo );
    1947                 :          0 :         bRet = sal_True;
    1948                 :            :     }
    1949                 :            : 
    1950         [ -  + ]:          2 :     if( bRet )
    1951                 :          0 :         rPropInfo.SetBoxItem( rItemSet, MIN_BORDER_DIST );
    1952                 :            : 
    1953 [ -  + ][ #  # ]:          2 :     if( pLang && pLang->Len() )
                 [ -  + ]
    1954                 :            :     {
    1955         [ #  # ]:          0 :         LanguageType eLang = MsLangId::convertIsoStringToLanguage( *pLang );
    1956         [ #  # ]:          0 :         if( LANGUAGE_DONTKNOW != eLang )
    1957                 :            :         {
    1958         [ #  # ]:          0 :             SvxLanguageItem aLang( eLang, RES_CHRATR_LANGUAGE );
    1959         [ #  # ]:          0 :             rItemSet.Put( aLang );
    1960                 :          0 :             aLang.SetWhich( RES_CHRATR_CJK_LANGUAGE );
    1961         [ #  # ]:          0 :             rItemSet.Put( aLang );
    1962                 :          0 :             aLang.SetWhich( RES_CHRATR_CTL_LANGUAGE );
    1963         [ #  # ]:          0 :             rItemSet.Put( aLang );
    1964                 :            : 
    1965         [ #  # ]:          0 :             bRet = sal_True;
    1966                 :            :         }
    1967                 :            :     }
    1968 [ +  - ][ +  - ]:          2 :     if( pDir && pDir->Len() )
                 [ +  - ]
    1969                 :            :     {
    1970         [ +  - ]:          2 :         String aValue( *pDir );
    1971         [ +  - ]:          2 :         aValue.ToUpperAscii();
    1972                 :          2 :         SvxFrameDirection eDir = FRMDIR_ENVIRONMENT;
    1973 [ +  - ][ +  - ]:          2 :         if( aValue.EqualsAscii( "LTR" ) )
    1974                 :          2 :             eDir = FRMDIR_HORI_LEFT_TOP;
    1975 [ #  # ][ #  # ]:          0 :         else if( aValue.EqualsAscii( "RTL" ) )
    1976                 :          0 :             eDir = FRMDIR_HORI_RIGHT_TOP;
    1977                 :            : 
    1978         [ +  - ]:          2 :         if( FRMDIR_ENVIRONMENT != eDir )
    1979                 :            :         {
    1980         [ +  - ]:          2 :             SvxFrameDirectionItem aDir( eDir, RES_FRAMEDIR );
    1981         [ +  - ]:          2 :             rItemSet.Put( aDir );
    1982                 :            : 
    1983         [ +  - ]:          2 :             bRet = sal_True;
    1984         [ +  - ]:          2 :         }
    1985                 :            :     }
    1986                 :            : 
    1987                 :          2 :     return bRet;
    1988                 :            : }
    1989                 :            : 
    1990                 :          0 : void SwHTMLParser::SetAnchorAndAdjustment( const SfxItemSet & /*rItemSet*/,
    1991                 :            :                                            const SvxCSS1PropertyInfo &rPropInfo,
    1992                 :            :                                            SfxItemSet &rFrmItemSet )
    1993                 :            : {
    1994         [ #  # ]:          0 :     SwFmtAnchor aAnchor;
    1995                 :            : 
    1996                 :          0 :     sal_Int16 eHoriOri = text::HoriOrientation::NONE;
    1997                 :          0 :     sal_Int16 eVertOri = text::VertOrientation::NONE;
    1998                 :          0 :     sal_Int16 eHoriRel = text::RelOrientation::FRAME;
    1999                 :          0 :     sal_Int16 eVertRel = text::RelOrientation::FRAME;
    2000                 :          0 :     SwTwips nHoriPos = 0, nVertPos = 0;
    2001                 :          0 :     SwSurround eSurround = SURROUND_THROUGHT;
    2002         [ #  # ]:          0 :     if( SVX_CSS1_POS_ABSOLUTE == rPropInfo.ePosition )
    2003                 :            :     {
    2004 [ #  # ][ #  # ]:          0 :         if( SVX_CSS1_LTYPE_TWIP == rPropInfo.eLeftType &&
    2005                 :            :             SVX_CSS1_LTYPE_TWIP == rPropInfo.eTopType )
    2006                 :            :         {
    2007                 :            :             // Absolut positionierte Objekte sind seitengebunden, wenn
    2008                 :            :             // sie nicht schon in einem Rahmen stehen und sonst
    2009                 :            :             // Rahmengebunden.
    2010                 :            :             const SwStartNode *pFlySttNd =
    2011         [ #  # ]:          0 :                 pPam->GetPoint()->nNode.GetNode().FindFlyStartNode();
    2012         [ #  # ]:          0 :             if( pFlySttNd )
    2013                 :            :             {
    2014                 :          0 :                 aAnchor.SetType( FLY_AT_FLY );
    2015         [ #  # ]:          0 :                 SwPosition aPos( *pFlySttNd );
    2016 [ #  # ][ #  # ]:          0 :                 aAnchor.SetAnchor( &aPos );
    2017                 :            :             }
    2018                 :            :             else
    2019                 :            :             {
    2020                 :          0 :                 aAnchor.SetType( FLY_AT_PAGE );
    2021                 :          0 :                 aAnchor.SetPageNum( 1 );
    2022                 :            :             }
    2023                 :          0 :             nHoriPos = rPropInfo.nLeft;
    2024                 :          0 :             nVertPos = rPropInfo.nTop;
    2025                 :            :         }
    2026                 :            :         else
    2027                 :            :         {
    2028                 :          0 :             aAnchor.SetType( FLY_AT_PARA );
    2029         [ #  # ]:          0 :             aAnchor.SetAnchor( pPam->GetPoint() );
    2030                 :          0 :             eVertOri = text::VertOrientation::TOP;
    2031                 :          0 :             eVertRel = text::RelOrientation::CHAR;
    2032         [ #  # ]:          0 :             if( SVX_CSS1_LTYPE_TWIP == rPropInfo.eLeftType )
    2033                 :            :             {
    2034                 :          0 :                 eHoriOri = text::HoriOrientation::NONE;
    2035                 :          0 :                 eHoriRel = text::RelOrientation::PAGE_FRAME;
    2036                 :          0 :                 nHoriPos = rPropInfo.nLeft;
    2037                 :            :             }
    2038                 :            :             else
    2039                 :            :             {
    2040                 :          0 :                 eHoriOri = text::HoriOrientation::LEFT;
    2041                 :          0 :                 eHoriRel = text::RelOrientation::FRAME;   // wird noch umgeschossen
    2042                 :            :             }
    2043                 :            :         }
    2044                 :            :     }
    2045                 :            :     else
    2046                 :            :     {
    2047                 :            :         // fliessende Objekte werden Absatzgebunden eingefuegt, wenn
    2048                 :            :         // der Absatz noch leer ist und sonst auto-gebunden.
    2049                 :            :         // Auto-gebundene Rahmen werden zunaechst an der Position davor
    2050                 :            :         // eingefuegt und erst spaeter verschoben.
    2051                 :          0 :         xub_StrLen nCntnt = pPam->GetPoint()->nContent.GetIndex();
    2052         [ #  # ]:          0 :         if( nCntnt )
    2053                 :            :         {
    2054                 :          0 :             aAnchor.SetType( FLY_AT_CHAR );
    2055         [ #  # ]:          0 :             pPam->Move( fnMoveBackward );
    2056                 :          0 :             eVertOri = text::VertOrientation::CHAR_BOTTOM;
    2057                 :          0 :             eVertRel = text::RelOrientation::CHAR;
    2058                 :            :         }
    2059                 :            :         else
    2060                 :            :         {
    2061                 :          0 :             aAnchor.SetType( FLY_AT_PARA );
    2062                 :          0 :             eVertOri = text::VertOrientation::TOP;
    2063                 :          0 :             eVertRel = text::RelOrientation::PRINT_AREA;
    2064                 :            :         }
    2065                 :            : 
    2066         [ #  # ]:          0 :         aAnchor.SetAnchor( pPam->GetPoint() );
    2067                 :            : 
    2068         [ #  # ]:          0 :         if( nCntnt )
    2069         [ #  # ]:          0 :             pPam->Move( fnMoveForward );
    2070                 :            : 
    2071                 :          0 :         sal_uInt16 nLeftSpace = 0, nRightSpace = 0;
    2072                 :          0 :         short nIndent = 0;
    2073         [ #  # ]:          0 :         GetMarginsFromContextWithNumBul( nLeftSpace, nRightSpace, nIndent );
    2074                 :            : 
    2075         [ #  # ]:          0 :         if( SVX_ADJUST_RIGHT==rPropInfo.eFloat )
    2076                 :            :         {
    2077                 :          0 :             eHoriOri = text::HoriOrientation::RIGHT;
    2078         [ #  # ]:          0 :             eHoriRel = nRightSpace ? text::RelOrientation::PRINT_AREA : text::RelOrientation::FRAME;
    2079                 :          0 :             eSurround = SURROUND_LEFT;
    2080                 :            :         }
    2081                 :            :         else
    2082                 :            :         {
    2083                 :          0 :             eHoriOri = text::HoriOrientation::LEFT;
    2084         [ #  # ]:          0 :             eHoriRel = nLeftSpace ? text::RelOrientation::PRINT_AREA : text::RelOrientation::FRAME;
    2085                 :          0 :             eSurround = SURROUND_RIGHT;
    2086                 :            :         }
    2087                 :            :     }
    2088         [ #  # ]:          0 :     rFrmItemSet.Put( aAnchor );
    2089                 :            : 
    2090                 :            :     // Absolut Positioniert mit Durchlauf
    2091 [ #  # ][ #  # ]:          0 :     rFrmItemSet.Put( SwFmtHoriOrient( nHoriPos, eHoriOri, eHoriRel ) );
                 [ #  # ]
    2092 [ #  # ][ #  # ]:          0 :     rFrmItemSet.Put( SwFmtVertOrient( nVertPos, eVertOri, eVertRel ) );
                 [ #  # ]
    2093 [ #  # ][ #  # ]:          0 :     rFrmItemSet.Put( SwFmtSurround( eSurround ) );
         [ #  # ][ #  # ]
    2094                 :          0 : }
    2095                 :            : 
    2096                 :          0 : void SwHTMLParser::SetVarSize( SfxItemSet & /*rItemSet*/,
    2097                 :            :                                SvxCSS1PropertyInfo &rPropInfo,
    2098                 :            :                                SfxItemSet &rFrmItemSet,
    2099                 :            :                                SwTwips nDfltWidth, sal_uInt8 nDfltPrcWidth )
    2100                 :            : {
    2101                 :          0 :     SwFrmSize eSize = ATT_MIN_SIZE;
    2102                 :          0 :     SwTwips nWidth = nDfltWidth, nHeight = MINFLY;
    2103                 :          0 :     sal_uInt8 nPrcWidth = nDfltPrcWidth, nPrcHeight = 0;
    2104      [ #  #  # ]:          0 :     switch( rPropInfo.eWidthType )
    2105                 :            :     {
    2106                 :            :     case SVX_CSS1_LTYPE_PERCENTAGE:
    2107         [ #  # ]:          0 :         nPrcWidth = rPropInfo.nWidth > 0 ? (sal_uInt8)rPropInfo.nWidth : 1;
    2108                 :          0 :         nWidth = MINFLY;
    2109                 :          0 :         break;
    2110                 :            :     case SVX_CSS1_LTYPE_TWIP:
    2111                 :          0 :         nWidth = rPropInfo.nWidth > MINFLY ? rPropInfo.nWidth : MINFLY;
    2112                 :          0 :         nPrcWidth = 0;
    2113                 :          0 :         break;
    2114                 :            :     default:
    2115                 :            :         ;
    2116                 :            :     }
    2117      [ #  #  # ]:          0 :     switch( rPropInfo.eHeightType )
    2118                 :            :     {
    2119                 :            :     case SVX_CSS1_LTYPE_PERCENTAGE:
    2120         [ #  # ]:          0 :         nPrcHeight = rPropInfo.nHeight > 0 ? (sal_uInt8)rPropInfo.nHeight : 1;
    2121                 :          0 :         break;
    2122                 :            :     case SVX_CSS1_LTYPE_TWIP:
    2123                 :            :         // Netscape und MS-IE interpretieren die Hoehe regelwiedrig
    2124                 :            :         // als Mindest-Hoehe, also machwn wir das auch so.
    2125                 :          0 :         nHeight = rPropInfo.nHeight > MINFLY ? rPropInfo.nHeight : MINFLY;
    2126                 :          0 :         break;
    2127                 :            :     default:
    2128                 :            :         ;
    2129                 :            :     }
    2130                 :            : 
    2131         [ #  # ]:          0 :     SwFmtFrmSize aFrmSize( eSize, nWidth, nHeight );
    2132                 :          0 :     aFrmSize.SetWidthPercent( nPrcWidth );
    2133                 :          0 :     aFrmSize.SetHeightPercent( nPrcHeight );
    2134 [ #  # ][ #  # ]:          0 :     rFrmItemSet.Put( aFrmSize );
    2135                 :          0 : }
    2136                 :            : 
    2137                 :          0 : void SwHTMLParser::SetFrmFmtAttrs( SfxItemSet &rItemSet,
    2138                 :            :                                    SvxCSS1PropertyInfo & /*rPropInfo*/,
    2139                 :            :                                    sal_uInt16 nFlags,
    2140                 :            :                                    SfxItemSet &rFrmItemSet )
    2141                 :            : {
    2142                 :            :     const SfxPoolItem *pItem;
    2143 [ #  # ][ #  # ]:          0 :     if( (nFlags & HTML_FF_BOX) != 0 &&
                 [ #  # ]
    2144         [ #  # ]:          0 :         SFX_ITEM_SET==rItemSet.GetItemState( RES_BOX, sal_True, &pItem ) )
    2145                 :            :     {
    2146         [ #  # ]:          0 :         if( (nFlags & HTML_FF_PADDING) == 0 )
    2147                 :            :         {
    2148         [ #  # ]:          0 :             SvxBoxItem aBoxItem( *(const SvxBoxItem *)pItem );
    2149                 :            :             // Alle 4 Seiten gleichzeitig auf 0 setzen
    2150                 :          0 :             aBoxItem.SetDistance( 0 );
    2151 [ #  # ][ #  # ]:          0 :             rFrmItemSet.Put( aBoxItem );
    2152                 :            :         }
    2153                 :            :         else
    2154                 :            :         {
    2155         [ #  # ]:          0 :             rFrmItemSet.Put( *pItem );
    2156                 :            :         }
    2157         [ #  # ]:          0 :         rItemSet.ClearItem( RES_BOX );
    2158                 :            :     }
    2159                 :            : 
    2160 [ #  # ][ #  # ]:          0 :     if( (nFlags & HTML_FF_BACKGROUND) != 0 &&
                 [ #  # ]
    2161         [ #  # ]:          0 :         SFX_ITEM_SET==rItemSet.GetItemState( RES_BACKGROUND, sal_True, &pItem ) )
    2162                 :            :     {
    2163         [ #  # ]:          0 :         rFrmItemSet.Put( *pItem );
    2164         [ #  # ]:          0 :         rItemSet.ClearItem( RES_BACKGROUND );
    2165                 :            :     }
    2166                 :            : 
    2167 [ #  # ][ #  # ]:          0 :     if( (nFlags & HTML_FF_DIRECTION) != 0 &&
                 [ #  # ]
    2168         [ #  # ]:          0 :         SFX_ITEM_SET==rItemSet.GetItemState( RES_FRAMEDIR, sal_True, &pItem ) )
    2169                 :            :     {
    2170         [ #  # ]:          0 :         rFrmItemSet.Put( *pItem );
    2171         [ #  # ]:          0 :         rItemSet.ClearItem( RES_FRAMEDIR );
    2172                 :            :     }
    2173                 :          0 : }
    2174                 :            : 
    2175                 :            : 
    2176                 :            : 
    2177                 :          2 : _HTMLAttrContext *SwHTMLParser::PopContext( sal_uInt16 nToken, sal_uInt16 nLimit,
    2178                 :            :                                             sal_Bool bRemove )
    2179                 :            : {
    2180                 :          2 :     sal_uInt16 nPos = aContexts.size();
    2181         [ -  + ]:          2 :     if( nPos <= nContextStMin )
    2182                 :          0 :         return 0;
    2183                 :            : 
    2184                 :          2 :     sal_Bool bFound = 0==nToken;
    2185         [ +  - ]:          2 :     if( nToken )
    2186                 :            :     {
    2187                 :            :         // Stack-Eintrag zu dem Token suchen
    2188         [ +  - ]:          4 :         while( nPos > nContextStMin )
    2189                 :            :         {
    2190                 :          2 :             sal_uInt16 nCntxtToken = aContexts[--nPos]->GetToken();
    2191         [ +  - ]:          2 :             if( nCntxtToken == nToken )
    2192                 :            :             {
    2193                 :          2 :                 bFound = sal_True;
    2194                 :          2 :                 break;
    2195                 :            :             }
    2196         [ #  # ]:          0 :             else if( nCntxtToken == nLimit ) // 0 als Token kommt nicht vor
    2197                 :            :             {
    2198                 :          0 :                 break;
    2199                 :            :             }
    2200                 :            :         }
    2201                 :            :     }
    2202                 :            :     else
    2203                 :            :     {
    2204                 :          0 :         nPos--;
    2205                 :            :     }
    2206                 :            : 
    2207                 :          2 :     _HTMLAttrContext *pCntxt = 0;
    2208         [ +  - ]:          2 :     if( bFound )
    2209                 :            :     {
    2210                 :          2 :         pCntxt = aContexts[nPos];
    2211         [ +  - ]:          2 :         if( bRemove )
    2212 [ +  - ][ +  - ]:          2 :             aContexts.erase( aContexts.begin() + nPos );
    2213                 :            :     }
    2214                 :            : 
    2215                 :          2 :     return pCntxt;
    2216                 :            : }
    2217                 :            : 
    2218                 :          0 : sal_Bool SwHTMLParser::GetMarginsFromContext( sal_uInt16& nLeft,
    2219                 :            :                                           sal_uInt16& nRight,
    2220                 :            :                                           short& nIndent,
    2221                 :            :                                           sal_Bool bIgnoreTopContext ) const
    2222                 :            : {
    2223                 :          0 :     sal_uInt16 nPos = aContexts.size();
    2224         [ #  # ]:          0 :     if( bIgnoreTopContext )
    2225                 :            :     {
    2226         [ #  # ]:          0 :         if( !nPos )
    2227                 :          0 :             return sal_False;
    2228                 :            :         else
    2229                 :          0 :             nPos--;
    2230                 :            :     }
    2231                 :            : 
    2232         [ #  # ]:          0 :     while( nPos > nContextStAttrMin )
    2233                 :            :     {
    2234                 :          0 :         const _HTMLAttrContext *pCntxt = aContexts[--nPos];
    2235         [ #  # ]:          0 :         if( pCntxt->IsLRSpaceChanged() )
    2236                 :            :         {
    2237                 :          0 :             pCntxt->GetMargins( nLeft, nRight, nIndent );
    2238                 :          0 :             return sal_True;
    2239                 :            :         }
    2240                 :            :     }
    2241                 :            : 
    2242                 :          0 :     return sal_False;
    2243                 :            : }
    2244                 :            : 
    2245                 :          0 : sal_Bool SwHTMLParser::GetMarginsFromContextWithNumBul( sal_uInt16& nLeft,
    2246                 :            :                                                     sal_uInt16& nRight,
    2247                 :            :                                                     short& nIndent ) const
    2248                 :            : {
    2249                 :          0 :     sal_Bool bRet = GetMarginsFromContext( nLeft, nRight, nIndent );
    2250                 :          0 :     const SwHTMLNumRuleInfo& rInfo = ((SwHTMLParser*)this)->GetNumInfo();
    2251         [ #  # ]:          0 :     if( rInfo.GetDepth() )
    2252                 :            :     {
    2253                 :          0 :         sal_uInt8 nLevel = (sal_uInt8)( (rInfo.GetDepth() <= MAXLEVEL ? rInfo.GetDepth()
    2254         [ #  # ]:          0 :                                                             : MAXLEVEL) - 1 );
    2255                 :          0 :         const SwNumFmt& rNumFmt = rInfo.GetNumRule()->Get(nLevel);
    2256                 :          0 :         nLeft = nLeft + rNumFmt.GetAbsLSpace();
    2257                 :          0 :         nIndent = rNumFmt.GetFirstLineOffset();
    2258                 :            :     }
    2259                 :            : 
    2260                 :          0 :     return bRet;
    2261                 :            : }
    2262                 :            : 
    2263                 :          0 : void SwHTMLParser::GetULSpaceFromContext( sal_uInt16& nUpper,
    2264                 :            :                                           sal_uInt16& nLower ) const
    2265                 :            : {
    2266                 :          0 :     sal_uInt16 nDfltColl = 0;
    2267         [ #  # ]:          0 :     String aDfltClass;
    2268                 :            : 
    2269                 :          0 :     sal_uInt16 nPos = aContexts.size();
    2270         [ #  # ]:          0 :     while( nPos > nContextStAttrMin )
    2271                 :            :     {
    2272                 :          0 :         const _HTMLAttrContext *pCntxt = aContexts[--nPos];
    2273         [ #  # ]:          0 :         if( pCntxt->IsULSpaceChanged() )
    2274                 :            :         {
    2275                 :          0 :             pCntxt->GetULSpace( nUpper, nLower );
    2276                 :          0 :             return;
    2277                 :            :         }
    2278         [ #  # ]:          0 :         else if( !nDfltColl )
    2279                 :            :         {
    2280                 :          0 :             nDfltColl = pCntxt->GetDfltTxtFmtColl();
    2281         [ #  # ]:          0 :             if( nDfltColl )
    2282         [ #  # ]:          0 :                 aDfltClass = pCntxt->GetClass();
    2283                 :            :         }
    2284                 :            :     }
    2285                 :            : 
    2286         [ #  # ]:          0 :     if( !nDfltColl )
    2287                 :          0 :         nDfltColl = RES_POOLCOLL_TEXT;
    2288                 :            : 
    2289                 :            :     const SwTxtFmtColl *pColl =
    2290         [ #  # ]:          0 :         pCSS1Parser->GetTxtFmtColl( nDfltColl, aDfltClass );
    2291         [ #  # ]:          0 :     const SvxULSpaceItem& rULSpace = pColl->GetULSpace();
    2292                 :          0 :     nUpper = rULSpace.GetUpper();
    2293 [ #  # ][ #  # ]:          0 :     nLower = rULSpace.GetLower();
    2294                 :            : }
    2295                 :            : 
    2296                 :          0 : void SwHTMLParser::EndContextAttrs( _HTMLAttrContext *pContext, sal_Bool bRemove )
    2297                 :            : {
    2298                 :          0 :     _HTMLAttrs &rAttrs = pContext->GetAttrs();
    2299         [ #  # ]:          0 :     for( sal_uInt16 i=0; i<rAttrs.size(); i++ )
    2300                 :            :     {
    2301                 :          0 :         _HTMLAttr *pAttr = rAttrs[i];
    2302                 :            : 
    2303         [ #  # ]:          0 :         if( RES_PARATR_DROP==pAttr->GetItem().Which() )
    2304                 :            :         {
    2305                 :            :             // Fuer DropCaps noch die Anzahl der Zeichen anpassen. Wenn
    2306                 :            :             // es am Ende 0 sind, wird das Attribut invalidiert und dann
    2307                 :            :             // von _SetAttr gar nicht erst gesetzt.
    2308                 :          0 :             xub_StrLen nChars = pPam->GetPoint()->nContent.GetIndex();
    2309         [ #  # ]:          0 :             if( nChars < 1 )
    2310                 :          0 :                 pAttr->Invalidate();
    2311         [ #  # ]:          0 :             else if( nChars > MAX_DROPCAP_CHARS )
    2312                 :          0 :                 nChars = MAX_DROPCAP_CHARS;
    2313                 :          0 :             ((SwFmtDrop&)pAttr->GetItem()).GetChars() = (sal_uInt8)nChars;
    2314                 :            :         }
    2315                 :            : 
    2316                 :          0 :         EndAttr( pAttr );
    2317                 :            :     }
    2318                 :            : 
    2319 [ #  # ][ #  # ]:          0 :     if( bRemove && !rAttrs.empty() )
                 [ #  # ]
    2320                 :          0 :         rAttrs.clear();
    2321                 :          0 : }
    2322                 :            : 
    2323                 :          0 : void SwHTMLParser::InsertParaAttrs( const SfxItemSet& rItemSet )
    2324                 :            : {
    2325         [ #  # ]:          0 :     SfxItemIter aIter( rItemSet );
    2326                 :            : 
    2327                 :          0 :     const SfxPoolItem *pItem = aIter.FirstItem();
    2328         [ #  # ]:          0 :     while( pItem )
    2329                 :            :     {
    2330                 :            :         // den zu dem Item gehoehrenden Tabellen-Eintrag ermitteln ...
    2331                 :          0 :         sal_uInt16 nWhich = pItem->Which();
    2332                 :          0 :         _HTMLAttr **ppAttr = GetAttrTabEntry( nWhich );
    2333                 :            : 
    2334         [ #  # ]:          0 :         if( ppAttr )
    2335                 :            :         {
    2336         [ #  # ]:          0 :             NewAttr( ppAttr, *pItem );
    2337         [ #  # ]:          0 :             if( RES_PARATR_BEGIN > nWhich )
    2338                 :          0 :                 (*ppAttr)->SetLikePara();
    2339         [ #  # ]:          0 :             aParaAttrs.push_back( *ppAttr );
    2340         [ #  # ]:          0 :             EndAttr( *ppAttr, 0, sal_False );
    2341                 :            :         }
    2342                 :            : 
    2343         [ #  # ]:          0 :         pItem = aIter.NextItem();
    2344         [ #  # ]:          0 :     }
    2345                 :          0 : }
    2346                 :            : 
    2347                 :         12 : void lcl_swcss1_setEncoding( SwFmt& rFmt, rtl_TextEncoding eEnc )
    2348                 :            : {
    2349         [ +  - ]:         12 :     if( RTL_TEXTENCODING_DONTKNOW == eEnc )
    2350                 :         12 :         return;
    2351                 :            : 
    2352                 :         12 :     const SfxItemSet& rItemSet = rFmt.GetAttrSet();
    2353                 :            :     static sal_uInt16 aWhichIds[3] = { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT,
    2354                 :            :                                    RES_CHRATR_CTL_FONT };
    2355                 :            :     const SfxPoolItem *pItem;
    2356         [ +  + ]:         48 :     for( sal_uInt16 i=0; i<3; i++ )
    2357                 :            :     {
    2358 [ +  - ][ +  + ]:         36 :         if( SFX_ITEM_SET == rItemSet.GetItemState( aWhichIds[i], sal_False,&pItem ) )
    2359                 :            :         {
    2360                 :         12 :             const SvxFontItem& rFont = *(const SvxFontItem *)pItem;
    2361         [ +  - ]:         12 :             if( RTL_TEXTENCODING_SYMBOL != rFont.GetCharSet() )
    2362                 :            :             {
    2363                 :         12 :                 SvxFontItem aFont( rFont.GetFamily(), rFont.GetFamilyName(),
    2364                 :         12 :                                    rFont.GetStyleName(), rFont.GetPitch(),
    2365         [ +  - ]:         24 :                                    eEnc, aWhichIds[i]);
    2366 [ +  - ][ +  - ]:         12 :                 rFmt.SetFmtAttr( aFont );
    2367                 :            :             }
    2368                 :            :         }
    2369                 :            :     }
    2370                 :            : }
    2371                 :            : 
    2372                 :          2 : void SwCSS1Parser::SetDfltEncoding( rtl_TextEncoding eEnc )
    2373                 :            : {
    2374         [ +  - ]:          2 :     if( eEnc != GetDfltEncoding() )
    2375                 :            :     {
    2376         [ +  - ]:          2 :         if( bIsNewDoc )
    2377                 :            :         {
    2378                 :            :             // Set new encoding as pool default
    2379                 :            :             static sal_uInt16 aWhichIds[3] = { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT,
    2380                 :            :                                            RES_CHRATR_CTL_FONT };
    2381                 :            :             sal_uInt16 i;
    2382         [ +  + ]:          8 :             for( i=0; i<3; i++ )
    2383                 :            :             {
    2384                 :            :                 const SvxFontItem& rDfltFont =
    2385         [ +  - ]:          6 :                     (const SvxFontItem&)pDoc->GetDefault( aWhichIds[i]);
    2386                 :            :                 SvxFontItem aFont( rDfltFont.GetFamily(),
    2387                 :          6 :                                    rDfltFont.GetFamilyName(),
    2388                 :          6 :                                    rDfltFont.GetStyleName(),
    2389                 :            :                                    rDfltFont.GetPitch(),
    2390         [ +  - ]:         12 :                                    eEnc, aWhichIds[i] );
    2391         [ +  - ]:          6 :                 pDoc->SetDefault( aFont );
    2392         [ +  - ]:          6 :             }
    2393                 :            : 
    2394                 :            :             // Change all paragraph styles that do specify a font.
    2395                 :          2 :             sal_uInt16 nArrLen = pDoc->GetTxtFmtColls()->size();
    2396         [ +  + ]:         14 :             for( i=1; i<nArrLen; i++ )
    2397                 :         12 :                 lcl_swcss1_setEncoding( *(*pDoc->GetTxtFmtColls())[i], eEnc );
    2398                 :            : 
    2399                 :            :             // Change all character styles that do specify a font.
    2400                 :          2 :             nArrLen = pDoc->GetCharFmts()->size();
    2401         [ -  + ]:          2 :             for( i=1; i<nArrLen; i++ )
    2402                 :          0 :                 lcl_swcss1_setEncoding( *(*pDoc->GetCharFmts())[i], eEnc );
    2403                 :            :         }
    2404                 :            : 
    2405                 :          2 :         SvxCSS1Parser::SetDfltEncoding( eEnc );
    2406                 :            :     }
    2407 [ +  - ][ +  - ]:        221 : }
    2408                 :            : 
    2409                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10