LCOV - code coverage report
Current view: top level - sw/source/filter/ww8 - ww8par6.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1365 2178 62.7 %
Date: 2012-08-25 Functions: 116 144 80.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1084 2794 38.8 %

           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 <stdlib.h>
      30                 :            : #include <svl/itemiter.hxx>
      31                 :            : #include <rtl/tencinfo.h>
      32                 :            : 
      33                 :            : 
      34                 :            : #include <hintids.hxx>
      35                 :            : #include <editeng/lspcitem.hxx>
      36                 :            : #include <editeng/wrlmitem.hxx>
      37                 :            : #include <editeng/udlnitem.hxx>
      38                 :            : #include <editeng/kernitem.hxx>
      39                 :            : #include <editeng/langitem.hxx>
      40                 :            : #include <editeng/cmapitem.hxx>
      41                 :            : #include <editeng/shdditem.hxx>
      42                 :            : #include <editeng/cntritem.hxx>
      43                 :            : #include <editeng/crsditem.hxx>
      44                 :            : #include <editeng/postitem.hxx>
      45                 :            : #include <editeng/wghtitem.hxx>
      46                 :            : #include <editeng/colritem.hxx>
      47                 :            : #include <editeng/brshitem.hxx>
      48                 :            : #include <editeng/spltitem.hxx>
      49                 :            : #include <editeng/keepitem.hxx>
      50                 :            : #include <editeng/orphitem.hxx>
      51                 :            : #include <editeng/widwitem.hxx>
      52                 :            : #include <editeng/adjitem.hxx>
      53                 :            : #include <editeng/escpitem.hxx>
      54                 :            : #include <editeng/fhgtitem.hxx>
      55                 :            : #include <editeng/fontitem.hxx>
      56                 :            : #include <editeng/shaditem.hxx>
      57                 :            : #include <editeng/boxitem.hxx>
      58                 :            : #include <editeng/ulspitem.hxx>
      59                 :            : #include <editeng/lrspitem.hxx>
      60                 :            : #include <editeng/tstpitem.hxx>
      61                 :            : #include <editeng/akrnitem.hxx>
      62                 :            : #include <editeng/paperinf.hxx>
      63                 :            : #include <editeng/emphitem.hxx>
      64                 :            : #include <editeng/forbiddenruleitem.hxx>
      65                 :            : #include <editeng/twolinesitem.hxx>
      66                 :            : #include <editeng/scriptspaceitem.hxx>
      67                 :            : #include <editeng/hngpnctitem.hxx>
      68                 :            : #include <editeng/pbinitem.hxx>
      69                 :            : #include <editeng/charscaleitem.hxx>
      70                 :            : #include <editeng/charrotateitem.hxx>
      71                 :            : #include <editeng/charreliefitem.hxx>
      72                 :            : #include <editeng/blnkitem.hxx>
      73                 :            : #include <editeng/hyznitem.hxx>
      74                 :            : #include <editeng/paravertalignitem.hxx>
      75                 :            : #include <editeng/pgrditem.hxx>
      76                 :            : #include <editeng/frmdiritem.hxx>
      77                 :            : #include <editeng/charhiddenitem.hxx>
      78                 :            : #include <i18npool/mslangid.hxx>
      79                 :            : #include <fmtpdsc.hxx>
      80                 :            : #include <node.hxx>
      81                 :            : #include <ndtxt.hxx> // SwTxtNode, siehe unten: JoinNode()
      82                 :            : #include <pam.hxx>              // fuer SwPam
      83                 :            : #include <doc.hxx>
      84                 :            : #include <pagedesc.hxx>         // class SwPageDesc
      85                 :            : #include <fmtanchr.hxx>
      86                 :            : #include <fmtcntnt.hxx>
      87                 :            : #include <fchrfmt.hxx>
      88                 :            : #include <fmthdft.hxx>
      89                 :            : #include <fmtclds.hxx>
      90                 :            : #include <fmtftntx.hxx>
      91                 :            : #include <frmatr.hxx>
      92                 :            : #include <section.hxx>
      93                 :            : #include <lineinfo.hxx>
      94                 :            : #include <fmtline.hxx>
      95                 :            : #include <txatbase.hxx>
      96                 :            : #include <fmtflcnt.hxx>
      97                 :            : #include <fmtclbl.hxx>
      98                 :            : #include <tgrditem.hxx>
      99                 :            : #include <hfspacingitem.hxx>
     100                 :            : #include <swtable.hxx>
     101                 :            : #include <fltini.hxx>   //For CalculateFlySize
     102                 :            : #include "writerhelper.hxx"
     103                 :            : #include "writerwordglue.hxx"
     104                 :            : #include "ww8scan.hxx"
     105                 :            : #include "ww8par2.hxx"          // class WW8RStyle, class WwAnchorPara
     106                 :            : #include "ww8graf.hxx"
     107                 :            : 
     108                 :            : // #i27767#
     109                 :            : #include <fmtwrapinfluenceonobjpos.hxx>
     110                 :            : 
     111                 :            : using namespace sw::util;
     112                 :            : using namespace sw::types;
     113                 :            : using namespace ::com::sun::star;
     114                 :            : using namespace nsHdFtFlags;
     115                 :            : 
     116                 :            : //-----------------------------------------
     117                 :            : //              diverses
     118                 :            : //-----------------------------------------
     119                 :            : 
     120                 :            : #define MM_250 1417             // WW-Default fuer Hor. Seitenraender: 2.5 cm
     121                 :            : #define MM_200 1134             // WW-Default fuer u.Seitenrand: 2.0 cm
     122                 :            : 
     123                 :            : 
     124                 :            : sal_uInt8 lcl_ReadBorders(bool bVer67, WW8_BRC* brc, WW8PLCFx_Cp_FKP* pPap,
     125                 :            :     const WW8RStyle* pSty = 0, const WW8PLCFx_SEPX* pSep = 0);
     126                 :            : 
     127                 :            : 
     128                 :       1983 : ColorData SwWW8ImplReader::GetCol(sal_uInt8 nIco)
     129                 :            : {
     130                 :            :     static const ColorData eSwWW8ColA[] =
     131                 :            :     {
     132                 :            :         COL_AUTO, COL_BLACK, COL_LIGHTBLUE, COL_LIGHTCYAN, COL_LIGHTGREEN,
     133                 :            :         COL_LIGHTMAGENTA, COL_LIGHTRED, COL_YELLOW, COL_WHITE, COL_BLUE,
     134                 :            :         COL_CYAN, COL_GREEN, COL_MAGENTA, COL_RED, COL_BROWN, COL_GRAY,
     135                 :            :         COL_LIGHTGRAY
     136                 :            :     };
     137                 :            : 
     138                 :       1983 :     return eSwWW8ColA[nIco];
     139                 :            : }
     140                 :            : 
     141                 :        222 : inline sal_uInt32 MSRoundTweak(sal_uInt32 x)
     142                 :            : {
     143                 :        222 :     return x;
     144                 :            : }
     145                 :            : 
     146                 :            : /***************************************************************************
     147                 :            : #  Seiten - Attribute, die nicht ueber die Attribut-Verwaltung, sondern
     148                 :            : #   ueber ...->HasSprm abgearbeitet werden
     149                 :            : #   ( ausser OLST, dass weiterhin ein normales Attribut ist )
     150                 :            : #**************************************************************************/
     151                 :            : 
     152                 :        444 : static short ReadSprm( const WW8PLCFx_SEPX* pSep, sal_uInt16 nId, short nDefaultVal )
     153                 :            : {
     154                 :        444 :     const sal_uInt8* pS = pSep->HasSprm( nId );          // sprm da ?
     155         [ +  + ]:        444 :     short nVal = ( pS ) ? SVBT16ToShort( pS ) : nDefaultVal;
     156                 :        444 :     return nVal;
     157                 :            : }
     158                 :            : 
     159                 :       1332 : static sal_uInt16 ReadUSprm( const WW8PLCFx_SEPX* pSep, sal_uInt16 nId, short nDefaultVal )
     160                 :            : {
     161                 :       1332 :     const sal_uInt8* pS = pSep->HasSprm( nId );          // sprm da ?
     162         [ +  + ]:       1332 :     sal_uInt16 nVal = ( pS ) ? SVBT16ToShort( pS ) : nDefaultVal;
     163                 :       1332 :     return nVal;
     164                 :            : }
     165                 :            : 
     166                 :        999 : static sal_uInt8 ReadBSprm( const WW8PLCFx_SEPX* pSep, sal_uInt16 nId, sal_uInt8 nDefaultVal )
     167                 :            : {
     168                 :        999 :     const sal_uInt8* pS = pSep->HasSprm( nId );          // sprm da ?
     169         [ +  + ]:        999 :     sal_uInt8 nVal = ( pS ) ? SVBT8ToByte( pS ) : nDefaultVal;
     170                 :        999 :     return nVal;
     171                 :            : }
     172                 :            : 
     173                 :        111 : void wwSection::SetDirection()
     174                 :            : {
     175                 :            :     //sprmSTextFlow
     176   [ +  -  -  -  :        111 :     switch (maSep.wTextFlow)
                      - ]
     177                 :            :     {
     178                 :            :         default:
     179                 :            :             OSL_ENSURE(!this, "Unknown layout type");
     180                 :            :         case 0:
     181                 :        111 :             meDir=FRMDIR_HORI_LEFT_TOP;
     182                 :        111 :             break;
     183                 :            :         case 1:
     184                 :          0 :             meDir=FRMDIR_VERT_TOP_RIGHT;
     185                 :          0 :             break;
     186                 :            :         case 2:
     187                 :            :             //asian letters are not rotated, western are. We can't import
     188                 :            :             //bottom to top going left to right, we can't do this in
     189                 :            :             //pages, (in drawboxes we could partly hack it with a rotated
     190                 :            :             //drawing box, though not frame)
     191                 :          0 :             meDir=FRMDIR_VERT_TOP_RIGHT;
     192                 :          0 :             break;
     193                 :            :         case 3:
     194                 :            :             //asian letters are not rotated, western are. We can't import
     195                 :          0 :             meDir=FRMDIR_VERT_TOP_RIGHT;
     196                 :          0 :             break;
     197                 :            :         case 4:
     198                 :            :             //asian letters are rotated, western not. We can't import
     199                 :          0 :             meDir=FRMDIR_HORI_LEFT_TOP;
     200                 :          0 :             break;
     201                 :            :     }
     202                 :            : 
     203                 :        111 :     sal_uInt8 nRTLPgn = maSep.fBiDi;
     204 [ +  - ][ -  + ]:        111 :     if ((meDir == FRMDIR_HORI_LEFT_TOP) && nRTLPgn)
     205                 :          0 :         meDir = FRMDIR_HORI_RIGHT_TOP;
     206                 :        111 : }
     207                 :            : 
     208                 :        342 : bool wwSection::IsVertical() const
     209                 :            : {
     210 [ +  - ][ -  + ]:        342 :     if (meDir == FRMDIR_VERT_TOP_RIGHT || meDir == FRMDIR_VERT_TOP_LEFT)
     211                 :          0 :         return true;
     212                 :        342 :     return false;
     213                 :            : }
     214                 :            : 
     215                 :            : /*
     216                 :            :   This is something of festering mapping, I'm open to better ways of doing it,
     217                 :            :   but primarily the grid in writer is different to that in word. In writer the
     218                 :            :   grid elements are squares with ruby rows inbetween. While in word there is no
     219                 :            :   ruby stuff, and the elements are rectangles. By misusing the ruby row I can
     220                 :            :   handle distortions in one direction, but its all a bit of a mess:
     221                 :            : */
     222                 :        324 : void SwWW8ImplReader::SetDocumentGrid(SwFrmFmt &rFmt, const wwSection &rSection)
     223                 :            : {
     224         [ +  - ]:        324 :     if (bVer67)
     225                 :        324 :         return;
     226                 :            : 
     227 [ +  - ][ +  - ]:        324 :     rFmt.SetFmtAttr(SvxFrameDirectionItem(rSection.meDir, RES_FRAMEDIR));
                 [ +  - ]
     228                 :            : 
     229         [ +  - ]:        324 :     SwTwips nTextareaHeight = rFmt.GetFrmSize().GetHeight();
     230         [ +  - ]:        324 :     const SvxULSpaceItem &rUL = ItemGet<SvxULSpaceItem>(rFmt, RES_UL_SPACE);
     231                 :        324 :     nTextareaHeight -= rUL.GetUpper();
     232                 :        324 :     nTextareaHeight -= rUL.GetLower();
     233                 :            : 
     234         [ +  - ]:        324 :     SwTwips nTextareaWidth = rFmt.GetFrmSize().GetWidth();
     235         [ +  - ]:        324 :     const SvxLRSpaceItem &rLR = ItemGet<SvxLRSpaceItem>(rFmt, RES_LR_SPACE);
     236                 :        324 :     nTextareaWidth -= rLR.GetLeft();
     237                 :        324 :     nTextareaWidth -= rLR.GetRight();
     238                 :            : 
     239         [ -  + ]:        324 :     if (rSection.IsVertical())
     240                 :          0 :         std::swap(nTextareaHeight, nTextareaWidth);
     241                 :            : 
     242         [ +  - ]:        324 :     SwTextGridItem aGrid;
     243                 :        324 :     aGrid.SetDisplayGrid(false);
     244                 :        324 :     aGrid.SetPrintGrid(false);
     245                 :        324 :     SwTextGrid eType=GRID_NONE;
     246                 :            : 
     247   [ +  -  -  - ]:        324 :     switch (rSection.maSep.clm)
     248                 :            :     {
     249                 :            :         case 0:
     250                 :        324 :             eType = GRID_NONE;
     251                 :        324 :             break;
     252                 :            :         default:
     253                 :            :             OSL_ENSURE(!this, "Unknown grid type");
     254                 :            :         case 3:
     255                 :          0 :             eType = GRID_LINES_CHARS;
     256                 :          0 :             aGrid.SetSnapToChars(sal_True);
     257                 :          0 :             break;
     258                 :            :         case 1:
     259                 :          0 :             eType = GRID_LINES_CHARS;
     260                 :          0 :             aGrid.SetSnapToChars(sal_False);
     261                 :          0 :             break;
     262                 :            :         case 2:
     263                 :          0 :             eType = GRID_LINES_ONLY;
     264                 :          0 :             break;
     265                 :            :     }
     266                 :            : 
     267                 :        324 :     aGrid.SetGridType(eType);
     268                 :            : 
     269                 :            :     // seem to not add external leading in word, or the character would run across
     270                 :            :     // two line in some cases.
     271         [ -  + ]:        324 :     if (eType != GRID_NONE)
     272         [ #  # ]:          0 :         rDoc.set(IDocumentSettingAccess::ADD_EXT_LEADING, false);
     273                 :            : 
     274                 :            :     //force to set document as standard page mode
     275                 :        324 :     sal_Bool bSquaredMode = sal_False;
     276         [ +  - ]:        324 :     rDoc.SetDefaultPageMode( bSquaredMode );
     277                 :        324 :     aGrid.SetSquaredMode( bSquaredMode );
     278                 :            : 
     279                 :            :     //Get the size of word's default styles font
     280                 :        324 :     sal_uInt32 nCharWidth=240;
     281         [ +  - ]:        324 :     for (sal_uInt16 nI = 0; nI < pStyles->GetCount(); ++nI)
     282                 :            :     {
     283         [ +  - ]:        648 :         if (vColl[nI].bValid && vColl[nI].pFmt &&
           [ +  -  +  - ]
                 [ +  - ]
     284                 :        324 :             vColl[nI].GetWWStyleId() == 0)
     285                 :            :         {
     286                 :        324 :             nCharWidth = ItemGet<SvxFontHeightItem>(*(vColl[nI].pFmt),
     287         [ +  - ]:        324 :                 RES_CHRATR_CJK_FONTSIZE).GetHeight();
     288                 :        324 :             break;
     289                 :            :         }
     290                 :            :     }
     291                 :            : 
     292                 :            :     //dxtCharSpace
     293         [ +  + ]:        324 :     if (rSection.maSep.dxtCharSpace)
     294                 :            :     {
     295                 :          9 :         sal_uInt32 nCharSpace = rSection.maSep.dxtCharSpace;
     296                 :            :         //main lives in top 20 bits, and is signed.
     297                 :          9 :         sal_Int32 nMain = (nCharSpace & 0xFFFFF000);
     298                 :          9 :         nMain/=0x1000;
     299                 :          9 :         nCharWidth += nMain*20;
     300                 :            : 
     301                 :          9 :         int nFraction = (nCharSpace & 0x00000FFF);
     302                 :          9 :         nFraction = (nFraction*20)/0xFFF;
     303                 :          9 :         nCharWidth += nFraction;
     304                 :            :     }
     305                 :            : 
     306         [ +  - ]:        324 :     aGrid.SetBaseWidth( writer_cast<sal_uInt16>(nCharWidth));
     307                 :            : 
     308                 :            :     //sep.dyaLinePitch
     309                 :        324 :     sal_Int32 nLinePitch = rSection.maSep.dyaLinePitch;
     310 [ +  - ][ +  + ]:        324 :     if (nLinePitch >= 1 && nLinePitch <= 31680)
     311                 :            :     {
     312         [ +  - ]:        315 :         aGrid.SetLines(writer_cast<sal_uInt16>(nTextareaHeight/nLinePitch));
     313         [ +  - ]:        315 :         aGrid.SetBaseHeight(writer_cast<sal_uInt16>(nLinePitch));
     314                 :            :     }
     315                 :            : 
     316                 :        324 :     sal_Int32 nRubyHeight = 0;
     317         [ +  - ]:        324 :     aGrid.SetRubyHeight(writer_cast<sal_uInt16>(nRubyHeight));
     318                 :            : 
     319 [ +  - ][ +  - ]:        324 :     rFmt.SetFmtAttr(aGrid);
     320                 :            : }
     321                 :            : 
     322                 :         12 : void SwWW8ImplReader::Read_ParaBiDi(sal_uInt16, const sal_uInt8* pData, short nLen)
     323                 :            : {
     324         [ -  + ]:         12 :     if( nLen < 0 )
     325                 :          0 :         pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_FRAMEDIR);
     326                 :            :     else
     327                 :            :     {
     328                 :            :         SvxFrameDirection eDir =
     329         [ -  + ]:         12 :             *pData ? FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP;
     330         [ +  - ]:         12 :         NewAttr(SvxFrameDirectionItem(eDir, RES_FRAMEDIR));
     331                 :            :     }
     332                 :         12 : }
     333                 :            : 
     334                 :        324 : bool wwSectionManager::SetCols(SwFrmFmt &rFmt, const wwSection &rSection,
     335                 :            :     sal_uInt32 nNettoWidth) const
     336                 :            : {
     337                 :            :     //sprmSCcolumns - number of columns - 1
     338                 :        324 :     const sal_Int16 nCols = rSection.NoCols();
     339                 :            : 
     340         [ +  + ]:        324 :     if (nCols < 2)          //check for no columns or other wierd state
     341                 :        315 :         return false;
     342                 :            : 
     343         [ +  - ]:          9 :     SwFmtCol aCol;                      // Create SwFmtCol
     344                 :            : 
     345                 :            :     //sprmSDxaColumns   - Default distance is 1.25 cm
     346                 :          9 :     sal_Int32 nColSpace = rSection.StandardColSeperation();
     347                 :            : 
     348                 :          9 :     const SEPr& rSep = rSection.maSep;
     349                 :            : 
     350                 :            :     // sprmSLBetween
     351         [ -  + ]:          9 :     if (rSep.fLBetween)
     352                 :            :     {
     353                 :          0 :         aCol.SetLineAdj(COLADJ_TOP);      // Line
     354                 :          0 :         aCol.SetLineHeight(100);
     355                 :          0 :         aCol.SetLineColor(Color(COL_BLACK));
     356                 :          0 :         aCol.SetLineWidth(1);
     357                 :            :     }
     358                 :            : 
     359         [ +  - ]:          9 :     aCol.Init(nCols, writer_cast<sal_uInt16>(nColSpace),
     360 [ +  - ][ +  - ]:         18 :         writer_cast<sal_uInt16>(nNettoWidth));
     361                 :            : 
     362                 :            :     // sprmSFEvenlySpaced
     363         [ +  - ]:          9 :     if (!rSep.fEvenlySpaced)
     364                 :            :     {
     365                 :          9 :         aCol._SetOrtho(false);
     366                 :          9 :         const sal_uInt16 maxIdx = SAL_N_ELEMENTS(rSep.rgdxaColumnWidthSpacing);
     367 [ +  + ][ +  - ]:         27 :         for (sal_uInt16 i = 0, nIdx = 1; i < nCols && nIdx < maxIdx; i++, nIdx+=2 )
                 [ +  + ]
     368                 :            :         {
     369         [ +  - ]:         18 :             SwColumn* pCol = &aCol.GetColumns()[i];
     370                 :         18 :             const sal_Int32 nLeft = rSep.rgdxaColumnWidthSpacing[nIdx-1]/2;
     371                 :         18 :             const sal_Int32 nRight = rSep.rgdxaColumnWidthSpacing[nIdx+1]/2;
     372                 :         18 :             const sal_Int32 nWishWidth = rSep.rgdxaColumnWidthSpacing[nIdx]
     373                 :         36 :                 + nLeft + nRight;
     374         [ +  - ]:         18 :             pCol->SetWishWidth(writer_cast<sal_uInt16>(nWishWidth));
     375         [ +  - ]:         18 :             pCol->SetLeft(writer_cast<sal_uInt16>(nLeft));
     376         [ +  - ]:         18 :             pCol->SetRight(writer_cast<sal_uInt16>(nRight));
     377                 :            :         }
     378         [ +  - ]:          9 :         aCol.SetWishWidth(writer_cast<sal_uInt16>(nNettoWidth));
     379                 :            :     }
     380         [ +  - ]:          9 :     rFmt.SetFmtAttr(aCol);
     381         [ +  - ]:        324 :     return true;
     382                 :            : }
     383                 :            : 
     384                 :        111 : void wwSectionManager::SetLeftRight(wwSection &rSection)
     385                 :            : {
     386                 :            :     // 3. LR-Raender
     387                 :        111 :     sal_uInt32 nWWLe = MSRoundTweak(rSection.maSep.dxaLeft);
     388                 :        111 :     sal_uInt32 nWWRi = MSRoundTweak(rSection.maSep.dxaRight);
     389                 :        111 :     sal_uInt32 nWWGu = rSection.maSep.dzaGutter;
     390                 :            : 
     391                 :            :     /*
     392                 :            :     fRTLGutter is set if the gutter is on the right, the gutter is otherwise
     393                 :            :     placed on the left unless the global dop options are to put it on top, that
     394                 :            :     case is handled in GetPageULData.
     395                 :            :     */
     396         [ -  + ]:        111 :     if (rSection.maSep.fRTLGutter)
     397                 :          0 :         nWWRi += nWWGu;
     398         [ +  - ]:        111 :     else if (!mrReader.pWDop->iGutterPos)
     399                 :        111 :         nWWLe += nWWGu;
     400                 :            : 
     401                 :            :     // Left / Right
     402         [ -  + ]:        111 :     if ((rSection.nPgWidth - nWWLe - nWWRi) < MINLAY)
     403                 :            :     {
     404                 :            :         /*
     405                 :            :         There are some label templates which are "broken", they specify
     406                 :            :         margins which make no sense e.g. Left 16.10cm, Right 16.10cm. So the
     407                 :            :         space left between the margins is less than 0 In word the left margin
     408                 :            :         is honoured and if the right margin would be past the left margin is
     409                 :            :         left at the left margin position.
     410                 :            : 
     411                 :            :         Now this will work fine for importing, layout and exporting, *but* the
     412                 :            :         page layout dialog has a hardcoded minimum page width of 0.5cm so it
     413                 :            :         will report a different value than what is actually being used. i.e.
     414                 :            :         it will add up the values to give a wider page than is actually being
     415                 :            :         used.
     416                 :            :         */
     417                 :          0 :         nWWRi = rSection.nPgWidth - nWWLe - MINLAY;
     418                 :            :     }
     419                 :            : 
     420                 :        111 :     rSection.nPgLeft = nWWLe;
     421                 :        111 :     rSection.nPgRight = nWWRi;
     422                 :        111 : }
     423                 :            : 
     424                 :        324 : void wwSectionManager::SetPage(SwPageDesc &rInPageDesc, SwFrmFmt &rFmt,
     425                 :            :     const wwSection &rSection, bool bIgnoreCols) const
     426                 :            : {
     427                 :            :     // 1. Orientierung
     428                 :        324 :     rInPageDesc.SetLandscape(rSection.IsLandScape());
     429                 :            : 
     430                 :            :     // 2. Papiergroesse
     431 [ +  - ][ +  - ]:        324 :     SwFmtFrmSize aSz( rFmt.GetFrmSize() );
     432                 :        324 :     aSz.SetWidth(rSection.GetPageWidth());
     433         [ +  - ]:        324 :     aSz.SetHeight(SvxPaperInfo::GetSloppyPaperDimension(rSection.GetPageHeight()));
     434         [ +  - ]:        324 :     rFmt.SetFmtAttr(aSz);
     435                 :            : 
     436                 :            :     rFmt.SetFmtAttr(
     437 [ +  - ][ +  - ]:        324 :         SvxLRSpaceItem(rSection.GetPageLeft(), rSection.GetPageRight(), 0, 0, RES_LR_SPACE));
                 [ +  - ]
     438                 :            : 
     439         [ +  - ]:        324 :     if (!bIgnoreCols)
     440 [ +  - ][ +  - ]:        324 :         SetCols(rFmt, rSection, rSection.GetTextAreaWidth());
                 [ +  - ]
     441                 :        324 : }
     442                 :            : 
     443                 :          0 : sal_uInt16 lcl_MakeSafeNegativeSpacing(sal_uInt16 nIn)
     444                 :            : {
     445         [ #  # ]:          0 :     if (nIn > SHRT_MAX)
     446                 :          0 :         nIn = 0;
     447                 :          0 :     return nIn;
     448                 :            : }
     449                 :            : 
     450                 :        324 : void SwWW8ImplReader::SetPageBorder(SwFrmFmt &rFmt, const wwSection &rSection) const
     451                 :            : {
     452         [ -  + ]:        324 :     if (!IsBorder(rSection.brc))
     453                 :        324 :         return;
     454                 :            : 
     455         [ #  # ]:          0 :     SfxItemSet aSet(rFmt.GetAttrSet());
     456                 :          0 :     short aSizeArray[5]={0};
     457         [ #  # ]:          0 :     SetFlyBordersShadow(aSet, rSection.brc, &aSizeArray[0]);
     458 [ #  # ][ #  # ]:          0 :     SvxLRSpaceItem aLR(ItemGet<SvxLRSpaceItem>(aSet, RES_LR_SPACE));
     459 [ #  # ][ #  # ]:          0 :     SvxULSpaceItem aUL(ItemGet<SvxULSpaceItem>(aSet, RES_UL_SPACE));
     460                 :            : 
     461 [ #  # ][ #  # ]:          0 :     SvxBoxItem aBox(ItemGet<SvxBoxItem>(aSet, RES_BOX));
     462         [ #  # ]:          0 :     short aOriginalBottomMargin = aBox.GetDistance(BOX_LINE_BOTTOM);
     463                 :            : 
     464         [ #  # ]:          0 :     if (rSection.maSep.pgbOffsetFrom == 1)
     465                 :            :     {
     466                 :            :         sal_uInt16 nDist;
     467         [ #  # ]:          0 :         if (aBox.GetLeft())
     468                 :            :         {
     469         [ #  # ]:          0 :             nDist = aBox.GetDistance(BOX_LINE_LEFT);
     470         [ #  # ]:          0 :             aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aLR.GetLeft() - nDist)), BOX_LINE_LEFT);
     471                 :            :             aSizeArray[WW8_LEFT] =
     472         [ #  # ]:          0 :                 aSizeArray[WW8_LEFT] - nDist + aBox.GetDistance(BOX_LINE_LEFT);
     473                 :            :         }
     474                 :            : 
     475         [ #  # ]:          0 :         if (aBox.GetRight())
     476                 :            :         {
     477         [ #  # ]:          0 :             nDist = aBox.GetDistance(BOX_LINE_RIGHT);
     478         [ #  # ]:          0 :             aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aLR.GetRight() - nDist)), BOX_LINE_RIGHT);
     479                 :            :             aSizeArray[WW8_RIGHT] =
     480         [ #  # ]:          0 :                 aSizeArray[WW8_RIGHT] - nDist + aBox.GetDistance(BOX_LINE_RIGHT);
     481                 :            :         }
     482                 :            : 
     483         [ #  # ]:          0 :         if (aBox.GetTop())
     484                 :            :         {
     485         [ #  # ]:          0 :             nDist = aBox.GetDistance(BOX_LINE_TOP);
     486         [ #  # ]:          0 :             aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aUL.GetUpper() - nDist)), BOX_LINE_TOP);
     487                 :            :             aSizeArray[WW8_TOP] =
     488         [ #  # ]:          0 :                 aSizeArray[WW8_TOP] - nDist + aBox.GetDistance(BOX_LINE_TOP);
     489                 :            :         }
     490                 :            : 
     491         [ #  # ]:          0 :         if (aBox.GetBottom())
     492                 :            :         {
     493         [ #  # ]:          0 :             nDist = aBox.GetDistance(BOX_LINE_BOTTOM);
     494         [ #  # ]:          0 :             aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aUL.GetLower() - nDist)), BOX_LINE_BOTTOM);
     495                 :            :             aSizeArray[WW8_BOT] =
     496         [ #  # ]:          0 :                 aSizeArray[WW8_BOT] - nDist + aBox.GetDistance(BOX_LINE_BOTTOM);
     497                 :            :         }
     498                 :            : 
     499         [ #  # ]:          0 :         aSet.Put(aBox);
     500                 :            :     }
     501                 :            : 
     502         [ #  # ]:          0 :     if (aBox.GetLeft())
     503                 :          0 :         aLR.SetLeft(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aLR.GetLeft() - aSizeArray[WW8_LEFT])));
     504         [ #  # ]:          0 :     if (aBox.GetRight())
     505                 :          0 :         aLR.SetRight(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aLR.GetRight() - aSizeArray[WW8_RIGHT])));
     506         [ #  # ]:          0 :     if (aBox.GetTop())
     507                 :          0 :         aUL.SetUpper(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aUL.GetUpper() - aSizeArray[WW8_TOP])));
     508         [ #  # ]:          0 :     if (aBox.GetBottom())
     509                 :            :     {
     510                 :            :         //#i30088# and #i30074# - do a final sanity check on
     511                 :            :         //bottom value. Do not allow a resulting zero if bottom
     512                 :            :         //Border margin value was not originally zero.
     513         [ #  # ]:          0 :         if(aUL.GetLower() != 0)
     514                 :          0 :             aUL.SetLower(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aUL.GetLower() - aSizeArray[WW8_BOT])));
     515                 :            :         else
     516                 :          0 :             aUL.SetLower(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aOriginalBottomMargin - aSizeArray[WW8_BOT])));
     517                 :            :     }
     518                 :            : 
     519         [ #  # ]:          0 :     aSet.Put(aLR);
     520         [ #  # ]:          0 :     aSet.Put(aUL);
     521 [ #  # ][ #  # ]:        324 :     rFmt.SetFmtAttr(aSet);
         [ #  # ][ #  # ]
                 [ #  # ]
     522                 :            : }
     523                 :            : 
     524                 :        324 : void wwSectionManager::GetPageULData(const wwSection &rSection, bool bFirst,
     525                 :            :     wwSectionManager::wwULSpaceData& rData) const
     526                 :            : {
     527                 :        324 :     sal_Int32 nWWUp = rSection.maSep.dyaTop;
     528                 :        324 :     sal_Int32 nWWLo = rSection.maSep.dyaBottom;
     529                 :        324 :     sal_uInt32 nWWHTop = rSection.maSep.dyaHdrTop;
     530                 :        324 :     sal_uInt32 nWWFBot = rSection.maSep.dyaHdrBottom;
     531                 :            : 
     532                 :            :     /*
     533                 :            :     If there is gutter in 97+ and the dop says put it on top then get the
     534                 :            :     gutter distance and set it to the top margin. When we are "two pages
     535                 :            :     in one" the gutter is put at the top of odd pages, and bottom of
     536                 :            :     even pages, something we cannot do. So we will put it on top of all
     537                 :            :     pages, that way the pages are at least the right size.
     538                 :            :     */
     539 [ +  - ][ -  + ]:        324 :     if (
                 [ #  # ]
     540                 :        324 :          (!mrReader.bVer67 && mrReader.pWDop->iGutterPos &&
     541                 :            :          rSection.maSep.fRTLGutter)
     542                 :            :        )
     543                 :            :     {
     544                 :          0 :         nWWUp += rSection.maSep.dzaGutter;
     545                 :            :     }
     546                 :            : 
     547         [ +  + ]:        324 :     if( bFirst )
     548                 :        216 :         rData.bHasHeader = (rSection.maSep.grpfIhdt & WW8_HEADER_FIRST) !=0;
     549                 :            :     else
     550                 :            :     {
     551                 :            :         rData.bHasHeader = (rSection.maSep.grpfIhdt &
     552                 :        108 :             (WW8_HEADER_EVEN | WW8_HEADER_ODD)) != 0;
     553                 :            :     }
     554                 :            : 
     555         [ +  + ]:        324 :     if( rData.bHasHeader )
     556                 :            :     {
     557                 :          6 :         rData.nSwUp  = nWWHTop;             // Header -> umrechnen
     558                 :            :         // #i19922# - correction:
     559                 :            :         // consider that <nWWUp> can be negative, compare only if it's positive
     560 [ +  - ][ +  - ]:          6 :         if ( nWWUp > 0 &&
     561                 :          6 :              static_cast<sal_uInt32>(abs(nWWUp)) >= nWWHTop )
     562                 :          6 :             rData.nSwHLo = nWWUp - nWWHTop;
     563                 :            :         else
     564                 :          0 :             rData.nSwHLo = 0;
     565                 :            : 
     566                 :            :         // #i19922# - minimum page header height is now 1mm
     567                 :            :         // use new constant <cMinHdFtHeight>
     568         [ -  + ]:          6 :         if (rData.nSwHLo < sal::static_int_cast< sal_uInt32 >(cMinHdFtHeight))
     569                 :          0 :             rData.nSwHLo = sal::static_int_cast< sal_uInt32 >(cMinHdFtHeight);
     570                 :            :     }
     571                 :            :     else // kein Header -> Up einfach uebernehmen
     572                 :        318 :         rData.nSwUp = Abs(nWWUp);
     573                 :            : 
     574         [ +  + ]:        324 :     if( bFirst )
     575                 :        216 :         rData.bHasFooter = (rSection.maSep.grpfIhdt &  WW8_FOOTER_FIRST) !=0;
     576                 :            :     else
     577                 :            :     {
     578                 :            :         rData.bHasFooter = (rSection.maSep.grpfIhdt &
     579                 :        108 :             (WW8_FOOTER_EVEN | WW8_FOOTER_ODD)) != 0;
     580                 :            :     }
     581                 :            : 
     582         [ +  + ]:        324 :     if( rData.bHasFooter )
     583                 :            :     {
     584                 :         18 :         rData.nSwLo = nWWFBot;              // Footer -> Umrechnen
     585                 :            :         // #i19922# - correction: consider that <nWWLo> can be negative, compare only if it's positive
     586 [ +  - ][ +  - ]:         18 :         if ( nWWLo > 0 &&
     587                 :         18 :              static_cast<sal_uInt32>(abs(nWWLo)) >= nWWFBot )
     588                 :         18 :             rData.nSwFUp = nWWLo - nWWFBot;
     589                 :            :         else
     590                 :          0 :             rData.nSwFUp = 0;
     591                 :            : 
     592                 :            :         // #i19922# - minimum page header height is now 1mm
     593                 :            :         // use new constant <cMinHdFtHeight>
     594         [ -  + ]:         18 :         if (rData.nSwFUp < sal::static_int_cast< sal_uInt32 >(cMinHdFtHeight))
     595                 :          0 :             rData.nSwFUp = sal::static_int_cast< sal_uInt32 >(cMinHdFtHeight);
     596                 :            :     }
     597                 :            :     else // kein Footer -> Lo einfach uebernehmen
     598                 :        306 :         rData.nSwLo = Abs(nWWLo);
     599                 :        324 : }
     600                 :            : 
     601                 :        324 : void wwSectionManager::SetPageULSpaceItems(SwFrmFmt &rFmt,
     602                 :            :     wwSectionManager::wwULSpaceData& rData, const wwSection &rSection) const
     603                 :            : {
     604         [ +  + ]:        324 :     if (rData.bHasHeader)               // ... und Header-Lower setzen
     605                 :            :     {
     606                 :            :         //Kopfzeilenhoehe minimal sezten
     607 [ +  - ][ +  - ]:          6 :         if (SwFrmFmt* pHdFmt = (SwFrmFmt*)rFmt.GetHeader().GetHeaderFmt())
     608                 :            :         {
     609 [ +  - ][ +  - ]:          6 :             SvxULSpaceItem aHdUL(pHdFmt->GetULSpace());
     610         [ +  - ]:          6 :             if (!rSection.IsFixedHeightHeader())    //normal
     611                 :            :             {
     612 [ +  - ][ +  - ]:          6 :                 pHdFmt->SetFmtAttr(SwFmtFrmSize(ATT_MIN_SIZE, 0, rData.nSwHLo));
                 [ +  - ]
     613                 :            :                 // #i19922# - minimum page header height is now 1mm
     614                 :            :                 // use new constant <cMinHdFtHeight>
     615         [ +  - ]:          6 :                 aHdUL.SetLower( writer_cast<sal_uInt16>(rData.nSwHLo - cMinHdFtHeight) );
     616                 :            :                 pHdFmt->SetFmtAttr(SwHeaderAndFooterEatSpacingItem(
     617 [ +  - ][ +  - ]:          6 :                     RES_HEADER_FOOTER_EAT_SPACING, true));
                 [ +  - ]
     618                 :            :             }
     619                 :            :             else
     620                 :            :             {
     621                 :            :                 // #i48832# - set correct spacing between header and body.
     622                 :          0 :                 const SwTwips nHdLowerSpace( Abs(rSection.maSep.dyaTop) - rData.nSwUp - rData.nSwHLo );
     623 [ #  # ][ #  # ]:          0 :                 pHdFmt->SetFmtAttr(SwFmtFrmSize(ATT_FIX_SIZE, 0, rData.nSwHLo + nHdLowerSpace));
                 [ #  # ]
     624                 :          0 :                 aHdUL.SetLower( static_cast< sal_uInt16 >(nHdLowerSpace) );
     625                 :            :                 pHdFmt->SetFmtAttr(SwHeaderAndFooterEatSpacingItem(
     626 [ #  # ][ #  # ]:          0 :                     RES_HEADER_FOOTER_EAT_SPACING, false));
                 [ #  # ]
     627                 :            :             }
     628 [ +  - ][ +  - ]:          6 :             pHdFmt->SetFmtAttr(aHdUL);
     629                 :            :         }
     630                 :            :     }
     631                 :            : 
     632         [ +  + ]:        324 :     if (rData.bHasFooter)               // ... und Footer-Upper setzen
     633                 :            :     {
     634 [ +  - ][ +  - ]:         18 :         if (SwFrmFmt* pFtFmt = (SwFrmFmt*)rFmt.GetFooter().GetFooterFmt())
     635                 :            :         {
     636 [ +  - ][ +  - ]:         18 :             SvxULSpaceItem aFtUL(pFtFmt->GetULSpace());
     637         [ +  - ]:         18 :             if (!rSection.IsFixedHeightFooter())    //normal
     638                 :            :             {
     639 [ +  - ][ +  - ]:         18 :                 pFtFmt->SetFmtAttr(SwFmtFrmSize(ATT_MIN_SIZE, 0, rData.nSwFUp));
                 [ +  - ]
     640                 :            :                 // #i19922# - minimum page header height is now 1mm
     641                 :            :                 // use new constant <cMinHdFtHeight>
     642         [ +  - ]:         18 :                 aFtUL.SetUpper( writer_cast<sal_uInt16>(rData.nSwFUp - cMinHdFtHeight) );
     643                 :            :                 pFtFmt->SetFmtAttr(SwHeaderAndFooterEatSpacingItem(
     644 [ +  - ][ +  - ]:         18 :                     RES_HEADER_FOOTER_EAT_SPACING, true));
                 [ +  - ]
     645                 :            :             }
     646                 :            :             else
     647                 :            :             {
     648                 :            :                 // #i48832# - set correct spacing between footer and body.
     649                 :          0 :                 const SwTwips nFtUpperSpace( Abs(rSection.maSep.dyaBottom) - rData.nSwLo - rData.nSwFUp );
     650 [ #  # ][ #  # ]:          0 :                 pFtFmt->SetFmtAttr(SwFmtFrmSize(ATT_FIX_SIZE, 0, rData.nSwFUp + nFtUpperSpace));
                 [ #  # ]
     651                 :          0 :                 aFtUL.SetUpper( static_cast< sal_uInt16 >(nFtUpperSpace) );
     652                 :            :                 pFtFmt->SetFmtAttr(SwHeaderAndFooterEatSpacingItem(
     653 [ #  # ][ #  # ]:          0 :                     RES_HEADER_FOOTER_EAT_SPACING, false));
                 [ #  # ]
     654                 :            :             }
     655 [ +  - ][ +  - ]:         18 :             pFtFmt->SetFmtAttr(aFtUL);
     656                 :            :         }
     657                 :            :     }
     658                 :            : 
     659         [ +  - ]:        324 :     SvxULSpaceItem aUL(writer_cast<sal_uInt16>(rData.nSwUp),
     660 [ +  - ][ +  - ]:        648 :         writer_cast<sal_uInt16>(rData.nSwLo), RES_UL_SPACE);
     661 [ +  - ][ +  - ]:        324 :     rFmt.SetFmtAttr(aUL);
     662                 :        324 : }
     663                 :            : 
     664                 :          0 : SwSectionFmt *wwSectionManager::InsertSection(
     665                 :            :     SwPaM& rMyPaM, wwSection &rSection)
     666                 :            : {
     667                 :            :     SwSectionData aSection( CONTENT_SECTION,
     668 [ #  # ][ #  # ]:          0 :             mrReader.rDoc.GetUniqueSectionName() );
                 [ #  # ]
     669                 :            : 
     670         [ #  # ]:          0 :     SfxItemSet aSet( mrReader.rDoc.GetAttrPool(), aFrmFmtSetRange );
     671                 :            : 
     672 [ #  # ][ #  # ]:          0 :     sal_uInt8 nRTLPgn = maSegments.empty() ? 0 : maSegments.back().IsBiDi();
     673                 :            :     aSet.Put(SvxFrameDirectionItem(
     674 [ #  # ][ #  # ]:          0 :         nRTLPgn ? FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR));
         [ #  # ][ #  # ]
     675                 :            : 
     676         [ #  # ]:          0 :     if (2 == mrReader.pWDop->fpc)
     677 [ #  # ][ #  # ]:          0 :         aSet.Put( SwFmtFtnAtTxtEnd(FTNEND_ATTXTEND));
                 [ #  # ]
     678         [ #  # ]:          0 :     if (0 == mrReader.pWDop->epc)
     679 [ #  # ][ #  # ]:          0 :         aSet.Put( SwFmtEndAtTxtEnd(FTNEND_ATTXTEND));
                 [ #  # ]
     680                 :            : 
     681         [ #  # ]:          0 :     aSection.SetProtectFlag(SectionIsProtected(rSection));
     682                 :            : 
     683                 :            :     rSection.mpSection =
     684         [ #  # ]:          0 :         mrReader.rDoc.InsertSwSection( rMyPaM, aSection, 0, & aSet );
     685                 :            :     OSL_ENSURE(rSection.mpSection, "section not inserted!");
     686         [ #  # ]:          0 :     if (!rSection.mpSection)
     687                 :          0 :         return 0;
     688                 :            : 
     689                 :          0 :     SwPageDesc *pPage = 0;
     690                 :          0 :     mySegrIter aEnd = maSegments.rend();
     691 [ #  # ][ #  # ]:          0 :     for (mySegrIter aIter = maSegments.rbegin(); aIter != aEnd; ++aIter)
                 [ #  # ]
     692                 :            :     {
     693 [ #  # ][ #  # ]:          0 :         if (0 != (pPage = aIter->mpPage))
     694                 :          0 :             break;
     695                 :            :     }
     696                 :            : 
     697                 :            :     OSL_ENSURE(pPage, "no page outside this section!");
     698                 :            : 
     699         [ #  # ]:          0 :     if (!pPage)
     700         [ #  # ]:          0 :         pPage = &mrReader.rDoc.GetPageDesc(0);
     701                 :            : 
     702         [ #  # ]:          0 :     if (!pPage)
     703                 :          0 :         return 0;
     704                 :            : 
     705                 :          0 :     SwSectionFmt *pFmt = rSection.mpSection->GetFmt();
     706                 :            :     OSL_ENSURE(pFmt, "impossible");
     707         [ #  # ]:          0 :     if (!pFmt)
     708                 :          0 :         return 0;
     709                 :            : 
     710                 :          0 :     SwFrmFmt& rFmt = pPage->GetMaster();
     711         [ #  # ]:          0 :     const SvxLRSpaceItem& rLR = rFmt.GetLRSpace();
     712                 :          0 :     long nPageLeft  = rLR.GetLeft();
     713                 :          0 :     long nPageRight = rLR.GetRight();
     714                 :          0 :     long nSectionLeft = rSection.GetPageLeft() - nPageLeft;
     715                 :          0 :     long nSectionRight = rSection.GetPageRight() - nPageRight;
     716 [ #  # ][ #  # ]:          0 :     if ((nSectionLeft != 0) || (nSectionRight != 0))
     717                 :            :     {
     718         [ #  # ]:          0 :         SvxLRSpaceItem aLR(nSectionLeft, nSectionRight, 0, 0, RES_LR_SPACE);
     719 [ #  # ][ #  # ]:          0 :         pFmt->SetFmtAttr(aLR);
     720                 :            :     }
     721                 :            : 
     722 [ #  # ][ #  # ]:          0 :     SetCols(*pFmt, rSection, rSection.GetTextAreaWidth());
     723 [ #  # ][ #  # ]:          0 :     return pFmt;
     724                 :            : }
     725                 :            : 
     726                 :        111 : void SwWW8ImplReader::HandleLineNumbering(const wwSection &rSection)
     727                 :            : {
     728                 :            :     // check if Line Numbering must be activated or resetted
     729 [ +  - ][ -  + ]:        111 :     if (mbNewDoc && rSection.maSep.nLnnMod)
     730                 :            :     {
     731                 :            :         // restart-numbering-mode: 0 per page, 1 per section, 2 never restart
     732                 :          0 :         bool bRestartLnNumPerSection = (1 == rSection.maSep.lnc);
     733                 :            : 
     734         [ #  # ]:          0 :         if (bNoLnNumYet)
     735                 :            :         {
     736 [ #  # ][ #  # ]:          0 :             SwLineNumberInfo aInfo( rDoc.GetLineNumberInfo() );
     737                 :            : 
     738                 :          0 :             aInfo.SetPaintLineNumbers(true);
     739                 :            : 
     740                 :          0 :             aInfo.SetRestartEachPage(rSection.maSep.lnc == 0);
     741                 :            : 
     742         [ #  # ]:          0 :             aInfo.SetPosFromLeft(writer_cast<sal_uInt16>(rSection.maSep.dxaLnn));
     743                 :            : 
     744                 :            :             //Paint only for every n line
     745                 :          0 :             aInfo.SetCountBy(rSection.maSep.nLnnMod);
     746                 :            : 
     747                 :            :             // to be defaulted features ( HARDCODED in MS Word 6,7,8,9 )
     748                 :          0 :             aInfo.SetCountBlankLines(true);
     749                 :          0 :             aInfo.SetCountInFlys(false);
     750                 :          0 :             aInfo.SetPos( LINENUMBER_POS_LEFT );
     751         [ #  # ]:          0 :             SvxNumberType aNumType; // this sets SVX_NUM_ARABIC per default
     752 [ #  # ][ #  # ]:          0 :             aInfo.SetNumType( aNumType );
     753                 :            : 
     754         [ #  # ]:          0 :             rDoc.SetLineNumberInfo( aInfo );
     755 [ #  # ][ #  # ]:          0 :             bNoLnNumYet = false;
     756                 :            :         }
     757                 :            : 
     758 [ #  # ][ #  # ]:          0 :         if (
                 [ #  # ]
     759                 :            :             (0 < rSection.maSep.lnnMin) ||
     760                 :          0 :             (bRestartLnNumPerSection && !bNoLnNumYet)
     761                 :            :            )
     762                 :            :         {
     763         [ #  # ]:          0 :             SwFmtLineNumber aLN;
     764         [ #  # ]:          0 :             if (const SwFmtLineNumber* pLN
     765         [ #  # ]:          0 :                 = (const SwFmtLineNumber*)GetFmtAttr(RES_LINENUMBER))
     766                 :            :             {
     767                 :          0 :                 aLN.SetCountLines( pLN->IsCount() );
     768                 :            :             }
     769                 :          0 :             aLN.SetStartValue(1 + rSection.maSep.lnnMin);
     770         [ #  # ]:          0 :             NewAttr(aLN);
     771 [ #  # ][ #  # ]:          0 :             pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_LINENUMBER);
     772                 :            :         }
     773                 :          0 :         bNoLnNumYet = false;
     774                 :            :     }
     775                 :        111 : }
     776                 :            : 
     777                 :        222 : wwSection::wwSection(const SwPosition &rPos) : maStart(rPos.nNode),
     778                 :            :     mpSection(0), mpTitlePage(0), mpPage(0), meDir(FRMDIR_HORI_LEFT_TOP),
     779         [ +  - ]:        222 :     nPgWidth(SvxPaperInfo::GetPaperSize(PAPER_A4).Width()),
     780         [ +  + ]:       1110 :     nPgLeft(MM_250), nPgRight(MM_250), mnBorders(0), mbHasFootnote(false)
     781                 :            : {
     782                 :        222 : }
     783                 :            : 
     784                 :        324 : void wwSectionManager::SetNumberingType(const wwSection &rNewSection,
     785                 :            :     SwPageDesc &rPageDesc) const
     786                 :            : {
     787                 :            :     // Seitennummernformat speichern
     788                 :            :     static const SvxExtNumType aNumTyp[5] =
     789                 :            :     {
     790                 :            :         SVX_NUM_ARABIC, SVX_NUM_ROMAN_UPPER, SVX_NUM_ROMAN_LOWER,
     791                 :            :         SVX_NUM_CHARS_UPPER_LETTER_N, SVX_NUM_CHARS_LOWER_LETTER_N
     792                 :            :     };
     793                 :            : 
     794         [ +  - ]:        324 :     SvxNumberType aType;
     795                 :        324 :     aType.SetNumberingType( static_cast< sal_Int16 >(aNumTyp[rNewSection.maSep.nfcPgn]) );
     796         [ +  - ]:        324 :     rPageDesc.SetNumType(aType);
     797                 :        324 : }
     798                 :            : 
     799                 :            : // Bei jedem Abschnittswechsel ( auch am Anfang eines Dokuments ) wird
     800                 :            : // CreateSep gerufen, dass dann den / die Pagedesc(s) erzeugt und
     801                 :            : // mit Attributen un KF-Texten fuellt.
     802                 :            : // Dieses Vorgehen ist noetig geworden, da die UEbersetzung der verschiedenen
     803                 :            : // Seiten-Attribute zu stark verflochten ist.
     804                 :        111 : void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/)
     805                 :            : {
     806                 :            :     /*
     807                 :            :     #i1909# section/page breaks should not occur in tables or subpage
     808                 :            :     elements like frames. Word itself ignores them in this case. The bug is
     809                 :            :     more likely that this filter created such documents in the past!
     810                 :            :     */
     811 [ +  - ][ +  - ]:        111 :     if (mrReader.nInTable || mrReader.bTxbxFlySection || mrReader.InLocalApo())
         [ +  - ][ -  + ]
                 [ +  - ]
     812                 :            :         return;
     813                 :            : 
     814                 :        111 :     WW8PLCFx_SEPX* pSep = mrReader.pPlcxMan->GetSepPLCF();
     815                 :            :     OSL_ENSURE(pSep, "impossible!");
     816         [ +  - ]:        111 :     if (!pSep)
     817                 :            :         return;
     818                 :            : 
     819         [ +  - ]:        111 :     ww::WordVersion eVer = mrReader.GetFib().GetFIBVersion();
     820                 :            : 
     821                 :            :     // M.M. Create a linked section if the WkbPLCF
     822                 :            :     // has an entry for one at this cp
     823                 :        111 :     WW8PLCFspecial* pWkb = mrReader.pPlcxMan->GetWkbPLCF();
     824         [ +  - ]:        111 :     if (pWkb && pWkb->SeekPosExact(nTxtPos) &&
           [ -  +  #  # ]
         [ -  + ][ +  + ]
     825                 :          0 :             pWkb->Where() == nTxtPos)
     826                 :            :     {
     827                 :            :         void* pData;
     828                 :            :         WW8_CP nTest;
     829         [ #  # ]:          0 :         pWkb->Get(nTest, pData);
     830 [ #  # ][ #  # ]:          0 :         String sSectionName = mrReader.aLinkStringMap[SVBT16ToShort( ((WW8_WKB*)pData)->nLinkId) ];
     831         [ #  # ]:          0 :         mrReader.ConvertFFileName(sSectionName, sSectionName);
     832         [ #  # ]:          0 :         SwSectionData aSection(FILE_LINK_SECTION, sSectionName);
     833         [ #  # ]:          0 :         aSection.SetLinkFileName( sSectionName );
     834                 :          0 :         aSection.SetProtectFlag(true);
     835                 :            :         // #i19922# - improvement: return value of method <Insert> not used.
     836 [ #  # ][ #  # ]:          0 :         mrReader.rDoc.InsertSwSection(*mrReader.pPaM, aSection, 0, 0, false);
                 [ #  # ]
     837                 :            :     }
     838                 :            : 
     839         [ +  - ]:        111 :     wwSection aLastSection(*mrReader.pPaM->GetPoint());
     840         [ +  + ]:        111 :     if (!maSegments.empty())
     841 [ +  - ][ +  - ]:          9 :         aLastSection = maSegments.back();
     842                 :            : 
     843                 :            :     //Here
     844         [ +  + ]:        111 :     sal_uInt16 nLIdx = ( ( mrReader.pWwFib->lid & 0xff ) == 0x9 ) ? 1 : 0;
     845                 :            : 
     846                 :            :     //BEGIN read section values
     847         [ +  - ]:        111 :     wwSection aNewSection(*mrReader.pPaM->GetPoint());
     848                 :            : 
     849                 :            :     static const sal_uInt16 aVer2Ids0[] =
     850                 :            :     {
     851                 :            :         /*sprmSBkc*/           117,
     852                 :            :         /*sprmSFTitlePage*/    118,
     853                 :            :         /*sprmSNfcPgn*/        122,
     854                 :            :         /*sprmSCcolumns*/      119,
     855                 :            :         /*sprmSDxaColumns*/    120,
     856                 :            :         /*sprmSLBetween*/      133
     857                 :            :     };
     858                 :            : 
     859                 :            :     static const sal_uInt16 aVer67Ids0[] =
     860                 :            :     {
     861                 :            :         /*sprmSBkc*/           142,
     862                 :            :         /*sprmSFTitlePage*/    143,
     863                 :            :         /*sprmSNfcPgn*/        147,
     864                 :            :         /*sprmSCcolumns*/      144,
     865                 :            :         /*sprmSDxaColumns*/    145,
     866                 :            :         /*sprmSLBetween*/      158
     867                 :            :     };
     868                 :            : 
     869                 :            :     static const sal_uInt16 aVer8Ids0[] =
     870                 :            :     {
     871                 :            :         /*sprmSBkc*/           0x3009,
     872                 :            :         /*sprmSFTitlePage*/    0x300A,
     873                 :            :         /*sprmSNfcPgn*/        0x300E,
     874                 :            :         /*sprmSCcolumns*/      0x500B,
     875                 :            :         /*sprmSDxaColumns*/    0x900C,
     876                 :            :         /*sprmSLBetween*/      0x3019
     877                 :            :     };
     878                 :            : 
     879 [ +  - ][ -  + ]:        111 :     const sal_uInt16* pIds = eVer <= ww::eWW2 ? aVer2Ids0 : eVer <= ww::eWW7 ? aVer67Ids0 : aVer8Ids0;
     880                 :            : 
     881         [ +  + ]:        111 :     if (!maSegments.empty())
     882                 :            :     {
     883                 :            :         // Type of break: break codes are:
     884                 :            :         // 0 No break
     885                 :            :         // 1 New column
     886                 :            :         // 2 New page
     887                 :            :         // 3 Even page
     888                 :            :         // 4 Odd page
     889 [ +  - ][ +  - ]:          9 :         if (const sal_uInt8* pSprmBkc = pSep->HasSprm(pIds[0]))
     890                 :          9 :             aNewSection.maSep.bkc = *pSprmBkc;
     891                 :            :     }
     892                 :            : 
     893                 :            :     // Has a table page
     894                 :            :     aNewSection.maSep.fTitlePage =
     895         [ +  - ]:        111 :         (0 != ReadBSprm( pSep, pIds[1], 0 ));
     896                 :            : 
     897                 :            :     // sprmSNfcPgn
     898         [ +  - ]:        111 :     aNewSection.maSep.nfcPgn = ReadBSprm( pSep, pIds[2], 0 );
     899         [ -  + ]:        111 :     if (aNewSection.maSep.nfcPgn > 4)
     900                 :          0 :         aNewSection.maSep.nfcPgn = 0;
     901                 :            : 
     902 [ +  - ][ -  + ]:        111 :     aNewSection.maSep.fUnlocked = eVer > ww::eWW2 ? ReadBSprm(pSep, (eVer <= ww::eWW7 ? 139 : 0x3006), 0 ) : 0;
                 [ +  - ]
     903                 :            : 
     904                 :            :     // sprmSFBiDi
     905 [ +  - ][ +  - ]:        111 :     aNewSection.maSep.fBiDi = eVer >= ww::eWW8 ? ReadBSprm(pSep, 0x3228, 0) : 0;
     906                 :            : 
     907         [ +  - ]:        111 :     aNewSection.maSep.ccolM1 = ReadSprm(pSep, pIds[3], 0 );
     908                 :            : 
     909                 :            :     //sprmSDxaColumns   - Default-Abstand 1.25 cm
     910         [ +  - ]:        111 :     aNewSection.maSep.dxaColumns = ReadUSprm( pSep, pIds[4], 708 );
     911                 :            : 
     912                 :            :     // sprmSLBetween
     913         [ +  - ]:        111 :     aNewSection.maSep.fLBetween = ReadBSprm(pSep, pIds[5], 0 );
     914                 :            : 
     915         [ +  - ]:        111 :     if (eVer >= ww::eWW6)
     916                 :            :     {
     917                 :            :         // sprmSFEvenlySpaced
     918                 :            :         aNewSection.maSep.fEvenlySpaced =
     919 [ -  + ][ +  - ]:        111 :             ReadBSprm(pSep, (eVer <= ww::eWW7 ? 138 : 0x3005), 1) ? true : false;
     920                 :            : 
     921                 :        111 :         const sal_uInt8 numrgda = SAL_N_ELEMENTS(aNewSection.maSep.rgdxaColumnWidthSpacing);
     922 [ +  + ][ +  - ]:        111 :         if (aNewSection.maSep.ccolM1 > 0 && !aNewSection.maSep.fEvenlySpaced)
     923                 :            :         {
     924                 :          6 :             aNewSection.maSep.rgdxaColumnWidthSpacing[0] = 0;
     925                 :          6 :             int nCols = aNewSection.maSep.ccolM1 + 1;
     926                 :          6 :             int nIdx = 0;
     927         [ +  + ]:         18 :             for (int i = 0; i < nCols; ++i)
     928                 :            :             {
     929                 :            :                 //sprmSDxaColWidth
     930 [ -  + ][ +  - ]:         12 :                 const sal_uInt8* pSW = pSep->HasSprm( (eVer <= ww::eWW7 ? 136 : 0xF203), sal_uInt8( i ) );
     931                 :            : 
     932                 :            :                 OSL_ENSURE( pSW, "+Sprm 136 (bzw. 0xF203) (ColWidth) fehlt" );
     933         [ +  - ]:         12 :                 sal_uInt16 nWidth = pSW ? SVBT16ToShort(pSW + 1) : 1440;
     934                 :            : 
     935         [ +  - ]:         12 :                 if (++nIdx < numrgda)
     936                 :         12 :                     aNewSection.maSep.rgdxaColumnWidthSpacing[nIdx] = nWidth;
     937                 :            : 
     938         [ +  + ]:         12 :                 if (i < nCols-1)
     939                 :            :                 {
     940                 :            :                     //sprmSDxaColSpacing
     941 [ -  + ][ +  - ]:          6 :                     const sal_uInt8* pSD = pSep->HasSprm( (eVer <= ww::eWW7 ? 137 : 0xF204), sal_uInt8( i ) );
     942                 :            : 
     943                 :            :                     OSL_ENSURE( pSD, "+Sprm 137 (bzw. 0xF204) (Colspacing) fehlt" );
     944         [ +  - ]:          6 :                     if( pSD )
     945                 :            :                     {
     946                 :          6 :                         nWidth = SVBT16ToShort(pSD + 1);
     947         [ +  - ]:          6 :                         if (++nIdx < numrgda)
     948                 :          6 :                             aNewSection.maSep.rgdxaColumnWidthSpacing[nIdx] = nWidth;
     949                 :            :                     }
     950                 :            :                 }
     951                 :            :             }
     952                 :            :         }
     953                 :            :     }
     954                 :            : 
     955                 :            :     static const sal_uInt16 aVer2Ids1[] =
     956                 :            :     {
     957                 :            :         /*sprmSBOrientation*/   137,
     958                 :            :         /*sprmSXaPage*/         139,
     959                 :            :         /*sprmSYaPage*/         140,
     960                 :            :         /*sprmSDxaLeft*/        141,
     961                 :            :         /*sprmSDxaRight*/       142,
     962                 :            :         /*sprmSDzaGutter*/      145,
     963                 :            :         /*sprmSFPgnRestart*/    125,
     964                 :            :         /*sprmSPgnStart*/       136,
     965                 :            :         /*sprmSDmBinFirst*/     115,
     966                 :            :         /*sprmSDmBinOther*/     116
     967                 :            :     };
     968                 :            : 
     969                 :            :     static const sal_uInt16 aVer67Ids1[] =
     970                 :            :     {
     971                 :            :         /*sprmSBOrientation*/   162,
     972                 :            :         /*sprmSXaPage*/         164,
     973                 :            :         /*sprmSYaPage*/         165,
     974                 :            :         /*sprmSDxaLeft*/        166,
     975                 :            :         /*sprmSDxaRight*/       167,
     976                 :            :         /*sprmSDzaGutter*/      170,
     977                 :            :         /*sprmSFPgnRestart*/    150,
     978                 :            :         /*sprmSPgnStart*/       161,
     979                 :            :         /*sprmSDmBinFirst*/     140,
     980                 :            :         /*sprmSDmBinOther*/     141
     981                 :            :     };
     982                 :            : 
     983                 :            :     static const sal_uInt16 aVer8Ids1[] =
     984                 :            :     {
     985                 :            :         /*sprmSBOrientation*/   0x301d,
     986                 :            :         /*sprmSXaPage*/         0xB01F,
     987                 :            :         /*sprmSYaPage*/         0xB020,
     988                 :            :         /*sprmSDxaLeft*/        0xB021,
     989                 :            :         /*sprmSDxaRight*/       0xB022,
     990                 :            :         /*sprmSDzaGutter*/      0xB025,
     991                 :            :         /*sprmSFPgnRestart*/    0x3011,
     992                 :            :         /*sprmSPgnStart*/       0x501C,
     993                 :            :            /*sprmSDmBinFirst*/     0x5007,
     994                 :            :         /*sprmSDmBinOther*/     0x5008
     995                 :            :     };
     996                 :            : 
     997 [ +  - ][ -  + ]:        111 :     pIds = eVer <= ww::eWW2 ? aVer2Ids1 : eVer <= ww::eWW7 ? aVer67Ids1 : aVer8Ids1;
     998                 :            : 
     999                 :            :                                             // 1. Orientierung
    1000         [ +  - ]:        111 :     aNewSection.maSep.dmOrientPage = ReadBSprm(pSep, pIds[0], 0);
    1001                 :            : 
    1002                 :            :     // 2. Papiergroesse
    1003         [ +  - ]:        111 :     aNewSection.maSep.xaPage = ReadUSprm(pSep, pIds[1], lLetterWidth);
    1004         [ +  - ]:        111 :     aNewSection.nPgWidth = SvxPaperInfo::GetSloppyPaperDimension(aNewSection.maSep.xaPage);
    1005                 :            : 
    1006         [ +  - ]:        111 :     aNewSection.maSep.yaPage = ReadUSprm(pSep, pIds[2], lLetterHeight);
    1007                 :            : 
    1008                 :            :     // 3. LR-Raender
    1009                 :            :     static const sal_uInt16 nLef[] = { MM_250, 1800 };
    1010                 :            :     static const sal_uInt16 nRig[] = { MM_250, 1800 };
    1011                 :            : 
    1012         [ +  - ]:        111 :     aNewSection.maSep.dxaLeft = ReadUSprm( pSep, pIds[3], nLef[nLIdx]);
    1013         [ +  - ]:        111 :     aNewSection.maSep.dxaRight = ReadUSprm( pSep, pIds[4], nRig[nLIdx]);
    1014                 :            : 
    1015                 :            :     // 2pages in 1sheet hackery ?
    1016                 :            :     // #i31806# but only swap if 2page in 1sheet is enabled.
    1017                 :            :     // its not clear if dmOrientPage is the correct member to
    1018                 :            :     // decide on this but I am not about to 2nd guess cmc.
    1019 [ -  + ][ #  # ]:        111 :     if(mrReader.pWDop->doptypography.f2on1 &&
    1020                 :            :             aNewSection.maSep.dmOrientPage == 2)
    1021                 :          0 :         std::swap(aNewSection.maSep.dxaLeft, aNewSection.maSep.dxaRight);
    1022                 :            : 
    1023         [ +  - ]:        111 :     aNewSection.maSep.dzaGutter = ReadUSprm( pSep, pIds[5], 0);
    1024                 :            : 
    1025 [ +  - ][ +  - ]:        111 :     aNewSection.maSep.fRTLGutter = static_cast< sal_uInt8 >(eVer >= ww::eWW8 ? ReadUSprm( pSep, 0x322A, 0 ) : 0);
    1026                 :            : 
    1027                 :            :     // Page Number Restarts - sprmSFPgnRestart
    1028         [ +  - ]:        111 :     aNewSection.maSep.fPgnRestart = ReadBSprm(pSep, pIds[6], 0);
    1029                 :            : 
    1030         [ +  - ]:        111 :     aNewSection.maSep.pgnStart = ReadBSprm( pSep, pIds[7], 0 );
    1031                 :            : 
    1032         [ +  - ]:        111 :     if (eVer >= ww::eWW6)
    1033                 :            :     {
    1034 [ -  + ][ +  - ]:        111 :         if (const sal_uInt8* p = pSep->HasSprm( (eVer <= ww::eWW7 ? 132 : 0x3001) ))
                 [ -  + ]
    1035                 :          0 :             aNewSection.maSep.iHeadingPgn = *p;
    1036                 :            : 
    1037 [ -  + ][ +  - ]:        111 :         if (const sal_uInt8* p = pSep->HasSprm( (eVer <= ww::eWW7 ? 131 : 0x3000) ))
                 [ -  + ]
    1038                 :          0 :             aNewSection.maSep.cnsPgn = *p;
    1039                 :            :     }
    1040                 :            : 
    1041 [ +  - ][ +  + ]:        111 :     if(const sal_uInt8* pSprmSDmBinFirst = pSep->HasSprm( pIds[8] ))
    1042                 :          9 :         aNewSection.maSep.dmBinFirst = *pSprmSDmBinFirst;
    1043                 :            : 
    1044 [ +  - ][ +  + ]:        111 :     if (const sal_uInt8* pSprmSDmBinOther = pSep->HasSprm( pIds[9] ))
    1045                 :          9 :         aNewSection.maSep.dmBinOther = *pSprmSDmBinOther;
    1046                 :            : 
    1047                 :            :     static const sal_uInt16 nTop[] = { MM_250, 1440 };
    1048                 :            :     static const sal_uInt16 nBot[] = { MM_200, 1440 };
    1049                 :            : 
    1050                 :            :     static const sal_uInt16 aVer2Ids2[] =
    1051                 :            :     {
    1052                 :            :         /*sprmSDyaTop*/         143,
    1053                 :            :         /*sprmSDyaBottom*/      144,
    1054                 :            :         /*sprmSDyaHdrTop*/      131,
    1055                 :            :         /*sprmSDyaHdrBottom*/   132,
    1056                 :            :         /*sprmSNLnnMod*/        129,
    1057                 :            :         /*sprmSLnc*/            127,
    1058                 :            :         /*sprmSDxaLnn*/         130,
    1059                 :            :         /*sprmSLnnMin*/         135
    1060                 :            :     };
    1061                 :            : 
    1062                 :            :     static const sal_uInt16 aVer67Ids2[] =
    1063                 :            :     {
    1064                 :            :         /*sprmSDyaTop*/         168,
    1065                 :            :         /*sprmSDyaBottom*/      169,
    1066                 :            :         /*sprmSDyaHdrTop*/      156,
    1067                 :            :         /*sprmSDyaHdrBottom*/   157,
    1068                 :            :         /*sprmSNLnnMod*/        154,
    1069                 :            :         /*sprmSLnc*/            152,
    1070                 :            :         /*sprmSDxaLnn*/         155,
    1071                 :            :         /*sprmSLnnMin*/         160
    1072                 :            :     };
    1073                 :            :     static const sal_uInt16 aVer8Ids2[] =
    1074                 :            :     {
    1075                 :            :         /*sprmSDyaTop*/         0x9023,
    1076                 :            :         /*sprmSDyaBottom*/      0x9024,
    1077                 :            :         /*sprmSDyaHdrTop*/      0xB017,
    1078                 :            :         /*sprmSDyaHdrBottom*/   0xB018,
    1079                 :            :         /*sprmSNLnnMod*/        0x5015,
    1080                 :            :         /*sprmSLnc*/            0x3013,
    1081                 :            :         /*sprmSDxaLnn*/         0x9016,
    1082                 :            :         /*sprmSLnnMin*/         0x501B
    1083                 :            :     };
    1084                 :            : 
    1085 [ +  - ][ -  + ]:        111 :     pIds = eVer <= ww::eWW2 ? aVer2Ids2 : eVer <= ww::eWW7 ? aVer67Ids2 : aVer8Ids2;
    1086                 :            : 
    1087         [ +  - ]:        111 :     aNewSection.maSep.dyaTop = ReadSprm( pSep, pIds[0], nTop[nLIdx] );
    1088         [ +  - ]:        111 :     aNewSection.maSep.dyaBottom = ReadSprm( pSep, pIds[1], nBot[nLIdx] );
    1089         [ +  - ]:        111 :     aNewSection.maSep.dyaHdrTop = ReadUSprm( pSep, pIds[2], 720 );
    1090         [ +  - ]:        111 :     aNewSection.maSep.dyaHdrBottom = ReadUSprm( pSep, pIds[3], 720 );
    1091                 :            : 
    1092         [ +  - ]:        111 :     if (eVer >= ww::eWW8)
    1093                 :            :     {
    1094         [ +  - ]:        111 :         aNewSection.maSep.wTextFlow = ReadUSprm(pSep, 0x5033, 0);
    1095         [ +  - ]:        111 :         aNewSection.maSep.clm = ReadUSprm( pSep, 0x5032, 0 );
    1096         [ +  - ]:        111 :         aNewSection.maSep.dyaLinePitch = ReadUSprm(pSep, 0x9031, 360);
    1097 [ +  - ][ +  + ]:        111 :         if (const sal_uInt8* pS = pSep->HasSprm(0x7030))
    1098                 :          9 :             aNewSection.maSep.dxtCharSpace = SVBT32ToUInt32(pS);
    1099                 :            : 
    1100                 :            :         //sprmSPgbProp
    1101         [ +  - ]:        111 :         sal_uInt16 pgbProp = ReadSprm( pSep, 0x522F, 0 );
    1102                 :        111 :         aNewSection.maSep.pgbApplyTo = pgbProp & 0x0007;
    1103                 :        111 :         aNewSection.maSep.pgbPageDepth = (pgbProp & 0x0018) >> 3;
    1104                 :        111 :         aNewSection.maSep.pgbOffsetFrom = (pgbProp & 0x00E0) >> 5;
    1105                 :            : 
    1106                 :            :         aNewSection.mnBorders =
    1107         [ +  - ]:        111 :             ::lcl_ReadBorders(eVer <= ww::eWW7, aNewSection.brc, 0, 0, pSep);
    1108                 :            :     }
    1109                 :            : 
    1110                 :            :     // check if Line Numbering must be activated or resetted
    1111 [ +  - ][ -  + ]:        111 :     if (const sal_uInt8* pSprmSNLnnMod = pSep->HasSprm( pIds[4] ))
    1112                 :          0 :         aNewSection.maSep.nLnnMod = *pSprmSNLnnMod;
    1113                 :            : 
    1114 [ +  - ][ -  + ]:        111 :     if (const sal_uInt8* pSprmSLnc = pSep->HasSprm( pIds[5] ))
    1115                 :          0 :         aNewSection.maSep.lnc = *pSprmSLnc;
    1116                 :            : 
    1117 [ +  - ][ -  + ]:        111 :     if (const sal_uInt8* pSprmSDxaLnn = pSep->HasSprm( pIds[6] ))
    1118                 :          0 :         aNewSection.maSep.dxaLnn = SVBT16ToShort( pSprmSDxaLnn );
    1119                 :            : 
    1120 [ +  - ][ -  + ]:        111 :     if (const sal_uInt8* pSprmSLnnMin = pSep->HasSprm( pIds[7] ))
    1121                 :          0 :         aNewSection.maSep.lnnMin = *pSprmSLnnMin;
    1122                 :            : 
    1123         [ -  + ]:        111 :     if (eVer <= ww::eWW7)
    1124 [ #  # ][ #  # ]:          0 :         aNewSection.maSep.grpfIhdt = ReadBSprm(pSep, eVer <= ww::eWW2 ? 128 : 153, 0);
    1125         [ +  + ]:        111 :     else if (mrReader.pHdFt)
    1126                 :            :     {
    1127                 :         45 :         aNewSection.maSep.grpfIhdt = WW8_HEADER_ODD | WW8_FOOTER_ODD;
    1128                 :            : 
    1129         [ -  + ]:         45 :         if (aNewSection.HasTitlePage())
    1130                 :          0 :             aNewSection.maSep.grpfIhdt |= WW8_HEADER_FIRST | WW8_FOOTER_FIRST;
    1131                 :            : 
    1132         [ -  + ]:         45 :         if (mrReader.pWDop->fFacingPages)
    1133                 :          0 :             aNewSection.maSep.grpfIhdt |= WW8_HEADER_EVEN | WW8_FOOTER_EVEN;
    1134                 :            : 
    1135                 :            :         //See if we have a header or footer for each enabled possibility
    1136                 :            :         //if we do not then we inherit the previous sections header/footer,
    1137         [ +  + ]:        315 :         for (int nI = 0, nMask = 1; nI < 6; ++nI, nMask <<= 1)
    1138                 :            :         {
    1139         [ +  + ]:        270 :             if (aNewSection.maSep.grpfIhdt & nMask)
    1140                 :            :             {
    1141                 :            :                 WW8_CP nStart;
    1142                 :            :                 long nLen;
    1143         [ +  - ]:         90 :                 mrReader.pHdFt->GetTextPosExact( static_cast< short >(nI + ( maSegments.size() + 1) * 6), nStart, nLen);
    1144                 :            :                 //No header or footer, inherit pervious one, or set to zero
    1145                 :            :                 //if no previous one
    1146         [ +  + ]:         90 :                 if (!nLen)
    1147                 :            :                 {
    1148 [ #  # ][ +  - ]:         66 :                     if (
                 [ -  + ]
    1149                 :         66 :                         maSegments.empty() ||
    1150         [ #  # ]:          0 :                         !(maSegments.back().maSep.grpfIhdt & nMask)
    1151                 :            :                        )
    1152                 :            :                     {
    1153                 :         90 :                         aNewSection.maSep.grpfIhdt &= ~nMask;
    1154                 :            :                     }
    1155                 :            :                 }
    1156                 :            :             }
    1157                 :            :         }
    1158                 :            :     }
    1159                 :            : 
    1160                 :        111 :     SetLeftRight(aNewSection);
    1161                 :            :     //END read section values
    1162                 :            : 
    1163         [ +  - ]:        111 :     if (eVer >= ww::eWW8)
    1164                 :        111 :         aNewSection.SetDirection();
    1165                 :            : 
    1166         [ +  - ]:        111 :     mrReader.HandleLineNumbering(aNewSection);
    1167 [ +  - ][ +  - ]:        111 :     maSegments.push_back(aNewSection);
                 [ +  - ]
    1168                 :            : }
    1169                 :            : 
    1170                 :          0 : void SwWW8ImplReader::CopyPageDescHdFt(const SwPageDesc* pOrgPageDesc,
    1171                 :            :     SwPageDesc* pNewPageDesc, sal_uInt8 nCode )
    1172                 :            : {
    1173                 :            :     // copy first header content section
    1174         [ #  # ]:          0 :     if (nCode & WW8_HEADER_FIRST)
    1175                 :          0 :         rDoc.CopyHeader(pOrgPageDesc->GetMaster(), pNewPageDesc->GetMaster());
    1176                 :            : 
    1177                 :            :     // copy first footer content section
    1178         [ #  # ]:          0 :     if( nCode & WW8_FOOTER_FIRST )
    1179                 :          0 :         rDoc.CopyFooter(pOrgPageDesc->GetMaster(), pNewPageDesc->GetMaster());
    1180                 :            : 
    1181         [ #  # ]:          0 :     if( nCode & (   WW8_HEADER_ODD  | WW8_FOOTER_ODD
    1182                 :            :                   | WW8_HEADER_EVEN | WW8_FOOTER_EVEN ) )
    1183                 :            :     {
    1184                 :            :         // copy odd header content section
    1185         [ #  # ]:          0 :         if( nCode & WW8_HEADER_ODD )
    1186                 :            :         {
    1187                 :          0 :             rDoc.CopyHeader(pOrgPageDesc->GetMaster(),
    1188                 :          0 :                             pNewPageDesc->GetMaster() );
    1189                 :            :         }
    1190                 :            :         // copy odd footer content section
    1191         [ #  # ]:          0 :         if( nCode & WW8_FOOTER_ODD )
    1192                 :            :         {
    1193                 :          0 :             rDoc.CopyFooter(pOrgPageDesc->GetMaster(),
    1194                 :          0 :                             pNewPageDesc->GetMaster());
    1195                 :            :         }
    1196                 :            :         // copy even header content section
    1197         [ #  # ]:          0 :         if( nCode & WW8_HEADER_EVEN )
    1198                 :            :         {
    1199                 :          0 :             rDoc.CopyHeader(pOrgPageDesc->GetLeft(),
    1200                 :          0 :                             pNewPageDesc->GetLeft());
    1201                 :            :         }
    1202                 :            :         // copy even footer content section
    1203         [ #  # ]:          0 :         if( nCode & WW8_FOOTER_EVEN )
    1204                 :            :         {
    1205                 :          0 :             rDoc.CopyFooter(pOrgPageDesc->GetLeft(),
    1206                 :          0 :                             pNewPageDesc->GetLeft());
    1207                 :            :         }
    1208                 :            :     }
    1209                 :          0 : }
    1210                 :            : 
    1211                 :            : //------------------------------------------------------
    1212                 :            : //   Hilfsroutinen fuer Grafiken und Apos und Tabellen
    1213                 :            : //------------------------------------------------------
    1214                 :            : 
    1215                 :        615 : static bool _SetWW8_BRC(bool bVer67, WW8_BRC& rVar, const sal_uInt8* pS)
    1216                 :            : {
    1217         [ +  + ]:        615 :     if( pS )
    1218                 :            :     {
    1219         [ -  + ]:        324 :         if( bVer67 )
    1220                 :          0 :             memcpy( rVar.aBits1, pS, sizeof( SVBT16 ) );
    1221                 :            :         else
    1222                 :        324 :             rVar = *((WW8_BRC*)pS);
    1223                 :            :     }
    1224                 :            : 
    1225                 :        615 :     return 0 != pS;
    1226                 :            : }
    1227                 :            : 
    1228                 :        234 : sal_uInt8 lcl_ReadBorders(bool bVer67, WW8_BRC* brc, WW8PLCFx_Cp_FKP* pPap,
    1229                 :            :     const WW8RStyle* pSty, const WW8PLCFx_SEPX* pSep)
    1230                 :            : {
    1231                 :            : 
    1232                 :            : //returns a sal_uInt8 filled with a bit for each position that had a sprm
    1233                 :            : //setting that border
    1234                 :            : 
    1235                 :        234 :     sal_uInt8 nBorder = false;
    1236         [ +  + ]:        234 :     if( pSep )
    1237                 :            :     {
    1238         [ +  - ]:        111 :         if( !bVer67 )
    1239                 :            :         {
    1240                 :            :              sal_uInt8* pSprm[4];
    1241                 :            : 
    1242                 :            :             //  sprmSBrcTop, sprmSBrcLeft, sprmSBrcBottom, sprmSBrcRight
    1243 [ +  - ][ -  + ]:        111 :              if( pSep->Find4Sprms(  0x702B,   0x702C,   0x702D,   0x702E,
    1244                 :            :                                     pSprm[0], pSprm[1], pSprm[2], pSprm[3] ) )
    1245                 :            :              {
    1246         [ #  # ]:        111 :                 for( int i = 0; i < 4; ++i )
    1247                 :          0 :                     nBorder |= (_SetWW8_BRC( bVer67, brc[ i ], pSprm[ i ] ))<<i;
    1248                 :            :              }
    1249                 :            :         }
    1250                 :            :     }
    1251                 :            :     else
    1252                 :            :     {
    1253                 :            : 
    1254                 :            :         static const sal_uInt16 aVer67Ids[5] = { 38, 39, 40, 41, 42 };
    1255                 :            : 
    1256                 :            :         static const sal_uInt16 aVer8Ids[5] =
    1257                 :            :                 { 0x6424, 0x6425, 0x6426, 0x6427, 0x6428 };
    1258                 :            : 
    1259         [ -  + ]:        123 :         const sal_uInt16* pIds = bVer67 ? aVer67Ids : aVer8Ids;
    1260                 :            : 
    1261         [ +  + ]:        123 :         if( pPap )
    1262                 :            :         {
    1263         [ +  + ]:        432 :             for( int i = 0; i < 5; ++i, ++pIds )
    1264                 :        360 :                 nBorder |= (_SetWW8_BRC( bVer67, brc[ i ], pPap->HasSprm( *pIds )))<<i;
    1265                 :            :         }
    1266         [ +  - ]:         51 :         else if( pSty )
    1267                 :            :         {
    1268         [ +  + ]:        306 :             for( int i = 0; i < 5; ++i, ++pIds )
    1269                 :        255 :                 nBorder |= (_SetWW8_BRC( bVer67, brc[ i ], pSty->HasParaSprm( *pIds )))<<i;
    1270                 :            :         }
    1271                 :            :         else {
    1272                 :            :             OSL_ENSURE( pSty || pPap, "WW8PLCFx_Cp_FKP and WW8RStyle "
    1273                 :            :                                "and WW8PLCFx_SEPX is 0" );
    1274                 :            :         }
    1275                 :            :     }
    1276                 :            : 
    1277                 :        234 :     return nBorder;
    1278                 :            : }
    1279                 :            : 
    1280                 :       1863 : void GetLineIndex(SvxBoxItem &rBox, short nLineThickness, short nSpace, sal_uInt8 nCol, short nIdx,
    1281                 :            :     sal_uInt16 nOOIndex, sal_uInt16 nWWIndex, short *pSize=0)
    1282                 :            : {
    1283                 :       1863 :     ::editeng::SvxBorderStyle eStyle = table::BorderLineStyle::SOLID;
    1284   [ +  -  -  -  :       1863 :     switch (nIdx)
          -  +  -  +  -  
          +  +  +  +  +  
                -  -  + ]
    1285                 :            :     {
    1286                 :            :         // First the single lines
    1287                 :            :         case  1:
    1288                 :            :         case  5:
    1289                 :            :         // and the unsupported special cases which we map to a single line
    1290                 :            :         case  8:
    1291                 :            :         case  9:
    1292                 :            :         case 20:
    1293                 :            :         case 22:
    1294                 :       1650 :             eStyle = table::BorderLineStyle::SOLID;
    1295                 :       1650 :             break;
    1296                 :            :         case  2:
    1297                 :            :             {
    1298                 :          0 :                 eStyle = table::BorderLineStyle::SOLID;
    1299                 :          0 :                 nLineThickness *= 2;
    1300                 :            :             }
    1301                 :          0 :             break;
    1302                 :            :         case  6:
    1303                 :          0 :             eStyle = table::BorderLineStyle::DOTTED;
    1304                 :          0 :             break;
    1305                 :            :         case  7:
    1306                 :          0 :             eStyle = table::BorderLineStyle::DASHED;
    1307                 :          0 :             break;
    1308                 :            :         // then the shading beams which we represent by a double line
    1309                 :            :         case 23:
    1310                 :          0 :             eStyle = table::BorderLineStyle::DOUBLE;
    1311                 :          0 :             break;
    1312                 :            :         // then the double lines, for which we have good matches
    1313                 :            :         case  3:
    1314                 :            :         case 10: //Don't have tripple so use double
    1315                 :            :         case 21: //Don't have double wave: use double instead
    1316                 :         30 :             eStyle = table::BorderLineStyle::DOUBLE;
    1317                 :         30 :             break;
    1318                 :            :         case 11:
    1319                 :          0 :             eStyle = table::BorderLineStyle::THINTHICK_SMALLGAP;
    1320                 :          0 :             break;
    1321                 :            :         case 12:
    1322                 :            :         case 13: //Don't have thin thick thin, so use thick thin
    1323                 :         15 :             eStyle = table::BorderLineStyle::THICKTHIN_SMALLGAP;
    1324                 :         15 :             break;
    1325                 :            :         case 14:
    1326                 :          0 :             eStyle = table::BorderLineStyle::THINTHICK_MEDIUMGAP;
    1327                 :          0 :             break;
    1328                 :            :         case 15:
    1329                 :            :         case 16: //Don't have thin thick thin, so use thick thin
    1330                 :         27 :             eStyle = table::BorderLineStyle::THICKTHIN_MEDIUMGAP;
    1331                 :         27 :             break;
    1332                 :            :         case 17:
    1333                 :         27 :             eStyle = table::BorderLineStyle::THINTHICK_LARGEGAP;
    1334                 :         27 :             break;
    1335                 :            :         case 18:
    1336                 :            :         case 19: //Don't have thin thick thin, so use thick thin
    1337                 :         54 :             eStyle = table::BorderLineStyle::THICKTHIN_LARGEGAP;
    1338                 :         54 :             break;
    1339                 :            :         case 24:
    1340                 :         18 :             eStyle = table::BorderLineStyle::EMBOSSED;
    1341                 :         18 :             break;
    1342                 :            :         case 25:
    1343                 :         18 :             eStyle = table::BorderLineStyle::ENGRAVED;
    1344                 :         18 :             break;
    1345                 :            :         case 26:
    1346                 :          0 :             eStyle = table::BorderLineStyle::OUTSET;
    1347                 :          0 :             break;
    1348                 :            :         case 27:
    1349                 :          0 :             eStyle = table::BorderLineStyle::INSET;
    1350                 :          0 :             break;
    1351                 :            :         default:
    1352                 :         24 :             eStyle = table::BorderLineStyle::NONE;
    1353                 :         24 :             break;
    1354                 :            :     }
    1355                 :            : 
    1356         [ +  - ]:       1863 :     ::editeng::SvxBorderLine aLine;
    1357         [ +  - ]:       1863 :     aLine.SetBorderLineStyle( eStyle );
    1358                 :            :     double const fConverted( (table::BorderLineStyle::NONE == eStyle) ? 0.0 :
    1359 [ +  + ][ +  - ]:       1863 :             ::editeng::ConvertBorderWidthFromWord(eStyle, nLineThickness));
    1360                 :       1863 :     aLine.SetWidth(fConverted);
    1361                 :            : 
    1362                 :            :     //No AUTO for borders as yet, so if AUTO, use BLACK
    1363         [ +  + ]:       1863 :     if (nCol == 0)
    1364                 :       1539 :         nCol = 1;
    1365                 :            : 
    1366                 :       1863 :     aLine.SetColor(SwWW8ImplReader::GetCol(nCol));
    1367                 :            : 
    1368         [ +  + ]:       1863 :     if (pSize)
    1369                 :        306 :         pSize[nWWIndex] = fConverted + nSpace;
    1370                 :            : 
    1371         [ +  - ]:       1863 :     rBox.SetLine(&aLine, nOOIndex);
    1372         [ +  - ]:       1863 :     rBox.SetDistance(nSpace, nOOIndex);
    1373                 :            : 
    1374                 :       1863 : }
    1375                 :            : 
    1376                 :       1863 : void Set1Border(bool bVer67, SvxBoxItem &rBox, const WW8_BRC& rBor,
    1377                 :            :     sal_uInt16 nOOIndex, sal_uInt16 nWWIndex, short *pSize=0)
    1378                 :            : {
    1379                 :            :     sal_uInt8 nCol;
    1380                 :            :     short nSpace, nIdx;
    1381                 :            :     short nLineThickness = rBor.DetermineBorderProperties(bVer67,&nSpace,&nCol,
    1382         [ +  - ]:       1863 :         &nIdx);
    1383                 :            : 
    1384         [ +  - ]:       1863 :     GetLineIndex(rBox, nLineThickness, nSpace, nCol, nIdx, nOOIndex, nWWIndex, pSize );
    1385                 :            : 
    1386                 :       1863 : }
    1387                 :            : 
    1388                 :       1068 : bool lcl_IsBorder(bool bVer67, const WW8_BRC* pbrc, bool bChkBtwn = false)
    1389                 :            : {
    1390         [ -  + ]:       1068 :     if( bVer67  )
    1391                 :          0 :         return ( pbrc[WW8_TOP  ].aBits1[0] & 0x18 ) ||  // brcType  != 0
    1392                 :          0 :                ( pbrc[WW8_LEFT ].aBits1[0] & 0x18 ) ||
    1393                 :          0 :                ( pbrc[WW8_BOT  ].aBits1[0] & 0x18 ) ||
    1394                 :          0 :                ( pbrc[WW8_RIGHT].aBits1[0] & 0x18 ) ||
    1395                 :          0 :                ( bChkBtwn && ( pbrc[WW8_BETW ].aBits1[0] )) ||
    1396                 :            :                //can have dotted and dashed with a brcType of 0
    1397                 :          0 :                ( (pbrc[WW8_TOP  ].aBits1[0] & 0x07)+1 > 6) ||
    1398                 :          0 :                ( (pbrc[WW8_LEFT ].aBits1[0] & 0x07)+1 > 6) ||
    1399                 :          0 :                ( (pbrc[WW8_BOT  ].aBits1[0] & 0x07)+1 > 6) ||
    1400                 :          0 :                ( (pbrc[WW8_RIGHT].aBits1[0] & 0x07)+1 > 6) ||
    1401 [ #  # ][ #  # ]:          0 :                ( bChkBtwn && ( (pbrc[WW8_BETW ].aBits1[0] & 0x07)+1 > 6))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1402                 :            :                ;
    1403                 :            :                 // Abfrage auf 0x1f statt 0x18 ist noetig, da zumindest einige
    1404                 :            :                 // WW-Versionen ( 6.0 US ) bei dotted brcType auf 0 setzen
    1405                 :            :     else
    1406                 :       1068 :         return pbrc[WW8_TOP  ].aBits1[1] ||         // brcType  != 0
    1407                 :        483 :                pbrc[WW8_LEFT ].aBits1[1] ||
    1408                 :        471 :                pbrc[WW8_BOT  ].aBits1[1] ||
    1409                 :        441 :                pbrc[WW8_RIGHT].aBits1[1] ||
    1410 [ +  + ][ +  + ]:       1068 :                (bChkBtwn && pbrc[WW8_BETW ].aBits1[1]);
         [ +  + ][ +  - ]
         [ -  + ][ #  # ]
    1411                 :            : }
    1412                 :            : 
    1413                 :       1068 : bool SwWW8ImplReader::IsBorder(const WW8_BRC* pbrc, bool bChkBtwn) const
    1414                 :            : {
    1415                 :       1068 :     return lcl_IsBorder(bVer67, pbrc, bChkBtwn);
    1416                 :            : }
    1417                 :            : 
    1418                 :       2508 : bool WW8_BRC::IsEmpty(bool bVer67) const
    1419                 :            : {
    1420 [ +  + ][ +  + ]:       2508 :     return (IsBlank() || IsZeroed(bVer67));
    1421                 :            : }
    1422                 :            : 
    1423                 :       2508 : bool WW8_BRC::IsBlank() const
    1424                 :            : {
    1425 [ +  + ][ +  - ]:       2508 :     return (aBits1[0] == 0xff && aBits1[1] == 0xff);
    1426                 :            : }
    1427                 :            : 
    1428                 :       6456 : bool WW8_BRC::IsZeroed(bool bVer67) const
    1429                 :            : {
    1430         [ -  + ]:       6456 :     return (!(bVer67 ? (aBits1[0] & 0x001f) : aBits1[1]));
    1431                 :            : }
    1432                 :            : 
    1433                 :        627 : bool SwWW8ImplReader::SetBorder(SvxBoxItem& rBox, const WW8_BRC* pbrc,
    1434                 :            :     short *pSizeArray, sal_uInt8 nSetBorders) const
    1435                 :            : {
    1436                 :        627 :     bool bChange = false;
    1437                 :            :     static const sal_uInt16 aIdArr[ 10 ] =
    1438                 :            :     {
    1439                 :            :         WW8_TOP,    BOX_LINE_TOP,
    1440                 :            :         WW8_LEFT,   BOX_LINE_LEFT,
    1441                 :            :         WW8_RIGHT,  BOX_LINE_RIGHT,
    1442                 :            :         WW8_BOT,    BOX_LINE_BOTTOM,
    1443                 :            :         WW8_BETW,   BOX_LINE_BOTTOM
    1444                 :            :     };
    1445                 :            : 
    1446         [ +  + ]:       3135 :     for( int i = 0, nEnd = 8; i < nEnd; i += 2 )
    1447                 :            :     {
    1448                 :            :         // ungueltige Borders ausfiltern
    1449                 :       2508 :         const WW8_BRC& rB = pbrc[ aIdArr[ i ] ];
    1450         [ +  + ]:       2508 :         if( !rB.IsEmpty(bVer67))
    1451                 :            :         {
    1452                 :       1863 :             Set1Border(bVer67, rBox, rB, aIdArr[i+1], aIdArr[i], pSizeArray);
    1453                 :       1863 :             bChange = true;
    1454                 :            :         }
    1455         [ +  + ]:        645 :         else if ( nSetBorders & (1 << aIdArr[i]) )
    1456                 :            :         {
    1457                 :            :             /*
    1458                 :            :             ##826##, ##653##
    1459                 :            : 
    1460                 :            :             If a style has borders set,and the para attributes attempt remove
    1461                 :            :             the borders, then this is perfectably acceptable, so we shouldn't
    1462                 :            :             ignore this blank entry
    1463                 :            : 
    1464                 :            :             nSetBorders has a bit set for each location that a sprm set a
    1465                 :            :             border, so with a sprm set, but no border, then disable the
    1466                 :            :             appropriate border
    1467                 :            :             */
    1468                 :        573 :             rBox.SetLine( 0, aIdArr[ i+1 ] );
    1469                 :            :         }
    1470                 :            :     }
    1471                 :        627 :     return bChange;
    1472                 :            : }
    1473                 :            : 
    1474                 :            : 
    1475                 :         99 : bool SwWW8ImplReader::SetShadow(SvxShadowItem& rShadow, const short *pSizeArray,
    1476                 :            :     const WW8_BRC *pbrc) const
    1477                 :            : {
    1478                 :            :     bool bRet = (
    1479                 :          0 :                 ( bVer67 ? (pbrc[WW8_RIGHT].aBits1[ 0 ] & 0x20 )
    1480                 :         99 :                          : (pbrc[WW8_RIGHT].aBits2[ 1 ] & 0x20 ) )
    1481         [ -  + ]:         99 :                 && (pSizeArray && pSizeArray[WW8_RIGHT])
    1482 [ -  + ][ #  # ]:        198 :                 );
         [ #  # ][ #  # ]
    1483         [ -  + ]:         99 :     if (bRet)
    1484                 :            :     {
    1485                 :          0 :         rShadow.SetColor(Color(COL_BLACK));
    1486                 :          0 :         short nVal = pSizeArray[WW8_RIGHT];
    1487         [ #  # ]:          0 :         if (nVal < 0x10)
    1488                 :          0 :             nVal = 0x10;
    1489                 :          0 :         rShadow.SetWidth(nVal);
    1490                 :          0 :         rShadow.SetLocation(SVX_SHADOW_BOTTOMRIGHT);
    1491                 :          0 :         bRet = true;
    1492                 :            :     }
    1493                 :         99 :     return bRet;
    1494                 :            : }
    1495                 :            : 
    1496                 :         99 : void SwWW8ImplReader::GetBorderDistance(const WW8_BRC* pbrc,
    1497                 :            :     Rectangle& rInnerDist) const
    1498                 :            : {
    1499                 :            :     // 'dptSpace' is stored in 3 bits of 'Border Code (BRC)'
    1500         [ -  + ]:         99 :     if (bVer67)
    1501                 :            :     {
    1502                 :          0 :         rInnerDist = Rectangle(((pbrc[ 1 ].aBits1[1] >> 3) & 0x1f) * 20,
    1503                 :          0 :                                ((pbrc[ 0 ].aBits1[1] >> 3) & 0x1f) * 20,
    1504                 :          0 :                                ((pbrc[ 3 ].aBits1[1] >> 3) & 0x1f) * 20,
    1505                 :          0 :                                ((pbrc[ 2 ].aBits1[1] >> 3) & 0x1f) * 20 );
    1506                 :            :     }
    1507                 :            :     else
    1508                 :            :     {
    1509                 :         99 :         rInnerDist = Rectangle( (pbrc[ 1 ].aBits2[1]       & 0x1f) * 20,
    1510                 :         99 :                                 (pbrc[ 0 ].aBits2[1]       & 0x1f) * 20,
    1511                 :         99 :                                 (pbrc[ 3 ].aBits2[1]       & 0x1f) * 20,
    1512                 :         99 :                                 (pbrc[ 2 ].aBits2[1]       & 0x1f) * 20 );
    1513                 :            :     }
    1514                 :         99 : }
    1515                 :            : 
    1516                 :            : 
    1517                 :         27 : bool SwWW8ImplReader::SetFlyBordersShadow(SfxItemSet& rFlySet,
    1518                 :            :     const WW8_BRC *pbrc, short *pSizeArray) const
    1519                 :            : {
    1520                 :         27 :     bool bShadowed = false;
    1521         [ -  + ]:         27 :     if (IsBorder(pbrc))
    1522                 :            :     {
    1523         [ #  # ]:          0 :         SvxBoxItem aBox( RES_BOX );
    1524         [ #  # ]:          0 :         SetBorder(aBox, pbrc, pSizeArray);
    1525                 :            : 
    1526         [ #  # ]:          0 :         rFlySet.Put( aBox );
    1527                 :            : 
    1528                 :            :         // fShadow
    1529         [ #  # ]:          0 :         SvxShadowItem aShadow( RES_SHADOW );
    1530         [ #  # ]:          0 :         if( SetShadow( aShadow, pSizeArray, pbrc ))
    1531                 :            :         {
    1532                 :          0 :             bShadowed = true;
    1533         [ #  # ]:          0 :             rFlySet.Put( aShadow );
    1534 [ #  # ][ #  # ]:          0 :         }
    1535                 :            :     }
    1536                 :         27 :     return bShadowed;
    1537                 :            : }
    1538                 :            : 
    1539                 :            : //-----------------------------------------
    1540                 :            : //              APOs
    1541                 :            : //-----------------------------------------
    1542                 :            :                             // fuer Berechnung der minimalen FrameSize
    1543                 :            : #define MAX_BORDER_SIZE 210         // so breit ist max. der Border
    1544                 :            : #define MAX_EMPTY_BORDER 10         // fuer +-1-Fehler, mindestens 1
    1545                 :            : 
    1546                 :         18 : static void FlySecur1(short& rSize, const bool bBorder)
    1547                 :            : {
    1548                 :            :     short nMin = MINFLY +
    1549         [ -  + ]:         18 :         (bBorder ? MAX_BORDER_SIZE : MAX_EMPTY_BORDER);
    1550                 :            : 
    1551         [ +  + ]:         18 :     if ( rSize < nMin )
    1552                 :          9 :         rSize = nMin;
    1553                 :         18 : }
    1554                 :            : 
    1555                 :        144 : inline bool SetValSprm( sal_Int16* pVar, WW8PLCFx_Cp_FKP* pPap, sal_uInt16 nId )
    1556                 :            : {
    1557                 :        144 :     const sal_uInt8* pS = pPap->HasSprm( nId );
    1558         [ +  + ]:        144 :     if( pS )
    1559                 :         36 :         *pVar = (sal_Int16)SVBT16ToShort( pS );
    1560                 :        144 :     return ( pS != 0 );
    1561                 :            : }
    1562                 :            : 
    1563                 :         48 : inline bool SetValSprm( sal_Int16* pVar, const WW8RStyle* pStyle, sal_uInt16 nId )
    1564                 :            : {
    1565                 :         48 :     const sal_uInt8* pS = pStyle->HasParaSprm( nId );
    1566         [ +  + ]:         48 :     if( pS )
    1567                 :         36 :         *pVar = (sal_Int16)SVBT16ToShort( pS );
    1568                 :         48 :     return ( pS != 0 );
    1569                 :            : }
    1570                 :            : 
    1571                 :            : /*
    1572                 :            : #i1930 revealed that sprm 0x360D as used in tables can affect the frame
    1573                 :            : around the table. Its full structure is not fully understood as yet.
    1574                 :            : */
    1575                 :         18 : void WW8FlyPara::ApplyTabPos(const WW8_TablePos *pTabPos)
    1576                 :            : {
    1577         [ -  + ]:         18 :     if (pTabPos)
    1578                 :            :     {
    1579                 :          0 :         nSp26 = pTabPos->nSp26;
    1580                 :          0 :         nSp27 = pTabPos->nSp27;
    1581                 :          0 :         nSp29 = pTabPos->nSp29;
    1582                 :          0 :         nLeMgn = pTabPos->nLeMgn;
    1583                 :          0 :         nRiMgn = pTabPos->nRiMgn;
    1584                 :          0 :         nUpMgn = pTabPos->nUpMgn;
    1585                 :          0 :         nLoMgn = pTabPos->nLoMgn;
    1586                 :          0 :         nSp37 = pTabPos->nSp37;
    1587                 :            :     }
    1588                 :         18 : }
    1589                 :            : 
    1590         [ +  + ]:        288 : WW8FlyPara::WW8FlyPara(bool bIsVer67, const WW8FlyPara* pSrc /* = 0 */)
    1591                 :            : {
    1592         [ -  + ]:         48 :     if ( pSrc )
    1593                 :          0 :         memcpy( this, pSrc, sizeof( WW8FlyPara ) ); // Copy-Ctor
    1594                 :            :     else
    1595                 :            :     {
    1596                 :         48 :         memset( this, 0, sizeof( WW8FlyPara ) );    // Default-Ctor
    1597                 :         48 :         nSp37 = 2;                                  // Default: Umfluss
    1598                 :            :     }
    1599                 :         48 :     bVer67 = bIsVer67;
    1600                 :         48 : }
    1601                 :            : 
    1602                 :         24 : bool WW8FlyPara::operator==(const WW8FlyPara& rSrc) const
    1603                 :            : {
    1604                 :            :     /*
    1605                 :            :      Compare the parts that word seems to compare for equivalence.
    1606                 :            :      Interestingly being autoheight or absolute height (the & 0x7fff) doesn't
    1607                 :            :      matter to word
    1608                 :            :     */
    1609                 :            :     return
    1610                 :            :        (
    1611                 :            :          (nSp26 == rSrc.nSp26) &&
    1612                 :            :          (nSp27 == rSrc.nSp27) &&
    1613                 :            :          ((nSp45 & 0x7fff) == (rSrc.nSp45 & 0x7fff)) &&
    1614                 :            :          (nSp28 == rSrc.nSp28) &&
    1615                 :            :          (nLeMgn == rSrc.nLeMgn) &&
    1616                 :            :          (nRiMgn == rSrc.nRiMgn) &&
    1617                 :            :          (nUpMgn == rSrc.nUpMgn) &&
    1618                 :            :          (nLoMgn == rSrc.nLoMgn) &&
    1619                 :            :          (nSp29 == rSrc.nSp29) &&
    1620                 :            :          (nSp37 == rSrc.nSp37)
    1621 [ -  + ][ #  # ]:         24 :        );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1622                 :            : }
    1623                 :            : 
    1624                 :            : // Read fuer normalen Text
    1625                 :         18 : void WW8FlyPara::Read(sal_uInt8 nOrigSp29, WW8PLCFx_Cp_FKP* pPap)
    1626                 :            : {
    1627                 :         18 :     const sal_uInt8* pS = 0;
    1628         [ -  + ]:         18 :     if( bVer67 )
    1629                 :            :     {
    1630                 :          0 :         SetValSprm( &nSp26, pPap, 26 ); // X-Position   //sprmPDxaAbs
    1631                 :            :         //set in me or in parent style
    1632                 :          0 :         mbVertSet |= SetValSprm( &nSp27, pPap, 27 );    // Y-Position   //sprmPDyaAbs
    1633                 :          0 :         SetValSprm( &nSp45, pPap, 45 ); // Hoehe        //sprmPWHeightAbs
    1634                 :          0 :         SetValSprm( &nSp28, pPap, 28 ); // Breite       //sprmPDxaWidth
    1635                 :          0 :         SetValSprm( &nLeMgn, pPap, 49 ); // L-Raender   //sprmPDxaFromText
    1636                 :          0 :         SetValSprm( &nRiMgn, pPap, 49 ); // R-Raender   //sprmPDxaFromText
    1637                 :          0 :         SetValSprm( &nUpMgn, pPap, 48 ); // U-Raender   //sprmPDyaFromText
    1638                 :          0 :         SetValSprm( &nLoMgn, pPap, 48 ); // D-Raender   //sprmPDyaFromText
    1639                 :            : 
    1640                 :          0 :         pS = pPap->HasSprm( 37 );                       //sprmPWr
    1641         [ #  # ]:          0 :         if( pS )
    1642                 :          0 :             nSp37 = *pS;
    1643                 :            :     }
    1644                 :            :     else
    1645                 :            :     {
    1646                 :         18 :         SetValSprm( &nSp26, pPap, 0x8418 ); // X-Position
    1647                 :            :         //set in me or in parent style
    1648                 :         18 :         mbVertSet |= SetValSprm( &nSp27, pPap, 0x8419 );    // Y-Position
    1649                 :         18 :         SetValSprm( &nSp45, pPap, 0x442B ); // Hoehe
    1650                 :         18 :         SetValSprm( &nSp28, pPap, 0x841A ); // Breite
    1651                 :         18 :         SetValSprm( &nLeMgn, pPap, 0x842F );    // L-Raender
    1652                 :         18 :         SetValSprm( &nRiMgn, pPap, 0x842F );    // R-Raender
    1653                 :         18 :         SetValSprm( &nUpMgn, pPap, 0x842E );    // U-Raender
    1654                 :         18 :         SetValSprm( &nLoMgn, pPap, 0x842E );    // D-Raender
    1655                 :            : 
    1656                 :         18 :         pS = pPap->HasSprm( 0x2423 );                               // Umfluss
    1657         [ +  - ]:         18 :         if( pS )
    1658                 :         18 :             nSp37 = *pS;
    1659                 :            :     }
    1660                 :            : 
    1661         [ -  + ]:         18 :     if( ::lcl_ReadBorders( bVer67, brc, pPap ))     // Umrandung
    1662                 :          0 :         bBorderLines = ::lcl_IsBorder( bVer67, brc );
    1663                 :            : 
    1664                 :            :     /*
    1665                 :            :      #i8798#
    1666                 :            :      Appears that with no dyaAbs set then the actual vert anchoring set is
    1667                 :            :      ignored and we remain relative to text, so if that is the case we are 0
    1668                 :            :      from para anchor, so we update the frame to have explicitly this type of
    1669                 :            :      anchoring
    1670                 :            :     */
    1671         [ -  + ]:         18 :     if (!mbVertSet)
    1672                 :          0 :         nSp29 = (nOrigSp29 & 0xCF) | 0x20;
    1673                 :            :     else
    1674                 :         18 :         nSp29 = nOrigSp29;
    1675                 :         18 : }
    1676                 :            : 
    1677                 :         18 : void WW8FlyPara::ReadFull(sal_uInt8 nOrigSp29, SwWW8ImplReader* pIo)
    1678                 :            : {
    1679                 :         18 :     WW8PLCFMan* pPlcxMan = pIo->pPlcxMan;
    1680                 :         18 :     WW8PLCFx_Cp_FKP* pPap = pPlcxMan->GetPapPLCF();
    1681                 :            : 
    1682                 :         18 :     Read(nOrigSp29, pPap);    // Lies Apo-Parameter
    1683                 :            : 
    1684                 :            :     do{             // Block zum rausspringen
    1685         [ +  - ]:         18 :         if( nSp45 != 0 /* || nSp28 != 0 */ )
    1686                 :            :             break;                      // bGrafApo nur bei Hoehe automatisch
    1687         [ +  - ]:         18 :         if( pIo->pWwFib->fComplex )
    1688                 :            :             break;                      // (*pPap)++ geht bei FastSave schief
    1689                 :            :                                         // -> bei FastSave kein Test auf Grafik-APO
    1690                 :         18 :         SvStream* pIoStrm = pIo->pStrm;
    1691                 :         18 :         sal_uLong nPos = pIoStrm->Tell();
    1692                 :            :         WW8PLCFxSave1 aSave;
    1693         [ +  - ]:         18 :         pPlcxMan->GetPap()->Save( aSave );
    1694                 :         18 :         bGrafApo = false;
    1695                 :            : 
    1696                 :            :         do{             // Block zum rausspringen
    1697                 :            :             sal_uInt8 nTxt[2];
    1698                 :            : 
    1699 [ +  - ][ +  - ]:         18 :             if (!checkRead(*pIoStrm, nTxt, 2)) // lies Text
    1700                 :            :                 break;
    1701                 :            : 
    1702 [ -  + ][ #  # ]:         18 :             if( nTxt[0] != 0x01 || nTxt[1] != 0x0d )// nur Grafik + CR ?
    1703                 :            :                 break;                              // Nein
    1704                 :            : 
    1705         [ #  # ]:          0 :             pPap->advance();                        // Naechste Zeile
    1706                 :            : 
    1707                 :            :             // In APO ?
    1708                 :            :             //sprmPPc
    1709 [ #  # ][ #  # ]:          0 :             const sal_uInt8* pS = pPap->HasSprm( bVer67 ? 29 : 0x261B );
    1710                 :            : 
    1711                 :            :             // Nein -> Grafik-Apo
    1712         [ #  # ]:          0 :             if (!pS)
    1713                 :            :             {
    1714                 :          0 :                 bGrafApo = true;
    1715                 :            :                 break;                              // Ende des APO
    1716                 :            :             }
    1717                 :            : 
    1718         [ #  # ]:          0 :             ww::WordVersion eVer = pIo->GetFib().GetFIBVersion();
    1719                 :          0 :             WW8FlyPara *pNowStyleApo=0;
    1720         [ #  # ]:          0 :             sal_uInt16 nColl = pPap->GetIstd();
    1721         [ #  # ]:          0 :             ww::sti eSti = eVer < ww::eWW6 ? ww::GetCanonicalStiFromStc( static_cast< sal_uInt8 >(nColl) ) : static_cast<ww::sti>(nColl);
    1722 [ #  # ][ #  # ]:          0 :             while (eSti != ww::stiNil && nColl < pIo->vColl.size() && 0 == (pNowStyleApo = pIo->vColl[nColl].pWWFly))
         [ #  # ][ #  # ]
    1723                 :            :             {
    1724                 :          0 :                 nColl = pIo->vColl[nColl].nBase;
    1725         [ #  # ]:          0 :                 eSti = eVer < ww::eWW6 ? ww::GetCanonicalStiFromStc( static_cast< sal_uInt8 >(nColl) ) : static_cast<ww::sti>(nColl);
    1726                 :            :             }
    1727                 :            : 
    1728                 :          0 :             WW8FlyPara aF(bVer67, pNowStyleApo);
    1729                 :            :                                                 // Neuer FlaPara zum Vergleich
    1730         [ #  # ]:          0 :             aF.Read( *pS, pPap );               // WWPara fuer neuen Para
    1731         [ #  # ]:          0 :             if( !( aF == *this ) )              // selber APO ? ( oder neuer ? )
    1732                 :         18 :                 bGrafApo = true;                // nein -> 1-zeiliger APO
    1733                 :            :                                                 //      -> Grafik-APO
    1734                 :            :         }
    1735                 :            :         while( 0 );                             // Block zum rausspringen
    1736                 :            : 
    1737         [ +  - ]:         18 :         pPlcxMan->GetPap()->Restore( aSave );
    1738         [ +  - ]:         18 :         pIoStrm->Seek( nPos );
    1739                 :            :     }while( 0 );                                    // Block zum rausspringen
    1740                 :         18 : }
    1741                 :            : 
    1742                 :            : 
    1743                 :            : // Read fuer Apo-Defs in Styledefs
    1744                 :          6 : void WW8FlyPara::Read(sal_uInt8 nOrigSp29, WW8RStyle* pStyle)
    1745                 :            : {
    1746                 :          6 :     const sal_uInt8* pS = 0;
    1747         [ -  + ]:          6 :     if (bVer67)
    1748                 :            :     {
    1749                 :          0 :         SetValSprm( &nSp26, pStyle, 26 );   // X-Position
    1750                 :            :         //set in me or in parent style
    1751                 :          0 :         mbVertSet |= SetValSprm(&nSp27, pStyle, 27);    // Y-Position
    1752                 :          0 :         SetValSprm( &nSp45, pStyle, 45 );   // Hoehe
    1753                 :          0 :         SetValSprm( &nSp28, pStyle, 28 );   // Breite
    1754                 :          0 :         SetValSprm( &nLeMgn,    pStyle, 49 );   // L-Raender
    1755                 :          0 :         SetValSprm( &nRiMgn,    pStyle, 49 );   // R-Raender
    1756                 :          0 :         SetValSprm( &nUpMgn,    pStyle, 48 );   // U-Raender
    1757                 :          0 :         SetValSprm( &nLoMgn,    pStyle, 48 );   // D-Raender
    1758                 :            : 
    1759                 :          0 :         pS = pStyle->HasParaSprm( 37 );             // Umfluss
    1760         [ #  # ]:          0 :         if( pS )
    1761                 :          0 :             nSp37 = *pS;
    1762                 :            :     }
    1763                 :            :     else
    1764                 :            :     {
    1765                 :          6 :         SetValSprm( &nSp26, pStyle, 0x8418 );   // X-Position
    1766                 :            :         //set in me or in parent style
    1767                 :          6 :         mbVertSet |= SetValSprm(&nSp27, pStyle, 0x8419);    // Y-Position
    1768                 :          6 :         SetValSprm( &nSp45, pStyle, 0x442B );   // Hoehe
    1769                 :          6 :         SetValSprm( &nSp28, pStyle, 0x841A );   // Breite
    1770                 :          6 :         SetValSprm( &nLeMgn, pStyle, 0x842F );  // L-Raender
    1771                 :          6 :         SetValSprm( &nRiMgn, pStyle, 0x842F );  // R-Raender
    1772                 :          6 :         SetValSprm( &nUpMgn, pStyle, 0x842E );  // U-Raender
    1773                 :          6 :         SetValSprm( &nLoMgn, pStyle, 0x842E );  // D-Raender
    1774                 :            : 
    1775                 :          6 :         pS = pStyle->HasParaSprm( 0x2423 );             // Umfluss
    1776         [ -  + ]:          6 :         if( pS )
    1777                 :          0 :             nSp37 = *pS;
    1778                 :            :     }
    1779                 :            : 
    1780         [ -  + ]:          6 :     if (::lcl_ReadBorders(bVer67, brc, 0, pStyle))      // Umrandung
    1781                 :          0 :         bBorderLines = ::lcl_IsBorder(bVer67, brc);
    1782                 :            : 
    1783                 :            :     /*
    1784                 :            :      #i8798#
    1785                 :            :      Appears that with no dyaAbs set then the actual vert anchoring set is
    1786                 :            :      ignored and we remain relative to text, so if that is the case we are 0
    1787                 :            :      from para anchor, so we update the frame to have explicitly this type of
    1788                 :            :      anchoring
    1789                 :            :     */
    1790         [ -  + ]:          6 :     if (!mbVertSet)
    1791                 :          0 :         nSp29 = (nOrigSp29 & 0xCF) | 0x20;
    1792                 :            :     else
    1793                 :          6 :         nSp29 = nOrigSp29;
    1794                 :          6 : }
    1795                 :            : 
    1796                 :         24 : bool WW8FlyPara::IsEmpty() const
    1797                 :            : {
    1798                 :         24 :     WW8FlyPara aEmpty(bVer67);
    1799                 :            :     /*
    1800                 :            :      wr of 0 like 2 appears to me to be equivalent for checking here. See
    1801                 :            :      #107103# if wrong, so given that the empty is 2, if we are 0 then set
    1802                 :            :      empty to 0 to make 0 equiv to 2 for empty checking
    1803                 :            :     */
    1804                 :            :     OSL_ENSURE(aEmpty.nSp37 == 2, "this is not what we expect for nSp37");
    1805         [ -  + ]:         24 :     if (this->nSp37 == 0)
    1806                 :          0 :         aEmpty.nSp37 = 0;
    1807         [ -  + ]:         24 :     if (aEmpty == *this)
    1808                 :          0 :         return true;
    1809                 :         24 :     return false;
    1810                 :            : }
    1811                 :            : 
    1812                 :            : // #i18732# - changes made on behalf of CMC
    1813                 :          9 : WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM,
    1814                 :            :                             WW8FlyPara& rWW,
    1815                 :            :                             const sal_uInt32 nWWPgTop,
    1816                 :            :                             const sal_uInt32 nPgLeft,
    1817                 :            :                             const sal_uInt32 nPgWidth,
    1818                 :            :                             const sal_Int32 nIniFlyDx,
    1819                 :            :                             const sal_Int32 nIniFlyDy )
    1820                 :            : {
    1821                 :            :     (void) rPaM;
    1822                 :            :     (void) nPgLeft;
    1823                 :            : 
    1824                 :          9 :     memset( this, 0, sizeof( WW8SwFlyPara ) );  // Initialisieren
    1825                 :          9 :     nNewNettoWidth = MINFLY;                    // Minimum
    1826                 :            : 
    1827         [ +  - ]:          9 :     eSurround = ( rWW.nSp37 > 1 ) ? SURROUND_IDEAL : SURROUND_NONE;
    1828                 :            : 
    1829                 :            :     /*
    1830                 :            :      #95905#, #83307# seems to have gone away now, so reenable parallel
    1831                 :            :      wrapping support for frames in headers/footers. I don't know if we truly
    1832                 :            :      have an explictly specified behaviour for these circumstances.
    1833                 :            :     */
    1834                 :            : 
    1835                 :          9 :     nHeight = rWW.nSp45;
    1836         [ -  + ]:          9 :     if( nHeight & 0x8000 )
    1837                 :            :     {
    1838                 :          0 :         nHeight &= 0x7fff;
    1839                 :          0 :         eHeightFix = ATT_MIN_SIZE;
    1840                 :            :     }
    1841                 :            :     else
    1842                 :          9 :         eHeightFix = ATT_FIX_SIZE;
    1843                 :            : 
    1844         [ +  - ]:          9 :     if( nHeight <= MINFLY )
    1845                 :            :     {                           // keine Angabe oder Stuss
    1846                 :          9 :         eHeightFix = ATT_MIN_SIZE;
    1847                 :          9 :         nHeight = MINFLY;
    1848                 :            :     }
    1849                 :            : 
    1850                 :          9 :     nWidth = nNettoWidth = rWW.nSp28;
    1851         [ +  - ]:          9 :     if( nWidth <= 10 )                              // Auto-Breite
    1852                 :            :     {
    1853                 :          9 :         bAutoWidth = true;
    1854                 :            :         nWidth = nNettoWidth =
    1855 [ +  - ][ +  - ]:          9 :             msword_cast<sal_Int16>((nPgWidth ? nPgWidth : 2268)); // 4 cm
    1856                 :            :     }
    1857         [ -  + ]:          9 :     if( nWidth <= MINFLY )
    1858                 :          0 :         nWidth = nNettoWidth = MINFLY;              // Minimale Breite
    1859                 :            : 
    1860                 :          9 :     eVAlign = text::VertOrientation::NONE;                            // Defaults
    1861                 :          9 :     eHAlign = text::HoriOrientation::NONE;
    1862                 :          9 :     nYPos = 0;
    1863                 :          9 :     nXPos = 0;
    1864                 :            : 
    1865                 :          9 :     nRiMgn = rWW.nRiMgn;
    1866                 :          9 :     nLeMgn = rWW.nLeMgn;
    1867                 :          9 :     nLoMgn = rWW.nLoMgn;
    1868                 :          9 :     nUpMgn = rWW.nUpMgn;
    1869                 :            : 
    1870                 :            :     /*
    1871                 :            :     See issue #i9178# for the 9 anchoring options, and make sure they stay
    1872                 :            :     working if you modify the anchoring logic here.
    1873                 :            :     */
    1874                 :            : 
    1875                 :            :     // Wenn der Fly links, rechts, oben oder unten aligned ist,
    1876                 :            :     // wird der aeussere Textabstand ignoriert, da sonst
    1877                 :            :     // der Fly an falscher Position landen wuerde
    1878                 :            :     // Problematisch wird es nur bei Innen/Aussen
    1879                 :            : 
    1880                 :            :     // Bindung
    1881                 :          9 :     nYBind = (( rWW.nSp29 & 0x30 ) >> 4);
    1882                 :            :     //#i53725# - absolute positioned objects have to be
    1883                 :            :     // anchored at-paragraph to assure its correct anchor position.
    1884                 :          9 :     eAnchor = FLY_AT_PARA;
    1885                 :            : 
    1886      [ -  -  + ]:          9 :     switch (nYBind)
    1887                 :            :     {
    1888                 :            :         case 0:     //relative to margin
    1889                 :          0 :             eVRel = text::RelOrientation::PAGE_PRINT_AREA;
    1890                 :          0 :             break;
    1891                 :            :         case 1:     //relative to page
    1892                 :          0 :             eVRel = text::RelOrientation::PAGE_FRAME;
    1893                 :          0 :             break;
    1894                 :            :         default:    //relative to text
    1895                 :          9 :             eVRel = text::RelOrientation::FRAME;
    1896                 :          9 :             break;
    1897                 :            :     }
    1898                 :            : 
    1899                 :            : // #i18732#
    1900   [ -  -  -  + ]:          9 :     switch( rWW.nSp27 )             // besondere Y-Positionen ?
    1901                 :            :     {
    1902                 :            :         case -4:
    1903                 :          0 :             eVAlign = text::VertOrientation::TOP;
    1904         [ #  # ]:          0 :             if (nYBind < 2)
    1905                 :          0 :                 nUpMgn = 0;
    1906                 :          0 :             break;  // oben
    1907                 :            :         case -8:
    1908                 :          0 :             eVAlign = text::VertOrientation::CENTER;
    1909                 :          0 :             break;  // zentriert
    1910                 :            :         case -12:
    1911                 :          0 :             eVAlign = text::VertOrientation::BOTTOM;
    1912         [ #  # ]:          0 :             if (nYBind < 2)
    1913                 :          0 :                 nLoMgn = 0;
    1914                 :          0 :             break;  // unten
    1915                 :            :         default:
    1916                 :          9 :             nYPos = rWW.nSp27 + (short)nIniFlyDy;
    1917                 :          9 :             break;  // Korrekturen per Ini-Datei
    1918                 :            :     }
    1919                 :            : 
    1920   [ -  +  -  -  :          9 :     switch( rWW.nSp26 )                 // besondere X-Positionen ?
                   -  - ]
    1921                 :            :     {
    1922                 :            :         case 0:
    1923                 :          0 :             eHAlign = text::HoriOrientation::LEFT;
    1924                 :          0 :             nLeMgn = 0;
    1925                 :          0 :             break;  // links
    1926                 :            :         case -4:
    1927                 :          9 :             eHAlign = text::HoriOrientation::CENTER;
    1928                 :          9 :             break;  // zentriert
    1929                 :            :         case -8:
    1930                 :          0 :             eHAlign = text::HoriOrientation::RIGHT;
    1931                 :          0 :             nRiMgn = 0;
    1932                 :          0 :             break;  // rechts
    1933                 :            :         case -12:
    1934                 :          0 :             eHAlign = text::HoriOrientation::LEFT;
    1935                 :          0 :             bToggelPos = true;
    1936                 :          0 :             break;  // innen
    1937                 :            :         case -16:
    1938                 :          0 :             eHAlign = text::HoriOrientation::RIGHT;
    1939                 :          0 :             bToggelPos = true;
    1940                 :          0 :             break;  // aussen
    1941                 :            :         default:
    1942                 :          0 :             nXPos = rWW.nSp26 + (short)nIniFlyDx;
    1943                 :          0 :             break;  // Korrekturen per Ini-Datei
    1944                 :            :     }
    1945                 :            : 
    1946                 :          9 :     nXBind = ( rWW.nSp29 & 0xc0 ) >> 6;
    1947                 :            : // #i18732#
    1948      [ -  +  - ]:          9 :     switch (nXBind)           // X - Bindung -> Koordinatentransformation
    1949                 :            :     {
    1950                 :            :         case 0:     //relative to column
    1951                 :          0 :             eHRel = text::RelOrientation::FRAME;
    1952                 :          0 :             break;
    1953                 :            :         case 1:     //relative to margin
    1954                 :          9 :             eHRel = text::RelOrientation::PAGE_PRINT_AREA;
    1955                 :          9 :             break;
    1956                 :            :         default:    //relative to page
    1957                 :          0 :             eHRel = text::RelOrientation::PAGE_FRAME;
    1958                 :          0 :             break;
    1959                 :            :     }
    1960                 :            : 
    1961                 :            :     // #i36649# - adjustments for certain horizontal alignments
    1962                 :            :     // Note: These special adjustments found by an investigation of documents
    1963                 :            :     //       containing frames with different left/right border distances and
    1964                 :            :     //       distances to text. The outcome is some how strange.
    1965                 :            :     // Note: These adjustments causes wrong horizontal positions for frames,
    1966                 :            :     //       which are aligned inside|outside to page|margin on even pages,
    1967                 :            :     //       the left and right border distances are different.
    1968                 :            :     // no adjustments possible, if frame has automatic width.
    1969                 :            :     // determine left border distance
    1970                 :          9 :     sal_Int16 nLeBorderMgn( 0L );
    1971         [ -  + ]:          9 :     if ( !bAutoWidth )
    1972                 :            :     {
    1973                 :            :         sal_Int16 nTemp = rWW.brc[WW8_LEFT].DetermineBorderProperties(rWW.bVer67,
    1974         [ #  # ]:          0 :             &nLeBorderMgn);
    1975                 :          0 :         nLeBorderMgn = nLeBorderMgn + nTemp;
    1976                 :            :     }
    1977                 :            :     // determine right border distance
    1978                 :          9 :     sal_Int16 nRiBorderMgn( 0L );
    1979         [ -  + ]:          9 :     if ( !bAutoWidth )
    1980                 :            :     {
    1981                 :            :         sal_Int16 nTemp = rWW.brc[WW8_RIGHT].DetermineBorderProperties(rWW.bVer67,
    1982         [ #  # ]:          0 :             &nRiBorderMgn);
    1983                 :          0 :         nRiBorderMgn = nRiBorderMgn + nTemp;
    1984                 :            :     }
    1985 [ -  + ][ #  # ]:          9 :     if ( !bAutoWidth && eHAlign == text::HoriOrientation::LEFT && eHRel == text::RelOrientation::PAGE_FRAME )
                 [ #  # ]
    1986                 :            :     {
    1987                 :            :         // convert 'left to page' to
    1988                 :            :         // 'from left -<width>-<2*left border distance>-<right wrap distance>
    1989                 :            :         // to page text area'
    1990                 :          0 :         eHAlign = text::HoriOrientation::NONE;
    1991                 :          0 :         eHRel = text::RelOrientation::PAGE_PRINT_AREA;
    1992                 :          0 :         nXPos = -nWidth - (2*nLeBorderMgn) - rWW.nRiMgn;
    1993                 :            :         // re-set left wrap distance
    1994                 :          0 :         nLeMgn = rWW.nLeMgn;
    1995                 :            :     }
    1996 [ -  + ][ #  # ]:          9 :     else if ( !bAutoWidth && eHAlign == text::HoriOrientation::RIGHT && eHRel == text::RelOrientation::PAGE_FRAME )
                 [ #  # ]
    1997                 :            :     {
    1998                 :            :         // convert 'right to page' to
    1999                 :            :         // 'from left <right border distance-left border distance>+<left wrap distance>
    2000                 :            :         // to right page border'
    2001                 :          0 :         eHAlign = text::HoriOrientation::NONE;
    2002                 :          0 :         eHRel = text::RelOrientation::PAGE_RIGHT;
    2003                 :          0 :         nXPos = ( nRiBorderMgn - nLeBorderMgn ) + rWW.nLeMgn;
    2004                 :            :         // re-set right wrap distance
    2005                 :          0 :         nRiMgn = rWW.nRiMgn;
    2006                 :            :     }
    2007 [ -  + ][ #  # ]:          9 :     else if ( !bAutoWidth && eHAlign == text::HoriOrientation::LEFT && eHRel == text::RelOrientation::PAGE_PRINT_AREA )
                 [ #  # ]
    2008                 :            :     {
    2009                 :            :         // convert 'left to margin' to
    2010                 :            :         // 'from left -<left border distance> to page text area'
    2011                 :          0 :         eHAlign = text::HoriOrientation::NONE;
    2012                 :          0 :         eHRel = text::RelOrientation::PAGE_PRINT_AREA;
    2013                 :          0 :         nXPos = -nLeBorderMgn;
    2014                 :            :         // re-set left wrap distance
    2015                 :          0 :         nLeMgn = rWW.nLeMgn;
    2016                 :            :     }
    2017 [ -  + ][ #  # ]:          9 :     else if ( !bAutoWidth && eHAlign == text::HoriOrientation::RIGHT && eHRel == text::RelOrientation::PAGE_PRINT_AREA )
                 [ #  # ]
    2018                 :            :     {
    2019                 :            :         // convert 'right to margin' to
    2020                 :            :         // 'from left -<width>-<left border distance> to right page border'
    2021                 :          0 :         eHAlign = text::HoriOrientation::NONE;
    2022                 :          0 :         eHRel = text::RelOrientation::PAGE_RIGHT;
    2023                 :          0 :         nXPos = -nWidth - nLeBorderMgn;
    2024                 :            :         // re-set right wrap distance
    2025                 :          0 :         nRiMgn = rWW.nRiMgn;
    2026                 :            :     }
    2027         [ -  + ]:          9 :     else if (rWW.bBorderLines)
    2028                 :            :     {
    2029                 :            :         /*
    2030                 :            :         #i582#
    2031                 :            :         Word has a curious bug where the offset stored do not take into
    2032                 :            :         account the internal distance from the corner both
    2033                 :            :         */
    2034                 :          0 :         sal_Int16 nLeLMgn = 0;
    2035                 :            :         sal_Int16 nTemp = rWW.brc[WW8_LEFT].DetermineBorderProperties(rWW.bVer67,
    2036         [ #  # ]:          0 :             &nLeLMgn);
    2037                 :          0 :         nLeLMgn = nLeLMgn + nTemp;
    2038                 :            : 
    2039         [ #  # ]:          0 :         if (nLeLMgn)
    2040                 :            :         {
    2041         [ #  # ]:          0 :             if (eHAlign == text::HoriOrientation::LEFT)
    2042                 :          0 :                 eHAlign = text::HoriOrientation::NONE;
    2043                 :          0 :             nXPos = nXPos - nLeLMgn;
    2044                 :            :         }
    2045                 :            :     }
    2046                 :            : 
    2047                 :            :     // adjustments for certain vertical alignments
    2048 [ +  - ][ -  + ]:          9 :     if ( eVAlign == text::VertOrientation::NONE && eVRel == text::RelOrientation::PAGE_PRINT_AREA )
    2049                 :            :     {
    2050                 :            :         // convert "<X> from top page text area" to
    2051                 :            :         // "<X + page top margin> from page"
    2052                 :          0 :         eVRel = text::RelOrientation::PAGE_FRAME;
    2053                 :          0 :         nYPos = static_cast< sal_Int16 >( nYPos + nWWPgTop );
    2054                 :            :     }
    2055                 :            : 
    2056                 :          9 :     FlySecur1( nWidth, rWW.bBorderLines );          // passen Raender ?
    2057                 :          9 :     FlySecur1( nHeight, rWW.bBorderLines );
    2058                 :            : 
    2059                 :          9 : }
    2060                 :            : 
    2061                 :            : // hat ein Fly in WW eine automatische Breite, dann muss das durch
    2062                 :            : // nachtraegliches Anpassen der ( im SW festen ) Fly-Breite simuliert werden.
    2063                 :            : // Dabei kann die Fly-Breite groesser oder kleiner werden, da der Default-Wert
    2064                 :            : // ohne Wissen ueber den Inhalt eingesetzt wird.
    2065                 :          0 : void WW8SwFlyPara::BoxUpWidth( long nInWidth )
    2066                 :            : {
    2067 [ #  # ][ #  # ]:          0 :     if( bAutoWidth && nInWidth > nNewNettoWidth )
    2068                 :          0 :         nNewNettoWidth = nInWidth;
    2069                 :          0 : };
    2070                 :            : 
    2071                 :            : // Die Klasse WW8FlySet ist von SfxItemSet abgeleitet und stellt auch
    2072                 :            : // im Prizip nicht mehr zur Verfuegung, ist aber fuer mich besser
    2073                 :            : // zu handeln
    2074                 :            : // WW8FlySet-ctor fuer Apos und Graf-Apos
    2075                 :          9 : WW8FlySet::WW8FlySet(SwWW8ImplReader& rReader, const WW8FlyPara* pFW,
    2076                 :            :     const WW8SwFlyPara* pFS, bool bGraf)
    2077                 :          9 :     : SfxItemSet(rReader.rDoc.GetAttrPool(),RES_FRMATR_BEGIN,RES_FRMATR_END-1)
    2078                 :            : {
    2079         [ -  + ]:          9 :     if (!rReader.mbNewDoc)
    2080         [ #  # ]:          0 :         Reader::ResetFrmFmtAttrs(*this);    // Abstand/Umrandung raus
    2081                 :            :                                             // Position
    2082 [ +  - ][ +  - ]:          9 :     Put(SvxFrameDirectionItem(FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR));
                 [ +  - ]
    2083                 :            : 
    2084                 :            : /*Below can all go when we have from left in rtl mode*/
    2085                 :          9 :     SwTwips nXPos = pFS->nXPos;
    2086                 :          9 :     sal_Int16 eHRel = pFS->eHRel;
    2087         [ +  - ]:          9 :     rReader.MiserableRTLGraphicsHack(nXPos, pFS->nWidth, pFS->eHAlign, eHRel);
    2088                 :            : /*Above can all go when we have from left in rtl mode*/
    2089 [ +  - ][ +  - ]:          9 :     Put( SwFmtHoriOrient(nXPos, pFS->eHAlign, pFS->eHRel, pFS->bToggelPos ));
                 [ +  - ]
    2090 [ +  - ][ +  - ]:          9 :     Put( SwFmtVertOrient( pFS->nYPos, pFS->eVAlign, pFS->eVRel ) );
                 [ +  - ]
    2091                 :            : 
    2092 [ +  - ][ -  + ]:          9 :     if (pFS->nLeMgn || pFS->nRiMgn)     // Raender setzen
    2093 [ #  # ][ #  # ]:          0 :         Put(SvxLRSpaceItem(pFS->nLeMgn, pFS->nRiMgn, 0, 0, RES_LR_SPACE));
                 [ #  # ]
    2094                 :            : 
    2095 [ +  - ][ -  + ]:          9 :     if (pFS->nUpMgn || pFS->nLoMgn)
    2096 [ #  # ][ #  # ]:          0 :         Put(SvxULSpaceItem(pFS->nUpMgn, pFS->nLoMgn, RES_UL_SPACE));
                 [ #  # ]
    2097                 :            : 
    2098                 :            :     //we no longer need to hack around the header/footer problems
    2099         [ +  - ]:          9 :     SwFmtSurround aSurround(pFS->eSurround);
    2100         [ +  - ]:          9 :     if ( pFS->eSurround == SURROUND_IDEAL )
    2101                 :          9 :         aSurround.SetAnchorOnly( sal_True );
    2102         [ +  - ]:          9 :     Put( aSurround );
    2103                 :            : 
    2104                 :          9 :     short aSizeArray[5]={0};
    2105         [ +  - ]:          9 :     rReader.SetFlyBordersShadow(*this,(const WW8_BRC*)pFW->brc,&aSizeArray[0]);
    2106                 :            : 
    2107                 :            :     // der 5. Parameter ist immer 0, daher geht beim Cast nix verloren
    2108                 :            : 
    2109                 :            :     // #i27767#
    2110                 :            :     // #i35017# - constant name has changed
    2111                 :            :     Put( SwFmtWrapInfluenceOnObjPos(
    2112 [ +  - ][ +  - ]:          9 :                 text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE ) );
                 [ +  - ]
    2113                 :            : 
    2114         [ +  - ]:          9 :     if( !bGraf )
    2115                 :            :     {
    2116 [ +  - ][ +  - ]:          9 :         Put( SwFmtAnchor(pFS->eAnchor) );
                 [ +  - ]
    2117                 :            :         // Groesse einstellen
    2118                 :            : 
    2119                 :            :         //Ordinarily with frames, the border width and spacing is
    2120                 :            :         //placed outside the frame, making it larger. With these
    2121                 :            :         //types of frames, the left right thickness and space makes
    2122                 :            :         //it wider, but the top bottom spacing and border thickness
    2123                 :            :         //is placed inside.
    2124                 :            :         Put( SwFmtFrmSize( pFS->eHeightFix, pFS->nWidth +
    2125                 :         18 :             aSizeArray[WW8_LEFT] + aSizeArray[WW8_RIGHT],
    2126 [ +  - ][ +  - ]:          9 :             pFS->nHeight));
                 [ +  - ]
    2127         [ +  - ]:          9 :     }
    2128                 :          9 : }
    2129                 :            : 
    2130                 :            : // WW8FlySet-ctor fuer zeichengebundene Grafiken
    2131                 :         18 : WW8FlySet::WW8FlySet( SwWW8ImplReader& rReader, const SwPaM* pPaM,
    2132                 :            :     const WW8_PIC& rPic, long nWidth, long nHeight )
    2133                 :         18 :     : SfxItemSet(rReader.rDoc.GetAttrPool(),RES_FRMATR_BEGIN,RES_FRMATR_END-1)
    2134                 :            : {
    2135         [ +  - ]:         18 :     Init(rReader, pPaM);
    2136                 :            : 
    2137 [ +  - ][ +  - ]:         18 :     Put(SvxFrameDirectionItem(FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR));
                 [ +  - ]
    2138                 :            : 
    2139                 :         18 :     short aSizeArray[5]={0};
    2140                 :            :     /*
    2141                 :            :     If we have set borders then in word the graphic is displaced from the left
    2142                 :            :     and top the width of the borders of those sides, and then the shadow
    2143                 :            :     itself is drawn to the bottom and right of the displaced graphic.  In word
    2144                 :            :     the total size is that of the graphic plus the borders, plus the total
    2145                 :            :     shadow around all edges, for this translation the top and left shadow
    2146                 :            :     region is translated spacing around the graphic to those sides, and the
    2147                 :            :     bottom and right shadow size is added to the graphic size.
    2148                 :            :     */
    2149 [ +  - ][ -  + ]:         18 :     if (rReader.SetFlyBordersShadow( *this, rPic.rgbrc, &aSizeArray[0]))
    2150                 :            :     {
    2151 [ #  # ][ #  # ]:          0 :         Put(SvxLRSpaceItem( aSizeArray[WW8_LEFT], 0, 0, 0, RES_LR_SPACE ) );
                 [ #  # ]
    2152 [ #  # ][ #  # ]:          0 :         Put(SvxULSpaceItem( aSizeArray[WW8_TOP], 0, RES_UL_SPACE ));
                 [ #  # ]
    2153                 :          0 :         aSizeArray[WW8_RIGHT]*=2;
    2154                 :          0 :         aSizeArray[WW8_BOT]*=2;
    2155                 :            :     }
    2156                 :            : 
    2157                 :         18 :     Put( SwFmtFrmSize( ATT_FIX_SIZE, nWidth+aSizeArray[WW8_LEFT]+
    2158                 :         36 :         aSizeArray[WW8_RIGHT], nHeight+aSizeArray[WW8_TOP]
    2159 [ +  - ][ +  - ]:         18 :         + aSizeArray[WW8_BOT]) );
                 [ +  - ]
    2160                 :         18 : }
    2161                 :            : 
    2162                 :         18 : void WW8FlySet::Init(const SwWW8ImplReader& rReader, const SwPaM* pPaM)
    2163                 :            : {
    2164         [ -  + ]:         18 :     if (!rReader.mbNewDoc)
    2165         [ #  # ]:          0 :         Reader::ResetFrmFmtAttrs(*this);  // Abstand/Umrandung raus
    2166                 :            : 
    2167 [ +  - ][ +  - ]:         18 :     Put(SvxLRSpaceItem(RES_LR_SPACE)); //inline writer ole2 objects start with 0.2cm l/r
                 [ +  - ]
    2168         [ +  - ]:         18 :     SwFmtAnchor aAnchor(FLY_AS_CHAR);
    2169                 :            : 
    2170         [ +  - ]:         18 :     aAnchor.SetAnchor(pPaM->GetPoint());
    2171         [ +  - ]:         18 :     Put(aAnchor);
    2172                 :            : 
    2173                 :            :     //The horizontal default is on the baseline, the vertical is centered
    2174                 :            :     //around the character center it appears
    2175 [ +  - ][ -  + ]:         18 :     if (rReader.maSectionManager.CurrentSectionIsVertical())
    2176 [ #  # ][ #  # ]:          0 :         Put(SwFmtVertOrient(0, text::VertOrientation::CHAR_CENTER,text::RelOrientation::CHAR));
                 [ #  # ]
    2177                 :            :     else
    2178 [ +  - ][ +  - ]:         18 :         Put(SwFmtVertOrient(0, text::VertOrientation::TOP, text::RelOrientation::FRAME));
         [ +  - ][ +  - ]
    2179                 :         18 : }
    2180                 :            : 
    2181                 :        204 : WW8DupProperties::WW8DupProperties(SwDoc &rDoc, SwWW8FltControlStack *pStk)
    2182                 :            :     : pCtrlStck(pStk),
    2183                 :        204 :     aChrSet(rDoc.GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END - 1 ),
    2184         [ +  - ]:        204 :     aParSet(rDoc.GetAttrPool(), RES_PARATR_BEGIN, RES_PARATR_END - 1 )
    2185                 :            : {
    2186                 :            :     //Close any open character properties and duplicate them inside the
    2187                 :            :     //first table cell
    2188         [ +  - ]:        204 :     size_t nCnt = pCtrlStck->size();
    2189         [ +  + ]:        417 :     for (size_t i=0; i < nCnt; ++i)
    2190                 :            :     {
    2191         [ +  - ]:        213 :         const SwFltStackEntry& rEntry = (*pCtrlStck)[ i ];
    2192         [ +  + ]:        213 :         if (rEntry.bOpen)
    2193                 :            :         {
    2194         [ +  - ]:         21 :             if (isCHRATR(rEntry.pAttr->Which()))
    2195                 :            :             {
    2196         [ +  - ]:         21 :                 aChrSet.Put( *rEntry.pAttr );
    2197                 :            : 
    2198                 :            :             }
    2199         [ #  # ]:          0 :             else if (isPARATR(rEntry.pAttr->Which()))
    2200                 :            :             {
    2201         [ #  # ]:          0 :                 aParSet.Put( *rEntry.pAttr );
    2202                 :            :             }
    2203                 :            :         }
    2204                 :            :     }
    2205                 :        204 : }
    2206                 :            : 
    2207                 :        204 : void WW8DupProperties::Insert(const SwPosition &rPos)
    2208                 :            : {
    2209                 :        204 :     const SfxItemSet *pSet=&aChrSet;
    2210         [ +  + ]:        612 :     for(int i=0;i<2;i++)
    2211                 :            :     {
    2212         [ +  + ]:        408 :         if (i==1)
    2213                 :        204 :             pSet = &aParSet;
    2214                 :            : 
    2215         [ +  + ]:        408 :         if( pSet->Count() )
    2216                 :            :         {
    2217         [ +  - ]:         21 :             SfxItemIter aIter( *pSet );
    2218                 :         21 :             const SfxPoolItem* pItem = aIter.GetCurItem();
    2219 [ #  # ][ #  # ]:         21 :             do
         [ -  + ][ -  + ]
    2220                 :            :             {
    2221         [ +  - ]:         21 :                 pCtrlStck->NewAttr(rPos, *pItem);
    2222         [ +  - ]:         42 :             }while( !aIter.IsAtEnd() && 0 != ( pItem = aIter.NextItem() ) );
    2223                 :            :         }
    2224                 :            :     }
    2225                 :        204 : }
    2226                 :            : 
    2227                 :         12 : void SwWW8ImplReader::MoveInsideFly(const SwFrmFmt *pFlyFmt)
    2228                 :            : {
    2229         [ +  - ]:         12 :     WW8DupProperties aDup(rDoc,pCtrlStck);
    2230                 :            : 
    2231         [ +  - ]:         12 :     pCtrlStck->SetAttr(*pPaM->GetPoint(), 0, false);
    2232                 :            : 
    2233                 :            :     // Setze Pam in den FlyFrame
    2234         [ +  - ]:         12 :     const SwFmtCntnt& rCntnt = pFlyFmt->GetCntnt();
    2235                 :            :     OSL_ENSURE( rCntnt.GetCntntIdx(), "Kein Inhalt vorbereitet." );
    2236         [ +  - ]:         12 :     pPaM->GetPoint()->nNode = rCntnt.GetCntntIdx()->GetIndex() + 1;
    2237 [ +  - ][ +  - ]:         12 :     pPaM->GetPoint()->nContent.Assign( pPaM->GetCntntNode(), 0 );
    2238                 :            : 
    2239 [ +  - ][ +  - ]:         12 :     aDup.Insert(*pPaM->GetPoint());
    2240                 :         12 : }
    2241                 :            : 
    2242                 :         12 : SwTwips SwWW8ImplReader::MoveOutsideFly(SwFrmFmt *pFlyFmt,
    2243                 :            :     const SwPosition &rPos, bool bTableJoin)
    2244                 :            : {
    2245                 :         12 :     SwTwips nRetWidth = 0;
    2246                 :            :     // Alle Attribute schliessen, da sonst Attribute entstehen koennen,
    2247                 :            :     // die aus Flys rausragen
    2248         [ +  - ]:         12 :     WW8DupProperties aDup(rDoc,pCtrlStck);
    2249         [ +  - ]:         12 :     pCtrlStck->SetAttr(*pPaM->GetPoint(), 0, false);
    2250                 :            : 
    2251                 :            :     /*
    2252                 :            :     #i1291
    2253                 :            :     If this fly frame consists entirely of one table inside a frame
    2254                 :            :     followed by an empty paragraph then we want to delete the empty
    2255                 :            :     paragraph so as to get the frame to autoshrink to the size of the
    2256                 :            :     table to emulate words behaviour closer.
    2257                 :            :     */
    2258         [ +  + ]:         12 :     if (bTableJoin)
    2259                 :            :     {
    2260         [ +  - ]:          9 :         const SwNodeIndex* pNodeIndex = pFlyFmt->GetCntnt().
    2261                 :          9 :             GetCntntIdx();
    2262         [ +  - ]:          9 :         if (pNodeIndex)
    2263                 :            :         {
    2264         [ +  - ]:          9 :             SwNodeIndex aIdx( *pNodeIndex, 1 ),
    2265         [ +  - ]:          9 :             aEnd( *pNodeIndex->GetNode().EndOfSectionNode() );
    2266                 :            : 
    2267         [ +  - ]:          9 :             if (aIdx < aEnd)
    2268                 :            :             {
    2269         [ -  + ]:          9 :                 if(aIdx.GetNode().IsTableNode())
    2270                 :            :                 {
    2271                 :          0 :                     SwTableNode *pTable = aIdx.GetNode().GetTableNode();
    2272         [ #  # ]:          0 :                     aIdx = *aIdx.GetNode().EndOfSectionNode();
    2273         [ #  # ]:          0 :                     aIdx++;
    2274 [ #  # ][ #  # ]:          0 :                     if ( (aIdx < aEnd) && aIdx.GetNode().IsTxtNode() )
                 [ #  # ]
    2275                 :            :                     {
    2276                 :          0 :                         SwTxtNode *pNd = aIdx.GetNode().GetTxtNode();
    2277         [ #  # ]:          0 :                         aIdx++;
    2278 [ #  # ][ #  # ]:          0 :                         if (aIdx == aEnd && pNd && !pNd->GetTxt().Len())
         [ #  # ][ #  # ]
    2279                 :            :                         {
    2280                 :            :                             //An extra pre-created by writer unused paragraph
    2281                 :            :                             //
    2282                 :            :                             //delete after import is complete rather than now
    2283                 :            :                             //to avoid the complication of managing uncommitted
    2284                 :            :                             //ctrlstack properties that refer to it.
    2285         [ #  # ]:          0 :                             m_aExtraneousParas.push_back(pNd);
    2286                 :            : 
    2287                 :          0 :                             SwTable& rTable = pTable->GetTable();
    2288                 :          0 :                             SwFrmFmt* pTblFmt = rTable.GetFrmFmt();
    2289                 :            : 
    2290         [ #  # ]:          0 :                             if (pTblFmt)
    2291                 :            :                             {
    2292 [ #  # ][ #  # ]:          0 :                                 SwFmtFrmSize aSize = pTblFmt->GetFrmSize();
    2293                 :          0 :                                 aSize.SetHeightSizeType(ATT_MIN_SIZE);
    2294                 :          0 :                                 aSize.SetHeight(MINLAY);
    2295         [ #  # ]:          0 :                                 pFlyFmt->SetFmtAttr(aSize);
    2296 [ #  # ][ #  # ]:          0 :                                 SwFmtHoriOrient aHori = pTblFmt->GetHoriOrient();
    2297                 :            :                                 // passing the table orientaion of
    2298                 :            :                                 // LEFT_AND_WIDTH to the frame seems to
    2299                 :            :                                 // work better than FULL, especially if the
    2300                 :            :                                 // table width exceeds the page width, however
    2301                 :            :                                 // I am not brave enough to set it in all
    2302                 :            :                                 // instances
    2303 [ #  # ][ #  # ]:          0 :                                 pTblFmt->SetFmtAttr( SwFmtHoriOrient(0, ( aHori.GetHoriOrient() == text::HoriOrientation::LEFT_AND_WIDTH ) ? ::text::HoriOrientation::LEFT_AND_WIDTH : text::HoriOrientation::FULL ) );
         [ #  # ][ #  # ]
    2304 [ #  # ][ #  # ]:          0 :                                 nRetWidth = aSize.GetWidth();
    2305                 :            :                             }
    2306                 :            :                         }
    2307                 :            :                     }
    2308                 :            :                 }
    2309 [ +  - ][ +  - ]:          9 :             }
    2310                 :            :         }
    2311                 :            :     }
    2312                 :            : 
    2313         [ +  - ]:         12 :     *pPaM->GetPoint() = rPos;
    2314         [ +  - ]:         12 :     aDup.Insert(*pPaM->GetPoint());
    2315         [ +  - ]:         12 :     return nRetWidth;
    2316                 :            : }
    2317                 :            : 
    2318                 :         18 : WW8FlyPara *SwWW8ImplReader::ConstructApo(const ApoTestResults &rApo,
    2319                 :            :     const WW8_TablePos *pTabPos)
    2320                 :            : {
    2321                 :         18 :     WW8FlyPara *pRet = 0;
    2322                 :            :     OSL_ENSURE(rApo.HasFrame() || pTabPos,
    2323                 :            :         "If no frame found, *MUST* be in a table");
    2324                 :            : 
    2325                 :         18 :     pRet = new WW8FlyPara(bVer67, rApo.mpStyleApo);
    2326                 :            : 
    2327                 :            :     // APO-Parameter ermitteln und Test auf bGrafApo
    2328         [ +  - ]:         18 :     if (rApo.HasFrame())
    2329                 :         18 :         pRet->ReadFull(rApo.m_nSprm29, this);
    2330                 :            : 
    2331                 :         18 :     pRet->ApplyTabPos(pTabPos);
    2332                 :            : 
    2333         [ -  + ]:         18 :     if (pRet->IsEmpty())
    2334                 :          0 :         delete pRet, pRet = 0;
    2335                 :         18 :     return pRet;
    2336                 :            : }
    2337                 :            : 
    2338                 :          9 : bool SwWW8ImplReader::IsDropCap()
    2339                 :            : {
    2340                 :            :     // Find the DCS (Drop Cap Specifier) for the paragraph
    2341                 :            :     // if does not exist or if the first three bits are 0
    2342                 :            :     // then there is no dropcap on the paragraph
    2343         [ +  - ]:          9 :     WW8PLCFx_Cp_FKP *pPap = pPlcxMan ? pPlcxMan->GetPapPLCF() : 0;
    2344         [ +  - ]:          9 :     if (pPap)
    2345                 :            :     {
    2346                 :            :         const sal_uInt8 *pDCS;
    2347         [ -  + ]:          9 :         if (bVer67)
    2348                 :          0 :             pDCS = pPap->HasSprm(46);
    2349                 :            :         else
    2350                 :          9 :             pDCS = pPlcxMan->GetPapPLCF()->HasSprm(0x442C);
    2351         [ -  + ]:          9 :         if(pDCS)
    2352                 :            :         {
    2353                 :          0 :             short nDCS = SVBT16ToShort( pDCS );
    2354                 :            :             if((nDCS | 7) != 0)
    2355                 :          0 :                 return true;
    2356                 :            :         }
    2357                 :            :     }
    2358                 :          9 :     return false;
    2359                 :            : }
    2360                 :            : 
    2361                 :          9 : bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo,
    2362                 :            :     const WW8_TablePos *pTabPos)
    2363                 :            : {
    2364         [ -  + ]:          9 :     if (0 == (pWFlyPara = ConstructApo(rApo, pTabPos)))
    2365                 :          0 :         return false;
    2366                 :            : 
    2367                 :            :     // <WW8SwFlyPara> constructor has changed - new 4th parameter
    2368                 :            :     // containing WW8 page top margin.
    2369                 :            :     pSFlyPara = new WW8SwFlyPara( *pPaM, *pWFlyPara,
    2370                 :          9 :                                   maSectionManager.GetWWPageTopMargin(),
    2371                 :          9 :                                   maSectionManager.GetPageLeft(),
    2372                 :          9 :                                   maSectionManager.GetTextAreaWidth(),
    2373         [ +  - ]:          9 :                                   nIniFlyDx, nIniFlyDy);
    2374                 :            : 
    2375                 :            :     // If this paragraph is a Dropcap set the flag and we will deal with it later
    2376         [ -  + ]:          9 :     if (IsDropCap())
    2377                 :            :     {
    2378                 :          0 :         bDropCap = true;
    2379         [ #  # ]:          0 :         pAktItemSet = new SfxItemSet( rDoc.GetAttrPool(), RES_CHRATR_BEGIN, RES_PARATR_END - 1 );
    2380                 :          0 :         return false;
    2381                 :            :     }
    2382                 :            : 
    2383         [ +  - ]:          9 :     if( !pWFlyPara->bGrafApo )
    2384                 :            :     {
    2385                 :            : 
    2386                 :            :         // Innerhalb des GrafApo muessen Textattribute ignoriert werden, da
    2387                 :            :         // sie sonst auf den folgenden Zeilen landen.  Der Rahmen wird nur
    2388                 :            :         // eingefuegt, wenn er *nicht* nur zum Positionieren einer einzelnen
    2389                 :            :         // Grafik dient.  Ist es ein Grafik-Rahmen, dann werden pWFlyPara und
    2390                 :            :         // pSFlyPara behalten und die
    2391                 :            :         // daraus resultierenden Attribute beim Einfuegen der Grafik auf die
    2392                 :            :         // Grafik angewendet.
    2393                 :            : 
    2394         [ +  - ]:          9 :         WW8FlySet aFlySet(*this, pWFlyPara, pSFlyPara, false);
    2395                 :            : 
    2396                 :            :         pSFlyPara->pFlyFmt = rDoc.MakeFlySection( pSFlyPara->eAnchor,
    2397         [ +  - ]:          9 :             pPaM->GetPoint(), &aFlySet );
    2398                 :            :         OSL_ENSURE(pSFlyPara->pFlyFmt->GetAnchor().GetAnchorId() ==
    2399                 :            :             pSFlyPara->eAnchor, "Not the anchor type requested!");
    2400                 :            : 
    2401         [ +  - ]:          9 :         if (pSFlyPara->pFlyFmt)
    2402                 :            :         {
    2403         [ +  - ]:          9 :             if (!pDrawModel)
    2404         [ +  - ]:          9 :                 GrafikCtor();
    2405                 :            : 
    2406         [ +  - ]:          9 :             SdrObject* pOurNewObject = CreateContactObject(pSFlyPara->pFlyFmt);
    2407         [ +  - ]:          9 :             pWWZOrder->InsertTextLayerObject(pOurNewObject);
    2408                 :            :         }
    2409                 :            : 
    2410         [ +  - ]:          9 :         if (FLY_AS_CHAR != pSFlyPara->eAnchor)
    2411                 :            :         {
    2412         [ +  - ]:          9 :             pAnchorStck->AddAnchor(*pPaM->GetPoint(),pSFlyPara->pFlyFmt);
    2413                 :            :         }
    2414                 :            : 
    2415                 :            :         // merke Pos im Haupttext
    2416 [ +  - ][ +  - ]:          9 :         pSFlyPara->pMainTextPos = new SwPosition( *pPaM->GetPoint() );
    2417                 :            : 
    2418                 :            :         //remove fltanchors, otherwise they will be closed inside the
    2419                 :            :         //frame, which makes no sense, restore them after the frame is
    2420                 :            :         //closed
    2421                 :          9 :         pSFlyPara->pOldAnchorStck = pAnchorStck;
    2422 [ +  - ][ +  - ]:          9 :         pAnchorStck = new SwWW8FltAnchorStack(&rDoc, nFieldFlags);
    2423                 :            : 
    2424 [ +  - ][ +  - ]:          9 :         MoveInsideFly(pSFlyPara->pFlyFmt);
    2425                 :            : 
    2426                 :            :         // 1) ReadText() wird nicht wie beim W4W-Reader rekursiv aufgerufen,
    2427                 :            :         //    da die Laenge des Apo zu diesen Zeitpunkt noch nicht feststeht,
    2428                 :            :         //    ReadText() diese Angabe aber braucht.
    2429                 :            :         // 2) Der CtrlStck wird nicht neu erzeugt.
    2430                 :            :         //    die Char-Attribute laufen weiter ( AErger mit SW-Attributen )
    2431                 :            :         //    Paraattribute muessten am Ende jeden Absatzes zurueckgesetzt
    2432                 :            :         //    sein, d.h. es duerften am Absatzende keine Paraattribute
    2433                 :            :         //    auf dem Stack liegen
    2434                 :            :     }
    2435                 :          9 :     return true;
    2436                 :            : }
    2437                 :            : 
    2438                 :        144 : void wwSectionManager::JoinNode(const SwPosition &rPos, const SwNode &rNode)
    2439                 :            : {
    2440 [ +  - ][ -  + ]:        144 :     if ((!maSegments.empty()) && (maSegments.back().maStart == rPos.nNode))
                 [ -  + ]
    2441 [ #  # ][ #  # ]:          0 :         maSegments.back().maStart = SwNodeIndex(rNode);
    2442                 :        144 : }
    2443                 :            : 
    2444                 :        144 : bool SwWW8ImplReader::JoinNode(SwPaM &rPam, bool bStealAttr)
    2445                 :            : {
    2446                 :        144 :     bool bRet = false;
    2447         [ +  - ]:        144 :     rPam.GetPoint()->nContent = 0;          // an den Anfang der Zeile gehen
    2448                 :            : 
    2449         [ +  - ]:        144 :     SwNodeIndex aPref(rPam.GetPoint()->nNode, -1);
    2450                 :            : 
    2451         [ +  - ]:        144 :     if (SwTxtNode* pNode = aPref.GetNode().GetTxtNode())
    2452                 :            :     {
    2453         [ +  - ]:        144 :         maSectionManager.JoinNode(*rPam.GetPoint(), aPref.GetNode());
    2454         [ +  - ]:        144 :         rPam.GetPoint()->nNode = aPref;
    2455 [ +  - ][ +  - ]:        144 :         rPam.GetPoint()->nContent.Assign(pNode, pNode->GetTxt().Len());
    2456         [ -  + ]:        144 :         if (bStealAttr)
    2457         [ #  # ]:          0 :             pCtrlStck->StealAttr(rPam.GetPoint()->nNode);
    2458                 :            : 
    2459         [ +  - ]:        144 :         pNode->JoinNext();
    2460                 :            : 
    2461                 :        144 :         bRet = true;
    2462                 :            :     }
    2463         [ +  - ]:        144 :     return bRet;
    2464                 :            : }
    2465                 :            : 
    2466                 :          9 : void SwWW8ImplReader::StopApo()
    2467                 :            : {
    2468                 :            :     OSL_ENSURE(pWFlyPara, "no pWFlyPara to close");
    2469         [ -  + ]:          9 :     if (!pWFlyPara)
    2470                 :          0 :         return;
    2471         [ -  + ]:          9 :     if (pWFlyPara->bGrafApo)
    2472                 :            :     {
    2473                 :            :         // Grafik-Rahmen, der *nicht* eingefuegt wurde leeren Absatz incl.
    2474                 :            :         // Attributen entfernen
    2475                 :          0 :         JoinNode(*pPaM, true);
    2476                 :            : 
    2477                 :            :     }
    2478                 :            :     else
    2479                 :            :     {
    2480 [ +  - ][ +  - ]:          9 :         if (!pSFlyPara->pMainTextPos || !pWFlyPara)
    2481                 :            :         {
    2482                 :            :             OSL_ENSURE( pSFlyPara->pMainTextPos, "StopApo: pMainTextPos ist 0" );
    2483                 :            :             OSL_ENSURE( pWFlyPara, "StopApo: pWFlyPara ist 0" );
    2484                 :            :             return;
    2485                 :            :         }
    2486                 :            : 
    2487                 :            :         /*
    2488                 :            :         What we are doing with this temporary nodeindex is as follows: The
    2489                 :            :         stack of attributes normally only places them into the document when
    2490                 :            :         the current insertion point has passed them by. Otherwise the end
    2491                 :            :         point of the attribute gets pushed along with the insertion point. The
    2492                 :            :         insertion point is moved and the properties commited during
    2493                 :            :         MoveOutsideFly. We also may want to remove the final paragraph in the
    2494                 :            :         frame, but we need to wait until the properties for that frame text
    2495                 :            :         have been commited otherwise they will be lost. So we first get a
    2496                 :            :         handle to the last the filter inserted. After the attributes are
    2497                 :            :         commited, if that paragraph exists we join it with the para after it
    2498                 :            :         that comes with the frame by default so that as normal we don't end up
    2499                 :            :         with one more paragraph than we wanted.
    2500                 :            :         */
    2501         [ +  - ]:          9 :         SwNodeIndex aPref(pPaM->GetPoint()->nNode, -1);
    2502                 :            : 
    2503                 :            :         SwTwips nNewWidth =
    2504         [ +  - ]:          9 :             MoveOutsideFly(pSFlyPara->pFlyFmt, *pSFlyPara->pMainTextPos);
    2505         [ -  + ]:          9 :         if (nNewWidth)
    2506                 :          0 :             pSFlyPara->BoxUpWidth(nNewWidth);
    2507                 :            : 
    2508                 :          9 :         Color aBg(0xFE, 0xFF, 0xFF, 0xFF);  //Transparent by default
    2509                 :            : 
    2510         [ +  - ]:          9 :         if (SwTxtNode* pNd = aPref.GetNode().GetTxtNode())
    2511                 :            :         {
    2512                 :            :             /*
    2513                 :            :             #i582#
    2514                 :            :             Take the last paragraph background colour and fill the frame with
    2515                 :            :             it.  Otherwise, make it transparent, this appears to be how MSWord
    2516                 :            :             works
    2517                 :            :             */
    2518         [ +  - ]:          9 :             const SfxPoolItem &rItm = pNd->SwCntntNode::GetAttr(RES_BACKGROUND);
    2519                 :          9 :             const SvxBrushItem &rBrush = (const SvxBrushItem&)(rItm);
    2520         [ -  + ]:          9 :             if (rBrush.GetColor().GetColor() != COL_AUTO)
    2521                 :          0 :                 aBg = rBrush.GetColor();
    2522                 :            : 
    2523                 :            :             //Get rid of extra empty paragraph
    2524         [ +  - ]:          9 :             pNd->JoinNext();
    2525                 :            :         }
    2526                 :            : 
    2527 [ +  - ][ +  - ]:          9 :         pSFlyPara->pFlyFmt->SetFmtAttr(SvxBrushItem(aBg, RES_BACKGROUND));
                 [ +  - ]
    2528                 :            : 
    2529         [ +  - ]:          9 :         DeleteAnchorStk();
    2530                 :          9 :         pAnchorStck = pSFlyPara->pOldAnchorStck;
    2531                 :            : 
    2532                 :            :         // Ist die Fly-Breite durch eine innenliegende Grafik vergroessert
    2533                 :            :         // worden ( bei automatischer Breite des Flys ), dann muss die Breite
    2534                 :            :         // des SW-Flys entsprechend umgesetzt werden, da der SW keine
    2535                 :            :         // automatische Breite kennt.
    2536         [ -  + ]:          9 :         if( pSFlyPara->nNewNettoWidth > MINFLY )    // BoxUpWidth ?
    2537                 :            :         {
    2538                 :          0 :             long nW = pSFlyPara->nNewNettoWidth;
    2539                 :          0 :             nW += pSFlyPara->nWidth - pSFlyPara->nNettoWidth;   // Rand dazu
    2540                 :            :             pSFlyPara->pFlyFmt->SetFmtAttr(
    2541 [ #  # ][ #  # ]:          0 :                 SwFmtFrmSize( pSFlyPara->eHeightFix, nW, pSFlyPara->nHeight ) );
                 [ #  # ]
    2542                 :            :         }
    2543                 :            :         /*
    2544                 :            :         Word set *no* width meaning its an automatic width. The
    2545                 :            :         SwFlyPara reader will have already set a fallback width of the
    2546                 :            :         printable regions width, so we should reuse it. Despite the related
    2547                 :            :         problems with layout addressed with a hack in WW8FlyPara's constructor
    2548                 :            :         #i27204# Added AutoWidth setting. Left the old CalculateFlySize in place
    2549                 :            :         so that if the user unselects autowidth, the width doesn't max out
    2550                 :            :         */
    2551         [ +  - ]:          9 :         else if( !pWFlyPara->nSp28 )
    2552                 :            :         {
    2553                 :            :             using namespace sw::util;
    2554         [ +  - ]:          9 :             SfxItemSet aFlySet( pSFlyPara->pFlyFmt->GetAttrSet() );
    2555                 :            : 
    2556 [ +  - ][ +  - ]:          9 :             SwFmtFrmSize aSize(ItemGet<SwFmtFrmSize>(aFlySet, RES_FRM_SIZE));
    2557                 :            : 
    2558         [ +  - ]:          9 :             aFlySet.ClearItem(RES_FRM_SIZE);
    2559                 :            : 
    2560                 :            :             CalculateFlySize(aFlySet, pSFlyPara->pMainTextPos->nNode,
    2561         [ +  - ]:          9 :                 pSFlyPara->nWidth);
    2562                 :            : 
    2563         [ +  - ]:          9 :             nNewWidth = ItemGet<SwFmtFrmSize>(aFlySet, RES_FRM_SIZE).GetWidth();
    2564                 :            : 
    2565                 :          9 :             aSize.SetWidth(nNewWidth);
    2566                 :          9 :             aSize.SetWidthSizeType(ATT_VAR_SIZE);
    2567                 :            : 
    2568 [ +  - ][ +  - ]:          9 :             pSFlyPara->pFlyFmt->SetFmtAttr(aSize);
                 [ +  - ]
    2569                 :            :         }
    2570                 :            : 
    2571 [ +  - ][ +  - ]:          9 :         delete pSFlyPara->pMainTextPos, pSFlyPara->pMainTextPos = 0;
                 [ +  - ]
    2572                 :            : 
    2573                 :            : // Damit die Frames bei Einfuegen in existierendes Doc erzeugt werden,
    2574                 :            : // wird in fltshell.cxx beim Setzen des FltAnchor-Attributes
    2575                 :            : // pFlyFrm->MakeFrms() gerufen
    2576                 :            : 
    2577                 :            :     }
    2578                 :            : 
    2579                 :            :     //#i8062#
    2580 [ +  - ][ +  - ]:          9 :     if (pSFlyPara && pSFlyPara->pFlyFmt)
    2581                 :          9 :         pFmtOfJustInsertedApo = pSFlyPara->pFlyFmt;
    2582                 :            : 
    2583                 :          9 :     DELETEZ( pSFlyPara );
    2584                 :          9 :     DELETEZ( pWFlyPara );
    2585                 :            : }
    2586                 :            : 
    2587                 :            : // TestSameApo() beantwortet die Frage, ob es dasselbe APO oder ein neues ist
    2588                 :          0 : bool SwWW8ImplReader::TestSameApo(const ApoTestResults &rApo,
    2589                 :            :     const WW8_TablePos *pTabPos)
    2590                 :            : {
    2591         [ #  # ]:          0 :     if( !pWFlyPara )
    2592                 :            :     {
    2593                 :            :         OSL_ENSURE( pWFlyPara, " Wo ist mein pWFlyPara ? " );
    2594                 :          0 :         return true;
    2595                 :            :     }
    2596                 :            : 
    2597                 :            :     // Es muss ein kompletter Vergleich ( ausser Borders ) stattfinden, um
    2598                 :            :     // alle Kombinationen Style / Hart richtig einzuordnen. Deshalb wird ein
    2599                 :            :     // temporaerer WW8FlyPara angelegt ( abh. ob Style oder nicht ), darauf
    2600                 :            :     // die harten Attrs angewendet, und dann verglichen
    2601                 :            : 
    2602                 :            :     // Zum Vergleich
    2603                 :          0 :     WW8FlyPara aF(bVer67, rApo.mpStyleApo);
    2604                 :            :     // WWPara fuer akt. Para
    2605         [ #  # ]:          0 :     if (rApo.HasFrame())
    2606         [ #  # ]:          0 :         aF.Read(rApo.m_nSprm29, pPlcxMan->GetPapPLCF());
    2607                 :          0 :     aF.ApplyTabPos(pTabPos);
    2608                 :            : 
    2609                 :          0 :     return aF == *pWFlyPara;
    2610                 :            : }
    2611                 :            : 
    2612                 :            : /***************************************************************************
    2613                 :            : #       Attribut - Verwaltung
    2614                 :            : #**************************************************************************/
    2615                 :            : 
    2616                 :      18006 : void SwWW8ImplReader::NewAttr( const SfxPoolItem& rAttr,
    2617                 :            :                                const bool bFirstLineOfStSet,
    2618                 :            :                                const bool bLeftIndentSet )
    2619                 :            : {
    2620         [ +  - ]:      18006 :     if( !bNoAttrImport ) // zum Ignorieren von Styles beim Doc-Einfuegen
    2621                 :            :     {
    2622         [ +  + ]:      18006 :         if (pAktColl)
    2623                 :            :         {
    2624                 :            :             OSL_ENSURE(rAttr.Which() != RES_FLTR_REDLINE, "redline in style!");
    2625                 :       5586 :             pAktColl->SetFmtAttr(rAttr);
    2626                 :            :         }
    2627         [ +  + ]:      12420 :         else if (pAktItemSet)
    2628                 :            :         {
    2629                 :       1317 :             pAktItemSet->Put(rAttr);
    2630                 :            :         }
    2631         [ -  + ]:      11103 :         else if (rAttr.Which() == RES_FLTR_REDLINE)
    2632                 :            :         {
    2633                 :          0 :             mpRedlineStack->open(*pPaM->GetPoint(), rAttr);
    2634                 :            :         }
    2635                 :            :         else
    2636                 :            :         {
    2637                 :      11103 :             pCtrlStck->NewAttr(*pPaM->GetPoint(), rAttr);
    2638                 :            :             // #i103711#
    2639         [ +  + ]:      11103 :             if ( bFirstLineOfStSet )
    2640                 :            :             {
    2641                 :        531 :                 const SwNode* pNd = &(pPaM->GetPoint()->nNode.GetNode());
    2642         [ +  - ]:        531 :                 maTxtNodesHavingFirstLineOfstSet.insert( pNd );
    2643                 :            :             }
    2644                 :            :             // #i105414#
    2645         [ +  + ]:      11103 :             if ( bLeftIndentSet )
    2646                 :            :             {
    2647                 :        855 :                 const SwNode* pNd = &(pPaM->GetPoint()->nNode.GetNode());
    2648         [ +  - ]:        855 :                 maTxtNodesHavingLeftIndentSet.insert( pNd );
    2649                 :            :             }
    2650                 :            :         }
    2651                 :            : 
    2652 [ -  + ][ #  # ]:      18006 :         if (mpPostProcessAttrsInfo && mpPostProcessAttrsInfo->mbCopy)
    2653                 :          0 :             mpPostProcessAttrsInfo->mItemSet.Put(rAttr);
    2654                 :            :     }
    2655                 :      18006 : }
    2656                 :            : 
    2657                 :            : // holt Attribut aus der FmtColl / Stack / Doc
    2658                 :      18786 : const SfxPoolItem* SwWW8ImplReader::GetFmtAttr( sal_uInt16 nWhich )
    2659                 :            : {
    2660                 :      18786 :     const SfxPoolItem* pRet = 0;
    2661         [ +  + ]:      18786 :     if (pAktColl)
    2662                 :       1509 :         pRet = &(pAktColl->GetFmtAttr(nWhich));
    2663         [ -  + ]:      17277 :     else if (pAktItemSet)
    2664                 :            :     {
    2665                 :          0 :         pRet = pAktItemSet->GetItem(nWhich);
    2666         [ #  # ]:          0 :         if (!pRet)
    2667         [ #  # ]:          0 :             pRet = pStandardFmtColl ? &(pStandardFmtColl->GetFmtAttr(nWhich)) : 0;
    2668         [ #  # ]:          0 :         if (!pRet)
    2669                 :          0 :             pRet = &rDoc.GetAttrPool().GetDefaultItem(nWhich);
    2670                 :            :     }
    2671 [ +  + ][ +  + ]:      17277 :     else if (pPlcxMan && pPlcxMan->GetDoingDrawTextBox())
                 [ +  + ]
    2672                 :            :     {
    2673                 :        144 :         pRet = pCtrlStck->GetStackAttr(*pPaM->GetPoint(), nWhich);
    2674         [ +  - ]:        144 :         if (!pRet)
    2675                 :            :         {
    2676         [ +  - ]:        288 :             if (nAktColl < vColl.size() && vColl[nAktColl].pFmt &&
           [ +  -  +  - ]
                 [ +  - ]
    2677                 :        144 :                 vColl[nAktColl].bColl)
    2678                 :            :             {
    2679                 :        144 :                 pRet = &(vColl[nAktColl].pFmt->GetFmtAttr(nWhich));
    2680                 :            :             }
    2681                 :            :         }
    2682         [ -  + ]:        144 :         if (!pRet)
    2683         [ #  # ]:          0 :             pRet = pStandardFmtColl ? &(pStandardFmtColl->GetFmtAttr(nWhich)) : 0;
    2684         [ -  + ]:        144 :         if (!pRet)
    2685                 :          0 :             pRet = &rDoc.GetAttrPool().GetDefaultItem(nWhich);
    2686                 :            :     }
    2687                 :            :     else
    2688                 :      17133 :         pRet = pCtrlStck->GetFmtAttr(*pPaM->GetPoint(), nWhich);
    2689                 :      18786 :     return pRet;
    2690                 :            : }
    2691                 :            : 
    2692                 :            : /***************************************************************************
    2693                 :            : #       eigentliche Attribute
    2694                 :            : #
    2695                 :            : # Die Methoden erhalten die Token-Id und die Laenge der noch folgenden
    2696                 :            : # Parameter gemaess Tabelle in WWScan.cxx als Parameter
    2697                 :            : #**************************************************************************/
    2698                 :            : 
    2699                 :            : /***************************************************************************
    2700                 :            : #  Spezial WW - Attribute
    2701                 :            : #**************************************************************************/
    2702                 :            : 
    2703                 :        360 : void SwWW8ImplReader::Read_Special(sal_uInt16, const sal_uInt8* pData, short nLen)
    2704                 :            : {
    2705         [ +  + ]:        360 :     if( nLen < 0 )
    2706                 :            :     {
    2707                 :        180 :         bSpec = false;
    2708                 :        360 :         return;
    2709                 :            :     }
    2710                 :        180 :     bSpec = ( *pData != 0 );
    2711                 :            : }
    2712                 :            : 
    2713                 :            : // Read_Obj wird fuer fObj und fuer fOle2 benutzt !
    2714                 :          0 : void SwWW8ImplReader::Read_Obj(sal_uInt16 , const sal_uInt8* pData, short nLen)
    2715                 :            : {
    2716         [ #  # ]:          0 :     if( nLen < 0 )
    2717                 :          0 :         bObj = false;
    2718                 :            :     else
    2719                 :            :     {
    2720                 :          0 :         bObj = 0 != *pData;
    2721                 :            : 
    2722 [ #  # ][ #  # ]:          0 :         if( bObj && nPicLocFc && bEmbeddObj )
                 [ #  # ]
    2723                 :            :         {
    2724 [ #  # ][ #  # ]:          0 :             if (!maFieldStack.empty() && maFieldStack.back().mnFieldId == 56)
                 [ #  # ]
    2725                 :            :             {
    2726                 :            :                 // For LINK fields, store the nObjLocFc value in the field entry
    2727                 :          0 :                 maFieldStack.back().mnObjLocFc = nPicLocFc;
    2728                 :            :             }
    2729                 :            :             else
    2730                 :            :             {
    2731                 :          0 :                 nObjLocFc = nPicLocFc;
    2732                 :            :             }
    2733                 :            :         }
    2734                 :            :     }
    2735                 :          0 : }
    2736                 :            : 
    2737                 :        360 : void SwWW8ImplReader::Read_PicLoc(sal_uInt16 , const sal_uInt8* pData, short nLen )
    2738                 :            : {
    2739         [ +  + ]:        360 :     if( nLen < 0 )
    2740                 :            :     {
    2741                 :        180 :         nPicLocFc = 0;
    2742                 :        180 :         bSpec = false;  // Stimmt das immer ?
    2743                 :            :     }
    2744                 :            :     else
    2745                 :            :     {
    2746                 :        180 :         nPicLocFc = SVBT32ToUInt32( pData );
    2747                 :        180 :         bSpec = true;
    2748                 :            : 
    2749 [ #  # ][ #  # ]:        180 :         if( bObj && nPicLocFc && bEmbeddObj )
                 [ -  + ]
    2750                 :          0 :             nObjLocFc = nPicLocFc;
    2751                 :            :     }
    2752                 :        360 : }
    2753                 :            : 
    2754                 :        183 : void SwWW8ImplReader::Read_POutLvl(sal_uInt16, const sal_uInt8* pData, short nLen )
    2755                 :            : {
    2756 [ +  - ][ +  - ]:        183 :     if (pAktColl && (0 < nLen))
    2757                 :            :     {
    2758         [ +  - ]:        183 :         if (SwWW8StyInf* pSI = GetStyle(nAktColl))
    2759                 :            :         {
    2760                 :            :             pSI->nOutlineLevel = static_cast< sal_uInt8 >(
    2761                 :        366 :                 ( (1 <= pSI->GetWWStyleId()) && (9 >= pSI->GetWWStyleId()) )
    2762                 :        183 :             ? pSI->GetWWStyleId()-1
    2763         [ #  # ]:        549 :             : (pData ? *pData : 0) );
           [ +  -  +  - ]
    2764                 :            :         }
    2765                 :            :     }
    2766                 :        183 : }
    2767                 :            : 
    2768                 :          0 : void SwWW8ImplReader::Read_Symbol(sal_uInt16, const sal_uInt8* pData, short nLen )
    2769                 :            : {
    2770         [ #  # ]:          0 :     if( !bIgnoreText )
    2771                 :            :     {
    2772         [ #  # ]:          0 :         if( nLen < 0 )
    2773                 :            :         {
    2774                 :            :             //otherwise disable after we print the char
    2775 [ #  # ][ #  # ]:          0 :             if (pPlcxMan && pPlcxMan->GetDoingDrawTextBox())
                 [ #  # ]
    2776                 :          0 :                 pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_FONT );
    2777                 :          0 :             bSymbol = false;
    2778                 :            :         }
    2779                 :            :         else
    2780                 :            :         {
    2781                 :            :             // Make new Font-Atribut
    2782                 :            :             // (will be closed in SwWW8ImplReader::ReadChars() )
    2783                 :            : 
    2784                 :            :             //Will not be added to the charencoding stack, for styles the real
    2785                 :            :             //font setting will be put in as the styles charset, and for plain
    2786                 :            :             //text encoding for symbols is moot. Drawing boxes will check bSymbol
    2787                 :            :             //themselves so they don't need to add it to the stack either.
    2788         [ #  # ]:          0 :             if (SetNewFontAttr(SVBT16ToShort( pData ), false, RES_CHRATR_FONT))
    2789                 :            :             {
    2790         [ #  # ]:          0 :                 if( bVer67 )
    2791                 :            :                 {
    2792                 :            :                     //convert single byte from MS1252 to Unicode
    2793                 :            :                     cSymbol = rtl::OUString(
    2794                 :            :                         reinterpret_cast<const sal_Char*>(pData+2), 1,
    2795                 :          0 :                         RTL_TEXTENCODING_MS_1252).toChar();
    2796                 :            :                 }
    2797                 :            :                 else
    2798                 :            :                 {
    2799                 :            :                     //already is Unicode
    2800                 :          0 :                     cSymbol = SVBT16ToShort( pData+2 );
    2801                 :            :                 }
    2802                 :          0 :                 bSymbol = true;
    2803                 :            :             }
    2804                 :            :         }
    2805                 :            :     }
    2806                 :          0 : }
    2807                 :            : 
    2808                 :       2034 : SwWW8StyInf *SwWW8ImplReader::GetStyle(sal_uInt16 nColl) const
    2809                 :            : {
    2810         [ +  + ]:       2034 :     return const_cast<SwWW8StyInf *>(nColl < vColl.size() ? &vColl[nColl] : 0);
    2811                 :            : }
    2812                 :            : 
    2813                 :            : /***************************************************************************
    2814                 :            : #  Zeichen - Attribute
    2815                 :            : #**************************************************************************/
    2816                 :            : 
    2817                 :            : // Read_BoldUsw fuer Italic, Bold, Kapitaelchen, Versalien, durchgestrichen,
    2818                 :            : // Contour und Shadow
    2819                 :       2298 : void SwWW8ImplReader::Read_BoldUsw( sal_uInt16 nId, const sal_uInt8* pData, short nLen )
    2820                 :            : {
    2821                 :       2298 :     const int nContigiousWestern = 8;
    2822                 :       2298 :     const int nWestern = nContigiousWestern + 1;
    2823                 :       2298 :     const int nEastern = 2;
    2824                 :       2298 :     const int nCTL = 2;
    2825                 :       2298 :     const int nIds = nWestern + nEastern + nCTL;
    2826                 :            :     static const sal_uInt16 nEndIds[ nIds ] =
    2827                 :            :     {
    2828                 :            :         RES_CHRATR_WEIGHT,          RES_CHRATR_POSTURE,
    2829                 :            :         RES_CHRATR_CROSSEDOUT,      RES_CHRATR_CONTOUR,
    2830                 :            :         RES_CHRATR_SHADOWED,        RES_CHRATR_CASEMAP,
    2831                 :            :         RES_CHRATR_CASEMAP,         RES_CHRATR_HIDDEN,
    2832                 :            : 
    2833                 :            :         RES_CHRATR_CROSSEDOUT,
    2834                 :            : 
    2835                 :            :         RES_CHRATR_CJK_WEIGHT,      RES_CHRATR_CJK_POSTURE,
    2836                 :            : 
    2837                 :            :         RES_CHRATR_CTL_WEIGHT,      RES_CHRATR_CTL_POSTURE
    2838                 :            :     };
    2839                 :            : 
    2840                 :       2298 :     ww::WordVersion eVersion = pWwFib->GetFIBVersion();
    2841                 :            : 
    2842                 :            :     sal_uInt8 nI;
    2843                 :            :     // die Attribut-Nr fuer "doppelt durchgestrichen" tanzt aus der Reihe
    2844         [ -  + ]:       2298 :     if (0x2A53 == nId)
    2845                 :          0 :         nI = nContigiousWestern;               // The out of sequence western id
    2846                 :            :     else
    2847                 :            :     {
    2848                 :            :         // The contigious western ids
    2849         [ -  + ]:       2298 :         if (eVersion <= ww::eWW2)
    2850                 :          0 :             nI = static_cast< sal_uInt8 >(nId - 60);
    2851         [ -  + ]:       2298 :         else if (eVersion < ww::eWW8)
    2852                 :          0 :             nI = static_cast< sal_uInt8 >(nId - 85);
    2853                 :            :         else
    2854                 :       2298 :             nI = static_cast< sal_uInt8 >(nId - 0x0835);
    2855                 :            :     }
    2856                 :            : 
    2857                 :       2298 :     sal_uInt16 nMask = 1 << nI;
    2858                 :            : 
    2859         [ +  + ]:       2298 :     if (nLen < 0)
    2860                 :            :     {
    2861         [ +  + ]:        948 :         if (nI < 2)
    2862                 :            :         {
    2863         [ -  + ]:        936 :             if (eVersion <= ww::eWW6)
    2864                 :            :             {
    2865                 :            :                 // reset the CTL Weight and Posture, because they are the same as their
    2866                 :            :                 // western equivalents in ww6
    2867                 :          0 :                 pCtrlStck->SetAttr( *pPaM->GetPoint(), nEndIds[ nWestern + nEastern + nI ] );
    2868                 :            :             }
    2869                 :            :             // reset the CJK Weight and Posture, because they are the same as their
    2870                 :            :             // western equivalents in word
    2871                 :        936 :             pCtrlStck->SetAttr( *pPaM->GetPoint(), nEndIds[ nWestern + nI ] );
    2872                 :            :         }
    2873                 :        948 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), nEndIds[ nI ] );
    2874                 :        948 :         pCtrlStck->SetToggleAttr(nI, false);
    2875                 :       2298 :         return;
    2876                 :            :     }
    2877                 :            :     // Wert: 0 = Aus, 1 = An, 128 = Wie Style, 129 entgegen Style
    2878                 :       1350 :     bool bOn = *pData & 1;
    2879                 :       1350 :     SwWW8StyInf* pSI = GetStyle(nAktColl);
    2880 [ +  - ][ +  + ]:       1350 :     if (pPlcxMan && eVersion > ww::eWW2)
    2881                 :            :     {
    2882                 :            :         const sal_uInt8 *pCharIstd =
    2883         [ -  + ]:        984 :             pPlcxMan->GetChpPLCF()->HasSprm(bVer67 ? 80 : 0x4A30);
    2884         [ -  + ]:        984 :         if (pCharIstd)
    2885                 :          0 :             pSI = GetStyle(SVBT16ToShort(pCharIstd));
    2886                 :            :     }
    2887                 :            : 
    2888         [ +  + ]:       1350 :     if( pAktColl )                          // StyleDef -> Flags merken
    2889                 :            :     {
    2890         [ +  - ]:        300 :         if (pSI)
    2891                 :            :         {
    2892                 :            :             // The style based on has Bit 7 set ?
    2893   [ +  +  -  + ]:        516 :             if (
         [ -  + ][ +  + ]
    2894                 :        300 :                 pSI->nBase < vColl.size() && (*pData & 0x80) &&
    2895                 :        216 :                 (vColl[pSI->nBase].n81Flags & nMask)
    2896                 :            :                )
    2897                 :            :             {
    2898                 :          0 :                 bOn = !bOn;                     // umdrehen
    2899                 :            :             }
    2900                 :            : 
    2901         [ +  + ]:        300 :             if (bOn)
    2902                 :        297 :                 pSI->n81Flags |= nMask;         // Flag setzen
    2903                 :            :             else
    2904                 :          3 :                 pSI->n81Flags &= ~nMask;        // Flag loeschen
    2905                 :            :        }
    2906                 :            :     }
    2907                 :            :     else
    2908                 :            :     {
    2909                 :            : 
    2910                 :            :         // im Text -> Flags abfragen
    2911         [ +  + ]:       1050 :         if( *pData & 0x80 )                 // Bit 7 gesetzt ?
    2912                 :            :         {
    2913 [ +  - ][ +  + ]:        969 :             if (pSI && pSI->n81Flags & nMask)       // und in StyleDef an ?
    2914                 :         39 :                 bOn = !bOn;                 // dann invertieren
    2915                 :            :             // am Stack vermerken, das dieses ein Toggle-Attribut ist
    2916                 :        969 :             pCtrlStck->SetToggleAttr(nI, true);
    2917                 :            :         }
    2918                 :            :     }
    2919                 :            : 
    2920                 :       1350 :     SetToggleAttr( nI, bOn );
    2921                 :            : }
    2922                 :            : 
    2923                 :          0 : void SwWW8ImplReader::Read_Bidi(sal_uInt16, const sal_uInt8*, short nLen)
    2924                 :            : {
    2925         [ #  # ]:          0 :     if (nLen > 0)
    2926                 :          0 :         bBidi = true;
    2927                 :            :     else
    2928                 :          0 :         bBidi = false;
    2929                 :          0 : }
    2930                 :            : 
    2931                 :            : // Read_BoldUsw for BiDi Italic, Bold
    2932                 :        243 : void SwWW8ImplReader::Read_BoldBiDiUsw(sal_uInt16 nId, const sal_uInt8* pData,
    2933                 :            :     short nLen)
    2934                 :            : {
    2935                 :            :     static const sal_uInt16 nEndIds[2] =
    2936                 :            :     {
    2937                 :            :         RES_CHRATR_CTL_WEIGHT, RES_CHRATR_CTL_POSTURE,
    2938                 :            :     };
    2939                 :            : 
    2940                 :            :     sal_uInt8 nI;
    2941                 :        243 :     ww::WordVersion eVersion = pWwFib->GetFIBVersion();
    2942         [ -  + ]:        243 :     if (eVersion <= ww::eWW2)
    2943                 :          0 :         nI = static_cast< sal_uInt8 >(nId - 80);
    2944         [ -  + ]:        243 :     else if (eVersion < ww::eWW8)
    2945                 :          0 :         nI = static_cast< sal_uInt8 >(nId - 111);
    2946                 :            :     else
    2947                 :        243 :         nI = static_cast< sal_uInt8 >(nId - 0x085C);
    2948                 :            : 
    2949                 :            :     OSL_ENSURE(nI <= 1, "not happening");
    2950         [ -  + ]:        243 :     if (nI > 1)
    2951                 :          0 :         return;
    2952                 :            : 
    2953                 :        243 :     sal_uInt16 nMask = 1 << nI;
    2954                 :            : 
    2955         [ +  + ]:        243 :     if( nLen < 0 )
    2956                 :            :     {
    2957                 :         30 :         pCtrlStck->SetAttr(*pPaM->GetPoint(),nEndIds[nI]);
    2958                 :         30 :         pCtrlStck->SetToggleBiDiAttr(nI, false);
    2959                 :         30 :         return;
    2960                 :            :     }
    2961                 :        213 :     bool bOn = *pData & 1;
    2962                 :        213 :     SwWW8StyInf* pSI = GetStyle(nAktColl);
    2963         [ +  + ]:        213 :     if (pPlcxMan)
    2964                 :            :     {
    2965                 :            :         const sal_uInt8 *pCharIstd =
    2966         [ -  + ]:         66 :             pPlcxMan->GetChpPLCF()->HasSprm(bVer67 ? 80 : 0x4A30);
    2967         [ -  + ]:         66 :         if (pCharIstd)
    2968                 :          0 :             pSI = GetStyle(SVBT16ToShort(pCharIstd));
    2969                 :            :     }
    2970                 :            : 
    2971 [ +  + ][ +  - ]:        213 :     if (pAktColl && eVersion > ww::eWW2)        // StyleDef -> Flags merken
    2972                 :            :     {
    2973         [ +  - ]:        294 :         if (pSI)
    2974                 :            :         {
    2975         [ +  - ]:        246 :             if( pSI->nBase < vColl.size()             // Style Based on
           [ +  +  -  + ]
                 [ -  + ]
    2976                 :            :                 && ( *pData & 0x80 )            // Bit 7 gesetzt ?
    2977                 :         99 :                 && ( vColl[pSI->nBase].n81BiDiFlags & nMask ) ) // BasisMaske ?
    2978                 :          0 :                     bOn = !bOn;                     // umdrehen
    2979                 :            : 
    2980         [ +  - ]:        147 :             if( bOn )
    2981                 :        147 :                 pSI->n81BiDiFlags |= nMask;         // Flag setzen
    2982                 :            :             else
    2983                 :          0 :                 pSI->n81BiDiFlags &= ~nMask;        // Flag loeschen
    2984                 :            :         }
    2985                 :            :     }
    2986                 :            :     else
    2987                 :            :     {
    2988                 :            : 
    2989                 :            :         // im Text -> Flags abfragen
    2990         [ +  - ]:         66 :         if (*pData & 0x80)                  // Bit 7 gesetzt ?
    2991                 :            :         {
    2992 [ +  - ][ +  + ]:         66 :             if (pSI && pSI->n81BiDiFlags & nMask) // und in StyleDef an ?
    2993                 :         12 :                 bOn = !bOn;                     // dann invertieren
    2994                 :            :             // am Stack vermerken, das dieses ein Toggle-Attribut ist
    2995                 :         66 :             pCtrlStck->SetToggleBiDiAttr(nI, true);
    2996                 :            :         }
    2997                 :            :     }
    2998                 :            : 
    2999                 :        243 :     SetToggleBiDiAttr(nI, bOn);
    3000                 :            : }
    3001                 :            : 
    3002                 :        213 : void SwWW8ImplReader::SetToggleBiDiAttr(sal_uInt8 nAttrId, bool bOn)
    3003                 :            : {
    3004      [ +  +  - ]:        213 :     switch (nAttrId)
    3005                 :            :     {
    3006                 :            :         case 0:
    3007                 :            :             {
    3008 [ +  + ][ +  - ]:        156 :                 SvxWeightItem aAttr( bOn ? WEIGHT_BOLD : WEIGHT_NORMAL, RES_CHRATR_WEIGHT );
    3009                 :        156 :                 aAttr.SetWhich( RES_CHRATR_CTL_WEIGHT );
    3010 [ +  - ][ +  - ]:        156 :                 NewAttr( aAttr );
    3011                 :            :             }
    3012                 :        156 :             break;
    3013                 :            :         case 1:
    3014                 :            :             {
    3015 [ +  - ][ +  - ]:         57 :                 SvxPostureItem aAttr( bOn ? ITALIC_NORMAL : ITALIC_NONE, RES_CHRATR_POSTURE );
    3016                 :         57 :                 aAttr.SetWhich( RES_CHRATR_CTL_POSTURE );
    3017 [ +  - ][ +  - ]:         57 :                 NewAttr( aAttr );
    3018                 :            :             }
    3019                 :         57 :             break;
    3020                 :            :         default:
    3021                 :            :             OSL_ENSURE(!this, "Unhandled unknown bidi toggle attribute");
    3022                 :          0 :             break;
    3023                 :            : 
    3024                 :            :     }
    3025                 :        213 : }
    3026                 :            : 
    3027                 :       1350 : void SwWW8ImplReader::SetToggleAttr(sal_uInt8 nAttrId, bool bOn)
    3028                 :            : {
    3029                 :       1350 :     ww::WordVersion eVersion = pWwFib->GetFIBVersion();
    3030                 :            : 
    3031   [ +  +  -  -  :       1350 :     switch (nAttrId)
          +  -  -  -  -  
                      - ]
    3032                 :            :     {
    3033                 :            :         case 0:
    3034                 :            :             {
    3035 [ +  + ][ +  - ]:        777 :                 SvxWeightItem aAttr( bOn ? WEIGHT_BOLD : WEIGHT_NORMAL, RES_CHRATR_WEIGHT );
    3036         [ +  - ]:        777 :                 NewAttr( aAttr );
    3037                 :        777 :                 aAttr.SetWhich( RES_CHRATR_CJK_WEIGHT );
    3038         [ +  - ]:        777 :                 NewAttr( aAttr );
    3039         [ -  + ]:        777 :                 if (eVersion <= ww::eWW6)
    3040                 :            :                 {
    3041                 :          0 :                     aAttr.SetWhich( RES_CHRATR_CTL_WEIGHT );
    3042         [ #  # ]:          0 :                     NewAttr( aAttr );
    3043         [ +  - ]:        777 :                 }
    3044                 :            :             }
    3045                 :        777 :             break;
    3046                 :            :         case 1:
    3047                 :            :             {
    3048 [ +  + ][ +  - ]:        561 :                 SvxPostureItem aAttr( bOn ? ITALIC_NORMAL : ITALIC_NONE, RES_CHRATR_POSTURE );
    3049         [ +  - ]:        561 :                 NewAttr( aAttr );
    3050                 :        561 :                 aAttr.SetWhich( RES_CHRATR_CJK_POSTURE );
    3051         [ +  - ]:        561 :                 NewAttr( aAttr );
    3052         [ -  + ]:        561 :                 if (eVersion <= ww::eWW6)
    3053                 :            :                 {
    3054                 :          0 :                     aAttr.SetWhich( RES_CHRATR_CTL_POSTURE );
    3055         [ #  # ]:          0 :                     NewAttr( aAttr );
    3056         [ +  - ]:        561 :                 }
    3057                 :            :             }
    3058                 :        561 :             break;
    3059                 :            :         case 2:
    3060 [ #  # ][ #  # ]:          0 :             NewAttr(SvxCrossedOutItem(bOn ? STRIKEOUT_SINGLE : STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT));
    3061                 :          0 :             break;
    3062                 :            :         case 3:
    3063         [ #  # ]:          0 :             NewAttr( SvxContourItem( bOn, RES_CHRATR_CONTOUR ) );
    3064                 :          0 :             break;
    3065                 :            :         case 4:
    3066         [ +  - ]:         12 :             NewAttr( SvxShadowedItem( bOn, RES_CHRATR_SHADOWED ) );
    3067                 :         12 :             break;
    3068                 :            :         case 5:
    3069                 :            :             NewAttr( SvxCaseMapItem( bOn ? SVX_CASEMAP_KAPITAELCHEN
    3070 [ #  # ][ #  # ]:          0 :                                               : SVX_CASEMAP_NOT_MAPPED, RES_CHRATR_CASEMAP ) );
    3071                 :          0 :             break;
    3072                 :            :         case 6:
    3073                 :            :             NewAttr( SvxCaseMapItem( bOn ? SVX_CASEMAP_VERSALIEN
    3074 [ #  # ][ #  # ]:          0 :                                              : SVX_CASEMAP_NOT_MAPPED, RES_CHRATR_CASEMAP ) );
    3075                 :          0 :             break;
    3076                 :            :         case 7:
    3077         [ #  # ]:          0 :             NewAttr(SvxCharHiddenItem(bOn, RES_CHRATR_HIDDEN));
    3078                 :          0 :             break;
    3079                 :            :         case 8:
    3080                 :            :             NewAttr( SvxCrossedOutItem( bOn ? STRIKEOUT_DOUBLE
    3081 [ #  # ][ #  # ]:          0 :                                                 : STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ) );
    3082                 :          0 :             break;
    3083                 :            :         default:
    3084                 :            :             OSL_ENSURE(!this, "Unhandled unknown toggle attribute");
    3085                 :          0 :             break;
    3086                 :            :     }
    3087                 :       1350 : }
    3088                 :            : 
    3089                 :          0 : void SwWW8ImplReader::_ChkToggleAttr( sal_uInt16 nOldStyle81Mask,
    3090                 :            :                                         sal_uInt16 nNewStyle81Mask )
    3091                 :            : {
    3092                 :          0 :     sal_uInt16 i = 1, nToggleAttrFlags = pCtrlStck->GetToggleAttrFlags();
    3093         [ #  # ]:          0 :     for (sal_uInt8 n = 0; n < 7; ++n, i <<= 1)
    3094                 :            :     {
    3095 [ #  # ][ #  # ]:          0 :         if (
    3096                 :            :             (i & nToggleAttrFlags) &&
    3097                 :            :             ((i & nOldStyle81Mask) != (i & nNewStyle81Mask))
    3098                 :            :            )
    3099                 :            :         {
    3100                 :          0 :             SetToggleAttr(n, (i & nOldStyle81Mask));
    3101                 :            :         }
    3102                 :            :     }
    3103                 :          0 : }
    3104                 :            : 
    3105                 :          0 : void SwWW8ImplReader::_ChkToggleBiDiAttr( sal_uInt16 nOldStyle81Mask,
    3106                 :            :                                         sal_uInt16 nNewStyle81Mask )
    3107                 :            : {
    3108                 :          0 :     sal_uInt16 i = 1, nToggleAttrFlags = pCtrlStck->GetToggleBiDiAttrFlags();
    3109         [ #  # ]:          0 :     for (sal_uInt8 n = 0; n < 7; ++n, i <<= 1)
    3110                 :            :     {
    3111 [ #  # ][ #  # ]:          0 :         if (
    3112                 :            :             (i & nToggleAttrFlags) &&
    3113                 :            :             ((i & nOldStyle81Mask) != (i & nNewStyle81Mask))
    3114                 :            :            )
    3115                 :            :         {
    3116                 :          0 :             SetToggleBiDiAttr(n, (i & nOldStyle81Mask));
    3117                 :            :         }
    3118                 :            :     }
    3119                 :          0 : }
    3120                 :            : 
    3121                 :         24 : void SwWW8ImplReader::Read_SubSuper( sal_uInt16, const sal_uInt8* pData, short nLen )
    3122                 :            : {
    3123         [ +  + ]:         24 :     if( nLen < 0 ){
    3124                 :          6 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_ESCAPEMENT );
    3125                 :         24 :         return;
    3126                 :            :     }
    3127                 :            : 
    3128                 :            :     short nEs;
    3129                 :            :     sal_uInt8 nProp;
    3130      [ +  -  - ]:         18 :     switch( *pData )
    3131                 :            :     {
    3132                 :            :         case 1:
    3133                 :         18 :             nEs = DFLT_ESC_AUTO_SUPER;
    3134                 :         18 :             nProp = DFLT_ESC_PROP;
    3135                 :         18 :             break;
    3136                 :            :         case 2:
    3137                 :          0 :             nEs = DFLT_ESC_AUTO_SUB;
    3138                 :          0 :             nProp = DFLT_ESC_PROP;
    3139                 :          0 :             break;
    3140                 :            :         default:
    3141                 :          0 :             nEs = 0;
    3142                 :          0 :             nProp = 100;
    3143                 :          0 :             break;
    3144                 :            :     }
    3145         [ +  - ]:         18 :     NewAttr( SvxEscapementItem( nEs, nProp, RES_CHRATR_ESCAPEMENT ) );
    3146                 :            : }
    3147                 :            : 
    3148                 :          9 : SwFrmFmt *SwWW8ImplReader::ContainsSingleInlineGraphic(const SwPaM &rRegion)
    3149                 :            : {
    3150                 :            :     /*
    3151                 :            :     For inline graphics and objects word has a hacked in feature to use
    3152                 :            :     subscripting to force the graphic into a centered position on the line, so
    3153                 :            :     we must check when applying sub/super to see if it the subscript range
    3154                 :            :     contains only a single graphic, and if that graphic is anchored as
    3155                 :            :     FLY_AS_CHAR and then we can change its anchoring to centered in the line.
    3156                 :            :     */
    3157                 :          9 :     SwFrmFmt *pRet=0;
    3158 [ +  - ][ +  - ]:          9 :     SwNodeIndex aBegin(rRegion.Start()->nNode);
    3159         [ +  - ]:          9 :     xub_StrLen nBegin(rRegion.Start()->nContent.GetIndex());
    3160 [ +  - ][ +  - ]:          9 :     SwNodeIndex aEnd(rRegion.End()->nNode);
    3161         [ +  - ]:          9 :     xub_StrLen nEnd(rRegion.End()->nContent.GetIndex());
    3162                 :            :     const SwTxtNode* pTNd;
    3163                 :            :     const SwTxtAttr* pTFlyAttr;
    3164   [ -  +  #  # ]:          9 :     if (
         [ #  # ][ #  # ]
         [ -  + ][ +  - ]
    3165                 :          9 :          aBegin == aEnd && nBegin == nEnd - 1 &&
    3166                 :          0 :          0 != (pTNd = aBegin.GetNode().GetTxtNode()) &&
    3167                 :          0 :          0 != (pTFlyAttr = pTNd->GetTxtAttrForCharAt(nBegin, RES_TXTATR_FLYCNT))
    3168                 :            :        )
    3169                 :            :     {
    3170                 :          0 :         const SwFmtFlyCnt& rFly = pTFlyAttr->GetFlyCnt();
    3171                 :          0 :         SwFrmFmt *pFlyFmt = rFly.GetFrmFmt();
    3172         [ #  # ]:          0 :         if (pFlyFmt &&
           [ #  #  #  # ]
    3173         [ #  # ]:          0 :             (FLY_AS_CHAR == pFlyFmt->GetAnchor().GetAnchorId()))
    3174                 :            :         {
    3175                 :          0 :             pRet = pFlyFmt;
    3176                 :            :         }
    3177                 :            :     }
    3178 [ +  - ][ +  - ]:          9 :     return pRet;
    3179                 :            : }
    3180                 :            : 
    3181                 :          0 : bool SwWW8ImplReader::ConvertSubToGraphicPlacement()
    3182                 :            : {
    3183                 :            :     /*
    3184                 :            :     For inline graphics and objects word has a hacked in feature to use
    3185                 :            :     subscripting to force the graphic into a centered position on the line, so
    3186                 :            :     we must check when applying sub/super to see if it the subscript range
    3187                 :            :     contains only a single graphic, and if that graphic is anchored as
    3188                 :            :     FLY_AS_CHAR and then we can change its anchoring to centered in the line.
    3189                 :            :     */
    3190                 :          0 :     bool bIsGraphicPlacementHack = false;
    3191                 :            :     sal_uInt16 nPos;
    3192 [ #  # ][ #  # ]:          0 :     if (pCtrlStck->GetFmtStackAttr(RES_CHRATR_ESCAPEMENT, &nPos))
    3193                 :            :     {
    3194         [ #  # ]:          0 :         SwPaM aRegion(*pPaM->GetPoint());
    3195                 :            : 
    3196 [ #  # ][ #  # ]:          0 :         SwFltPosition aMkPos((*pCtrlStck)[nPos].m_aMkPos);
    3197         [ #  # ]:          0 :         SwFltPosition aPtPos(*pPaM->GetPoint());
    3198                 :            : 
    3199                 :          0 :         SwFrmFmt *pFlyFmt = 0;
    3200 [ #  # ][ #  # ]:          0 :         if (
         [ #  # ][ #  # ]
    3201         [ #  # ]:          0 :              SwFltStackEntry::MakeRegion(&rDoc,aRegion,false,aMkPos,aPtPos) &&
    3202                 :            :              0 != (pFlyFmt = ContainsSingleInlineGraphic(aRegion))
    3203                 :            :            )
    3204                 :            :         {
    3205         [ #  # ]:          0 :             pCtrlStck->DeleteAndDestroy(nPos);
    3206 [ #  # ][ #  # ]:          0 :             pFlyFmt->SetFmtAttr(SwFmtVertOrient(0, text::VertOrientation::CHAR_CENTER, text::RelOrientation::CHAR));
                 [ #  # ]
    3207                 :          0 :             bIsGraphicPlacementHack = true;
    3208 [ #  # ][ #  # ]:          0 :         }
                 [ #  # ]
    3209                 :            :     }
    3210                 :          0 :     return bIsGraphicPlacementHack;
    3211                 :            : }
    3212                 :            : 
    3213                 :          0 : void SwWW8ImplReader::Read_SubSuperProp( sal_uInt16, const sal_uInt8* pData, short nLen )
    3214                 :            : {
    3215         [ #  # ]:          0 :     if( nLen < 0 )
    3216                 :            :     {
    3217 [ #  # ][ #  # ]:          0 :         if (!ConvertSubToGraphicPlacement())
    3218         [ #  # ]:          0 :             pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_ESCAPEMENT );
    3219                 :          0 :         return;
    3220                 :            :     }
    3221                 :            : 
    3222         [ #  # ]:          0 :     ww::WordVersion eVersion = pWwFib->GetFIBVersion();
    3223                 :            : 
    3224                 :            :     // Font-Position in HalfPoints
    3225         [ #  # ]:          0 :     short nPos = eVersion <= ww::eWW2 ? static_cast< sal_Int8 >( *pData ) : SVBT16ToShort( pData );
    3226                 :          0 :     sal_Int32 nPos2 = nPos * ( 10 * 100 );      // HalfPoints in 100 * tw
    3227                 :            :     const SvxFontHeightItem* pF
    3228         [ #  # ]:          0 :         = (const SvxFontHeightItem*)GetFmtAttr(RES_CHRATR_FONTSIZE);
    3229                 :            :     OSL_ENSURE(pF, "Expected to have the fontheight available here");
    3230                 :            : 
    3231                 :            :     // #i59022: Check ensure nHeight != 0. Div by zero otherwise.
    3232                 :          0 :     sal_Int32 nHeight = 240;
    3233 [ #  # ][ #  # ]:          0 :     if (pF != NULL && pF->GetHeight() != 0)
                 [ #  # ]
    3234                 :          0 :         nHeight = pF->GetHeight();
    3235                 :          0 :     nPos2 /= nHeight;                       // ... nun in % ( gerundet )
    3236         [ #  # ]:          0 :     if( nPos2 > 100 )                       // zur Sicherheit
    3237                 :          0 :         nPos2 = 100;
    3238         [ #  # ]:          0 :     if( nPos2 < -100 )
    3239                 :          0 :         nPos2 = -100;
    3240         [ #  # ]:          0 :     SvxEscapementItem aEs( (short)nPos2, 100, RES_CHRATR_ESCAPEMENT );
    3241 [ #  # ][ #  # ]:          0 :     NewAttr( aEs );
    3242                 :            : }
    3243                 :            : 
    3244                 :        141 : void SwWW8ImplReader::Read_Underline( sal_uInt16, const sal_uInt8* pData, short nLen )
    3245                 :            : {
    3246                 :        141 :     FontUnderline eUnderline = UNDERLINE_NONE;
    3247                 :        141 :     bool bWordLine = false;
    3248         [ +  + ]:        141 :     if( pData )
    3249                 :            :     {
    3250                 :            :         // Parameter:  0 = none,    1 = single,  2 = by Word,
    3251                 :            :                     // 3 = double,  4 = dotted,  5 = hidden
    3252                 :            :                     // 6 = thick,   7 = dash,    8 = dot(not used)
    3253                 :            :                     // 9 = dotdash 10 = dotdotdash 11 = wave
    3254                 :            : 
    3255                 :            : 
    3256                 :            :         // pruefe auf Sonderfall "fett+unterstrichen"
    3257                 :         96 :         bool bAlsoBold = /*( 6 == b )*/ false;
    3258                 :            :         // erst mal ggfs. *bold* einschalten!
    3259         [ -  + ]:         96 :         if( bAlsoBold )
    3260                 :            :         {
    3261                 :          0 :             sal_uInt8 nOn = 1;
    3262         [ #  # ]:          0 :             Read_BoldUsw( 0x0835, &nOn, nLen );
    3263                 :          0 :             eUnderline = UNDERLINE_SINGLE;
    3264                 :            :         }
    3265                 :            :         else
    3266                 :            :         {
    3267   [ -  +  -  -  :         96 :             switch( *pData )
          -  -  -  -  -  
          -  -  -  -  -  
             -  -  -  + ]
    3268                 :            :             {
    3269                 :          0 :             case 2: bWordLine = true;       // no break;
    3270                 :         51 :             case 1: eUnderline = (FontUnderline)UNDERLINE_SINGLE;       break;
    3271                 :          0 :             case 3: eUnderline = (FontUnderline)UNDERLINE_DOUBLE;       break;
    3272                 :          0 :             case 4: eUnderline = (FontUnderline)UNDERLINE_DOTTED;       break;
    3273                 :          0 :             case 7: eUnderline = (FontUnderline)UNDERLINE_DASH;         break;
    3274                 :          0 :             case 9: eUnderline = (FontUnderline)UNDERLINE_DASHDOT;      break;
    3275                 :          0 :             case 10:eUnderline = (FontUnderline)UNDERLINE_DASHDOTDOT;   break;
    3276                 :          0 :             case 6: eUnderline = (FontUnderline)UNDERLINE_BOLD;         break;
    3277                 :          0 :             case 11:eUnderline = (FontUnderline)UNDERLINE_WAVE;         break;
    3278                 :          0 :             case 20:eUnderline = (FontUnderline)UNDERLINE_BOLDDOTTED;   break;
    3279                 :          0 :             case 23:eUnderline = (FontUnderline)UNDERLINE_BOLDDASH;     break;
    3280                 :          0 :             case 39:eUnderline = (FontUnderline)UNDERLINE_LONGDASH;     break;
    3281                 :          0 :             case 55:eUnderline = (FontUnderline)UNDERLINE_BOLDLONGDASH; break;
    3282                 :          0 :             case 25:eUnderline = (FontUnderline)UNDERLINE_BOLDDASHDOT;  break;
    3283                 :          0 :             case 26:eUnderline = (FontUnderline)UNDERLINE_BOLDDASHDOTDOT;break;
    3284                 :          0 :             case 27:eUnderline = (FontUnderline)UNDERLINE_BOLDWAVE;     break;
    3285                 :         96 :             case 43:eUnderline = (FontUnderline)UNDERLINE_DOUBLEWAVE;   break;
    3286                 :            :             }
    3287                 :            :         }
    3288                 :            :     }
    3289                 :            : 
    3290                 :            :     // dann Stack ggfs. verwursteln und exit!
    3291         [ +  + ]:        141 :     if( nLen < 0 )
    3292                 :            :     {
    3293                 :         45 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_UNDERLINE );
    3294                 :         45 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_WORDLINEMODE );
    3295                 :            :     }
    3296                 :            :     else
    3297                 :            :     {
    3298         [ +  - ]:         96 :         NewAttr( SvxUnderlineItem( eUnderline, RES_CHRATR_UNDERLINE ));
    3299         [ -  + ]:         96 :         if( bWordLine )
    3300         [ #  # ]:          0 :             NewAttr(SvxWordLineModeItem(true, RES_CHRATR_WORDLINEMODE));
    3301                 :            :     }
    3302                 :        141 : }
    3303                 :            : 
    3304                 :            : /*
    3305                 :            : //The last three vary, measurements, rotation ? ?
    3306                 :            : NoBracket   78 CA 06 -  02 00 00 02 34 52
    3307                 :            : ()          78 CA 06 -  02 01 00 02 34 52
    3308                 :            : []          78 CA 06 -  02 02 00 02 34 52
    3309                 :            : <>          78 CA 06 -  02 03 00 02 34 52
    3310                 :            : {}          78 CA 06 -  02 04 00 02 34 52
    3311                 :            : */
    3312                 :          0 : void SwWW8ImplReader::Read_DoubleLine_Rotate( sal_uInt16, const sal_uInt8* pData,
    3313                 :            :     short nLen )
    3314                 :            : {
    3315         [ #  # ]:          0 :     if( nLen < 0 ) // close the tag
    3316                 :            :     {
    3317                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_TWO_LINES );
    3318                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_ROTATE );
    3319                 :            :     }
    3320 [ #  # ][ #  # ]:          0 :     else if( pData && 6 == nLen )
    3321                 :            :     {
    3322      [ #  #  # ]:          0 :         switch( *pData )
    3323                 :            :         {
    3324                 :            :         case 2:                     // double line
    3325                 :            :             {
    3326                 :          0 :                 sal_Unicode cStt = 0, cEnd = 0;
    3327   [ #  #  #  #  :          0 :                 switch( SVBT16ToShort( pData+1 ) )
                      # ]
    3328                 :            :                 {
    3329                 :          0 :                 case 1: cStt = '(', cEnd = ')'; break;
    3330                 :          0 :                 case 2: cStt = '[', cEnd = ']'; break;
    3331                 :          0 :                 case 3: cStt = '<', cEnd = '>'; break;
    3332                 :          0 :                 case 4: cStt = '{', cEnd = '}'; break;
    3333                 :            :                 }
    3334         [ #  # ]:          0 :                 NewAttr( SvxTwoLinesItem( sal_True, cStt, cEnd, RES_CHRATR_TWO_LINES ));
    3335                 :            :             }
    3336                 :          0 :             break;
    3337                 :            : 
    3338                 :            :         case 1:                         // rotated characters
    3339                 :            :             {
    3340                 :          0 :                 bool bFitToLine = 0 != *(pData+1);
    3341         [ #  # ]:          0 :                 NewAttr( SvxCharRotateItem( 900, bFitToLine, RES_CHRATR_ROTATE ));
    3342                 :            :             }
    3343                 :          0 :             break;
    3344                 :            :         }
    3345                 :            :     }
    3346                 :          0 : }
    3347                 :            : 
    3348                 :        768 : void SwWW8ImplReader::Read_TxtColor( sal_uInt16, const sal_uInt8* pData, short nLen )
    3349                 :            : {
    3350                 :            :     //Has newer colour varient, ignore this old varient
    3351 [ +  - ][ +  + ]:        768 :     if (!bVer67 && pPlcxMan && pPlcxMan->GetChpPLCF()->HasSprm(0x6870))
         [ +  - ][ +  + ]
    3352                 :        768 :         return;
    3353                 :            : 
    3354         [ -  + ]:         78 :     if( nLen < 0 )
    3355                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_COLOR );
    3356                 :            :     else
    3357                 :            :     {
    3358                 :         78 :         sal_uInt8 b = *pData;            // Parameter: 0 = Auto, 1..16 Farben
    3359                 :            : 
    3360         [ -  + ]:         78 :         if( b > 16 )                // unbekannt -> Black
    3361                 :          0 :             b = 0;
    3362                 :            : 
    3363 [ +  - ][ +  - ]:         78 :         NewAttr( SvxColorItem(Color(GetCol(b)), RES_CHRATR_COLOR));
                 [ +  - ]
    3364 [ +  + ][ +  - ]:         78 :         if (pAktColl && pStyles)
    3365                 :         63 :             pStyles->bTxtColChanged = true;
    3366                 :            :     }
    3367                 :            : }
    3368                 :            : 
    3369                 :        720 : void SwWW8ImplReader::Read_TxtForeColor(sal_uInt16, const sal_uInt8* pData, short nLen)
    3370                 :            : {
    3371         [ +  + ]:        720 :     if( nLen < 0 )
    3372                 :        273 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_COLOR );
    3373                 :            :     else
    3374                 :            :     {
    3375         [ +  - ]:        447 :         Color aColor(msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)));
    3376 [ +  - ][ +  - ]:        447 :         NewAttr(SvxColorItem(aColor, RES_CHRATR_COLOR));
                 [ +  - ]
    3377 [ +  + ][ +  - ]:        447 :         if (pAktColl && pStyles)
    3378                 :        447 :             pStyles->bTxtColChanged = true;
    3379                 :            :     }
    3380                 :        720 : }
    3381                 :            : 
    3382                 :       4155 : bool SwWW8ImplReader::GetFontParams( sal_uInt16 nFCode, FontFamily& reFamily,
    3383                 :            :     String& rName, FontPitch& rePitch, CharSet& reCharSet )
    3384                 :            : {
    3385                 :            :     // Die Defines, aus denen diese Tabellen erzeugt werden, stehen in windows.h
    3386                 :            :     static const FontPitch ePitchA[] =
    3387                 :            :     {
    3388                 :            :         PITCH_DONTKNOW, PITCH_FIXED, PITCH_VARIABLE, PITCH_DONTKNOW
    3389                 :            :     };
    3390                 :            : 
    3391                 :            :     static const FontFamily eFamilyA[] =
    3392                 :            :     {
    3393                 :            :         FAMILY_DONTKNOW, FAMILY_ROMAN, FAMILY_SWISS, FAMILY_MODERN,
    3394                 :            :         FAMILY_SCRIPT, FAMILY_DECORATIVE
    3395                 :            :     };
    3396                 :            : 
    3397                 :       4155 :     const WW8_FFN* pF = pFonts->GetFont( nFCode );  // Info dazu
    3398         [ +  + ]:       4155 :     if( !pF )                                   // FontNummer unbekannt ?
    3399                 :        495 :         return false;                           // dann ignorieren
    3400                 :            : 
    3401         [ +  - ]:       3660 :     rName = String( pF->sFontname );
    3402                 :            : 
    3403                 :            :     // pF->prg : Pitch
    3404                 :       3660 :     rePitch = ePitchA[pF->prg];
    3405                 :            : 
    3406                 :            :     // pF->chs: Charset
    3407         [ -  + ]:       3660 :     if( 77 == pF->chs )             // Mac-Font im Mac-Charset oder
    3408                 :          0 :         reCharSet = eTextCharSet;   // auf ANSI-Charset uebersetzt
    3409                 :            :     else
    3410                 :            :     { // patch from cmc for #i52786#
    3411                 :            :         // #i52786#, for word 67 we'll assume that ANSI is basically invalid,
    3412                 :            :         // might be true for (above) mac as well, but would need a mac example
    3413                 :            :         // that exercises this to be sure
    3414 [ -  + ][ #  # ]:       3660 :         if (bVer67 && pF->chs == 0)
    3415                 :          0 :             reCharSet = RTL_TEXTENCODING_DONTKNOW;
    3416                 :            :         else
    3417                 :       3660 :             reCharSet = rtl_getTextEncodingFromWindowsCharset( pF->chs );
    3418                 :            :     }
    3419                 :            : 
    3420                 :            :     // pF->ff : Family
    3421                 :       3660 :     sal_uInt8 b = pF->ff;
    3422                 :            : 
    3423                 :            :     // make sure Font Family Code is set correctly
    3424                 :            :     // at least for the most important fonts
    3425                 :            :     // ( might be set wrong when Doc was not created by
    3426                 :            :     //   Winword but by third party program like Applixware... )
    3427                 :            :         /*
    3428                 :            :         0: FAMILY_DONTKNOW
    3429                 :            :         1: FAMILY_ROMAN
    3430                 :            :         2: FAMILY_SWISS
    3431                 :            :         3: FAMILY_MODERN
    3432                 :            :         4: FAMILY_SCRIPT
    3433                 :            :         5: FAMILY_DECORATIVE
    3434                 :            :     */
    3435                 :            : #define FONTNAMETAB_SZ    14
    3436                 :            : #define MAX_FONTNAME_ROMAN 6
    3437                 :            :     static const sal_Char
    3438                 :            :         // first comes ROMAN
    3439                 :            :         sFontName0[] = "\x07""Tms Rmn",
    3440                 :            :         sFontName1[] = "\x07""Timmons",
    3441                 :            :         sFontName2[] = "\x08""CG Times",
    3442                 :            :         sFontName3[] = "\x08""MS Serif",
    3443                 :            :         sFontName4[] = "\x08""Garamond",
    3444                 :            :         sFontName5[] = "\x11""Times Roman",
    3445                 :            :         sFontName6[] = "\x15""Times New Roman",
    3446                 :            :         // from here SWISS --> see above: #define MAX_FONTNAME_ROMAN 6
    3447                 :            :         sFontName7[] = "\x04""Helv",
    3448                 :            :         sFontName8[] = "\x05""Arial",
    3449                 :            :         sFontName9[] = "\x07""Univers",
    3450                 :            :         sFontName10[]= "\x11""LinePrinter",
    3451                 :            :         sFontName11[]= "\x11""Lucida Sans",
    3452                 :            :         sFontName12[]= "\x11""Small Fonts",
    3453                 :            :         sFontName13[]= "\x13""MS Sans Serif";
    3454                 :            :     static const sal_Char* const aFontNameTab[ FONTNAMETAB_SZ ] =
    3455                 :            :     {
    3456                 :            :         sFontName0,  sFontName1,  sFontName2,  sFontName3,
    3457                 :            :         sFontName4,  sFontName5,  sFontName6,  sFontName7,
    3458                 :            :         sFontName8,  sFontName9,  sFontName10, sFontName11,
    3459                 :            :         sFontName12, sFontName13
    3460                 :            :     };
    3461                 :            : 
    3462         [ +  + ]:      43512 :     for( sal_uInt16 n = 0;  n < FONTNAMETAB_SZ; n++ )
    3463                 :            :     {
    3464                 :      41610 :         const sal_Char* pCmp = aFontNameTab[ n ];
    3465                 :      41610 :         xub_StrLen nLen = *pCmp++;
    3466         [ +  + ]:      41610 :         if( rName.EqualsIgnoreCaseAscii(pCmp, 0, nLen) )
    3467                 :            :         {
    3468         [ +  + ]:       1758 :             b = n <= MAX_FONTNAME_ROMAN ? 1 : 2;
    3469                 :       1758 :             break;
    3470                 :            :         }
    3471                 :            :     }
    3472         [ +  - ]:       3660 :     if (b < (sizeof(eFamilyA)/sizeof(eFamilyA[0])))
    3473                 :       3660 :         reFamily = eFamilyA[b];
    3474                 :            :     else
    3475                 :          0 :         reFamily = FAMILY_DONTKNOW;
    3476                 :            : 
    3477                 :       4155 :     return true;
    3478                 :            : }
    3479                 :            : 
    3480                 :       4155 : bool SwWW8ImplReader::SetNewFontAttr(sal_uInt16 nFCode, bool bSetEnums,
    3481                 :            :     sal_uInt16 nWhich)
    3482                 :            : {
    3483                 :            :     FontFamily eFamily;
    3484         [ +  - ]:       4155 :     String aName;
    3485                 :            :     FontPitch ePitch;
    3486                 :            :     CharSet eSrcCharSet;
    3487                 :            : 
    3488 [ +  - ][ +  + ]:       4155 :     if( !GetFontParams( nFCode, eFamily, aName, ePitch, eSrcCharSet ) )
    3489                 :            :     {
    3490                 :            :         //If we fail (and are not doing a style) then put something into the
    3491                 :            :         //character encodings stack anyway so that the property end that pops
    3492                 :            :         //off the stack will keep in sync
    3493 [ +  + ][ +  - ]:        495 :         if (!pAktColl && IsListOrDropcap())
                 [ +  + ]
    3494                 :            :         {
    3495         [ -  + ]:        354 :             if (nWhich == RES_CHRATR_CJK_FONT)
    3496                 :            :             {
    3497         [ #  # ]:          0 :                 if (!maFontSrcCJKCharSets.empty())
    3498                 :            :                 {
    3499         [ #  # ]:          0 :                     eSrcCharSet = maFontSrcCJKCharSets.top();
    3500                 :            :                 }
    3501                 :            :                 else
    3502                 :            :                 {
    3503                 :          0 :                     eSrcCharSet = RTL_TEXTENCODING_DONTKNOW;
    3504                 :            :                 }
    3505                 :            : 
    3506         [ #  # ]:          0 :                 maFontSrcCJKCharSets.push(eSrcCharSet);
    3507                 :            :             }
    3508                 :            :             else
    3509                 :            :             {
    3510         [ +  + ]:        354 :                 if (!maFontSrcCharSets.empty())
    3511                 :            :                 {
    3512         [ +  - ]:        177 :                     eSrcCharSet = maFontSrcCharSets.top();
    3513                 :            :                 }
    3514                 :            :                 else
    3515                 :            :                 {
    3516                 :        177 :                     eSrcCharSet = RTL_TEXTENCODING_DONTKNOW;
    3517                 :            :                 }
    3518                 :            : 
    3519         [ +  - ]:        354 :                 maFontSrcCharSets.push(eSrcCharSet);
    3520                 :            :             }
    3521                 :            :         }
    3522                 :        495 :         return false;
    3523                 :            :     }
    3524                 :            : 
    3525                 :       3660 :     CharSet eDstCharSet = eSrcCharSet;
    3526                 :            : 
    3527         [ +  - ]:       3660 :     SvxFontItem aFont( eFamily, aName, aEmptyStr, ePitch, eDstCharSet, nWhich);
    3528                 :            : 
    3529         [ +  - ]:       3660 :     if( bSetEnums )
    3530                 :            :     {
    3531 [ +  + ][ +  - ]:       3660 :         if( pAktColl && nAktColl < vColl.size() ) // StyleDef
                 [ +  + ]
    3532                 :            :         {
    3533      [ +  +  + ]:        849 :             switch(nWhich)
    3534                 :            :             {
    3535                 :            :                 default:
    3536                 :            :                 case RES_CHRATR_FONT:
    3537                 :        240 :                     vColl[nAktColl].eLTRFontSrcCharSet = eSrcCharSet;
    3538                 :        240 :                     break;
    3539                 :            :                 case RES_CHRATR_CTL_FONT:
    3540                 :        402 :                     vColl[nAktColl].eRTLFontSrcCharSet = eSrcCharSet;
    3541                 :        402 :                     break;
    3542                 :            :                 case RES_CHRATR_CJK_FONT:
    3543                 :        207 :                     vColl[nAktColl].eCJKFontSrcCharSet = eSrcCharSet;
    3544                 :        849 :                     break;
    3545                 :            :             }
    3546                 :            :         }
    3547         [ +  + ]:       2811 :         else if (IsListOrDropcap())
    3548                 :            :         {
    3549                 :            :             //Add character text encoding to stack
    3550         [ +  + ]:       1719 :             if (nWhich  == RES_CHRATR_CJK_FONT)
    3551         [ +  - ]:         51 :                 maFontSrcCJKCharSets.push(eSrcCharSet);
    3552                 :            :             else
    3553         [ +  - ]:       1668 :                 maFontSrcCharSets.push(eSrcCharSet);
    3554                 :            :         }
    3555                 :            :     }
    3556                 :            : 
    3557         [ +  - ]:       3660 :     NewAttr( aFont );                       // ...und 'reinsetzen
    3558                 :            : 
    3559 [ +  - ][ +  - ]:       4155 :     return true;
    3560                 :            : }
    3561                 :            : 
    3562                 :       1590 : void SwWW8ImplReader::ResetCharSetVars()
    3563                 :            : {
    3564                 :            :     OSL_ENSURE(!maFontSrcCharSets.empty(),"no charset to remove");
    3565         [ +  - ]:       1590 :     if (!maFontSrcCharSets.empty())
    3566                 :       1590 :         maFontSrcCharSets.pop();
    3567                 :       1590 : }
    3568                 :            : 
    3569                 :         51 : void SwWW8ImplReader::ResetCJKCharSetVars()
    3570                 :            : {
    3571                 :            :     OSL_ENSURE(!maFontSrcCJKCharSets.empty(),"no charset to remove");
    3572         [ +  - ]:         51 :     if (!maFontSrcCJKCharSets.empty())
    3573                 :         51 :         maFontSrcCJKCharSets.pop();
    3574                 :         51 : }
    3575                 :            : 
    3576                 :       3837 : void SwWW8ImplReader::openFont(sal_uInt16 nFCode, sal_uInt16 nId)
    3577                 :            : {
    3578 [ +  + ][ +  + ]:       3837 :     if (SetNewFontAttr(nFCode, true, nId) && pAktColl && pStyles)
         [ +  - ][ +  + ]
    3579                 :            :     {
    3580                 :            :         // merken zur Simulation Default-Font
    3581         [ +  + ]:        603 :         if (RES_CHRATR_CJK_FONT == nId)
    3582                 :        111 :             pStyles->bCJKFontChanged = true;
    3583         [ +  + ]:        492 :         else if (RES_CHRATR_CTL_FONT == nId)
    3584                 :        327 :             pStyles->bCTLFontChanged = true;
    3585                 :            :         else
    3586                 :        165 :             pStyles->bFontChanged = true;
    3587                 :            :     }
    3588                 :       3837 : }
    3589                 :            : 
    3590                 :       1641 : void SwWW8ImplReader::closeFont(sal_uInt16 nId)
    3591                 :            : {
    3592                 :       1641 :     pCtrlStck->SetAttr( *pPaM->GetPoint(), nId );
    3593         [ +  + ]:       1641 :     if (nId == RES_CHRATR_CJK_FONT)
    3594                 :         51 :         ResetCJKCharSetVars();
    3595                 :            :     else
    3596                 :       1590 :         ResetCharSetVars();
    3597                 :       1641 : }
    3598                 :            : 
    3599                 :            : /*
    3600                 :            :     Font ein oder ausschalten:
    3601                 :            : */
    3602                 :       5478 : void SwWW8ImplReader::Read_FontCode( sal_uInt16 nId, const sal_uInt8* pData, short nLen )
    3603                 :            : {
    3604         [ +  - ]:       5478 :     if (!bSymbol)           // falls bSymbol, gilt der am Symbol
    3605                 :            :     {                       // (siehe sprmCSymbol) gesetzte Font !
    3606   [ +  +  +  - ]:       5478 :         switch( nId )
    3607                 :            :         {
    3608                 :            :             case 113:       //WW7
    3609                 :            :             case 0x4A51:    //"Other" font, override with BiDi if it exists
    3610                 :            :             case 0x4A5E:    //BiDi Font
    3611                 :       3012 :                 nId = RES_CHRATR_CTL_FONT;
    3612                 :       3012 :                 break;
    3613                 :            :             case 93:        //WW6
    3614                 :            :             case 111:       //WW7
    3615                 :            :             case 0x4A4f:
    3616                 :       2244 :                 nId = RES_CHRATR_FONT;
    3617                 :       2244 :                 break;
    3618                 :            :             case 112:       //WW7
    3619                 :            :             case 0x4A50:
    3620                 :        222 :                 nId = RES_CHRATR_CJK_FONT;
    3621                 :        222 :                 break;
    3622                 :            :             default:
    3623                 :       5478 :                 return ;
    3624                 :            :         }
    3625                 :            : 
    3626                 :       5478 :         ww::WordVersion eVersion = pWwFib->GetFIBVersion();
    3627                 :            : 
    3628         [ +  + ]:       5478 :         if( nLen < 0 ) // Ende des Attributes
    3629                 :            :         {
    3630         [ -  + ]:       1641 :             if (eVersion <= ww::eWW6)
    3631                 :            :             {
    3632                 :          0 :                 closeFont(RES_CHRATR_CTL_FONT);
    3633                 :          0 :                 closeFont(RES_CHRATR_CJK_FONT);
    3634                 :            :             }
    3635                 :       1641 :             closeFont(nId);
    3636                 :            :         }
    3637                 :            :         else
    3638                 :            :         {
    3639                 :       3837 :             sal_uInt16 nFCode = SVBT16ToShort( pData );     // Font-Nummer
    3640                 :       3837 :             openFont(nFCode, nId);
    3641         [ -  + ]:       3837 :             if (eVersion <= ww::eWW6)
    3642                 :            :             {
    3643                 :          0 :                 openFont(nFCode, RES_CHRATR_CJK_FONT);
    3644                 :          0 :                 openFont(nFCode, RES_CHRATR_CTL_FONT);
    3645                 :            :             }
    3646                 :            :         }
    3647                 :            :     }
    3648                 :            : }
    3649                 :            : 
    3650                 :       4812 : void SwWW8ImplReader::Read_FontSize( sal_uInt16 nId, const sal_uInt8* pData, short nLen )
    3651                 :            : {
    3652      [ +  +  - ]:       4812 :     switch( nId )
    3653                 :            :     {
    3654                 :            :         case 74:
    3655                 :            :         case 99:
    3656                 :            :         case 0x4a43:
    3657                 :       3900 :             nId = RES_CHRATR_FONTSIZE;
    3658                 :       3900 :             break;
    3659                 :            :         case 85:  //WW2
    3660                 :            :         case 116: //WW7
    3661                 :            :         case 0x4a61:
    3662                 :        912 :             nId = RES_CHRATR_CTL_FONTSIZE;
    3663                 :        912 :             break;
    3664                 :            :         default:
    3665                 :       4812 :             return ;
    3666                 :            :     }
    3667                 :            : 
    3668                 :       4812 :     ww::WordVersion eVersion = pWwFib->GetFIBVersion();
    3669                 :            : 
    3670         [ +  + ]:       4812 :     if( nLen < 0 )          // Ende des Attributes
    3671                 :            :     {
    3672                 :       1998 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), nId  );
    3673         [ -  + ]:       1998 :         if (eVersion <= ww::eWW6) // reset additionally the CTL size
    3674                 :          0 :             pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_CTL_FONTSIZE );
    3675         [ +  + ]:       1998 :         if (RES_CHRATR_FONTSIZE == nId)  // reset additionally the CJK size
    3676                 :       1695 :             pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_CJK_FONTSIZE );
    3677                 :            :     }
    3678                 :            :     else
    3679                 :            :     {
    3680                 :            :         // Font-Size in half points e.g. 10 = 1440 / ( 72 * 2 )
    3681         [ -  + ]:       2814 :         sal_uInt16 nFSize = eVersion <= ww::eWW2 ? *pData : SVBT16ToShort(pData);
    3682                 :       2814 :         nFSize*= 10;
    3683                 :            : 
    3684         [ +  - ]:       2814 :         SvxFontHeightItem aSz( nFSize, 100, nId );
    3685         [ +  - ]:       2814 :         NewAttr( aSz );
    3686         [ +  + ]:       2814 :         if (RES_CHRATR_FONTSIZE == nId)  // set additionally the CJK size
    3687                 :            :         {
    3688                 :       2205 :             aSz.SetWhich( RES_CHRATR_CJK_FONTSIZE );
    3689         [ +  - ]:       2205 :             NewAttr( aSz );
    3690                 :            :         }
    3691         [ -  + ]:       2814 :         if (eVersion <= ww::eWW6) // set additionally the CTL size
    3692                 :            :         {
    3693                 :          0 :             aSz.SetWhich( RES_CHRATR_CTL_FONTSIZE );
    3694         [ #  # ]:          0 :             NewAttr( aSz );
    3695                 :            :         }
    3696 [ +  + ][ +  - ]:       2814 :         if (pAktColl && pStyles)            // Style-Def ?
    3697                 :            :         {
    3698                 :            :             // merken zur Simulation Default-FontSize
    3699         [ +  + ]:        777 :             if (nId == RES_CHRATR_CTL_FONTSIZE)
    3700                 :        306 :                 pStyles->bFCTLSizeChanged = true;
    3701                 :            :             else
    3702                 :            :             {
    3703                 :        471 :                 pStyles->bFSizeChanged = true;
    3704         [ -  + ]:        471 :                 if (eVersion <= ww::eWW6)
    3705                 :          0 :                     pStyles->bFCTLSizeChanged= true;
    3706                 :            :             }
    3707         [ +  - ]:       2814 :         }
    3708                 :            :     }
    3709                 :            : }
    3710                 :            : 
    3711                 :            : 
    3712                 :            : 
    3713                 :          0 : void SwWW8ImplReader::Read_CharSet(sal_uInt16 , const sal_uInt8* pData, short nLen)
    3714                 :            : {
    3715         [ #  # ]:          0 :     if( nLen < 0 )
    3716                 :            :     {                   // Ende des Attributes
    3717                 :          0 :         eHardCharSet = RTL_TEXTENCODING_DONTKNOW;
    3718                 :          0 :         return;
    3719                 :            :     }
    3720                 :          0 :     sal_uInt8 nfChsDiff = SVBT8ToByte( pData );
    3721                 :            : 
    3722         [ #  # ]:          0 :     if( nfChsDiff )
    3723                 :          0 :         eHardCharSet = rtl_getTextEncodingFromWindowsCharset( *(pData + 1) );
    3724                 :            :     else
    3725                 :          0 :         eHardCharSet = RTL_TEXTENCODING_DONTKNOW;
    3726                 :            : }
    3727                 :            : 
    3728                 :       1254 : void SwWW8ImplReader::Read_Language( sal_uInt16 nId, const sal_uInt8* pData, short nLen )
    3729                 :            : {
    3730   [ +  +  +  - ]:       1254 :     switch( nId )
    3731                 :            :     {
    3732                 :            :         case 97:
    3733                 :            :         case 0x486D: //sprmCRgLid0_80
    3734                 :            :         case 0x4873: //Methinks, uncertain
    3735                 :        948 :             nId = RES_CHRATR_LANGUAGE;
    3736                 :        948 :             break;
    3737                 :            :         case 0x486E: //sprmCRgLid1_80
    3738                 :            :         case 0x4874: //Methinks, uncertain
    3739                 :        171 :             nId = RES_CHRATR_CJK_LANGUAGE;
    3740                 :        171 :             break;
    3741                 :            :         case 83:
    3742                 :            :         case 114:
    3743                 :            :         case 0x485F:
    3744                 :        135 :             nId = RES_CHRATR_CTL_LANGUAGE;
    3745                 :        135 :             break;
    3746                 :            :         default:
    3747                 :       1254 :             return;
    3748                 :            :     }
    3749                 :            : 
    3750         [ +  + ]:       1254 :     if( nLen < 0 )                  // Ende des Attributes
    3751                 :        348 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), nId );
    3752                 :            :     else
    3753                 :            :     {
    3754                 :        906 :         sal_uInt16 nLang = SVBT16ToShort( pData );  // Language-Id
    3755         [ +  - ]:        906 :         NewAttr(SvxLanguageItem((const LanguageType)nLang, nId));
    3756                 :            :     }
    3757                 :            : }
    3758                 :            : 
    3759                 :            : /*
    3760                 :            :     Einschalten des Zeichen-Styles:
    3761                 :            : */
    3762                 :        138 : void SwWW8ImplReader::Read_CColl( sal_uInt16, const sal_uInt8* pData, short nLen )
    3763                 :            : {
    3764         [ +  + ]:        138 :     if( nLen < 0 ){                 // Ende des Attributes
    3765                 :         69 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_TXTATR_CHARFMT );
    3766                 :         69 :         nCharFmt = -1;
    3767                 :         69 :         return;
    3768                 :            :     }
    3769                 :         69 :     sal_uInt16 nId = SVBT16ToShort( pData );    // Style-Id (NICHT Sprm-Id!)
    3770                 :            : 
    3771   [ +  -  -  + ]:        138 :     if( nId >= vColl.size() || !vColl[nId].pFmt  // ungueltige Id ?
         [ -  + ][ +  - ]
    3772                 :         69 :         || vColl[nId].bColl )              // oder Para-Style ?
    3773                 :          0 :         return;                             // dann ignorieren
    3774                 :            : 
    3775         [ +  - ]:         69 :     NewAttr( SwFmtCharFmt( (SwCharFmt*)vColl[nId].pFmt ) );
    3776                 :        138 :     nCharFmt = (short) nId;
    3777                 :            : }
    3778                 :            : 
    3779                 :            : 
    3780                 :            : /*
    3781                 :            :     enger oder weiter als normal:
    3782                 :            : */
    3783                 :          0 : void SwWW8ImplReader::Read_Kern( sal_uInt16, const sal_uInt8* pData, short nLen )
    3784                 :            : {
    3785         [ #  # ]:          0 :     if( nLen < 0 ){                 // Ende des Attributes
    3786                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_KERNING );
    3787                 :          0 :         return;
    3788                 :            :     }
    3789                 :          0 :     sal_Int16 nKern = SVBT16ToShort( pData );    // Kerning in Twips
    3790         [ #  # ]:          0 :     NewAttr( SvxKerningItem( nKern, RES_CHRATR_KERNING ) );
    3791                 :            : }
    3792                 :            : 
    3793                 :         66 : void SwWW8ImplReader::Read_FontKern( sal_uInt16, const sal_uInt8* , short nLen )
    3794                 :            : {
    3795         [ +  + ]:         66 :     if( nLen < 0 ) // Ende des Attributes
    3796                 :         12 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_AUTOKERN );
    3797                 :            :     else
    3798         [ +  - ]:         54 :         NewAttr(SvxAutoKernItem(true, RES_CHRATR_AUTOKERN));
    3799                 :         66 : }
    3800                 :            : 
    3801                 :          0 : void SwWW8ImplReader::Read_CharShadow(  sal_uInt16, const sal_uInt8* pData, short nLen )
    3802                 :            : {
    3803                 :            :     //Has newer colour varient, ignore this old varient
    3804 [ #  # ][ #  # ]:          0 :     if (!bVer67 && pPlcxMan && pPlcxMan->GetChpPLCF()->HasSprm(0xCA71))
         [ #  # ][ #  # ]
    3805                 :          0 :         return;
    3806                 :            : 
    3807         [ #  # ]:          0 :     if( nLen <= 0 )
    3808                 :            :     {
    3809                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_BACKGROUND );
    3810         [ #  # ]:          0 :         if( bCharShdTxtCol )
    3811                 :            :         {
    3812                 :            :             // Zeichenfarbe auch
    3813                 :          0 :             pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_COLOR );
    3814                 :          0 :             bCharShdTxtCol = false;
    3815                 :            :         }
    3816                 :            :     }
    3817                 :            :     else
    3818                 :            :     {
    3819                 :          0 :         WW8_SHD aSHD;
    3820                 :          0 :         aSHD.SetWWValue( *(SVBT16*)pData );
    3821         [ #  # ]:          0 :         SwWW8Shade aSh( bVer67, aSHD );
    3822                 :            : 
    3823 [ #  # ][ #  # ]:          0 :         NewAttr( SvxBrushItem( aSh.aColor, RES_CHRATR_BACKGROUND ));
                 [ #  # ]
    3824                 :            :     }
    3825                 :            : }
    3826                 :            : 
    3827                 :          0 : void SwWW8ImplReader::Read_TxtBackColor(sal_uInt16, const sal_uInt8* pData, short nLen )
    3828                 :            : {
    3829         [ #  # ]:          0 :     if( nLen <= 0 )
    3830                 :            :     {
    3831                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_BACKGROUND );
    3832         [ #  # ]:          0 :         if( bCharShdTxtCol )
    3833                 :            :         {
    3834                 :            :             // Zeichenfarbe auch
    3835                 :          0 :             pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_COLOR );
    3836                 :          0 :             bCharShdTxtCol = false;
    3837                 :            :         }
    3838                 :            :     }
    3839                 :            :     else
    3840                 :            :     {
    3841                 :            :         OSL_ENSURE(nLen == 10, "Len of para back colour not 10!");
    3842         [ #  # ]:          0 :         if (nLen != 10)
    3843                 :          0 :             return;
    3844         [ #  # ]:          0 :         Color aColour(ExtractColour(pData, bVer67));
    3845 [ #  # ][ #  # ]:          0 :         NewAttr(SvxBrushItem(aColour, RES_CHRATR_BACKGROUND));
                 [ #  # ]
    3846                 :            :     }
    3847                 :            : }
    3848                 :            : 
    3849                 :          0 : void SwWW8ImplReader::Read_CharHighlight(sal_uInt16, const sal_uInt8* pData, short nLen)
    3850                 :            : {
    3851         [ #  # ]:          0 :     if( nLen <= 0 )
    3852                 :            :     {
    3853                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_BACKGROUND );
    3854         [ #  # ]:          0 :         if( bCharShdTxtCol )
    3855                 :            :         {
    3856                 :          0 :             pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_COLOR );  // Zeichenfarbe auch
    3857                 :          0 :             bCharShdTxtCol = false;
    3858                 :            :         }
    3859                 :            :     }
    3860                 :            :     else
    3861                 :            :     {
    3862                 :          0 :         sal_uInt8 b = *pData;            // Parameter: 0 = Auto, 1..16 Farben
    3863                 :            : 
    3864         [ #  # ]:          0 :         if( b > 16 )                // unbekannt -> Black
    3865                 :          0 :             b = 0;                  // Auto -> Black
    3866                 :            : 
    3867                 :          0 :         Color aCol(GetCol(b));
    3868 [ #  # ][ #  # ]:          0 :         NewAttr( SvxBrushItem( aCol , RES_CHRATR_BACKGROUND ));
                 [ #  # ]
    3869                 :            :     }
    3870                 :          0 : }
    3871                 :            : 
    3872                 :            : 
    3873                 :            : /***************************************************************************
    3874                 :            : #  Absatz - Attribute
    3875                 :            : #**************************************************************************/
    3876                 :            : 
    3877                 :         63 : void SwWW8ImplReader::Read_NoLineNumb(sal_uInt16 , const sal_uInt8* pData, short nLen)
    3878                 :            : {
    3879         [ -  + ]:         63 :     if( nLen < 0 )  // Ende des Attributes
    3880                 :            :     {
    3881         [ #  # ]:          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_LINENUMBER );
    3882                 :         63 :         return;
    3883                 :            :     }
    3884         [ +  - ]:         63 :     SwFmtLineNumber aLN;
    3885         [ +  - ]:         63 :     if (const SwFmtLineNumber* pLN
    3886         [ +  - ]:         63 :         = (const SwFmtLineNumber*)GetFmtAttr(RES_LINENUMBER))
    3887                 :            :     {
    3888                 :         63 :         aLN.SetStartValue( pLN->GetStartValue() );
    3889                 :            :     }
    3890                 :            : 
    3891 [ +  - ][ -  + ]:         63 :     aLN.SetCountLines( pData && (0 == *pData) );
    3892 [ +  - ][ +  - ]:         63 :     NewAttr( aLN );
    3893                 :            : }
    3894                 :            : 
    3895                 :            : // Sprm 16, 17
    3896                 :       3111 : void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLen )
    3897                 :            : {
    3898         [ +  + ]:       3111 :     if (nLen < 0)  // End of the Attributes
    3899                 :            :     {
    3900         [ +  - ]:       1395 :         pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_LR_SPACE);
    3901                 :            :         return;
    3902                 :            :     }
    3903                 :            : 
    3904                 :       1716 :     short nPara = SVBT16ToShort( pData );
    3905                 :            : 
    3906         [ +  - ]:       1716 :     SvxLRSpaceItem aLR( RES_LR_SPACE );
    3907         [ +  - ]:       1716 :     const SfxPoolItem* pLR = GetFmtAttr(RES_LR_SPACE);
    3908         [ +  - ]:       1716 :     if( pLR )
    3909                 :       1716 :         aLR = *(const SvxLRSpaceItem*)pLR;
    3910                 :            : 
    3911                 :            :     // Fix the regression issue: #i99822#: Discussion?
    3912                 :            :     // Since the list lever formatting doesn't apply into paragraph style
    3913                 :            :     // for list levels of mode LABEL_ALIGNMENT.(see ww8par3.cxx
    3914                 :            :     // W8ImplReader::RegisterNumFmtOnTxtNode).
    3915                 :            :     // Need to apply the list format to the paragraph here.
    3916                 :       1716 :     SwTxtNode* pTxtNode = pPaM->GetNode()->GetTxtNode();
    3917 [ +  - ][ +  + ]:       1716 :     if( pTxtNode && pTxtNode->AreListLevelIndentsApplicable() )
         [ +  + ][ +  - ]
    3918                 :            :     {
    3919         [ +  - ]:        153 :         SwNumRule * pNumRule = pTxtNode->GetNumRule();
    3920         [ +  - ]:        153 :         if( pNumRule )
    3921                 :            :         {
    3922         [ +  - ]:        153 :             sal_uInt8 nLvl = static_cast< sal_uInt8 >(pTxtNode->GetActualListLevel());
    3923         [ +  - ]:        153 :             const SwNumFmt* pFmt = pNumRule->GetNumFmt( nLvl );
    3924 [ +  - ][ +  - ]:        153 :             if ( pFmt && pFmt->GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
         [ +  - ][ +  - ]
    3925                 :            :             {
    3926 [ +  - ][ +  - ]:        153 :                 aLR.SetTxtLeft( pFmt->GetIndentAt() );
    3927 [ +  - ][ +  - ]:        153 :                 aLR.SetTxtFirstLineOfst( static_cast<short>(pFmt->GetFirstLineIndent()) );
    3928                 :            :                 // make paragraph have hard-set indent attributes
    3929         [ +  - ]:        153 :                 pTxtNode->SetAttr( aLR );
    3930                 :            :             }
    3931                 :            :         }
    3932                 :            :     }
    3933                 :            : 
    3934                 :            :     /*
    3935                 :            :     The older word sprms mean left/right, while the new ones mean before/after.
    3936                 :            :     Writer now also works with before after, so when we see old left/right and
    3937                 :            :     we're RTL. We swap them
    3938                 :            :     */
    3939 [ +  - ][ -  + ]:       1716 :     if (IsRightToLeft())
    3940                 :            :     {
    3941   [ #  #  #  #  :          0 :         switch (nId)
                      # ]
    3942                 :            :         {
    3943                 :            :             //Left becomes after;
    3944                 :            :             case 17:
    3945                 :          0 :                 nId = 16;
    3946                 :          0 :                 break;
    3947                 :            :             case 0x840F:
    3948                 :          0 :                 nId = 0x840E;
    3949                 :          0 :                 break;
    3950                 :            :             //Right becomes before;
    3951                 :            :             case 16:
    3952                 :          0 :                 nId = 17;
    3953                 :          0 :                 break;
    3954                 :            :             case 0x840E:
    3955                 :          0 :                 nId = 0x840F;
    3956                 :          0 :                 break;
    3957                 :            :         }
    3958                 :            :     }
    3959                 :            : 
    3960                 :       1716 :     bool bFirstLinOfstSet( false ); // #i103711#
    3961                 :       1716 :     bool bLeftIndentSet( false ); // #i105414#
    3962                 :            : 
    3963   [ +  +  +  - ]:       1716 :     switch (nId)
    3964                 :            :     {
    3965                 :            :         //sprmPDxaLeft
    3966                 :            :         case     17:
    3967                 :            :         case 0x840F:
    3968                 :            :         case 0x845E:
    3969         [ +  - ]:       1032 :             aLR.SetTxtLeft( nPara );
    3970 [ +  + ][ +  - ]:       1032 :             if (pAktColl && nAktColl < vColl.size())
                 [ +  + ]
    3971                 :            :             {
    3972                 :        177 :                 vColl[nAktColl].bListReleventIndentSet = true;
    3973                 :            :             }
    3974                 :       1032 :             bLeftIndentSet = true;  // #i105414#
    3975                 :       1032 :             break;
    3976                 :            :         //sprmPDxaLeft1
    3977                 :            :         case     19:
    3978                 :            :         case 0x8411:
    3979                 :            :         case 0x8460:
    3980                 :            :             /*
    3981                 :            :             As part of an attempt to break my spirit ww 8+ formats can contain
    3982                 :            :             ww 7- lists. If they do and the list is part of the style, then
    3983                 :            :             when removing the list from a paragraph of that style there
    3984                 :            :             appears to be a bug where the hanging indent value which the list
    3985                 :            :             set is still factored into the left indent of the paragraph. Its
    3986                 :            :             not listed in the winword dialogs, but it is clearly there. So if
    3987                 :            :             our style has a broken ww 7- list and we know that the list has
    3988                 :            :             been removed then we will factor the original list applied hanging
    3989                 :            :             into our calculation.
    3990                 :            :             */
    3991 [ +  + ][ +  - ]:        600 :             if (pPlcxMan && nAktColl < vColl.size() && vColl[nAktColl].bHasBrokenWW6List)
         [ -  + ][ -  + ]
    3992                 :            :             {
    3993         [ #  # ]:          0 :                 const sal_uInt8 *pIsZeroed = pPlcxMan->GetPapPLCF()->HasSprm(0x460B);
    3994 [ #  # ][ #  # ]:          0 :                 if (pIsZeroed && *pIsZeroed == 0)
    3995                 :            :                 {
    3996                 :            :                     const SvxLRSpaceItem &rLR =
    3997                 :          0 :                         ItemGet<SvxLRSpaceItem>(*(vColl[nAktColl].pFmt),
    3998         [ #  # ]:          0 :                         RES_LR_SPACE);
    3999                 :          0 :                     nPara = nPara - rLR.GetTxtFirstLineOfst();
    4000                 :            :                 }
    4001                 :            :             }
    4002                 :            : 
    4003         [ +  - ]:        600 :             aLR.SetTxtFirstLineOfst(nPara);
    4004 [ +  + ][ +  - ]:        600 :             if (pAktColl && nAktColl < vColl.size())
                 [ +  + ]
    4005                 :            :             {
    4006                 :         69 :                 vColl[nAktColl].bListReleventIndentSet = true;
    4007                 :            :             }
    4008                 :        600 :             bFirstLinOfstSet = true; // #i103711#
    4009                 :        600 :             break;
    4010                 :            :         //sprmPDxaRight
    4011                 :            :         case     16:
    4012                 :            :         case 0x840E:
    4013                 :            :         case 0x845D:
    4014                 :         84 :             aLR.SetRight( nPara );
    4015                 :         84 :             break;
    4016                 :            :         default:
    4017                 :            :             return;
    4018                 :            :     }
    4019                 :            : 
    4020 [ +  - ][ +  - ]:       3111 :     NewAttr( aLR, bFirstLinOfstSet, bLeftIndentSet ); // #i103711#, #i105414#
                 [ +  - ]
    4021                 :            : }
    4022                 :            : 
    4023                 :            : // Sprm 20
    4024                 :         57 : void SwWW8ImplReader::Read_LineSpace( sal_uInt16, const sal_uInt8* pData, short nLen )
    4025                 :            : {
    4026                 :            : // Kommentear siehe Read_UL()
    4027 [ +  + ][ +  - ]:         57 :     if (bStyNormal && bWWBugNormal)
    4028                 :            :         return;
    4029                 :            : 
    4030         [ +  + ]:         57 :     if( nLen < 0 ){
    4031         [ +  - ]:          6 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_LINESPACING );
    4032         [ +  - ]:          6 :         if( !( nIniFlags & WW8FL_NO_IMPLPASP ) )
    4033         [ +  - ]:          6 :             pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_UL_SPACE );
    4034                 :            :         return;
    4035                 :            :     }
    4036                 :            : 
    4037                 :         51 :     short nSpace = SVBT16ToShort( pData );
    4038         [ +  - ]:         51 :     ww::WordVersion eVersion = pWwFib->GetFIBVersion();
    4039         [ +  - ]:         51 :     short nMulti = (eVersion <= ww::eWW2) ? 1 : SVBT16ToShort( pData + 2 );
    4040                 :            : 
    4041                 :            :     SvxLineSpace eLnSpc;
    4042         [ -  + ]:         51 :     if( 0 > nSpace )
    4043                 :            :     {
    4044                 :          0 :         nSpace = -nSpace;
    4045                 :          0 :         eLnSpc = SVX_LINE_SPACE_FIX;
    4046                 :            :     }
    4047                 :            :     else
    4048                 :         51 :         eLnSpc = SVX_LINE_SPACE_MIN;
    4049                 :            : 
    4050                 :            : // WW hat einen impliziten zusaetzlichen Absatzabstand abhaengig vom
    4051                 :            : // Zeilenabstand. Er betraegt bei "genau", 0.8*Zeilenabstand "vor" und
    4052                 :            : // 0.2*Zeilenabstand "nach".
    4053                 :            : // Bei "Mindestens" sind es 1*Zeilenabstand "vor" und 0*Zeilenabstand "nach".
    4054                 :            : // Bei Mehrfach sind es 0 "vor" und min( 0cm, FontSize*(nFach-1) ) "nach".
    4055                 :            : //
    4056                 :            : // SW hat auch einen impliziten Zeilenabstand. er betraegt bei "mindestens"
    4057                 :            : // 1*Zeilenabstand "vor" und 0 "nach"
    4058                 :            : // bei proportional betraegt er min( 0cm, FontSize*(nFach-1) ) sowohl "vor"
    4059                 :            : // wie auch "nach"
    4060                 :            : 
    4061                 :         51 :     sal_uInt16 nSpaceTw = 0;
    4062                 :            : 
    4063         [ +  - ]:         51 :     SvxLineSpacingItem aLSpc( LINE_SPACE_DEFAULT_HEIGHT, RES_PARATR_LINESPACING );
    4064                 :            : 
    4065         [ +  + ]:         51 :     if( 1 == nMulti )               // MultilineSpace ( proportional )
    4066                 :            :     {
    4067                 :         48 :         long n = nSpace * 10 / 24;  // WW: 240 = 100%, SW: 100 = 100%
    4068                 :            : 
    4069                 :            : // nach Absprache mit AMA ist die Begrenzung unsinnig
    4070         [ -  + ]:         48 :         if( n>200 ) n = 200;        // SW_UI-Maximum
    4071                 :         48 :         aLSpc.SetPropLineSpace( (const sal_uInt8)n );
    4072                 :            :         const SvxFontHeightItem* pH = (const SvxFontHeightItem*)
    4073         [ +  - ]:         48 :             GetFmtAttr( RES_CHRATR_FONTSIZE );
    4074                 :         48 :         nSpaceTw = (sal_uInt16)( n * pH->GetHeight() / 100 );
    4075                 :            :     }
    4076                 :            :     else                            // Fixed / Minimum
    4077                 :            :     {
    4078                 :            :         // bei negativen Space ist der Abstand exakt, sonst minimum
    4079                 :          3 :         nSpaceTw = (sal_uInt16)nSpace;
    4080                 :          3 :         aLSpc.SetLineHeight( nSpaceTw );
    4081                 :          3 :         aLSpc.GetLineSpaceRule() = eLnSpc;
    4082                 :            :     }
    4083         [ +  - ]:         51 :     NewAttr( aLSpc );
    4084         [ -  + ]:         51 :     if( pSFlyPara )
    4085         [ +  - ]:         57 :         pSFlyPara->nLineSpace = nSpaceTw;   // LineSpace fuer Graf-Apos
    4086                 :            : }
    4087                 :            : 
    4088                 :            : //#i18519# AutoSpace value depends on Dop fDontUseHTMLAutoSpacing setting
    4089                 :         84 : sal_uInt16 SwWW8ImplReader::GetParagraphAutoSpace(bool fDontUseHTMLAutoSpacing)
    4090                 :            : {
    4091         [ +  - ]:         84 :     if (fDontUseHTMLAutoSpacing)
    4092                 :         84 :         return 100;  //Seems to be always 5points in this case
    4093                 :            :     else
    4094                 :         84 :         return 280;  //Seems to be always 14points in this case
    4095                 :            : }
    4096                 :            : 
    4097                 :         42 : void SwWW8ImplReader::Read_ParaAutoBefore(sal_uInt16, const sal_uInt8 *pData, short nLen)
    4098                 :            : {
    4099         [ -  + ]:         42 :     if (nLen < 0)
    4100                 :            :     {
    4101                 :          0 :         pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_UL_SPACE);
    4102                 :         42 :         return;
    4103                 :            :     }
    4104                 :            : 
    4105         [ +  - ]:         42 :     if (*pData)
    4106                 :            :     {
    4107 [ +  - ][ +  - ]:         42 :         SvxULSpaceItem aUL(*(const SvxULSpaceItem*)GetFmtAttr(RES_UL_SPACE));
    4108                 :         42 :         aUL.SetUpper(GetParagraphAutoSpace(pWDop->fDontUseHTMLAutoSpacing));
    4109         [ +  - ]:         42 :         NewAttr(aUL);
    4110 [ +  - ][ +  - ]:         42 :         if (pAktColl && nAktColl < vColl.size())
                 [ +  - ]
    4111                 :         42 :             vColl[nAktColl].bParaAutoBefore = true;
    4112                 :            :         else
    4113         [ +  - ]:         42 :             bParaAutoBefore = true;
    4114                 :            :     }
    4115                 :            :     else
    4116                 :            :     {
    4117 [ #  # ][ #  # ]:          0 :         if (pAktColl && nAktColl < vColl.size())
                 [ #  # ]
    4118                 :          0 :             vColl[nAktColl].bParaAutoBefore = false;
    4119                 :            :         else
    4120                 :          0 :             bParaAutoBefore = false;
    4121                 :            :     }
    4122                 :            : }
    4123                 :            : 
    4124                 :         42 : void SwWW8ImplReader::Read_ParaAutoAfter(sal_uInt16, const sal_uInt8 *pData, short nLen)
    4125                 :            : {
    4126         [ -  + ]:         42 :     if (nLen < 0)
    4127                 :            :     {
    4128                 :          0 :         pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_UL_SPACE);
    4129                 :         42 :         return;
    4130                 :            :     }
    4131                 :            : 
    4132         [ +  - ]:         42 :     if (*pData)
    4133                 :            :     {
    4134 [ +  - ][ +  - ]:         42 :         SvxULSpaceItem aUL(*(const SvxULSpaceItem*)GetFmtAttr(RES_UL_SPACE));
    4135                 :         42 :         aUL.SetLower(GetParagraphAutoSpace(pWDop->fDontUseHTMLAutoSpacing));
    4136         [ +  - ]:         42 :         NewAttr(aUL);
    4137 [ +  - ][ +  - ]:         42 :         if (pAktColl && nAktColl < vColl.size())
                 [ +  - ]
    4138                 :         42 :             vColl[nAktColl].bParaAutoAfter = true;
    4139                 :            :         else
    4140         [ +  - ]:         42 :             bParaAutoAfter = true;
    4141                 :            :     }
    4142                 :            :     else
    4143                 :            :     {
    4144 [ #  # ][ #  # ]:          0 :         if (pAktColl && nAktColl < vColl.size())
                 [ #  # ]
    4145                 :          0 :             vColl[nAktColl].bParaAutoAfter = false;
    4146                 :            :         else
    4147                 :          0 :             bParaAutoAfter = false;
    4148                 :            :     }
    4149                 :            : }
    4150                 :            : 
    4151                 :            : // Sprm 21, 22
    4152                 :        630 : void SwWW8ImplReader::Read_UL( sal_uInt16 nId, const sal_uInt8* pData, short nLen )
    4153                 :            : {
    4154                 :            : // Nun eine Umpopelung eines WW-Fehlers: Bei nProduct == 0c03d wird
    4155                 :            : // faelschlicherweise ein DyaAfter 240 ( delta y abstand after, amn.d.?b.)
    4156                 :            : // im Style "Normal" eingefuegt, der
    4157                 :            : // gar nicht da ist. Ueber das IniFlag WW8FL_NO_STY_DYA laesst sich dieses
    4158                 :            : // Verhalten auch fuer andere WW-Versionen erzwingen
    4159                 :            : //  OSL_ENSURE( !bStyNormal || bWWBugNormal, "+Dieses Doc deutet evtl. auf einen
    4160                 :            : // Fehler in der benutzten WW-Version hin. Wenn sich die Styles <Standard> bzw.
    4161                 :            : // <Normal> zwischen WW und SW im Absatz- oder Zeilenabstand unterscheiden,
    4162                 :            : // dann bitte dieses Doc SH zukommen lassen." );
    4163                 :            : // bWWBugNormal ist kein hinreichendes Kriterium dafuer, dass der
    4164                 :            : // angegebene Abstand falsch ist
    4165                 :            : 
    4166         [ +  + ]:        630 :     if( nLen < 0 )
    4167                 :            :     {
    4168                 :            :         // Ende des Attributes
    4169         [ +  - ]:         93 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_UL_SPACE );
    4170                 :            :         return;
    4171                 :            :     }
    4172                 :        537 :     short nPara = SVBT16ToShort( pData );
    4173         [ -  + ]:        537 :     if( nPara < 0 )
    4174                 :          0 :         nPara = -nPara;
    4175                 :            : 
    4176 [ +  - ][ +  - ]:        537 :     SvxULSpaceItem aUL( *(const SvxULSpaceItem*)GetFmtAttr( RES_UL_SPACE ));
    4177                 :            : 
    4178      [ +  +  - ]:        537 :     switch( nId )
    4179                 :            :     {
    4180                 :            :         //sprmPDyaBefore
    4181                 :            :         case     21:
    4182                 :            :         case 0xA413:
    4183                 :        216 :             aUL.SetUpper( nPara );
    4184                 :        216 :             break;
    4185                 :            :         //sprmPDyaAfter
    4186                 :            :         case     22:
    4187                 :            :         case 0xA414:
    4188                 :        321 :             aUL.SetLower( nPara );
    4189                 :        321 :             break;
    4190                 :            :         default:
    4191                 :            :             return;
    4192                 :            :     };
    4193                 :            : 
    4194 [ +  - ][ +  - ]:        630 :     NewAttr( aUL );
                 [ +  - ]
    4195                 :            : }
    4196                 :            : 
    4197                 :          0 : void SwWW8ImplReader::Read_ParaContextualSpacing( sal_uInt16, const sal_uInt8* pData, short nLen )
    4198                 :            : {
    4199         [ #  # ]:          0 :     if( nLen < 0 )
    4200                 :            :     {
    4201         [ #  # ]:          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_UL_SPACE );
    4202                 :          0 :         return;
    4203                 :            :     }
    4204 [ #  # ][ #  # ]:          0 :     SvxULSpaceItem aUL( *(const SvxULSpaceItem*)GetFmtAttr( RES_UL_SPACE ));
    4205                 :          0 :     aUL.SetContextValue(*pData);
    4206 [ #  # ][ #  # ]:          0 :     NewAttr( aUL );
    4207                 :            : }
    4208                 :            : 
    4209                 :       4314 : void SwWW8ImplReader::Read_IdctHint( sal_uInt16, const sal_uInt8* pData, short nLen )
    4210                 :            : {
    4211         [ +  + ]:       4314 :     if (nLen < 0)
    4212                 :          3 :         nIdctHint = 0;
    4213                 :            :     else
    4214                 :       4311 :         nIdctHint = *pData;
    4215                 :       4314 : }
    4216                 :            : 
    4217                 :       1416 : void SwWW8ImplReader::Read_Justify( sal_uInt16, const sal_uInt8* pData, short nLen )
    4218                 :            : {
    4219         [ +  + ]:       1416 :     if( nLen < 0 )
    4220                 :            :     {
    4221         [ +  - ]:        327 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_ADJUST );
    4222                 :       1416 :         return;
    4223                 :            :     }
    4224                 :            : 
    4225                 :       1089 :     SvxAdjust eAdjust(SVX_ADJUST_LEFT);
    4226                 :       1089 :     bool bDistributed = false;
    4227   [ +  +  +  +  :       1089 :     switch (*pData)
                      - ]
    4228                 :            :     {
    4229                 :            :         default:
    4230                 :            :         case 0:
    4231                 :         42 :             break;
    4232                 :            :         case 1:
    4233                 :        510 :             eAdjust = SVX_ADJUST_CENTER;
    4234                 :        510 :             break;
    4235                 :            :         case 2:
    4236                 :         24 :             eAdjust = SVX_ADJUST_RIGHT;
    4237                 :         24 :             break;
    4238                 :            :         case 3:
    4239                 :        513 :             eAdjust = SVX_ADJUST_BLOCK;
    4240                 :        513 :             break;
    4241                 :            :         case 4:
    4242                 :          0 :             eAdjust = SVX_ADJUST_BLOCK;
    4243                 :          0 :             bDistributed = true;
    4244                 :          0 :             break;
    4245                 :            :     }
    4246         [ +  - ]:       1089 :     SvxAdjustItem aAdjust(eAdjust, RES_PARATR_ADJUST);
    4247         [ -  + ]:       1089 :     if (bDistributed)
    4248                 :          0 :         aAdjust.SetLastBlock(SVX_ADJUST_BLOCK);
    4249                 :            : 
    4250 [ +  - ][ +  - ]:       1416 :     NewAttr(aAdjust);
    4251                 :            : }
    4252                 :            : 
    4253                 :       3078 : bool SwWW8ImplReader::IsRightToLeft()
    4254                 :            : {
    4255                 :       3078 :     bool bRTL = false;
    4256                 :            :     const sal_uInt8 *pDir =
    4257         [ +  + ]:       3078 :         pPlcxMan ? pPlcxMan->GetPapPLCF()->HasSprm(0x2441) : 0;
    4258         [ -  + ]:       3078 :     if (pDir)
    4259                 :          0 :         bRTL = *pDir ? true : false;
    4260                 :            :     else
    4261                 :            :     {
    4262                 :            :         const SvxFrameDirectionItem* pItem=
    4263                 :       3078 :             (const SvxFrameDirectionItem*)GetFmtAttr(RES_FRAMEDIR);
    4264 [ -  + ][ -  + ]:       3078 :         if (pItem && (pItem->GetValue() == FRMDIR_HORI_RIGHT_TOP))
                 [ +  - ]
    4265                 :          0 :             bRTL = true;
    4266                 :            :     }
    4267                 :       3078 :     return bRTL;
    4268                 :            : }
    4269                 :            : 
    4270                 :        735 : void SwWW8ImplReader::Read_RTLJustify( sal_uInt16, const sal_uInt8* pData, short nLen )
    4271                 :            : {
    4272         [ +  + ]:        735 :     if( nLen < 0 )
    4273                 :            :     {
    4274                 :        240 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_ADJUST );
    4275                 :        735 :         return;
    4276                 :            :     }
    4277                 :            : 
    4278                 :            :     //If we are in a ltr paragraph this is the same as normal Justify,
    4279                 :            :     //If we are in a rtl paragraph the meaning is reversed.
    4280         [ +  - ]:        495 :     if (!IsRightToLeft())
    4281                 :        495 :         Read_Justify(0x2403 /*dummy*/, pData, nLen);
    4282                 :            :     else
    4283                 :            :     {
    4284                 :          0 :         SvxAdjust eAdjust(SVX_ADJUST_RIGHT);
    4285                 :          0 :         bool bDistributed = false;
    4286   [ #  #  #  #  :          0 :         switch (*pData)
                      # ]
    4287                 :            :         {
    4288                 :            :             default:
    4289                 :            :             case 0:
    4290                 :          0 :                 break;
    4291                 :            :             case 1:
    4292                 :          0 :                 eAdjust = SVX_ADJUST_CENTER;
    4293                 :          0 :                 break;
    4294                 :            :             case 2:
    4295                 :          0 :                 eAdjust = SVX_ADJUST_LEFT;
    4296                 :          0 :                 break;
    4297                 :            :             case 3:
    4298                 :          0 :                 eAdjust = SVX_ADJUST_BLOCK;
    4299                 :          0 :                 break;
    4300                 :            :             case 4:
    4301                 :          0 :                 eAdjust = SVX_ADJUST_BLOCK;
    4302                 :          0 :                 bDistributed = true;
    4303                 :          0 :                 break;
    4304                 :            :         }
    4305         [ #  # ]:          0 :         SvxAdjustItem aAdjust(eAdjust, RES_PARATR_ADJUST);
    4306         [ #  # ]:          0 :         if (bDistributed)
    4307                 :          0 :             aAdjust.SetLastBlock(SVX_ADJUST_BLOCK);
    4308                 :            : 
    4309 [ #  # ][ #  # ]:          0 :         NewAttr(aAdjust);
    4310                 :            :     }
    4311                 :            : }
    4312                 :            : 
    4313                 :        393 : void SwWW8ImplReader::Read_BoolItem( sal_uInt16 nId, const sal_uInt8* pData, short nLen )
    4314                 :            : {
    4315   [ +  +  +  - ]:        393 :     switch( nId )
    4316                 :            :     {
    4317                 :            :         case 0x2433:
    4318                 :          9 :             nId = RES_PARATR_FORBIDDEN_RULES;
    4319                 :          9 :             break;
    4320                 :            :         case 0x2435:
    4321                 :        108 :             nId = RES_PARATR_HANGINGPUNCTUATION;
    4322                 :        108 :             break;
    4323                 :            :         case 0x2437:
    4324                 :        276 :             nId = RES_PARATR_SCRIPTSPACE;
    4325                 :        276 :             break;
    4326                 :            :         default:
    4327                 :            :             OSL_ENSURE( !this, "wrong Id" );
    4328                 :        393 :             return ;
    4329                 :            :     }
    4330                 :            : 
    4331         [ +  + ]:        393 :     if( nLen < 0 )
    4332                 :         12 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), nId );
    4333                 :            :     else
    4334                 :            :     {
    4335                 :        381 :         SfxBoolItem* pI = (SfxBoolItem*)GetDfltAttr( nId )->Clone();
    4336                 :        381 :         pI->SetValue( 0 != *pData );
    4337                 :        381 :         NewAttr( *pI );
    4338         [ +  - ]:        381 :         delete pI;
    4339                 :            :     }
    4340                 :            : }
    4341                 :            : 
    4342                 :          0 : void SwWW8ImplReader::Read_Emphasis( sal_uInt16, const sal_uInt8* pData, short nLen )
    4343                 :            : {
    4344         [ #  # ]:          0 :     if( nLen < 0 )
    4345                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_EMPHASIS_MARK );
    4346                 :            :     else
    4347                 :            :     {
    4348                 :            :         LanguageType nLang;
    4349                 :            :         //Check to see if there is an up and coming cjk language property. If
    4350                 :            :         //there is use it, if there is not fall back to the currently set one.
    4351                 :            :         //Only the cjk language setting seems to matter to word, the western
    4352                 :            :         //one is ignored
    4353                 :            :         const sal_uInt8 *pLang =
    4354         [ #  # ]:          0 :             pPlcxMan ? pPlcxMan->GetChpPLCF()->HasSprm(0x486E) : 0;
    4355                 :            : 
    4356         [ #  # ]:          0 :         if (pLang)
    4357                 :          0 :             nLang = SVBT16ToShort( pLang );
    4358                 :            :         else
    4359                 :            :         {
    4360                 :            :             nLang = ((const SvxLanguageItem *)
    4361                 :          0 :                 GetFmtAttr(RES_CHRATR_CJK_LANGUAGE))->GetLanguage();
    4362                 :            :         }
    4363                 :            : 
    4364                 :            :         sal_uInt16 nVal;
    4365   [ #  #  #  #  :          0 :         switch( *pData )
                   #  # ]
    4366                 :            :         {
    4367                 :            :         case 0:
    4368                 :          0 :             nVal = EMPHASISMARK_NONE;
    4369                 :          0 :             break;
    4370                 :            :         case 2:
    4371 [ #  # ][ #  # ]:          0 :             if (MsLangId::isKorean(nLang) || MsLangId::isTraditionalChinese(nLang))
                 [ #  # ]
    4372                 :          0 :                 nVal = EMPHASISMARK_CIRCLE_ABOVE;
    4373         [ #  # ]:          0 :             else if (nLang == LANGUAGE_JAPANESE)
    4374                 :          0 :                 nVal = EMPHASISMARK_SIDE_DOTS;
    4375                 :            :             else
    4376                 :          0 :                 nVal = EMPHASISMARK_DOTS_BELOW;
    4377                 :          0 :             break;
    4378                 :            :         case 3:
    4379                 :          0 :             nVal = EMPHASISMARK_CIRCLE_ABOVE;
    4380                 :          0 :             break;
    4381                 :            :         case 4:
    4382                 :          0 :             nVal = EMPHASISMARK_DOTS_BELOW;
    4383                 :          0 :             break;
    4384                 :            :         case 1:
    4385         [ #  # ]:          0 :             if (MsLangId::isSimplifiedChinese(nLang))
    4386                 :          0 :                 nVal = EMPHASISMARK_DOTS_BELOW;
    4387                 :            :             else
    4388                 :          0 :                 nVal = EMPHASISMARK_DOTS_ABOVE;
    4389                 :          0 :             break;
    4390                 :            :         default:
    4391                 :          0 :             nVal = EMPHASISMARK_DOTS_ABOVE;
    4392                 :          0 :             break;
    4393                 :            :         }
    4394                 :            : 
    4395         [ #  # ]:          0 :         NewAttr( SvxEmphasisMarkItem( nVal, RES_CHRATR_EMPHASIS_MARK ) );
    4396                 :            :     }
    4397                 :          0 : }
    4398                 :            : 
    4399                 :          0 : void SwWW8ImplReader::Read_ScaleWidth( sal_uInt16, const sal_uInt8* pData, short nLen )
    4400                 :            : {
    4401         [ #  # ]:          0 :     if( nLen < 0 )
    4402                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_SCALEW );
    4403                 :            :     else
    4404                 :            :     {
    4405                 :          0 :         sal_uInt16 nVal = SVBT16ToShort( pData );
    4406                 :            :         //The number must be between 1 and 600
    4407 [ #  # ][ #  # ]:          0 :         if (nVal < 1 || nVal > 600)
    4408                 :          0 :             nVal = 100;
    4409         [ #  # ]:          0 :         NewAttr( SvxCharScaleWidthItem( nVal, RES_CHRATR_SCALEW ) );
    4410                 :            :     }
    4411                 :          0 : }
    4412                 :            : 
    4413                 :          0 : void SwWW8ImplReader::Read_Relief( sal_uInt16 nId, const sal_uInt8* pData, short nLen )
    4414                 :            : {
    4415         [ #  # ]:          0 :     if( nLen < 0 )
    4416                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_RELIEF );
    4417                 :            :     else
    4418                 :            :     {
    4419         [ #  # ]:          0 :         if( *pData )
    4420                 :            :         {
    4421                 :            : // not so eays because this is also a toggle attribute!
    4422                 :            : //  2 x emboss on -> no emboss !!!
    4423                 :            : // the actual value must be searched over the stack / template
    4424                 :            : 
    4425                 :            :             const SvxCharReliefItem* pOld = (const SvxCharReliefItem*)
    4426                 :          0 :                                             GetFmtAttr( RES_CHRATR_RELIEF );
    4427                 :            :             FontRelief nNewValue = 0x854 == nId ? RELIEF_ENGRAVED
    4428                 :            :                                         : ( 0x858 == nId ? RELIEF_EMBOSSED
    4429 [ #  # ][ #  # ]:          0 :                                                          : RELIEF_NONE );
    4430         [ #  # ]:          0 :             if( pOld->GetValue() == nNewValue )
    4431                 :            :             {
    4432         [ #  # ]:          0 :                 if( RELIEF_NONE != nNewValue )
    4433                 :          0 :                     nNewValue = RELIEF_NONE;
    4434                 :            :             }
    4435         [ #  # ]:          0 :             NewAttr( SvxCharReliefItem( nNewValue, RES_CHRATR_RELIEF ));
    4436                 :            :         }
    4437                 :            :     }
    4438                 :          0 : }
    4439                 :            : 
    4440                 :          0 : void SwWW8ImplReader::Read_TxtAnim(sal_uInt16 /*nId*/, const sal_uInt8* pData, short nLen)
    4441                 :            : {
    4442         [ #  # ]:          0 :     if (nLen < 0)
    4443                 :          0 :         pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_CHRATR_BLINK);
    4444                 :            :     else
    4445                 :            :     {
    4446         [ #  # ]:          0 :         if (*pData)
    4447                 :            :         {
    4448                 :            :             bool bBlink;
    4449                 :            : 
    4450                 :            :             // The 7 animated text effects available in word all get
    4451                 :            :             // mapped to a blinking text effect in StarOffice
    4452                 :            :             // 0 no animation       1 Las Vegas lights
    4453                 :            :             // 2 background blink   3 sparkle text
    4454                 :            :             // 4 marching ants      5 marchine red ants
    4455                 :            :             // 6 shimmer
    4456 [ #  # ][ #  # ]:          0 :             if (*pData > 0 && *pData < 7 )
    4457                 :          0 :                 bBlink = true;
    4458                 :            :             else
    4459                 :          0 :                 bBlink = false;
    4460                 :            : 
    4461         [ #  # ]:          0 :             NewAttr(SvxBlinkItem(bBlink, RES_CHRATR_BLINK));
    4462                 :            :         }
    4463                 :            :     }
    4464                 :          0 : }
    4465                 :            : 
    4466                 :         21 : SwWW8Shade::SwWW8Shade(bool bVer67, const WW8_SHD& rSHD)
    4467                 :            : {
    4468                 :         21 :     sal_uInt8 b = rSHD.GetFore();
    4469                 :            :     OSL_ENSURE(b < 17, "ww8: colour out of range");
    4470         [ -  + ]:         21 :     if (b >= 17)
    4471                 :          0 :         b = 0;
    4472                 :            : 
    4473                 :         21 :     ColorData nFore(SwWW8ImplReader::GetCol(b));
    4474                 :            : 
    4475                 :         21 :     b = rSHD.GetBack();
    4476                 :            :     OSL_ENSURE(b < 17, "ww8: colour out of range");
    4477         [ -  + ]:         21 :     if( b >=  17 )
    4478                 :          0 :         b = 0;
    4479                 :            : 
    4480                 :         21 :     ColorData nBack(SwWW8ImplReader::GetCol(b));
    4481                 :            : 
    4482                 :         21 :     b = rSHD.GetStyle(bVer67);
    4483                 :            : 
    4484                 :         21 :     SetShade(nFore, nBack, b);
    4485                 :         21 : }
    4486                 :            : 
    4487                 :        117 : void SwWW8Shade::SetShade(ColorData nFore, ColorData nBack, sal_uInt16 nIndex)
    4488                 :            : {
    4489                 :            :     static const sal_uLong eMSGrayScale[] =
    4490                 :            :     {
    4491                 :            :         // Nul-Brush
    4492                 :            :            0,   // 0
    4493                 :            :         // Solid-Brush
    4494                 :            :         1000,   // 1
    4495                 :            :         // promillemaessig abgestufte Schattierungen
    4496                 :            :           50,   // 2
    4497                 :            :          100,   // 3
    4498                 :            :          200,   // 4
    4499                 :            :          250,   // 5
    4500                 :            :          300,   // 6
    4501                 :            :          400,   // 7
    4502                 :            :          500,   // 8
    4503                 :            :          600,   // 9
    4504                 :            :          700,   // 10
    4505                 :            :          750,   // 11
    4506                 :            :          800,   // 12
    4507                 :            :          900,   // 13
    4508                 :            :          333, // 14 Dark Horizontal
    4509                 :            :          333, // 15 Dark Vertical
    4510                 :            :          333, // 16 Dark Forward Diagonal
    4511                 :            :          333, // 17 Dark Backward Diagonal
    4512                 :            :          333, // 18 Dark Cross
    4513                 :            :          333, // 19 Dark Diagonal Cross
    4514                 :            :          333, // 20 Horizontal
    4515                 :            :          333, // 21 Vertical
    4516                 :            :          333, // 22 Forward Diagonal
    4517                 :            :          333, // 23 Backward Diagonal
    4518                 :            :          333, // 24 Cross
    4519                 :            :          333, // 25 Diagonal Cross
    4520                 :            :          // neun Nummern ohne Bedeutung in Ver8
    4521                 :            :          500, // 26
    4522                 :            :          500, // 27
    4523                 :            :          500, // 28
    4524                 :            :          500, // 29
    4525                 :            :          500, // 30
    4526                 :            :          500, // 31
    4527                 :            :          500, // 32
    4528                 :            :          500, // 33
    4529                 :            :          500, // 34
    4530                 :            :          // und weiter gehts mit tollen Schattierungen ;-)
    4531                 :            :           25,   // 35
    4532                 :            :           75,   // 36
    4533                 :            :          125,   // 37
    4534                 :            :          150,   // 38
    4535                 :            :          175,   // 39
    4536                 :            :          225,   // 40
    4537                 :            :          275,   // 41
    4538                 :            :          325,   // 42
    4539                 :            :          350,   // 43
    4540                 :            :          375,   // 44
    4541                 :            :          425,   // 45
    4542                 :            :          450,   // 46
    4543                 :            :          475,   // 47
    4544                 :            :          525,   // 48
    4545                 :            :          550,   // 49
    4546                 :            :          575,   // 50
    4547                 :            :          625,   // 51
    4548                 :            :          650,   // 52
    4549                 :            :          675,   // 53
    4550                 :            :          725,   // 54
    4551                 :            :          775,   // 55
    4552                 :            :          825,   // 56
    4553                 :            :          850,   // 57
    4554                 :            :          875,   // 58
    4555                 :            :          925,   // 59
    4556                 :            :          950,   // 60
    4557                 :            :          975,   // 61
    4558                 :            :          // und zu guter Letzt:
    4559                 :            :          970
    4560                 :            :     };// 62
    4561                 :            : 
    4562                 :            : 
    4563                 :            :     //NO auto for shading so Foreground: Auto = Black
    4564         [ +  + ]:        117 :     if (nFore == COL_AUTO)
    4565                 :          9 :         nFore = COL_BLACK;
    4566                 :            : 
    4567                 :            :     //NO auto for shading so background: Auto = Weiss
    4568                 :        117 :     ColorData nUseBack = nBack;
    4569         [ +  + ]:        117 :     if (nUseBack == COL_AUTO)
    4570                 :         18 :         nUseBack = COL_WHITE;
    4571                 :            : 
    4572                 :            : 
    4573         [ -  + ]:        117 :     if( nIndex >= sizeof( eMSGrayScale ) / sizeof ( eMSGrayScale[ 0 ] ) )
    4574                 :          0 :         nIndex = 0;
    4575                 :            : 
    4576                 :        117 :     sal_uLong nWW8BrushStyle = eMSGrayScale[nIndex];
    4577                 :            : 
    4578         [ +  - ]:        117 :     switch (nWW8BrushStyle)
    4579                 :            :     {
    4580                 :            :         case 0: // Null-Brush
    4581                 :        117 :             aColor.SetColor( nBack );
    4582                 :        117 :             break;
    4583                 :            :         default:
    4584                 :            :             {
    4585                 :          0 :                 Color aForeColor(nFore);
    4586                 :          0 :                 Color aBackColor(nUseBack);
    4587                 :            : 
    4588                 :          0 :                 sal_uInt32 nRed = aForeColor.GetRed() * nWW8BrushStyle;
    4589                 :          0 :                 sal_uInt32 nGreen = aForeColor.GetGreen() * nWW8BrushStyle;
    4590                 :          0 :                 sal_uInt32 nBlue = aForeColor.GetBlue() * nWW8BrushStyle;
    4591                 :          0 :                 nRed += aBackColor.GetRed()  * (1000L - nWW8BrushStyle);
    4592                 :          0 :                 nGreen += aBackColor.GetGreen()* (1000L - nWW8BrushStyle);
    4593                 :          0 :                 nBlue += aBackColor.GetBlue() * (1000L - nWW8BrushStyle);
    4594                 :            : 
    4595                 :            :                 aColor.SetColor( RGB_COLORDATA( nRed/1000, nGreen/1000,
    4596                 :          0 :                     nBlue/1000 ) );
    4597                 :            :             }
    4598                 :          0 :             break;
    4599                 :            :     }
    4600                 :        117 : }
    4601                 :            : 
    4602                 :        105 : void SwWW8ImplReader::Read_Shade( sal_uInt16, const sal_uInt8* pData, short nLen )
    4603                 :            : {
    4604 [ +  - ][ +  + ]:        105 :     if (!bVer67 && pPlcxMan && pPlcxMan->GetPapPLCF()->HasSprm(0xC64D))
         [ +  - ][ +  + ]
    4605                 :        105 :         return;
    4606                 :            : 
    4607         [ -  + ]:         21 :     if (nLen <= 0)
    4608                 :            :     {
    4609                 :            :         // Ende des Attributes
    4610                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_BACKGROUND );
    4611         [ #  # ]:          0 :         if (bShdTxtCol)
    4612                 :            :         {
    4613                 :            :             // Zeichenfarbe auch
    4614                 :          0 :             pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_COLOR );
    4615                 :          0 :             bShdTxtCol = false;
    4616                 :            :         }
    4617                 :            :     }
    4618                 :            :     else
    4619                 :            :     {
    4620                 :         21 :         WW8_SHD aSHD;
    4621                 :         21 :         aSHD.SetWWValue( *(SVBT16*)pData );
    4622         [ +  - ]:         21 :         SwWW8Shade aSh( bVer67, aSHD );
    4623                 :            : 
    4624 [ +  - ][ +  - ]:         21 :         NewAttr(SvxBrushItem(aSh.aColor, RES_BACKGROUND));
                 [ +  - ]
    4625                 :            :     }
    4626                 :            : }
    4627                 :            : 
    4628                 :        105 : void SwWW8ImplReader::Read_ParaBackColor(sal_uInt16, const sal_uInt8* pData, short nLen)
    4629                 :            : {
    4630         [ +  + ]:        105 :     if (nLen <= 0)
    4631                 :            :     {
    4632                 :            :         // Ende des Attributes
    4633                 :         42 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_BACKGROUND );
    4634         [ -  + ]:         42 :         if (bShdTxtCol)
    4635                 :            :         {
    4636                 :            :             // Zeichenfarbe auch
    4637                 :          0 :             pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_COLOR );
    4638                 :          0 :             bShdTxtCol = false;
    4639                 :            :         }
    4640                 :            :     }
    4641                 :            :     else
    4642                 :            :     {
    4643                 :            :         OSL_ENSURE(nLen == 10, "Len of para back colour not 10!");
    4644         [ -  + ]:         63 :         if (nLen != 10)
    4645                 :        105 :             return;
    4646 [ +  - ][ +  - ]:         63 :         NewAttr(SvxBrushItem(Color(ExtractColour(pData, bVer67)), RES_BACKGROUND));
                 [ +  - ]
    4647                 :            :     }
    4648                 :            : }
    4649                 :            : 
    4650                 :         96 : sal_uInt32 SwWW8ImplReader::ExtractColour(const sal_uInt8* &rpData, bool bVer67)
    4651                 :            : {
    4652                 :            :     (void) bVer67; // unused in non-debug
    4653                 :            :     OSL_ENSURE(bVer67 == false, "Impossible");
    4654         [ +  - ]:         96 :     sal_uInt32 nFore = msfilter::util::BGRToRGB(SVBT32ToUInt32(rpData));
    4655                 :         96 :     rpData+=4;
    4656         [ +  - ]:         96 :     sal_uInt32 nBack = msfilter::util::BGRToRGB(SVBT32ToUInt32(rpData));
    4657                 :         96 :     rpData+=4;
    4658                 :         96 :     sal_uInt16 nIndex = SVBT16ToShort(rpData);
    4659                 :         96 :     rpData+=2;
    4660                 :            :     //Being a transparent background colour doesn't actually show the page
    4661                 :            :     //background through, it merely acts like white
    4662         [ +  + ]:         96 :     if (nBack == 0xFF000000)
    4663                 :         15 :         nBack = COL_AUTO;
    4664                 :            :     OSL_ENSURE(nBack == COL_AUTO || !(nBack & 0xFF000000),
    4665                 :            :         "ww8: don't know what to do with such a transparent bg colour, report");
    4666         [ +  - ]:         96 :     SwWW8Shade aShade(nFore, nBack, nIndex);
    4667                 :         96 :     return aShade.aColor.GetColor();
    4668                 :            : }
    4669                 :            : 
    4670                 :        486 : void SwWW8ImplReader::Read_Border(sal_uInt16 , const sal_uInt8* , short nLen)
    4671                 :            : {
    4672         [ +  + ]:        486 :     if( nLen < 0 )
    4673                 :            :     {
    4674         [ +  + ]:        162 :         if( bHasBorder )
    4675                 :            :         {
    4676                 :         54 :             pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_BOX );
    4677                 :         54 :             pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_SHADOW );
    4678                 :         54 :             bHasBorder = false;
    4679                 :            :         }
    4680                 :            :     }
    4681         [ +  + ]:        324 :     else if( !bHasBorder )
    4682                 :            :     {
    4683                 :            :         // die Borders auf allen 4 Seiten werden gebuendelt.  dieses
    4684                 :            :         // vereinfacht die Verwaltung, d.h. die Box muss nicht 4 mal auf den
    4685                 :            :         // CtrlStack und wieder runter
    4686                 :         99 :         bHasBorder = true;
    4687                 :            : 
    4688         [ +  + ]:        594 :         WW8_BRC5 aBrcs;   // Top, Left, Bottom, Right, Between
    4689                 :            :         sal_uInt8 nBorder;
    4690                 :            : 
    4691         [ +  + ]:         99 :         if( pAktColl )
    4692         [ +  - ]:         45 :             nBorder = ::lcl_ReadBorders(bVer67, aBrcs, 0, pStyles);
    4693                 :            :         else
    4694 [ +  - ][ +  - ]:         54 :             nBorder = ::lcl_ReadBorders(bVer67, aBrcs, pPlcxMan ? pPlcxMan->GetPapPLCF() : NULL);
    4695                 :            : 
    4696         [ +  - ]:         99 :         if( nBorder )                                   // Border
    4697                 :            :         {
    4698                 :         99 :             bool bIsB = IsBorder(aBrcs, true);
    4699 [ -  + ][ #  # ]:         99 :             if (!InLocalApo() || !bIsB ||
         [ #  # ][ #  # ]
         [ +  - ][ +  - ]
    4700                 :          0 :                 (pWFlyPara && !pWFlyPara->bBorderLines ))
    4701                 :            :             {
    4702                 :            :                 // in Apo keine Umrandungen *ein*-schalten, da ich
    4703                 :            :                 // sonst die Flyumrandungen doppelt bekomme
    4704                 :            :                 // aber nur wenn am Fly ein gesetzt ist, keine
    4705                 :            :                 // uebernehmen. Sonst wird gar keine gesetzt!
    4706                 :            : 
    4707                 :            :                 // auch wenn kein Rand gesetzt ist, muss das Attribut gesetzt
    4708                 :            :                 // werden, sonst ist kein hartes Ausschalten von Style-Attrs
    4709                 :            :                 // moeglich
    4710                 :            :                 const SvxBoxItem* pBox
    4711         [ +  - ]:         99 :                     = (const SvxBoxItem*)GetFmtAttr( RES_BOX );
    4712         [ +  - ]:         99 :                 SvxBoxItem aBox(RES_BOX);
    4713         [ +  - ]:         99 :                 if (pBox)
    4714         [ +  - ]:         99 :                     aBox = *pBox;
    4715                 :         99 :                 short aSizeArray[5]={0};
    4716                 :            : 
    4717         [ +  - ]:         99 :                 SetBorder(aBox, aBrcs, &aSizeArray[0], nBorder);
    4718                 :            : 
    4719         [ +  - ]:         99 :                 Rectangle aInnerDist;
    4720         [ +  - ]:         99 :                 GetBorderDistance( aBrcs, aInnerDist );
    4721                 :            : 
    4722         [ +  + ]:         99 :                 if ((nBorder & WW8_LEFT)==WW8_LEFT)
    4723         [ +  - ]:         75 :                     aBox.SetDistance( (sal_uInt16)aInnerDist.Left(), BOX_LINE_LEFT );
    4724                 :            : 
    4725                 :            :                 if ((nBorder & WW8_TOP)==WW8_TOP)
    4726         [ +  - ]:         99 :                     aBox.SetDistance( (sal_uInt16)aInnerDist.Top(), BOX_LINE_TOP );
    4727                 :            : 
    4728         [ +  + ]:         99 :                 if ((nBorder & WW8_RIGHT)==WW8_RIGHT)
    4729         [ +  - ]:         75 :                     aBox.SetDistance( (sal_uInt16)aInnerDist.Right(), BOX_LINE_RIGHT );
    4730                 :            : 
    4731         [ +  + ]:         99 :                 if ((nBorder & WW8_BOT)==WW8_BOT)
    4732         [ +  - ]:         75 :                     aBox.SetDistance( (sal_uInt16)aInnerDist.Bottom(), BOX_LINE_BOTTOM );
    4733                 :            : 
    4734         [ +  - ]:         99 :                 NewAttr( aBox );
    4735                 :            : 
    4736         [ +  - ]:         99 :                 SvxShadowItem aS(RES_SHADOW);
    4737         [ -  + ]:         99 :                 if( SetShadow( aS, &aSizeArray[0], aBrcs ) )
    4738 [ #  # ][ +  - ]:         99 :                     NewAttr( aS );
                 [ +  - ]
    4739                 :            :             }
    4740                 :            :         }
    4741                 :            :     }
    4742                 :        486 : }
    4743                 :            : 
    4744                 :         30 : void SwWW8ImplReader::Read_Hyphenation( sal_uInt16, const sal_uInt8* pData, short nLen )
    4745                 :            : {
    4746                 :            :     // set Hyphenation flag
    4747         [ -  + ]:         30 :     if( nLen <= 0 )
    4748                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_HYPHENZONE );
    4749                 :            :     else
    4750                 :            :     {
    4751                 :            :         SvxHyphenZoneItem aAttr(
    4752 [ +  - ][ +  - ]:         30 :             *(const SvxHyphenZoneItem*)GetFmtAttr( RES_PARATR_HYPHENZONE ) );
    4753                 :            : 
    4754                 :         30 :         aAttr.SetHyphen( 0 == *pData ); // sic !
    4755                 :            : 
    4756         [ +  + ]:         30 :         if( !*pData )
    4757                 :            :         {
    4758                 :          3 :             aAttr.GetMinLead()    = 2;
    4759                 :          3 :             aAttr.GetMinTrail()   = 2;
    4760                 :          3 :             aAttr.GetMaxHyphens() = 0;
    4761                 :            :         }
    4762                 :            : 
    4763 [ +  - ][ +  - ]:         30 :         NewAttr( aAttr );
    4764                 :            :     }
    4765                 :         30 : }
    4766                 :            : 
    4767                 :         36 : void SwWW8ImplReader::Read_WidowControl( sal_uInt16, const sal_uInt8* pData, short nLen )
    4768                 :            : {
    4769         [ -  + ]:         36 :     if( nLen <= 0 )
    4770                 :            :     {
    4771                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_WIDOWS );
    4772                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_ORPHANS );
    4773                 :            :     }
    4774                 :            :     else
    4775                 :            :     {
    4776         [ +  + ]:         36 :         sal_uInt8 nL = ( *pData & 1 ) ? 2 : 0;
    4777                 :            : 
    4778         [ +  - ]:         36 :         NewAttr( SvxWidowsItem( nL, RES_PARATR_WIDOWS ) );     // Aus -> nLines = 0
    4779         [ +  - ]:         36 :         NewAttr( SvxOrphansItem( nL, RES_PARATR_ORPHANS ) );
    4780                 :            : 
    4781 [ +  - ][ +  - ]:         36 :         if( pAktColl && pStyles )           // Style-Def ?
    4782                 :         36 :             pStyles->bWidowsChanged = true; // merken zur Simulation
    4783                 :            :                                             // Default-Widows
    4784                 :            :     }
    4785                 :         36 : }
    4786                 :            : 
    4787                 :          0 : void SwWW8ImplReader::Read_UsePgsuSettings(sal_uInt16,const sal_uInt8* pData,short nLen)
    4788                 :            : {
    4789         [ #  # ]:          0 :     if( nLen <= 0 )
    4790                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_SNAPTOGRID);
    4791                 :            :     else
    4792                 :            :     {
    4793         [ #  # ]:          0 :         if(nInTable)
    4794         [ #  # ]:          0 :             NewAttr( SvxParaGridItem(false, RES_PARATR_SNAPTOGRID) );
    4795                 :            :         else
    4796         [ #  # ]:          0 :             NewAttr( SvxParaGridItem(*pData, RES_PARATR_SNAPTOGRID) );
    4797                 :            :     }
    4798                 :          0 : }
    4799                 :            : 
    4800                 :         99 : void SwWW8ImplReader::Read_AlignFont( sal_uInt16, const sal_uInt8* pData, short nLen )
    4801                 :            : {
    4802         [ -  + ]:         99 :     if( nLen <= 0 )
    4803                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_VERTALIGN);
    4804                 :            :     else
    4805                 :            :     {
    4806                 :         99 :         sal_uInt16 nVal = SVBT16ToShort( pData );
    4807   [ -  +  +  -  :         99 :         switch (nVal)
                   +  - ]
    4808                 :            :         {
    4809                 :            :             case 0:
    4810                 :          0 :                 nVal = SvxParaVertAlignItem::TOP;
    4811                 :          0 :                 break;
    4812                 :            :             case 1:
    4813                 :         24 :                 nVal = SvxParaVertAlignItem::CENTER;
    4814                 :         24 :                 break;
    4815                 :            :             case 2:
    4816                 :          6 :                 nVal = SvxParaVertAlignItem::BASELINE;
    4817                 :          6 :                 break;
    4818                 :            :             case 3:
    4819                 :          0 :                 nVal = SvxParaVertAlignItem::BOTTOM;
    4820                 :          0 :                 break;
    4821                 :            :             case 4:
    4822                 :         69 :                 nVal = SvxParaVertAlignItem::AUTOMATIC;
    4823                 :         69 :                 break;
    4824                 :            :             default:
    4825                 :          0 :                 nVal = SvxParaVertAlignItem::AUTOMATIC;
    4826                 :            :                 OSL_ENSURE(!this,"Unknown paragraph vertical align");
    4827                 :          0 :                 break;
    4828                 :            :         }
    4829         [ +  - ]:         99 :         NewAttr( SvxParaVertAlignItem( nVal, RES_PARATR_VERTALIGN ) );
    4830                 :            :     }
    4831                 :         99 : }
    4832                 :            : 
    4833                 :          3 : void SwWW8ImplReader::Read_KeepLines( sal_uInt16, const sal_uInt8* pData, short nLen )
    4834                 :            : {
    4835         [ -  + ]:          3 :     if( nLen <= 0 )
    4836                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_SPLIT );
    4837                 :            :     else
    4838         [ +  - ]:          3 :         NewAttr( SvxFmtSplitItem( ( *pData & 1 ) == 0, RES_PARATR_SPLIT ) );
    4839                 :          3 : }
    4840                 :            : 
    4841                 :        177 : void SwWW8ImplReader::Read_KeepParas( sal_uInt16, const sal_uInt8* pData, short nLen )
    4842                 :            : {
    4843         [ -  + ]:        177 :     if( nLen <= 0 )
    4844                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_KEEP );
    4845                 :            :     else
    4846         [ +  - ]:        177 :         NewAttr( SvxFmtKeepItem( ( *pData & 1 ) != 0 , RES_KEEP) );
    4847                 :        177 : }
    4848                 :            : 
    4849                 :          0 : void SwWW8ImplReader::Read_BreakBefore( sal_uInt16, const sal_uInt8* pData, short nLen )
    4850                 :            : {
    4851         [ #  # ]:          0 :     if( nLen <= 0 )
    4852                 :          0 :         pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_BREAK );
    4853                 :            :     else
    4854                 :            :         NewAttr( SvxFmtBreakItem(
    4855 [ #  # ][ #  # ]:          0 :                 ( *pData & 1 ) ? SVX_BREAK_PAGE_BEFORE : SVX_BREAK_NONE, RES_BREAK ) );
    4856                 :          0 : }
    4857                 :            : 
    4858                 :         24 : void SwWW8ImplReader::Read_ApoPPC( sal_uInt16, const sal_uInt8* pData, short )
    4859                 :            : {
    4860 [ +  + ][ +  - ]:         24 :     if (pAktColl && nAktColl < vColl.size()) // only for Styledef, sonst anders geloest
                 [ +  + ]
    4861                 :            :     {
    4862                 :          6 :         SwWW8StyInf& rSI = vColl[nAktColl];
    4863         [ -  + ]:          6 :         WW8FlyPara* pFly = rSI.pWWFly ? rSI.pWWFly : new WW8FlyPara(bVer67);
    4864                 :          6 :         vColl[nAktColl].pWWFly = pFly;
    4865                 :          6 :         pFly->Read(*pData, pStyles);
    4866         [ -  + ]:          6 :         if (pFly->IsEmpty())
    4867                 :          0 :             delete vColl[nAktColl].pWWFly, vColl[nAktColl].pWWFly = 0;
    4868                 :            :     }
    4869                 :         24 : }
    4870                 :            : 
    4871                 :        687 : bool SwWW8ImplReader::ParseTabPos(WW8_TablePos *pTabPos, WW8PLCFx_Cp_FKP* pPap)
    4872                 :            : {
    4873                 :        687 :     bool bRet = false;
    4874                 :        687 :     const sal_uInt8 *pRes=0;
    4875                 :        687 :     memset(pTabPos, 0, sizeof(WW8_TablePos));
    4876         [ -  + ]:        687 :     if (0 != (pRes = pPap->HasSprm(0x360D)))
    4877                 :            :     {
    4878                 :          0 :         pTabPos->nSp29 = *pRes;
    4879                 :          0 :         pTabPos->nSp37 = 2;     //Possible fail area, always parallel wrap
    4880         [ #  # ]:          0 :         if (0 != (pRes = pPap->HasSprm(0x940E)))
    4881                 :          0 :             pTabPos->nSp26 = SVBT16ToShort(pRes);
    4882         [ #  # ]:          0 :         if (0 != (pRes = pPap->HasSprm(0x940F)))
    4883                 :          0 :             pTabPos->nSp27 = SVBT16ToShort(pRes);
    4884         [ #  # ]:          0 :         if (0 != (pRes = pPap->HasSprm(0x9410)))
    4885                 :          0 :             pTabPos->nLeMgn = SVBT16ToShort(pRes);
    4886         [ #  # ]:          0 :         if (0 != (pRes = pPap->HasSprm(0x941E)))
    4887                 :          0 :             pTabPos->nRiMgn = SVBT16ToShort(pRes);
    4888         [ #  # ]:          0 :         if (0 != (pRes = pPap->HasSprm(0x9411)))
    4889                 :          0 :             pTabPos->nUpMgn = SVBT16ToShort(pRes);
    4890         [ #  # ]:          0 :         if (0 != (pRes = pPap->HasSprm(0x941F)))
    4891                 :          0 :             pTabPos->nLoMgn = SVBT16ToShort(pRes);
    4892                 :          0 :         bRet = true;
    4893                 :            :     }
    4894                 :        687 :     return bRet;
    4895                 :            : }
    4896                 :            : 
    4897                 :            : /***************************************************************************
    4898                 :            : #  Seiten - Attribute werden nicht mehr als Attribute gehandhabt
    4899                 :            : #   ( ausser OLST )
    4900                 :            : #**************************************************************************/
    4901                 :            : 
    4902                 :            : 
    4903                 :         57 : long SwWW8ImplReader::ImportExtSprm(WW8PLCFManResult* pRes)
    4904                 :            : {
    4905                 :            :     /*************************************************************************
    4906                 :            :     #       Arrays zum Lesen der erweiterten ( selbstdefinierten ) SPRMs
    4907                 :            :     #*************************************************************************/
    4908                 :            :     typedef long (SwWW8ImplReader:: *FNReadRecordExt)(WW8PLCFManResult*);
    4909                 :            : 
    4910                 :            :     static const FNReadRecordExt aWwSprmTab[] =
    4911                 :            :     {
    4912                 :            :         /* 0 (256) */   &SwWW8ImplReader::Read_Ftn,     // FootNote
    4913                 :            :         /* 1 (257) */   &SwWW8ImplReader::Read_Ftn,     // EndNote
    4914                 :            :         /* 2 (258) */   &SwWW8ImplReader::Read_Field,  // Feld
    4915                 :            :         /* 3 (259) */   &SwWW8ImplReader::Read_Book,   // Bookmark
    4916                 :            :         /* 4 (260) */   &SwWW8ImplReader::Read_And     // Annotation
    4917                 :            :     };
    4918                 :            : 
    4919         [ +  - ]:         57 :     if( pRes->nSprmId < 280 )
    4920                 :            :     {
    4921                 :         57 :         sal_uInt8 nIdx = static_cast< sal_uInt8 >(pRes->nSprmId - eFTN);
    4922 [ +  - ][ +  - ]:         57 :         if( nIdx < SAL_N_ELEMENTS(aWwSprmTab)
    4923                 :         57 :             && aWwSprmTab[nIdx] )
    4924         [ +  - ]:         57 :             return (this->*aWwSprmTab[nIdx])(pRes);
    4925                 :            :         else
    4926                 :          0 :             return 0;
    4927                 :            :     }
    4928                 :            :     else
    4929                 :         57 :         return 0;
    4930                 :            : }
    4931                 :            : 
    4932                 :         45 : void SwWW8ImplReader::EndExtSprm(sal_uInt16 nSprmId)
    4933                 :            : {
    4934                 :            :     typedef sal_uInt16 (SwWW8ImplReader:: *FNReadRecordExt)();
    4935                 :            : 
    4936                 :            :     static const FNReadRecordExt aWwSprmTab[] =
    4937                 :            :     {
    4938                 :            :         /* 0 (256) */   &SwWW8ImplReader::End_Ftn,      // FootNote
    4939                 :            :         /* 1 (257) */   &SwWW8ImplReader::End_Ftn,      // EndNote
    4940                 :            :         /* 2 (258) */   &SwWW8ImplReader::End_Field,  // Feld
    4941                 :            :         /* 3 (259) */   0,   // Bookmark
    4942                 :            :         /* 4 (260) */   0     // Annotation
    4943                 :            :     };
    4944                 :            : 
    4945                 :         45 :     sal_uInt8 nIdx = static_cast< sal_uInt8 >(nSprmId - eFTN);
    4946 [ +  - ][ +  - ]:         45 :     if( nIdx < SAL_N_ELEMENTS(aWwSprmTab)
    4947                 :         45 :         && aWwSprmTab[nIdx] )
    4948         [ +  - ]:         45 :         (this->*aWwSprmTab[nIdx])();
    4949                 :         45 : }
    4950                 :            : 
    4951                 :            : /***************************************************************************
    4952                 :            : #       Arrays zum Lesen der SPRMs
    4953                 :            : #**************************************************************************/
    4954                 :            : 
    4955                 :            : // Funktion zum Einlesen von Sprms. Par1: SprmId
    4956                 :            : typedef void (SwWW8ImplReader:: *FNReadRecord)( sal_uInt16, const sal_uInt8*, short );
    4957                 :            : 
    4958                 :            : struct SprmReadInfo
    4959                 :            : {
    4960                 :            :     sal_uInt16       nId;
    4961                 :            :     FNReadRecord pReadFnc;
    4962                 :            : };
    4963                 :            : 
    4964                 :          0 : bool operator==(const SprmReadInfo &rFirst, const SprmReadInfo &rSecond)
    4965                 :            : {
    4966                 :          0 :     return (rFirst.nId == rSecond.nId);
    4967                 :            : }
    4968                 :            : 
    4969                 :     706698 : bool operator<(const SprmReadInfo &rFirst, const SprmReadInfo &rSecond)
    4970                 :            : {
    4971                 :     706698 :     return (rFirst.nId < rSecond.nId);
    4972                 :            : }
    4973                 :            : 
    4974                 :            : typedef ww::SortedArray<SprmReadInfo> wwSprmDispatcher;
    4975                 :            : 
    4976                 :          0 : const wwSprmDispatcher *GetWW2SprmDispatcher()
    4977                 :            : {
    4978                 :            :     static SprmReadInfo aSprms[] =
    4979                 :            :     {
    4980                 :            :           {0, 0},                                    // "0" Default bzw. Error
    4981                 :            :                                                      //wird uebersprungen! ,
    4982                 :            :           {2, &SwWW8ImplReader::Read_StyleCode},     //"sprmPIstd",  pap.istd
    4983                 :            :                                                      //(style code)
    4984                 :            :           {3, 0},                                    //"sprmPIstdPermute", pap.istd
    4985                 :            :                                                      //permutation
    4986                 :            :           {4, 0},                                    //"sprmPIncLv1",
    4987                 :            :                                                      //pap.istddifference
    4988                 :            :           {5, &SwWW8ImplReader::Read_Justify},       //"sprmPJc", pap.jc
    4989                 :            :                                                      //(justification)
    4990                 :            :           {6, 0},                                    //"sprmPFSideBySide",
    4991                 :            :                                                      //pap.fSideBySide
    4992                 :            :           {7, &SwWW8ImplReader::Read_KeepLines},     //"sprmPFKeep", pap.fKeep
    4993                 :            :           {8, &SwWW8ImplReader::Read_KeepParas},     //"sprmPFKeepFollow ",
    4994                 :            :                                                      //pap.fKeepFollow
    4995                 :            :           {9, &SwWW8ImplReader::Read_BreakBefore},   //"sprmPPageBreakBefore",
    4996                 :            :                                                      //pap.fPageBreakBefore
    4997                 :            :          {10, 0},                                    //"sprmPBrcl", pap.brcl
    4998                 :            :          {11, 0},                                    //"sprmPBrcp ", pap.brcp
    4999                 :            :          {12, &SwWW8ImplReader::Read_ANLevelDesc},   //"sprmPAnld", pap.anld (ANLD
    5000                 :            :                                                      //structure)
    5001                 :            :          {13, &SwWW8ImplReader::Read_ANLevelNo},     //"sprmPNLvlAnm", pap.nLvlAnm
    5002                 :            :                                                      //nn
    5003                 :            :          {14, &SwWW8ImplReader::Read_NoLineNumb},    //"sprmPFNoLineNumb", ap.fNoLnn
    5004                 :            :          {15, &SwWW8ImplReader::Read_Tab},           //"?sprmPChgTabsPapx",
    5005                 :            :                                                      //pap.itbdMac, ...
    5006                 :            :          {16, &SwWW8ImplReader::Read_LR},            //"sprmPDxaRight", pap.dxaRight
    5007                 :            :          {17, &SwWW8ImplReader::Read_LR},            //"sprmPDxaLeft", pap.dxaLeft
    5008                 :            :          {18, 0},                                    //"sprmPNest", pap.dxaLeft
    5009                 :            :          {19, &SwWW8ImplReader::Read_LR},            //"sprmPDxaLeft1", pap.dxaLeft1
    5010                 :            :          {20, &SwWW8ImplReader::Read_LineSpace},     //"sprmPDyaLine", pap.lspd
    5011                 :            :                                                      //an LSPD
    5012                 :            :          {21, &SwWW8ImplReader::Read_UL},            //"sprmPDyaBefore",
    5013                 :            :                                                      //pap.dyaBefore
    5014                 :            :          {22, &SwWW8ImplReader::Read_UL},            //"sprmPDyaAfter", pap.dyaAfter
    5015                 :            :          {23, 0},                                    //"?sprmPChgTabs", pap.itbdMac,
    5016                 :            :                                                      //pap.rgdxaTab, ...
    5017                 :            :          {24, 0},                                    //"sprmPFInTable", pap.fInTable
    5018                 :            :          {25, &SwWW8ImplReader::Read_TabRowEnd},     //"sprmPTtp", pap.fTtp
    5019                 :            :          {26, 0},                                    //"sprmPDxaAbs", pap.dxaAbs
    5020                 :            :          {27, 0},                                    //"sprmPDyaAbs", pap.dyaAbs
    5021                 :            :          {28, 0},                                    //"sprmPDxaWidth", pap.dxaWidth
    5022                 :            :          {29, &SwWW8ImplReader::Read_ApoPPC},        //"sprmPPc", pap.pcHorz,
    5023                 :            :                                                      //pap.pcVert
    5024                 :            :          {30, 0},                                    //"sprmPBrcTop10", pap.brcTop
    5025                 :            :                                                      //BRC10
    5026                 :            :          {31, 0},                                    //"sprmPBrcLeft10",
    5027                 :            :                                                      //pap.brcLeft BRC10
    5028                 :            :          {32, 0},                                    //"sprmPBrcBottom10",
    5029                 :            :                                                      //pap.brcBottom BRC10
    5030                 :            :          {33, 0},                                    //"sprmPBrcRight10",
    5031                 :            :                                                      //pap.brcRight BRC10
    5032                 :            :          {34, 0},                                    //"sprmPBrcBetween10",
    5033                 :            :                                                      //pap.brcBetween BRC10
    5034                 :            :          {35, 0},                                    //"sprmPBrcBar10", pap.brcBar
    5035                 :            :                                                      //BRC10
    5036                 :            :          {36, 0},                                    //"sprmPFromText10",
    5037                 :            :                                                      //pap.dxaFromText dxa
    5038                 :            :          {37, 0},                                    //"sprmPWr", pap.wr wr
    5039                 :            :          {38, &SwWW8ImplReader::Read_Border},        //"sprmPBrcTop", pap.brcTop BRC
    5040                 :            :          {39, &SwWW8ImplReader::Read_Border},        //"sprmPBrcLeft",
    5041                 :            :                                                      //pap.brcLeft BRC
    5042                 :            :          {40, &SwWW8ImplReader::Read_Border},        //"sprmPBrcBottom",
    5043                 :            :                                                      //pap.brcBottom BRC
    5044                 :            :          {41, &SwWW8ImplReader::Read_Border},        //"sprmPBrcRight",
    5045                 :            :                                                      //pap.brcRight BRC
    5046                 :            :          {42, &SwWW8ImplReader::Read_Border},        //"sprmPBrcBetween",
    5047                 :            :                                                      //pap.brcBetween BRC
    5048                 :            :          {43, 0},                                    //"sprmPBrcBar", pap.brcBar
    5049                 :            :                                                      //BRC word
    5050                 :            :          {44, &SwWW8ImplReader::Read_Hyphenation},   //"sprmPFNoAutoHyph",
    5051                 :            :                                                      //pap.fNoAutoHyph
    5052                 :            :          {45, 0},                                    //"sprmPWHeightAbs",
    5053                 :            :                                                      //pap.wHeightAbs w
    5054                 :            :          {46, 0},                                    //"sprmPDcs", pap.dcs DCS
    5055                 :            :          {47, &SwWW8ImplReader::Read_Shade},         //"sprmPShd", pap.shd SHD
    5056                 :            :          {48, 0},                                    //"sprmPDyaFromText",
    5057                 :            :                                                      //pap.dyaFromText dya
    5058                 :            :          {49, 0},                                    //"sprmPDxaFromText",
    5059                 :            :                                                      //pap.dxaFromText dxa
    5060                 :            :          {50, 0},                                    //"sprmPFLocked", pap.fLocked
    5061                 :            :                                                      //0 or 1 byte
    5062                 :            :          {51, &SwWW8ImplReader::Read_WidowControl},  //"sprmPFWidowControl",
    5063                 :            :                                                      //pap.fWidowControl 0 or 1 byte
    5064                 :            :          {52, 0},                                    //"?sprmPRuler 52",
    5065                 :            :          {53, 0},                                    //"??53",
    5066                 :            :          {54, 0},                                    //"??54",
    5067                 :            :          {55, 0},                                    //"??55",
    5068                 :            :          {56, 0},                                    //"??56",
    5069                 :            :          {57, 0},                                    //"??57",
    5070                 :            :          {58, 0},                                    //"??58",
    5071                 :            :          {59, 0},                                    //"??59",
    5072                 :            : 
    5073                 :            :          {60, &SwWW8ImplReader::Read_BoldUsw},       //"sprmCFBold", chp.fBold 0,1,
    5074                 :            :                                                      //128, or 129 byte
    5075                 :            :          {61, &SwWW8ImplReader::Read_BoldUsw},       //"sprmCFItalic", chp.fItalic
    5076                 :            :                                                      //0,1, 128, or 129 byte
    5077                 :            :          {62, &SwWW8ImplReader::Read_BoldUsw},       //"sprmCFStrike", chp.fStrike
    5078                 :            :                                                      //0,1, 128, or 129 byte
    5079                 :            :          {63, &SwWW8ImplReader::Read_BoldUsw},       //"sprmCFOutline", chp.fOutline
    5080                 :            :                                                      //0,1, 128, or 129 byte
    5081                 :            :          {64, &SwWW8ImplReader::Read_BoldUsw},       //"sprmCFShadow", chp.fShadow
    5082                 :            :                                                      //0,1, 128, or 129 byte
    5083                 :            :          {65, &SwWW8ImplReader::Read_BoldUsw},       //"sprmCFSmallCaps",
    5084                 :            :                                                      //chp.fSmallCaps 0,1, 128, or
    5085                 :            :                                                      //129 byte
    5086                 :            :          {66, &SwWW8ImplReader::Read_BoldUsw},       //"sprmCFCaps", chp.fCaps 0,1,
    5087                 :            :                                                      //128, or 129 byte
    5088                 :            :          {67, &SwWW8ImplReader::Read_BoldUsw},       //"sprmCFVanish", chp.fVanish
    5089                 :            :                                                      //0,1, 128, or 129 byte
    5090                 :            :          {68, &SwWW8ImplReader::Read_FontCode},      //"sprmCFtc", chp.ftc ftc word
    5091                 :            :          {69, &SwWW8ImplReader::Read_Underline},     // "sprmCKul", chp.kul kul byte
    5092                 :            :          {70, 0},                                    //"sprmCSizePos", chp.hps,
    5093                 :            :                                                      //chp.hpsPos 3 bytes
    5094                 :            :          {71, &SwWW8ImplReader::Read_Kern},          //"sprmCDxaSpace",
    5095                 :            :                                                      //chp.dxaSpace dxa word
    5096                 :            :          {72, &SwWW8ImplReader::Read_Language},      //"sprmCLid", chp.lid LID word
    5097                 :            :          {73, &SwWW8ImplReader::Read_TxtColor},      //"sprmCIco", chp.ico ico byte
    5098                 :            :          {74, &SwWW8ImplReader::Read_FontSize},      //"sprmCHps", chp.hps hps word!
    5099                 :            :          {75, 0},                                    //"sprmCHpsInc", chp.hps byte
    5100                 :            :          {76, &SwWW8ImplReader::Read_SubSuperProp},  //"sprmCHpsPos", chp.hpsPos
    5101                 :            :                                                      //hps byte
    5102                 :            :          {77, 0},                                    //"sprmCHpsPosAdj", chp.hpsPos
    5103                 :            :                                                      //hps byte
    5104                 :            :          {78, &SwWW8ImplReader::Read_Majority},      //"?sprmCMajority", chp.fBold,
    5105                 :            :                                                      //chp.fItalic, chp.fSmallCaps
    5106                 :            :          {80, &SwWW8ImplReader::Read_BoldBiDiUsw},   //sprmCFBoldBi
    5107                 :            :          {81, &SwWW8ImplReader::Read_BoldBiDiUsw},   //sprmCFItalicBi
    5108                 :            :          {82, &SwWW8ImplReader::Read_FontCode},      //sprmCFtcBi
    5109                 :            :          {83, &SwWW8ImplReader::Read_Language},      //sprmClidBi
    5110                 :            :          {84, &SwWW8ImplReader::Read_TxtColor},      //sprmCIcoBi
    5111                 :            :          {85, &SwWW8ImplReader::Read_FontSize},      //sprmCHpsBi
    5112                 :            :          {86, 0},                                    //sprmCFBiDi
    5113                 :            :          {87, 0},                                    //sprmCFDiacColor
    5114                 :            :          {94, 0},                                    //"sprmPicBrcl", pic.brcl brcl
    5115                 :            :                                                      //(see PIC structure
    5116                 :            :                                                      //definition) byte
    5117                 :            :          {95, 0},                                    //"sprmPicScale", pic.mx,
    5118                 :            :                                                      //pic.my, pic.dxaCropleft,
    5119                 :            :          {96, 0},                                    //"sprmPicBrcTop", pic.brcTop
    5120                 :            :                                                      //BRC word
    5121                 :            :          {97, 0},                                    //"sprmPicBrcLeft",
    5122                 :            :                                                      //pic.brcLeft BRC word
    5123                 :            :          {98, 0},                                    //"sprmPicBrcBottom",
    5124                 :            :                                                      //pic.brcBottom BRC word
    5125                 :            :          {99, 0}                                     //"sprmPicBrcRight",
    5126                 :            :     };
    5127                 :            : 
    5128 [ #  # ][ #  # ]:          0 :     static wwSprmDispatcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
         [ #  # ][ #  # ]
    5129                 :          0 :     return &aSprmSrch;
    5130                 :            : }
    5131                 :            : 
    5132                 :          0 : const wwSprmDispatcher *GetWW6SprmDispatcher()
    5133                 :            : {
    5134                 :            :     static SprmReadInfo aSprms[] =
    5135                 :            :     {
    5136                 :            :           {0, 0},                                    // "0" Default bzw. Error
    5137                 :            :                                                      //wird uebersprungen! ,
    5138                 :            :           {2, &SwWW8ImplReader::Read_StyleCode},     //"sprmPIstd",  pap.istd
    5139                 :            :                                                      //(style code)
    5140                 :            :           {3, 0},                                    //"sprmPIstdPermute", pap.istd
    5141                 :            :                                                      //permutation
    5142                 :            :           {4, 0},                                    //"sprmPIncLv1",
    5143                 :            :                                                      //pap.istddifference
    5144                 :            :           {5, &SwWW8ImplReader::Read_Justify},       //"sprmPJc", pap.jc
    5145                 :            :                                                      //(justification)
    5146                 :            :           {6, 0},                                    //"sprmPFSideBySide",
    5147                 :            :                                                      //pap.fSideBySide
    5148                 :            :           {7, &SwWW8ImplReader::Read_KeepLines},     //"sprmPFKeep", pap.fKeep
    5149                 :            :           {8, &SwWW8ImplReader::Read_KeepParas},     //"sprmPFKeepFollow ",
    5150                 :            :                                                      //pap.fKeepFollow
    5151                 :            :           {9, &SwWW8ImplReader::Read_BreakBefore},   //"sprmPPageBreakBefore",
    5152                 :            :                                                      //pap.fPageBreakBefore
    5153                 :            :          {10, 0},                                    //"sprmPBrcl", pap.brcl
    5154                 :            :          {11, 0},                                    //"sprmPBrcp ", pap.brcp
    5155                 :            :          {12, &SwWW8ImplReader::Read_ANLevelDesc},   //"sprmPAnld", pap.anld (ANLD
    5156                 :            :                                                      //structure)
    5157                 :            :          {13, &SwWW8ImplReader::Read_ANLevelNo},     //"sprmPNLvlAnm", pap.nLvlAnm
    5158                 :            :                                                      //nn
    5159                 :            :          {14, &SwWW8ImplReader::Read_NoLineNumb},    //"sprmPFNoLineNumb", ap.fNoLnn
    5160                 :            :          {15, &SwWW8ImplReader::Read_Tab},           //"?sprmPChgTabsPapx",
    5161                 :            :                                                      //pap.itbdMac, ...
    5162                 :            :          {16, &SwWW8ImplReader::Read_LR},            //"sprmPDxaRight", pap.dxaRight
    5163                 :            :          {17, &SwWW8ImplReader::Read_LR},            //"sprmPDxaLeft", pap.dxaLeft
    5164                 :            :          {18, 0},                                    //"sprmPNest", pap.dxaLeft
    5165                 :            :          {19, &SwWW8ImplReader::Read_LR},            //"sprmPDxaLeft1", pap.dxaLeft1
    5166                 :            :          {20, &SwWW8ImplReader::Read_LineSpace},     //"sprmPDyaLine", pap.lspd
    5167                 :            :                                                      //an LSPD
    5168                 :            :          {21, &SwWW8ImplReader::Read_UL},            //"sprmPDyaBefore",
    5169                 :            :                                                      //pap.dyaBefore
    5170                 :            :          {22, &SwWW8ImplReader::Read_UL},            //"sprmPDyaAfter", pap.dyaAfter
    5171                 :            :          {23, 0},                                    //"?sprmPChgTabs", pap.itbdMac,
    5172                 :            :                                                      //pap.rgdxaTab, ...
    5173                 :            :          {24, 0},                                    //"sprmPFInTable", pap.fInTable
    5174                 :            :          {25, &SwWW8ImplReader::Read_TabRowEnd},     //"sprmPTtp", pap.fTtp
    5175                 :            :          {26, 0},                                    //"sprmPDxaAbs", pap.dxaAbs
    5176                 :            :          {27, 0},                                    //"sprmPDyaAbs", pap.dyaAbs
    5177                 :            :          {28, 0},                                    //"sprmPDxaWidth", pap.dxaWidth
    5178                 :            :          {29, &SwWW8ImplReader::Read_ApoPPC},        //"sprmPPc", pap.pcHorz,
    5179                 :            :                                                      //pap.pcVert
    5180                 :            :          {30, 0},                                    //"sprmPBrcTop10", pap.brcTop
    5181                 :            :                                                      //BRC10
    5182                 :            :          {31, 0},                                    //"sprmPBrcLeft10",
    5183                 :            :                                                      //pap.brcLeft BRC10
    5184                 :            :          {32, 0},                                    //"sprmPBrcBottom10",
    5185                 :            :                                                      //pap.brcBottom BRC10
    5186                 :            :          {33, 0},                                    //"sprmPBrcRight10",
    5187                 :            :                                                      //pap.brcRight BRC10
    5188                 :            :          {34, 0},                                    //"sprmPBrcBetween10",
    5189                 :            :                                                      //pap.brcBetween BRC10
    5190                 :            :          {35, 0},                                    //"sprmPBrcBar10", pap.brcBar
    5191                 :            :                                                      //BRC10
    5192                 :            :          {36, 0},                                    //"sprmPFromText10",
    5193                 :            :                                                      //pap.dxaFromText dxa
    5194                 :            :          {37, 0},                                    //"sprmPWr", pap.wr wr
    5195                 :            :          {38, &SwWW8ImplReader::Read_Border},        //"sprmPBrcTop", pap.brcTop BRC
    5196                 :            :          {39, &SwWW8ImplReader::Read_Border},        //"sprmPBrcLeft",
    5197                 :            :                                                      //pap.brcLeft BRC
    5198                 :            :          {40, &SwWW8ImplReader::Read_Border},        //"sprmPBrcBottom",
    5199                 :            :                                                      //pap.brcBottom BRC
    5200                 :            :          {41, &SwWW8ImplReader::Read_Border},        //"sprmPBrcRight",
    5201                 :            :                                                      //pap.brcRight BRC
    5202                 :            :          {42, &SwWW8ImplReader::Read_Border},        //"sprmPBrcBetween",
    5203                 :            :                                                      //pap.brcBetween BRC
    5204                 :            :          {43, 0},                                    //"sprmPBrcBar", pap.brcBar
    5205                 :            :                                                      //BRC word
    5206                 :            :          {44, &SwWW8ImplReader::Read_Hyphenation},   //"sprmPFNoAutoHyph",
    5207                 :            :                                                      //pap.fNoAutoHyph
    5208                 :            :          {45, 0},                                    //"sprmPWHeightAbs",
    5209                 :            :                                                      //pap.wHeightAbs w
    5210                 :            :          {46, 0},                                    //"sprmPDcs", pap.dcs DCS
    5211                 :            :          {47, &SwWW8ImplReader::Read_Shade},         //"sprmPShd", pap.shd SHD
    5212                 :            :          {48, 0},                                    //"sprmPDyaFromText",
    5213                 :            :                                                      //pap.dyaFromText dya
    5214                 :            :          {49, 0},                                    //"sprmPDxaFromText",
    5215                 :            :                                                      //pap.dxaFromText dxa
    5216                 :            :          {50, 0},                                    //"sprmPFLocked", pap.fLocked
    5217                 :            :                                                      //0 or 1 byte
    5218                 :            :          {51, &SwWW8ImplReader::Read_WidowControl},  //"sprmPFWidowControl",
    5219                 :            :                                                      //pap.fWidowControl 0 or 1 byte
    5220                 :            :          {52, 0},                                    //"?sprmPRuler 52",
    5221                 :            :          {53, 0},                                    //"??53",
    5222                 :            :          {54, 0},                                    //"??54",
    5223                 :            :          {55, 0},                                    //"??55",
    5224                 :            :          {56, 0},                                    //"??56",
    5225                 :            :          {57, 0},                                    //"??57",
    5226                 :            :          {58, 0},                                    //"??58",
    5227                 :            :          {59, 0},                                    //"??59",
    5228                 :            :          {60, 0},                                    //"??60",
    5229                 :            :          {61, 0},                                    //"??61",
    5230                 :            :          {62, 0},                                    //"??62",
    5231                 :            :          {63, 0},                                    //"??63",
    5232                 :            :          {64, &SwWW8ImplReader::Read_ParaBiDi},      //"rtl bidi ?
    5233                 :            :          {65, &SwWW8ImplReader::Read_CFRMarkDel},    //"sprmCFStrikeRM",
    5234                 :            :                                                      //chp.fRMarkDel 1 or 0 bit
    5235                 :            :          {66, &SwWW8ImplReader::Read_CFRMark},       //"sprmCFRMark", chp.fRMark
    5236                 :            :                                                      //1 or 0 bit
    5237                 :            :          {67, &SwWW8ImplReader::Read_FldVanish},     //"sprmCFFldVanish",
    5238                 :            :                                                      //chp.fFldVanish 1 or 0 bit
    5239                 :            :          {68, &SwWW8ImplReader::Read_PicLoc},        //"sprmCPicLocation",
    5240                 :            :                                                      //chp.fcPic and chp.fSpec
    5241                 :            :          {69, 0},                                    //"sprmCIbstRMark",
    5242                 :            :                                                      //chp.ibstRMark index into
    5243                 :            :                                                      //sttbRMark
    5244                 :            :          {70, 0},                                    //"sprmCDttmRMark", chp.dttm
    5245                 :            :                                                      //DTTM long
    5246                 :            :          {71, 0},                                    //"sprmCFData", chp.fData 1 or
    5247                 :            :                                                      //0 bit
    5248                 :            :          {72, 0},                                    //"sprmCRMReason",
    5249                 :            :                                                      //chp.idslRMReason an index to
    5250                 :            :                                                      //a table
    5251                 :            :          {73, &SwWW8ImplReader::Read_CharSet},       //"sprmCChse", chp.fChsDiff
    5252                 :            :                                                      //and chp.chse 3 bytes
    5253                 :            :          {74, &SwWW8ImplReader::Read_Symbol},        //"sprmCSymbol", chp.fSpec,
    5254                 :            :                                                      //chp.chSym and chp.ftcSym
    5255                 :            :          {75, &SwWW8ImplReader::Read_Obj},           //"sprmCFOle2", chp.fOle2 1
    5256                 :            :                                                      //or 0 bit
    5257                 :            :          {76, 0},                                    //"??76",
    5258                 :            :          {77, 0},                                    //"??77",
    5259                 :            :          {78, 0},                                    //"??78",
    5260                 :            :          {79, 0},                                    //"??79",
    5261                 :            :          {80, &SwWW8ImplReader::Read_CColl},         //"sprmCIstd", chp.istd istd,
    5262                 :            :                                                      //see stylesheet definition
    5263                 :            :                                                      //short
    5264                 :            :          {81, 0},                                    //"sprmCIstdPermute", chp.istd
    5265                 :            :                                                      //permutation vector
    5266                 :            :          {82, 0},                                    //"sprmCDefault", whole CHP
    5267                 :            :                                                      //none variable length
    5268                 :            :          {83, 0},                                    //"sprmCPlain", whole CHP
    5269                 :            :                                                      //none 0
    5270                 :            :          {84, 0},                                    //"??84",
    5271                 :            :          {85, &SwWW8ImplReader::Read_BoldUsw},       //"sprmCFBold", chp.fBold 0,1,
    5272                 :            :                                                      //128, or 129 byte
    5273                 :            :          {86, &SwWW8ImplReader::Read_BoldUsw},       //"sprmCFItalic", chp.fItalic
    5274                 :            :                                                      //0,1, 128, or 129 byte
    5275                 :            :          {87, &SwWW8ImplReader::Read_BoldUsw},       //"sprmCFStrike", chp.fStrike
    5276                 :            :                                                      //0,1, 128, or 129 byte
    5277                 :            :          {88, &SwWW8ImplReader::Read_BoldUsw},       //"sprmCFOutline", chp.fOutline
    5278                 :            :                                                      //0,1, 128, or 129 byte
    5279                 :            :          {89, &SwWW8ImplReader::Read_BoldUsw},       //"sprmCFShadow", chp.fShadow
    5280                 :            :                                                      //0,1, 128, or 129 byte
    5281                 :            :          {90, &SwWW8ImplReader::Read_BoldUsw},       //"sprmCFSmallCaps",
    5282                 :            :                                                      //chp.fSmallCaps 0,1, 128, or
    5283                 :            :                                                      //129 byte
    5284                 :            :          {91, &SwWW8ImplReader::Read_BoldUsw},       //"sprmCFCaps", chp.fCaps 0,1,
    5285                 :            :                                                      //128, or 129 byte
    5286                 :            :          {92, &SwWW8ImplReader::Read_BoldUsw},       //"sprmCFVanish", chp.fVanish
    5287                 :            :                                                      //0,1, 128, or 129 byte
    5288                 :            :          {93, &SwWW8ImplReader::Read_FontCode},      //"sprmCFtc", chp.ftc ftc word
    5289                 :            :          {94, &SwWW8ImplReader::Read_Underline},     // "sprmCKul", chp.kul kul byte
    5290                 :            :          {95, 0},                                    //"sprmCSizePos", chp.hps,
    5291                 :            :                                                      //chp.hpsPos 3 bytes
    5292                 :            :          {96, &SwWW8ImplReader::Read_Kern},          //"sprmCDxaSpace",
    5293                 :            :                                                      //chp.dxaSpace dxa word
    5294                 :            :          {97, &SwWW8ImplReader::Read_Language},      //"sprmCLid", chp.lid LID word
    5295                 :            :          {98, &SwWW8ImplReader::Read_TxtColor},      //"sprmCIco", chp.ico ico byte
    5296                 :            :          {99, &SwWW8ImplReader::Read_FontSize},      //"sprmCHps", chp.hps hps word!
    5297                 :            :         {100, 0},                                    //"sprmCHpsInc", chp.hps byte
    5298                 :            :         {101, &SwWW8ImplReader::Read_SubSuperProp},  //"sprmCHpsPos", chp.hpsPos
    5299                 :            :                                                      //hps byte
    5300                 :            :         {102, 0},                                    //"sprmCHpsPosAdj", chp.hpsPos
    5301                 :            :                                                      //hps byte
    5302                 :            :         {103, &SwWW8ImplReader::Read_Majority},      //"?sprmCMajority", chp.fBold,
    5303                 :            :                                                      //chp.fItalic, chp.fSmallCaps
    5304                 :            :         {104, &SwWW8ImplReader::Read_SubSuper},      //"sprmCIss", chp.iss iss byte
    5305                 :            :         {105, 0},                                    //"sprmCHpsNew50", chp.hps hps
    5306                 :            :                                                      //variable width, length
    5307                 :            :                                                      //always recorded as 2
    5308                 :            :         {106, 0},                                    //"sprmCHpsInc1", chp.hps
    5309                 :            :                                                      //complex variable width,
    5310                 :            :                                                      //length always recorded as 2
    5311                 :            :         {107, &SwWW8ImplReader::Read_FontKern},      //"sprmCHpsKern", chp.hpsKern
    5312                 :            :                                                      //hps short
    5313                 :            :         {108, &SwWW8ImplReader::Read_Majority},      //"sprmCMajority50", chp.fBold,
    5314                 :            :                                                      //chp.fItalic, chp.fSmallCaps,
    5315                 :            :                                                      // chp.fVanish, ...
    5316                 :            :         {109, 0},                                    //"sprmCHpsMul", chp.hps
    5317                 :            :                                                      //percentage to grow hps short
    5318                 :            :         {110, 0},                                    //"sprmCCondHyhen", chp.ysri
    5319                 :            :                                                      //ysri short
    5320                 :            :         {111, &SwWW8ImplReader::Read_FontCode},      //ww7 font
    5321                 :            :         {112, &SwWW8ImplReader::Read_FontCode},      //ww7 CJK font
    5322                 :            :         {113, &SwWW8ImplReader::Read_FontCode},      //ww7 rtl font
    5323                 :            :         {114, &SwWW8ImplReader::Read_Language},      //ww7 lid
    5324                 :            :         {115, &SwWW8ImplReader::Read_TxtColor},      //ww7 rtl colour ?
    5325                 :            :         {116, &SwWW8ImplReader::Read_FontSize},
    5326                 :            :         {117, &SwWW8ImplReader::Read_Special},       //"sprmCFSpec", chp.fSpec 1
    5327                 :            :                                                      //or 0 bit
    5328                 :            :         {118, &SwWW8ImplReader::Read_Obj},           //"sprmCFObj", chp.fObj 1 or 0
    5329                 :            :                                                      //bit
    5330                 :            :         {119, 0},                                    //"sprmPicBrcl", pic.brcl brcl
    5331                 :            :                                                      //(see PIC structure
    5332                 :            :                                                      //definition) byte
    5333                 :            :         {120, 0},                                    //"sprmPicScale", pic.mx,
    5334                 :            :                                                      //pic.my, pic.dxaCropleft,
    5335                 :            :         {121, 0},                                    //"sprmPicBrcTop", pic.brcTop
    5336                 :            :                                                      //BRC word
    5337                 :            :         {122, 0},                                    //"sprmPicBrcLeft",
    5338                 :            :                                                      //pic.brcLeft BRC word
    5339                 :            :         {123, 0},                                    //"sprmPicBrcBottom",
    5340                 :            :                                                      //pic.brcBottom BRC word
    5341                 :            :         {124, 0},                                    //"sprmPicBrcRight",
    5342                 :            :                                                      //pic.brcRight BRC word
    5343                 :            :         {125, 0},                                    //"??125",
    5344                 :            :         {126, 0},                                    //"??126",
    5345                 :            :         {127, 0},                                    //"??127",
    5346                 :            :         {128, 0},                                    //"??128",
    5347                 :            :         {129, 0},                                    //"??129",
    5348                 :            :         {130, 0},                                    //"??130",
    5349                 :            :         {131, 0},                                    //"sprmSScnsPgn", sep.cnsPgn
    5350                 :            :                                                      //cns byte
    5351                 :            :         {132, 0},                                    //"sprmSiHeadingPgn",
    5352                 :            :                                                      //sep.iHeadingPgn heading
    5353                 :            :                                                      //number level byte
    5354                 :            :         {133, &SwWW8ImplReader::Read_OLST},          //"sprmSOlstAnm", sep.olstAnm
    5355                 :            :                                                      //OLST variable length
    5356                 :            :         {134, 0},                                    //"??135",
    5357                 :            :         {135, 0},                                    //"??135",
    5358                 :            :         {136, 0},                                    //"sprmSDxaColWidth",
    5359                 :            :                                                      //sep.rgdxaColWidthSpacing
    5360                 :            :                                                      //complex 3 bytes
    5361                 :            :         {137, 0},                                    //"sprmSDxaColSpacing",
    5362                 :            :                                                      //sep.rgdxaColWidthSpacing
    5363                 :            :                                                      //complex 3 bytes
    5364                 :            :         {138, 0},                                    //"sprmSFEvenlySpaced",
    5365                 :            :                                                      //sep.fEvenlySpaced 1 or 0 byte
    5366                 :            :         {139, 0},                                    //"sprmSFProtected",
    5367                 :            :                                                      //sep.fUnlocked 1 or 0 byte
    5368                 :            :         {140, 0},                                    //"sprmSDmBinFirst",
    5369                 :            :                                                      //sep.dmBinFirst  word
    5370                 :            :         {141, 0},                                    //"sprmSDmBinOther",
    5371                 :            :                                                      //sep.dmBinOther  word
    5372                 :            :         {142, 0},                                    //"sprmSBkc", sep.bkc bkc
    5373                 :            :                                                      //byte BreakCode
    5374                 :            :         {143, 0},                                    //"sprmSFTitlePage",
    5375                 :            :                                                      //sep.fTitlePage 0 or 1 byte
    5376                 :            :         {144, 0},                                    //"sprmSCcolumns", sep.ccolM1
    5377                 :            :                                                      //# of cols - 1 word
    5378                 :            :         {145, 0},                                    //"sprmSDxaColumns",
    5379                 :            :                                                      //sep.dxaColumns dxa word
    5380                 :            :         {146, 0},                                    //"sprmSFAutoPgn",
    5381                 :            :                                                      //sep.fAutoPgn obsolete byte
    5382                 :            :         {147, 0},                                    //"sprmSNfcPgn", sep.nfcPgn
    5383                 :            :                                                      //nfc byte
    5384                 :            :         {148, 0},                                    //"sprmSDyaPgn", sep.dyaPgn
    5385                 :            :                                                      //dya short
    5386                 :            :         {149, 0},                                    //"sprmSDxaPgn", sep.dxaPgn
    5387                 :            :                                                      //dya short
    5388                 :            :         {150, 0},                                    //"sprmSFPgnRestart",
    5389                 :            :                                                      //sep.fPgnRestart 0 or 1 byte
    5390                 :            :         {151, 0},                                    //"sprmSFEndnote", sep.fEndnote
    5391                 :            :                                                      //0 or 1 byte
    5392                 :            :         {152, 0},                                    //"sprmSLnc", sep.lnc lnc byte
    5393                 :            :         {153, 0},                                    //"sprmSGprfIhdt", sep.grpfIhdt
    5394                 :            :                                                      //grpfihdt byte
    5395                 :            :         {154, 0},                                    //"sprmSNLnnMod", sep.nLnnMod
    5396                 :            :                                                      //non-neg int. word
    5397                 :            :         {155, 0},                                    //"sprmSDxaLnn", sep.dxaLnn
    5398                 :            :                                                      //dxa word
    5399                 :            :         {156, 0},                                    //"sprmSDyaHdrTop",
    5400                 :            :                                                      //sep.dyaHdrTop dya word
    5401                 :            :         {157, 0},                                    //"sprmSDyaHdrBottom",
    5402                 :            :                                                      //sep.dyaHdrBottom dya word
    5403                 :            :         {158, 0},                                    //"sprmSLBetween",
    5404                 :            :                                                      //sep.fLBetween 0 or 1 byte
    5405                 :            :         {159, 0},                                    //"sprmSVjc", sep.vjc vjc byte
    5406                 :            :         {160, 0},                                    //"sprmSLnnMin", sep.lnnMin
    5407                 :            :                                                      //lnn word
    5408                 :            :         {161, 0},                                    //"sprmSPgnStart", sep.pgnStart
    5409                 :            :                                                      //pgn word
    5410                 :            :         {162, 0},                                    //"sprmSBOrientation",
    5411                 :            :                                                      //sep.dmOrientPage dm byte
    5412                 :            :         {163, 0},                                    //"?SprmSBCustomize 163", ?
    5413                 :            :         {164, 0},                                    //"sprmSXaPage", sep.xaPage xa
    5414                 :            :                                                      //word
    5415                 :            :         {165, 0},                                    //"sprmSYaPage", sep.yaPage ya
    5416                 :            :                                                      //word
    5417                 :            :         {166, 0},                                    //"sprmSDxaLeft", sep.dxaLeft
    5418                 :            :                                                      //dxa word
    5419                 :            :         {167, 0},                                    //"sprmSDxaRight", sep.dxaRight
    5420                 :            :                                                      //dxa word
    5421                 :            :         {168, 0},                                    //"sprmSDyaTop", sep.dyaTop                                                     //dya word
    5422                 :            :         {169, 0},                                    //"sprmSDyaBottom",
    5423                 :            :                                                      //sep.dyaBottom dya word
    5424                 :            :         {170, 0},                                    //"sprmSDzaGutter",
    5425                 :            :                                                      //sep.dzaGutter dza word
    5426                 :            :         {171, 0},                                    //"sprmSDMPaperReq",
    5427                 :            :                                                      //sep.dmPaperReq dm word
    5428                 :            :         {172, 0},                                    //"??172",
    5429                 :            :         {173, 0},                                    //"??173",
    5430                 :            :         {174, 0},                                    //"??174",
    5431                 :            :         {175, 0},                                    //"??175",
    5432                 :            :         {176, 0},                                    //"??176",
    5433                 :            :         {177, 0},                                    //"??177",
    5434                 :            :         {178, 0},                                    //"??178",
    5435                 :            :         {179, 0},                                    //"??179",
    5436                 :            :         {180, 0},                                    //"??180",
    5437                 :            :         {181, 0},                                    //"??181",
    5438                 :            :         {182, 0},                                    //"sprmTJc", tap.jc jc word
    5439                 :            :                                                      //(low order byte is
    5440                 :            :                                                      //significant)
    5441                 :            :         {183, 0},                                    //"sprmTDxaLeft",
    5442                 :            :                                                      //tap.rgdxaCenter dxa word
    5443                 :            :         {184, 0},                                    //"sprmTDxaGapHalf",
    5444                 :            :                                                      //tap.dxaGapHalf,
    5445                 :            :                                                      //tap.rgdxaCenter dxa word
    5446                 :            :         {185, 0},                                    //"sprmTFCantSplit"
    5447                 :            :                                                      //tap.fCantSplit 1 or 0 byte
    5448                 :            :         {186, 0},                                    //"sprmTTableHeader",
    5449                 :            :                                                      //tap.fTableHeader 1 or 0 byte
    5450                 :            :         {187, 0},                                    //"sprmTTableBorders",
    5451                 :            :                                                      //tap.rgbrcTable complex
    5452                 :            :                                                      //12 bytes
    5453                 :            :         {188, 0},                                    //"sprmTDefTable10",
    5454                 :            :                                                      //tap.rgdxaCenter, tap.rgtc
    5455                 :            :                                                      //complex variable length
    5456                 :            :         {189, 0},                                    //"sprmTDyaRowHeight",
    5457                 :            :                                                      //tap.dyaRowHeight dya word
    5458                 :            :         {190, 0},                                    //"?sprmTDefTable", tap.rgtc
    5459                 :            :                                                      //complex
    5460                 :            :         {191, 0},                                    //"?sprmTDefTableShd",
    5461                 :            :                                                      //tap.rgshd complex
    5462                 :            :         {192, 0},                                    //"sprmTTlp", tap.tlp TLP
    5463                 :            :                                                      //4 bytes
    5464                 :            :         {193, 0},                                    //"sprmTSetBrc",
    5465                 :            :                                                      //tap.rgtc[].rgbrc complex
    5466                 :            :                                                      //5 bytes
    5467                 :            :         {194, 0},                                    //"sprmTInsert",
    5468                 :            :                                                      //tap.rgdxaCenter,
    5469                 :            :                                                      //tap.rgtc complex 4 bytes
    5470                 :            :         {195, 0},                                    //"sprmTDelete",
    5471                 :            :                                                      //tap.rgdxaCenter,
    5472                 :            :                                                      //tap.rgtc complex word
    5473                 :            :         {196, 0},                                    //"sprmTDxaCol",
    5474                 :            :                                                      //tap.rgdxaCenter complex
    5475                 :            :                                                      //4 bytes
    5476                 :            :         {197, 0},                                    //"sprmTMerge",
    5477                 :            :                                                      //tap.fFirstMerged,
    5478                 :            :                                                      //tap.fMerged complex word
    5479                 :            :         {198, 0},                                    //"sprmTSplit",
    5480                 :            :                                                      //tap.fFirstMerged,
    5481                 :            :                                                      //tap.fMerged complex word
    5482                 :            :         {199, 0},                                    //"sprmTSetBrc10",
    5483                 :            :                                                      //tap.rgtc[].rgbrc complex
    5484                 :            :                                                      //5 bytes
    5485                 :            :         {200, 0},                                    //"sprmTSetShd", tap.rgshd
    5486                 :            :                                                      //complex 4 bytes
    5487                 :            :         {207, 0},                                    //dunno
    5488                 :            :     };
    5489                 :            : 
    5490 [ #  # ][ #  # ]:          0 :     static wwSprmDispatcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
         [ #  # ][ #  # ]
    5491                 :          0 :     return &aSprmSrch;
    5492                 :            : }
    5493                 :            : 
    5494                 :      48693 : const wwSprmDispatcher *GetWW8SprmDispatcher()
    5495                 :            : {
    5496                 :            :     static SprmReadInfo aSprms[] =
    5497                 :            :     {
    5498                 :            :         {0,      0},                                 // "0" Default bzw. Error
    5499                 :            : 
    5500                 :            :         {0x4600, &SwWW8ImplReader::Read_StyleCode},  //"sprmPIstd" pap.istd;istd
    5501                 :            :                                                      //(style code);short;
    5502                 :            :         {0xC601, 0},                                 //"sprmPIstdPermute" pap.istd;
    5503                 :            :                                                      //permutation vector;
    5504                 :            :                                                      //variable length;
    5505                 :            :         {0x2602, 0},                                 //"sprmPIncLvl" pap.istd,
    5506                 :            :                                                      //pap.lvl;difference between
    5507                 :            :                                                      //istd of base PAP and istd of
    5508                 :            :                                                      //PAP to be produced; byte;
    5509                 :            :         {0x2403, &SwWW8ImplReader::Read_Justify},    //"sprmPJc" pap.jc;jc
    5510                 :            :                                                      //(justification);byte;
    5511                 :            :         {0x2404, 0},                                 //"sprmPFSideBySide"
    5512                 :            :                                                      //pap.fSideBySide;0 or 1;byte;
    5513                 :            :         {0x2405, &SwWW8ImplReader::Read_KeepLines},  //"sprmPFKeep" pap.fKeep;0 or
    5514                 :            :                                                      //1;byte;
    5515                 :            :         {0x2406, &SwWW8ImplReader::Read_KeepParas},  //"sprmPFKeepFollow"
    5516                 :            :                                                      //pap.fKeepFollow;0 or 1;byte;
    5517                 :            :         {0x2407, &SwWW8ImplReader::Read_BreakBefore},//"sprmPFPageBreakBefore"
    5518                 :            :                                                      //pap.fPageBreakBefore;0 or 1;
    5519                 :            :                                                      //byte;
    5520                 :            :         {0x2408, 0},                                 //"sprmPBrcl" pap.brcl;brcl;
    5521                 :            :                                                      //byte;
    5522                 :            :         {0x2409, 0},                                 //"sprmPBrcp" pap.brcp;brcp;
    5523                 :            :                                                      //byte;
    5524                 :            :         {0x260A, &SwWW8ImplReader::Read_ListLevel},  //"sprmPIlvl" pap.ilvl;ilvl;
    5525                 :            :                                                      //byte;
    5526                 :            :         {0x460B, &SwWW8ImplReader::Read_LFOPosition},//"sprmPIlfo" pap.ilfo;ilfo
    5527                 :            :                                                      //(list index) ;short;
    5528                 :            :         {0x240C, &SwWW8ImplReader::Read_NoLineNumb}, //"sprmPFNoLineNumb"
    5529                 :            :                                                      //pap.fNoLnn;0 or 1;byte;
    5530                 :            :         {0xC60D, &SwWW8ImplReader::Read_Tab},        //"sprmPChgTabsPapx"
    5531                 :            :                                                      //pap.itbdMac, pap.rgdxaTab,
    5532                 :            :                                                      //pap.rgtbd;complex;variable
    5533                 :            :                                                      //length
    5534                 :            :         {0x840E, &SwWW8ImplReader::Read_LR},         //Word 97 version of "sprmPDxaRight" pap.dxaRight;
    5535                 :            :                                                      //dxa;word;
    5536                 :            :         {0x840F, &SwWW8ImplReader::Read_LR},         //Apparently Word 97 version of "sprmPDxaLeft" pap.dxaLeft;
    5537                 :            :                                                      //dxa;word;
    5538                 :            :         {0x4610, 0},                                 //"sprmPNest" pap.dxaLeft;
    5539                 :            :                                                      //dxa;word;
    5540                 :            :         {0x8411, &SwWW8ImplReader::Read_LR},         //Word 97 version of "sprmPDxaLeft1" pap.dxaLeft1;
    5541                 :            :                                                      //dxa;word;
    5542                 :            :         {0x6412, &SwWW8ImplReader::Read_LineSpace},  //"sprmPDyaLine" pap.lspd;
    5543                 :            :                                                      //an LSPD, a long word
    5544                 :            :                                                      //structure consisting of a
    5545                 :            :                                                      //short of dyaLine followed by
    5546                 :            :                                                      //a short of fMultLinespace;
    5547                 :            :                                                      //long;
    5548                 :            :         {0xA413, &SwWW8ImplReader::Read_UL},         //"sprmPDyaBefore"
    5549                 :            :                                                      //pap.dyaBefore;dya;word;
    5550                 :            :         {0xA414, &SwWW8ImplReader::Read_UL},         //"sprmPDyaAfter" pap.dyaAfter;
    5551                 :            :                                                      //dya;word;
    5552                 :            :         {0xC615, 0},                                 //"sprmPChgTabs" pap.itbdMac,
    5553                 :            :                                                      //pap.rgdxaTab, pap.rgtbd;
    5554                 :            :                                                      //complex;variable length;
    5555                 :            :         {0x2416, 0},                                 //"sprmPFInTable" pap.fInTable;
    5556                 :            :                                                      //0 or 1;byte;
    5557                 :            :         {0x2417, &SwWW8ImplReader::Read_TabRowEnd},  //"sprmPFTtp" pap.fTtp;0 or 1;
    5558                 :            :                                                      //byte;
    5559                 :            :         {0x8418, 0},                                 //"sprmPDxaAbs" pap.dxaAbs;dxa;
    5560                 :            :                                                      //word;
    5561                 :            :         {0x8419, 0},                                 //"sprmPDyaAbs" pap.dyaAbs;dya;
    5562                 :            :                                                      //word;
    5563                 :            :         {0x841A, 0},                                 //"sprmPDxaWidth" pap.dxaWidth;
    5564                 :            :                                                      //dxa;word;
    5565                 :            :         {0x261B, &SwWW8ImplReader::Read_ApoPPC},     //"sprmPPc" pap.pcHorz,
    5566                 :            :                                                      //pap.pcVert;complex;byte;
    5567                 :            :         {0x461C, 0},                                 //"sprmPBrcTop10" pap.brcTop;
    5568                 :            :                                                      //BRC10;word;
    5569                 :            :         {0x461D, 0},                                 //"sprmPBrcLeft10" pap.brcLeft;
    5570                 :            :                                                      //BRC10;word;
    5571                 :            :         {0x461E, 0},                                 //"sprmPBrcBottom10"
    5572                 :            :                                                      //pap.brcBottom;BRC10;word;
    5573                 :            :         {0x461F, 0},                                 //"sprmPBrcRight10"
    5574                 :            :                                                      //pap.brcRight;BRC10;word;
    5575                 :            :         {0x4620, 0},                                 //"sprmPBrcBetween10"
    5576                 :            :                                                      //pap.brcBetween;BRC10;word;
    5577                 :            :         {0x4621, 0},                                 //"sprmPBrcBar10" pap.brcBar;
    5578                 :            :                                                      //BRC10;word;
    5579                 :            :         {0x4622, 0},                                 //"sprmPDxaFromText10"
    5580                 :            :                                                      //pap.dxaFromText;dxa;word;
    5581                 :            :         {0x2423, 0},                                 //"sprmPWr" pap.wr;wr;byte;
    5582                 :            :         {0x6424, &SwWW8ImplReader::Read_Border},     //"sprmPBrcTop" pap.brcTop;BRC;
    5583                 :            :                                                      //long;
    5584                 :            :         {0x6425, &SwWW8ImplReader::Read_Border},     //"sprmPBrcLeft" pap.brcLeft;
    5585                 :            :                                                      //BRC;long;
    5586                 :            :         {0x6426, &SwWW8ImplReader::Read_Border},     //"sprmPBrcBottom"
    5587                 :            :                                                      //pap.brcBottom;BRC;long;
    5588                 :            :         {0x6427, &SwWW8ImplReader::Read_Border},     //"sprmPBrcRight" pap.brcRight;
    5589                 :            :                                                      //BRC;long;
    5590                 :            :         {0x6428, &SwWW8ImplReader::Read_Border},     //"sprmPBrcBetween"
    5591                 :            :                                                      //pap.brcBetween;BRC;long;
    5592                 :            :         {0x6629, 0},                                 //"sprmPBrcBar" pap.brcBar;BRC;
    5593                 :            :                                                      //long;
    5594                 :            :         {0x242A, &SwWW8ImplReader::Read_Hyphenation},//"sprmPFNoAutoHyph"
    5595                 :            :                                                      //pap.fNoAutoHyph;0 or 1;byte;
    5596                 :            :         {0x442B, 0},                                 //"sprmPWHeightAbs"
    5597                 :            :                                                      //pap.wHeightAbs;w;word;
    5598                 :            :         {0x442C, 0},                                 //"sprmPDcs" pap.dcs;DCS;short;
    5599                 :            :         {0x442D, &SwWW8ImplReader::Read_Shade},      //"sprmPShd" pap.shd;SHD;word;
    5600                 :            :         {0x842E, 0},                                 //"sprmPDyaFromText"
    5601                 :            :                                                      //pap.dyaFromText;dya;word;
    5602                 :            :         {0x842F, 0},                                 //"sprmPDxaFromText"
    5603                 :            :                                                      //pap.dxaFromText;dxa;word;
    5604                 :            :         {0x2430, 0},                                 //"sprmPFLocked" pap.fLocked;
    5605                 :            :                                                      //0 or 1;byte;
    5606                 :            :         {0x2431, &SwWW8ImplReader::Read_WidowControl},//"sprmPFWidowControl"
    5607                 :            :                                                      //pap.fWidowControl;0 or 1;byte
    5608                 :            :         {0xC632, 0},                                 //"sprmPRuler" variable length;
    5609                 :            :         {0x2433, &SwWW8ImplReader::Read_BoolItem},   //"sprmPFKinsoku" pap.fKinsoku;
    5610                 :            :                                                      //0 or 1;byte;
    5611                 :            :         {0x2434, 0},                                 //"sprmPFWordWrap"
    5612                 :            :                                                      //pap.fWordWrap;0 or 1;byte;
    5613                 :            :         {0x2435, &SwWW8ImplReader::Read_BoolItem},   //"sprmPFOverflowPunct"
    5614                 :            :                                                      //pap.fOverflowPunct; 0 or 1;
    5615                 :            :                                                      //byte;
    5616                 :            :         {0x2436, 0},                                 //"sprmPFTopLinePunct"
    5617                 :            :                                                      //pap.fTopLinePunct;0 or 1;byte
    5618                 :            :         {0x2437, &SwWW8ImplReader::Read_BoolItem},   //"sprmPFAutoSpaceDE"
    5619                 :            :                                                      //pap.fAutoSpaceDE;0 or 1;byte;
    5620                 :            :         {0x2438, 0},                                 //"sprmPFAutoSpaceDN"
    5621                 :            :                                                      //pap.fAutoSpaceDN;0 or 1;byte;
    5622                 :            :         {0x4439, &SwWW8ImplReader::Read_AlignFont},  //"sprmPWAlignFont"
    5623                 :            :                                                      //pap.wAlignFont;iFa; word;
    5624                 :            :         {0x443A, 0},                                 //"sprmPFrameTextFlow"
    5625                 :            :                                                      //pap.fVertical pap.fBackward
    5626                 :            :                                                      //pap.fRotateFont;complex; word
    5627                 :            :         {0x243B, 0},                                 //"sprmPISnapBaseLine" obsolete
    5628                 :            :                                                      //not applicable in Word97
    5629                 :            :                                                      //and later versions;;byte;
    5630                 :            :         {0xC63E, &SwWW8ImplReader::Read_ANLevelDesc},//"sprmPAnld" pap.anld;;
    5631                 :            :                                                      //variable length;
    5632                 :            :         {0xC63F, 0},                                 //"sprmPPropRMark"
    5633                 :            :                                                      //pap.fPropRMark;complex;
    5634                 :            :                                                      //variable length;
    5635                 :            :         {0x2640,  &SwWW8ImplReader::Read_POutLvl},   //"sprmPOutLvl" pap.lvl;has no
    5636                 :            :                                                      //effect if pap.istd is < 1 or
    5637                 :            :                                                      //is > 9;byte;
    5638                 :            :         {0x2441, &SwWW8ImplReader::Read_ParaBiDi},   //"sprmPFBiDi" ;;byte;
    5639                 :            :         {0x2443, 0},                                 //"sprmPFNumRMIns"
    5640                 :            :                                                      //pap.fNumRMIns;1 or 0;bit;
    5641                 :            :         {0x2444, 0},                                 //"sprmPCrLf" ;;byte;
    5642                 :            :         {0xC645, 0},                                 //"sprmPNumRM" pap.numrm;;
    5643                 :            :                                                      //variable length;
    5644                 :            :         {0x6645, 0},                                 //"sprmPHugePapx" ;fc in the
    5645                 :            :                                                      //data stream to locate the
    5646                 :            :                                                      //huge grpprl; long;
    5647                 :            :         {0x6646, 0},                                 //"sprmPHugePapx" ;fc in the
    5648                 :            :                                                      //data stream to locate the
    5649                 :            :                                                      //huge grpprl; long;
    5650                 :            :         {0x2447, &SwWW8ImplReader::Read_UsePgsuSettings},//"sprmPFUsePgsuSettings"
    5651                 :            :                                                      //pap.fUsePgsuSettings;1 or 0;
    5652                 :            :                                                      //byte;
    5653                 :            :         {0x2448, 0},                                 //"sprmPFAdjustRight"
    5654                 :            :                                                      //pap.fAdjustRight;1 or 0;byte;
    5655                 :            :         {0x0800, &SwWW8ImplReader::Read_CFRMarkDel}, //"sprmCFRMarkDel"
    5656                 :            :                                                      //chp.fRMarkDel;1 or 0;bit;
    5657                 :            :         {0x0801, &SwWW8ImplReader::Read_CFRMark},    //"sprmCFRMark" chp.fRMark;1
    5658                 :            :                                                      //or 0;bit;
    5659                 :            :         {0x0802, &SwWW8ImplReader::Read_FldVanish},  //"sprmCFFldVanish"
    5660                 :            :                                                      //chp.fFldVanish;1 or 0;bit;
    5661                 :            :         {0x6A03, &SwWW8ImplReader::Read_PicLoc},     //"sprmCPicLocation" chp.fcPic
    5662                 :            :                                                      //and chp.fSpec;variable
    5663                 :            :                                                      //length, length recorded is
    5664                 :            :                                                      //always 4;
    5665                 :            :         {0x4804, 0},                                 //"sprmCIbstRMark"
    5666                 :            :                                                      //chp.ibstRMark;index into
    5667                 :            :                                                      //sttbRMark;short;
    5668                 :            :         {0x6805, 0},                                 //"sprmCDttmRMark"
    5669                 :            :                                                      //chp.dttmRMark;DTTM;long;
    5670                 :            :         {0x0806, 0},                                 //"sprmCFData" chp.fData;1 or
    5671                 :            :                                                      //0;bit;
    5672                 :            :         {0x4807, 0},                                 //"sprmCIdslRMark"
    5673                 :            :                                                      //chp.idslRMReason;an index to
    5674                 :            :                                                      //a table of strings defined in
    5675                 :            :                                                      //Word 6.0 executables;short;
    5676                 :            :         {0xEA08, &SwWW8ImplReader::Read_CharSet},    //"sprmCChs" chp.fChsDiff and
    5677                 :            :                                                      //chp.chse;3 bytes;
    5678                 :            :         {0x6A09, &SwWW8ImplReader::Read_Symbol},     //"sprmCSymbol" chp.fSpec,
    5679                 :            :                                                      //chp.xchSym and chp.ftcSym;
    5680                 :            :                                                      //variable length, length
    5681                 :            :                                                      //recorded is always 4;
    5682                 :            :         {0x080A, &SwWW8ImplReader::Read_Obj},        //"sprmCFOle2" chp.fOle2;1 or
    5683                 :            :                                                      //0;bit;
    5684                 :            :       //0x480B,                                      //"sprmCIdCharType", obsolete:
    5685                 :            :                                                      //not applicable in Word97
    5686                 :            :                                                      //and later versions
    5687                 :            :         {0x2A0C, &SwWW8ImplReader::Read_CharHighlight},//"sprmCHighlight"
    5688                 :            :                                                      //chp.fHighlight,
    5689                 :            :                                                      //chp.icoHighlight;ico
    5690                 :            :                                                      //(fHighlight is set to 1 iff
    5691                 :            :                                                      //ico is not 0);byte;
    5692                 :            :         {0x680E, &SwWW8ImplReader::Read_PicLoc},     //"sprmCObjLocation" chp.fcObj;
    5693                 :            :                                                      //FC;long;
    5694                 :            :       //0x2A10, ? ? ?,                               //"sprmCFFtcAsciSymb"
    5695                 :            :         {0x4A30, &SwWW8ImplReader::Read_CColl},      //"sprmCIstd" chp.istd;istd,
    5696                 :            :                                                      //short;
    5697                 :            :         {0xCA31, 0},                                 //"sprmCIstdPermute" chp.istd;
    5698                 :            :                                                      //permutation vector; variable
    5699                 :            :                                                      //length;
    5700                 :            :         {0x2A32, 0},                                 //"sprmCDefault" whole CHP;none
    5701                 :            :                                                      //;variable length;
    5702                 :            :         {0x2A33, 0},                                 //"sprmCPlain" whole CHP;none;
    5703                 :            :                                                      //Laenge: 0;
    5704                 :            :         {0x2A34, &SwWW8ImplReader::Read_Emphasis},   //"sprmCKcd"
    5705                 :            :         {0x0835, &SwWW8ImplReader::Read_BoldUsw},    //"sprmCFBold" chp.fBold;0,1,
    5706                 :            :                                                      //128, or 129; byte;
    5707                 :            :         {0x0836, &SwWW8ImplReader::Read_BoldUsw},    //"sprmCFItalic" chp.fItalic;0,
    5708                 :            :                                                      //1, 128, or 129; byte;
    5709                 :            :         {0x0837, &SwWW8ImplReader::Read_BoldUsw},    //"sprmCFStrike" chp.fStrike;0,
    5710                 :            :                                                      //1, 128, or 129; byte;
    5711                 :            :         {0x0838, &SwWW8ImplReader::Read_BoldUsw},    //"sprmCFOutline" chp.fOutline;
    5712                 :            :                                                      //0,1, 128, or 129; byte;
    5713                 :            :         {0x0839, &SwWW8ImplReader::Read_BoldUsw},    //"sprmCFShadow" chp.fShadow;0,
    5714                 :            :                                                      //1, 128, or 129; byte;
    5715                 :            :         {0x083A, &SwWW8ImplReader::Read_BoldUsw},    //"sprmCFSmallCaps"
    5716                 :            :                                                      //chp.fSmallCaps;0,1, 128, or
    5717                 :            :                                                      //129;byte;
    5718                 :            :         {0x083B, &SwWW8ImplReader::Read_BoldUsw},    //"sprmCFCaps" chp.fCaps;0,1,
    5719                 :            :                                                      //128, or 129; byte;
    5720                 :            :         {0x083C, &SwWW8ImplReader::Read_BoldUsw},    //"sprmCFVanish" chp.fVanish;0,
    5721                 :            :                                                      //1, 128, or 129; byte;
    5722                 :            :       //0x4A3D, 0,                                   //"sprmCFtcDefault" ftc, only
    5723                 :            :                                                      //used internally, never
    5724                 :            :                                                      //stored in file;word;
    5725                 :            :         {0x2A3E, &SwWW8ImplReader::Read_Underline},  //"sprmCKul" chp.kul;kul;byte;
    5726                 :            :         {0xEA3F, 0},                                 //"sprmCSizePos" chp.hps,
    5727                 :            :                                                      //chp.hpsPos;3 bytes;
    5728                 :            :         {0x8840, &SwWW8ImplReader::Read_Kern},       //"sprmCDxaSpace" chp.dxaSpace;
    5729                 :            :                                                      //dxa;word;
    5730                 :            :         {0x4A41, &SwWW8ImplReader::Read_Language},   //"sprmCLid" ;only used
    5731                 :            :                                                      //internally never stored;word;
    5732                 :            :         {0x2A42, &SwWW8ImplReader::Read_TxtColor},   //"sprmCIco" chp.ico;ico;byte;
    5733                 :            :         {0x4A43, &SwWW8ImplReader::Read_FontSize},   //"sprmCHps" chp.hps;hps;byte;
    5734                 :            :         {0x2A44, 0},                                 //"sprmCHpsInc" chp.hps;byte;
    5735                 :            :         {0x4845, &SwWW8ImplReader::Read_SubSuperProp},//"sprmCHpsPos" chp.hpsPos;
    5736                 :            :                                                      //hps; byte;
    5737                 :            :         {0x2A46, 0},                                 //"sprmCHpsPosAdj" chp.hpsPos;
    5738                 :            :                                                      //hps; byte;
    5739                 :            :         {0xCA47, &SwWW8ImplReader::Read_Majority},   //"sprmCMajority" chp.fBold,
    5740                 :            :                                                      //chp.fItalic, chp.fSmallCaps,
    5741                 :            :                                                      //chp.fVanish, chp.fStrike,
    5742                 :            :                                                      //chp.fCaps, chp.rgftc,
    5743                 :            :                                                      //chp.hps, chp.hpsPos, chp.kul,
    5744                 :            :                                                      //chp.dxaSpace, chp.ico,
    5745                 :            :                                                      //chp.rglid;complex;variable
    5746                 :            :                                                      //length, length byte plus
    5747                 :            :                                                      //size of following grpprl;
    5748                 :            :         {0x2A48, &SwWW8ImplReader::Read_SubSuper},   //"sprmCIss" chp.iss;iss;byte;
    5749                 :            :         {0xCA49, 0},                                 //"sprmCHpsNew50" chp.hps;hps;
    5750                 :            :                                                      //variable width, length
    5751                 :            :                                                      //always recorded as 2;
    5752                 :            :         {0xCA4A, 0},                                 //"sprmCHpsInc1" chp.hps;
    5753                 :            :                                                      //complex; variable width,
    5754                 :            :                                                      //length always recorded as 2;
    5755                 :            :         {0x484B, &SwWW8ImplReader::Read_FontKern},   //"sprmCHpsKern" chp.hpsKern;
    5756                 :            :                                                      //hps;short;
    5757                 :            :         {0xCA4C, &SwWW8ImplReader::Read_Majority},   //"sprmCMajority50" chp.fBold,
    5758                 :            :                                                      //chp.fItalic, chp.fSmallCaps,
    5759                 :            :                                                      //chp.fVanish, chp.fStrike,
    5760                 :            :                                                      //chp.fCaps, chp.ftc, chp.hps,
    5761                 :            :                                                      //chp.hpsPos, chp.kul,
    5762                 :            :                                                      //chp.dxaSpace, chp.ico;
    5763                 :            :                                                      //complex; variable length;
    5764                 :            :         {0x4A4D, 0},                                 //"sprmCHpsMul" chp.hps;
    5765                 :            :                                                      //percentage to grow hps;short;
    5766                 :            :         {0x484E, 0},                                 //"sprmCYsri" chp.ysri;ysri;
    5767                 :            :                                                      //short;
    5768                 :            :         {0x4A4F, &SwWW8ImplReader::Read_FontCode},   //"sprmCRgFtc0" chp.rgftc[0];
    5769                 :            :                                                      //ftc for ASCII text; short;
    5770                 :            :         {0x4A50, &SwWW8ImplReader::Read_FontCode},   //"sprmCRgFtc1" chp.rgftc[1];
    5771                 :            :                                                      //ftc for Far East text;short;
    5772                 :            :         {0x4A51, &SwWW8ImplReader::Read_FontCode},   //"sprmCRgFtc2" chp.rgftc[2];
    5773                 :            :                                                      //ftc for non-Far East text;
    5774                 :            :                                                      //short;
    5775                 :            :         {0x4852, &SwWW8ImplReader::Read_ScaleWidth}, //"sprmCCharScale"
    5776                 :            :         {0x2A53, &SwWW8ImplReader::Read_BoldUsw},    //"sprmCFDStrike" chp.fDStrike;
    5777                 :            :                                                      //;byte;
    5778                 :            :         {0x0854, &SwWW8ImplReader::Read_Relief},     //"sprmCFImprint" chp.fImprint;
    5779                 :            :                                                      //1 or 0;bit;
    5780                 :            :         {0x0855, &SwWW8ImplReader::Read_Special},    //"sprmCFSpec" chp.fSpec;
    5781                 :            :                                                      //1 or 0;bit;
    5782                 :            :         {0x0856, &SwWW8ImplReader::Read_Obj},        //"sprmCFObj" chp.fObj;1 or 0;
    5783                 :            :                                                      //bit;
    5784                 :            :         {0xCA57, &SwWW8ImplReader::Read_CPropRMark}, //"sprmCPropRMark"
    5785                 :            :                                                      //chp.fPropRMark,
    5786                 :            :                                                      //chp.ibstPropRMark,
    5787                 :            :                                                      //chp.dttmPropRMark;Complex;
    5788                 :            :                                                      //variable length always
    5789                 :            :                                                      //recorded as 7 bytes;
    5790                 :            :         {0x0858, &SwWW8ImplReader::Read_Relief},     //"sprmCFEmboss" chp.fEmboss;
    5791                 :            :                                                      //1 or 0;bit;
    5792                 :            :         {0x2859, &SwWW8ImplReader::Read_TxtAnim},    //"sprmCSfxText" chp.sfxtText;
    5793                 :            :                                                      //text animation;byte;
    5794                 :            :         {0x085A, &SwWW8ImplReader::Read_Bidi},                                 //"sprmCFBiDi"
    5795                 :            :         {0x085B, 0},                                 //"sprmCFDiacColor"
    5796                 :            :         {0x085C, &SwWW8ImplReader::Read_BoldBiDiUsw},//"sprmCFBoldBi"
    5797                 :            :         {0x085D, &SwWW8ImplReader::Read_BoldBiDiUsw},//"sprmCFItalicBi"
    5798                 :            :         {0x4A5E, &SwWW8ImplReader::Read_FontCode},   //"sprmCFtcBi"
    5799                 :            :         {0x485F, &SwWW8ImplReader::Read_Language},   //"sprmCLidBi"
    5800                 :            :       //0x4A60, ? ? ?,                               //"sprmCIcoBi",
    5801                 :            :         {0x4A61, &SwWW8ImplReader::Read_FontSize},   //"sprmCHpsBi"
    5802                 :            :         {0xCA62, 0},                                 //"sprmCDispFldRMark"
    5803                 :            :                                                      //chp.fDispFldRMark,
    5804                 :            :                                                      //chp.ibstDispFldRMark,
    5805                 :            :                                                      //chp.dttmDispFldRMark ;
    5806                 :            :                                                      //Complex;variable length
    5807                 :            :                                                      //always recorded as 39 bytes;
    5808                 :            :         {0x4863, 0},                                 //"sprmCIbstRMarkDel"
    5809                 :            :                                                      //chp.ibstRMarkDel;index into
    5810                 :            :                                                      //sttbRMark;short;
    5811                 :            :         {0x6864, 0},                                 //"sprmCDttmRMarkDel"
    5812                 :            :                                                      //chp.dttmRMarkDel;DTTM;long;
    5813                 :            :         {0x6865, 0},                                 //"sprmCBrc" chp.brc;BRC;long;
    5814                 :            :         {0x4866, &SwWW8ImplReader::Read_CharShadow}, //"sprmCShd" chp.shd;SHD;short;
    5815                 :            :         {0x4867, 0},                                 //"sprmCIdslRMarkDel"
    5816                 :            :                                                      //chp.idslRMReasonDel;an index
    5817                 :            :                                                      //to a table of strings
    5818                 :            :                                                      //defined in Word 6.0
    5819                 :            :                                                      //executables;short;
    5820                 :            :         {0x0868, 0},                                 //"sprmCFUsePgsuSettings"
    5821                 :            :                                                      //chp.fUsePgsuSettings; 1 or 0;
    5822                 :            :                                                      //bit;
    5823                 :            :         {0x486B, 0},                                 //"sprmCCpg" ;;word;
    5824                 :            :         {0x486D, &SwWW8ImplReader::Read_Language},   //"sprmCRgLid0_80" chp.rglid[0];
    5825                 :            :                                                      //LID: for non-Far East text;
    5826                 :            :                                                      //word;
    5827                 :            :         {0x486E, &SwWW8ImplReader::Read_Language},   //"sprmCRgLid1_80" chp.rglid[1];
    5828                 :            :                                                      //LID: for Far East text;word;
    5829                 :            :         {0x286F, &SwWW8ImplReader::Read_IdctHint},   //"sprmCIdctHint" chp.idctHint;
    5830                 :            :                                                      //IDCT: byte;
    5831                 :            :         {0x2E00, 0},                                 //"sprmPicBrcl" pic.brcl;brcl
    5832                 :            :                                                      //(see PIC structure
    5833                 :            :                                                      //definition);byte;
    5834                 :            :         {0xCE01, 0},                                 //"sprmPicScale" pic.mx,
    5835                 :            :                                                      //pic.my, pic.dxaCropleft,
    5836                 :            :                                                      //pic.dyaCropTop
    5837                 :            :                                                      //pic.dxaCropRight,
    5838                 :            :                                                      //pic.dyaCropBottom;Complex;
    5839                 :            :                                                      //length byte plus 12 bytes;
    5840                 :            :         {0x6C02, 0},                                 //"sprmPicBrcTop" pic.brcTop;
    5841                 :            :                                                      //BRC;long;
    5842                 :            :         {0x6C03, 0},                                 //"sprmPicBrcLeft" pic.brcLeft;
    5843                 :            :                                                      //BRC;long;
    5844                 :            :         {0x6C04, 0},                                 //"sprmPicBrcBottom"
    5845                 :            :                                                      //pic.brcBottom;BRC;long;
    5846                 :            :         {0x6C05, 0},                                 //"sprmPicBrcRight"
    5847                 :            :                                                      //pic.brcRight;BRC;long;
    5848                 :            :         {0x3000, 0},                                 //"sprmScnsPgn" sep.cnsPgn;cns;
    5849                 :            :                                                      //byte;
    5850                 :            :         {0x3001, 0},                                 //"sprmSiHeadingPgn"
    5851                 :            :                                                      //sep.iHeadingPgn;heading
    5852                 :            :                                                      //number level;byte;
    5853                 :            :         {0xD202, &SwWW8ImplReader::Read_OLST},       //"sprmSOlstAnm" sep.olstAnm;
    5854                 :            :                                                      //OLST;variable length;
    5855                 :            :         {0xF203, 0},                                 //"sprmSDxaColWidth"
    5856                 :            :                                                      //sep.rgdxaColWidthSpacing;
    5857                 :            :                                                      //complex; 3 bytes;
    5858                 :            :         {0xF204, 0},                                 //"sprmSDxaColSpacing"
    5859                 :            :                                                      //sep.rgdxaColWidthSpacing;
    5860                 :            :                                                      //complex; 3 bytes;
    5861                 :            :         {0x3005, 0},                                 //"sprmSFEvenlySpaced"
    5862                 :            :                                                      //sep.fEvenlySpaced; 1 or 0;
    5863                 :            :                                                      //byte;
    5864                 :            :         {0x3006, 0},                                 //"sprmSFProtected"
    5865                 :            :                                                      //sep.fUnlocked;1 or 0;byte;
    5866                 :            :         {0x5007, 0},                                 //"sprmSDmBinFirst"
    5867                 :            :                                                      //sep.dmBinFirst;;word;
    5868                 :            :         {0x5008, 0},                                 //"sprmSDmBinOther"
    5869                 :            :                                                      //sep.dmBinOther;;word;
    5870                 :            :         {0x3009, 0},                                 //"sprmSBkc" sep.bkc;bkc;byte;
    5871                 :            :         {0x300A, 0},                                 //"sprmSFTitlePage"
    5872                 :            :                                                      //sep.fTitlePage;0 or 1;byte;
    5873                 :            :         {0x500B, 0},                                 //"sprmSCcolumns" sep.ccolM1;
    5874                 :            :                                                      //# of cols - 1;word;
    5875                 :            :         {0x900C, 0},                                 //"sprmSDxaColumns"
    5876                 :            :                                                      //sep.dxaColumns;dxa;word;
    5877                 :            :         {0x300D, 0},                                 //"sprmSFAutoPgn" sep.fAutoPgn;
    5878                 :            :                                                      //obsolete;byte;
    5879                 :            :         {0x300E, 0},                                 //"sprmSNfcPgn" sep.nfcPgn;nfc;
    5880                 :            :                                                      //byte;
    5881                 :            :         {0xB00F, 0},                                 //"sprmSDyaPgn" sep.dyaPgn;dya;
    5882                 :            :                                                      //short;
    5883                 :            :         {0xB010, 0},                                 //"sprmSDxaPgn" sep.dxaPgn;dya;
    5884                 :            :                                                      //short;
    5885                 :            :         {0x3011, 0},                                 //"sprmSFPgnRestart"
    5886                 :            :                                                      //sep.fPgnRestart;0 or 1;byte;
    5887                 :            :         {0x3012, 0},                                 //"sprmSFEndnote" sep.fEndnote;
    5888                 :            :                                                      //0 or 1;byte;
    5889                 :            :         {0x3013, 0},                                 //"sprmSLnc" sep.lnc;lnc;byte;
    5890                 :            :         {0x3014, 0},                                 //"sprmSGprfIhdt" sep.grpfIhdt;
    5891                 :            :                                                      //grpfihdt; byte;
    5892                 :            :         {0x5015, 0},                                 //"sprmSNLnnMod" sep.nLnnMod;
    5893                 :            :                                                      //non-neg int.;word;
    5894                 :            :         {0x9016, 0},                                 //"sprmSDxaLnn" sep.dxaLnn;dxa;
    5895                 :            :                                                      //word;
    5896                 :            :         {0xB017, 0},                                 //"sprmSDyaHdrTop"
    5897                 :            :                                                      //sep.dyaHdrTop;dya;word;
    5898                 :            :         {0xB018, 0},                                 //"sprmSDyaHdrBottom"
    5899                 :            :                                                      //sep.dyaHdrBottom;dya;word;
    5900                 :            :         {0x3019, 0},                                 //"sprmSLBetween"
    5901                 :            :                                                      //sep.fLBetween;0 or 1;byte;
    5902                 :            :         {0x301A, 0},                                 //"sprmSVjc" sep.vjc;vjc;byte;
    5903                 :            :         {0x501B, 0},                                 //"sprmSLnnMin" sep.lnnMin;lnn;
    5904                 :            :                                                      //word;
    5905                 :            :         {0x501C, 0},                                 //"sprmSPgnStart" sep.pgnStart;
    5906                 :            :                                                      //pgn;word;
    5907                 :            :         {0x301D, 0},                                 //"sprmSBOrientation"
    5908                 :            :                                                      //sep.dmOrientPage;dm;byte;
    5909                 :            :       //0x301E, ? ? ?,                               //"sprmSBCustomize"
    5910                 :            :         {0xB01F, 0},                                 //"sprmSXaPage" sep.xaPage;xa;
    5911                 :            :                                                      //word;
    5912                 :            :         {0xB020, 0},                                 //"sprmSYaPage" sep.yaPage;ya;
    5913                 :            :                                                      //word;
    5914                 :            :         {0x2205, 0},                                 //"sprmSDxaLeft" sep.dxaLeft;
    5915                 :            :                                                      //dxa;word;
    5916                 :            :         {0xB022, 0},                                 //"sprmSDxaRight" sep.dxaRight;
    5917                 :            :                                                      //dxa;word;
    5918                 :            :         {0x9023, 0},                                 //"sprmSDyaTop" sep.dyaTop;dya;
    5919                 :            :                                                      //word;
    5920                 :            :         {0x9024, 0},                                 //"sprmSDyaBottom"
    5921                 :            :                                                      //sep.dyaBottom;dya;word;
    5922                 :            :         {0xB025, 0},                                 //"sprmSDzaGutter"
    5923                 :            :                                                      //sep.dzaGutter;dza;word;
    5924                 :            :         {0x5026, 0},                                 //"sprmSDmPaperReq"
    5925                 :            :                                                      //sep.dmPaperReq;dm;word;
    5926                 :            :         {0xD227, 0},                                 //"sprmSPropRMark"
    5927                 :            :                                                      //sep.fPropRMark,
    5928                 :            :                                                      //sep.ibstPropRMark,
    5929                 :            :                                                      //sep.dttmPropRMark ;complex;
    5930                 :            :                                                      //variable length always
    5931                 :            :                                                      //recorded as 7 bytes;
    5932                 :            :       //0x3228, ? ? ?,                               //"sprmSFBiDi",
    5933                 :            :       //0x3229, ? ? ?,                               //"sprmSFFacingCol"
    5934                 :            :         {0x322A, 0},                                 //"sprmSFRTLGutter", set to 1
    5935                 :            :                                                      //if gutter is on the right.
    5936                 :            :         {0x702B, 0},                                 //"sprmSBrcTop" sep.brcTop;BRC;
    5937                 :            :                                                      //long;
    5938                 :            :         {0x702C, 0},                                 //"sprmSBrcLeft" sep.brcLeft;
    5939                 :            :                                                      //BRC;long;
    5940                 :            :         {0x702D, 0},                                 //"sprmSBrcBottom"
    5941                 :            :                                                      //sep.brcBottom;BRC;long;
    5942                 :            :         {0x702E, 0},                                 //"sprmSBrcRight" sep.brcRight;
    5943                 :            :                                                      //BRC;long;
    5944                 :            :         {0x522F, 0},                                 //"sprmSPgbProp" sep.pgbProp;
    5945                 :            :                                                      //word;
    5946                 :            :         {0x7030, 0},                                 //"sprmSDxtCharSpace"
    5947                 :            :                                                      //sep.dxtCharSpace;dxt;long;
    5948                 :            :         {0x9031, 0},                                 //"sprmSDyaLinePitch"
    5949                 :            :                                                      //sep.dyaLinePitch;dya;
    5950                 :            :                                                      //WRONG:long; RIGHT:short; !
    5951                 :            :       //0x5032, ? ? ?,                               //"sprmSClm"
    5952                 :            :         {0x5033, 0},                                 //"sprmSTextFlow"
    5953                 :            :                                                      //sep.wTextFlow;complex ;short
    5954                 :            :         {0x5400, 0},                                 //"sprmTJc" tap.jc;jc;word (low
    5955                 :            :                                                      //order byte is significant);
    5956                 :            :         {0x9601, 0},                                 //"sprmTDxaLeft"
    5957                 :            :                                                      //tap.rgdxaCenter; dxa; word;
    5958                 :            :         {0x9602, 0},                                 //"sprmTDxaGapHalf"
    5959                 :            :                                                      //tap.dxaGapHalf,
    5960                 :            :                                                      //tap.rgdxaCenter; dxa; word;
    5961                 :            :         {0x3403, 0},                                 //"sprmTFCantSplit"
    5962                 :            :                                                      //tap.fCantSplit;1 or 0;byte;
    5963                 :            :         {0x3404, 0},                                 //"sprmTTableHeader"
    5964                 :            :                                                      //tap.fTableHeader;1 or 0;byte;
    5965                 :            :         {0x3466, 0},                                 //"sprmTFCantSplit90"
    5966                 :            :                                                      //tap.fCantSplit90;1 or 0;byte;
    5967                 :            :         {0xD605, 0},                                 //"sprmTTableBorders"
    5968                 :            :                                                      //tap.rgbrcTable;complex;
    5969                 :            :                                                      //24 bytes;
    5970                 :            :         {0xD606, 0},                                 //"sprmTDefTable10"
    5971                 :            :                                                      //tap.rgdxaCenter,
    5972                 :            :                                                      //tap.rgtc;complex; variable
    5973                 :            :                                                      //length;
    5974                 :            :         {0x9407, 0},                                 //"sprmTDyaRowHeight"
    5975                 :            :                                                      //tap.dyaRowHeight;dya;word;
    5976                 :            :         {0xD608, 0},                                 //"sprmTDefTable"
    5977                 :            :                                                      //tap.rgtc;complex
    5978                 :            :         {0xD609, 0},                                 //"sprmTDefTableShd"
    5979                 :            :                                                      //tap.rgshd;complex
    5980                 :            :         {0x740A, 0},                                 //"sprmTTlp" tap.tlp;TLP;
    5981                 :            :                                                      //4 bytes;
    5982                 :            :       //0x560B, ? ? ?,                               //"sprmTFBiDi"
    5983                 :            :       //0x740C, ? ? ?,                               //"sprmTHTMLProps"
    5984                 :            :         {0xD620, 0},                                 //"sprmTSetBrc"
    5985                 :            :                                                      //tap.rgtc[].rgbrc;complex;
    5986                 :            :                                                      //5 bytes;
    5987                 :            :         {0x7621, 0},                                 //"sprmTInsert"
    5988                 :            :                                                      //tap.rgdxaCenter,
    5989                 :            :                                                      //tap.rgtc;complex ;4 bytes;
    5990                 :            :         {0x5622, 0},                                 //"sprmTDelete"
    5991                 :            :                                                      //tap.rgdxaCenter,
    5992                 :            :                                                      //tap.rgtc;complex ;word;
    5993                 :            :         {0x7623, 0},                                 //"sprmTDxaCol"
    5994                 :            :                                                      //tap.rgdxaCenter;complex;
    5995                 :            :                                                      //4 bytes;
    5996                 :            :         {0x5624, 0},                                 //"sprmTMerge"
    5997                 :            :                                                      //tap.fFirstMerged,
    5998                 :            :                                                      //tap.fMerged;complex; word;
    5999                 :            :         {0x5625, 0},                                 //"sprmTSplit"
    6000                 :            :                                                      //tap.fFirstMerged,
    6001                 :            :                                                      //tap.fMerged;complex ;word;
    6002                 :            :         {0xD626, 0},                                 //"sprmTSetBrc10"
    6003                 :            :                                                      //tap.rgtc[].rgbrc;complex;
    6004                 :            :                                                      //5 bytes;
    6005                 :            :         {0x7627, 0},                                 //"sprmTSetShd" tap.rgshd;
    6006                 :            :                                                      //complex; 4 bytes;
    6007                 :            :         {0x7628, 0},                                 //"sprmTSetShdOdd"
    6008                 :            :                                                      //tap.rgshd;complex;4 bytes;
    6009                 :            :         {0x7629, 0},                                 //"sprmTTextFlow"
    6010                 :            :                                                      //tap.rgtc[].fVertical
    6011                 :            :                                                      //tap.rgtc[].fBackward
    6012                 :            :                                                      //tap.rgtc[].fRotateFont
    6013                 :            :                                                      //0 or 10 or 10 or 1;word;
    6014                 :            :       //0xD62A, ? ? ?  ,                             //"sprmTDiagLine"
    6015                 :            :         {0xD62B, 0},                                 //"sprmTVertMerge"
    6016                 :            :                                                      //tap.rgtc[].vertMerge;complex;
    6017                 :            :                                                      //variable length always
    6018                 :            :                                                      //recorded as 2 bytes;
    6019                 :            :         {0xD62C, 0},                                 //"sprmTVertAlign"
    6020                 :            :                                                      //tap.rgtc[].vertAlign;complex
    6021                 :            :                                                      //variable length always
    6022                 :            :                                                      //recorded as 3 byte;
    6023                 :            :         {0xCA78, &SwWW8ImplReader::Read_DoubleLine_Rotate},
    6024                 :            :         {0x6649, 0},                                 //undocumented
    6025                 :            :         {0xF614, 0},                                 //"sprmTTableWidth"
    6026                 :            :                                                      //recorded as 3 bytes;
    6027                 :            :         {0xD612, 0},                                 //undocumented
    6028                 :            :         {0xD613, 0},                                 //undocumented
    6029                 :            :         {0xD61A, 0},                                 //undocumented
    6030                 :            :         {0xD61B, 0},                                 //undocumented
    6031                 :            :         {0xD61C, 0},                                 //undocumented
    6032                 :            :         {0xD61D, 0},                                 //undocumented
    6033                 :            :         {0xD634, 0},                                 //undocumented
    6034                 :            :         {0xD632, 0},                                 //undocumented
    6035                 :            :         {0xD238, 0},                                 //undocumented sep
    6036                 :            :         {0xC64E, 0},                                 //undocumented
    6037                 :            :         {0xC64F, 0},                                 //undocumented
    6038                 :            :         {0xC650, 0},                                 //undocumented
    6039                 :            :         {0xC651, 0},                                 //undocumented
    6040                 :            :         {0xF661, 0},                                 //undocumented
    6041                 :            :         {0x4873, &SwWW8ImplReader::Read_Language},   //"sprmCRgLid0" chp.rglid[0];
    6042                 :            :                                                      //LID: for non-Far East text;
    6043                 :            :                                                      //(like a duplicate of 486D)
    6044                 :            :         {0x4874, 0},                                 //"sprmCRgLid1" chp.rglid[1];
    6045                 :            :                                                      //LID: for Far East text
    6046                 :            :                                                      //(like a duplicate of 486E)
    6047                 :            :         {0x6463, 0},                                 //undocumented
    6048                 :            :         {0x2461, &SwWW8ImplReader::Read_RTLJustify}, //undoc, must be asian version
    6049                 :            :                                                      //of "sprmPJc"
    6050                 :            :         {0x845E, &SwWW8ImplReader::Read_LR},         //Apparently post-Word 97 version of "sprmPDxaLeft"
    6051                 :            :         {0x8460, &SwWW8ImplReader::Read_LR},         //Post-Word 97 version of "sprmPDxaLeft1"
    6052                 :            :         {0x845D, &SwWW8ImplReader::Read_LR},         //Post-Word 97 version of "sprmPDxaRight"
    6053                 :            :         {0x3615, 0},                                 //undocumented
    6054                 :            :         {0x360D, 0},                                 //undocumented
    6055                 :            :         {0x940E, 0},                                 //undocumented
    6056                 :            :         {0x940F, 0},                                 //undocumented
    6057                 :            :         {0x9410, 0},                                 //undocumented
    6058                 :            :         {0x703A, 0},                                 //undocumented
    6059                 :            :         {0x303B, 0},                                 //undocumented
    6060                 :            :         {0x244B, &SwWW8ImplReader::Read_TabCellEnd}, //undocumented, must be
    6061                 :            :                                                      //subtable "sprmPFInTable"
    6062                 :            :         {0x244C, &SwWW8ImplReader::Read_TabRowEnd},  //undocumented, must be
    6063                 :            :                                                      // subtable "sprmPFTtp"
    6064                 :            :         {0x6815, 0},                                 //undocumented
    6065                 :            :         {0x6816, 0},                                 //undocumented
    6066                 :            :         {0x6870, &SwWW8ImplReader::Read_TxtForeColor},
    6067                 :            :         {0xC64D, &SwWW8ImplReader::Read_ParaBackColor},
    6068                 :            :         {0x6467, 0},                                 //undocumented
    6069                 :            :         {0xF617, 0},                                 //undocumented
    6070                 :            :         {0xD660, 0},                                 //undocumented
    6071                 :            :         {0xD670, 0},                                 //undocumented
    6072                 :            :         {0xCA71, &SwWW8ImplReader::Read_TxtBackColor},//undocumented
    6073                 :            :         {0x303C, 0},                                 //undocumented
    6074                 :            :         {0x245B, &SwWW8ImplReader::Read_ParaAutoBefore},//undocumented, para
    6075                 :            :         {0x245C, &SwWW8ImplReader::Read_ParaAutoAfter},//undocumented, para
    6076                 :            :         {0x246D, &SwWW8ImplReader::Read_ParaContextualSpacing} //"sprmPFContextualSpacing"
    6077                 :            :     };
    6078                 :            : 
    6079 [ +  + ][ +  - ]:      48693 :     static wwSprmDispatcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
         [ +  - ][ #  # ]
    6080                 :      48693 :     return &aSprmSrch;
    6081                 :            : }
    6082                 :            : 
    6083                 :            : //-----------------------------------------
    6084                 :            : //      Hilfsroutinen : SPRM finden
    6085                 :            : //-----------------------------------------
    6086                 :            : 
    6087                 :      48693 : const SprmReadInfo& SwWW8ImplReader::GetSprmReadInfo(sal_uInt16 nId) const
    6088                 :            : {
    6089         [ +  - ]:      48693 :     ww::WordVersion eVersion = pWwFib->GetFIBVersion();
    6090                 :            :     const wwSprmDispatcher *pDispatcher;
    6091         [ -  + ]:      48693 :     if (eVersion <= ww::eWW2)
    6092         [ #  # ]:          0 :         pDispatcher = GetWW2SprmDispatcher();
    6093         [ -  + ]:      48693 :     else if (eVersion < ww::eWW8)
    6094         [ #  # ]:          0 :         pDispatcher = GetWW6SprmDispatcher();
    6095                 :            :     else
    6096         [ +  - ]:      48693 :         pDispatcher = GetWW8SprmDispatcher();
    6097                 :            : 
    6098                 :      48693 :     SprmReadInfo aSrch = {0, 0};
    6099                 :      48693 :     aSrch.nId = nId;
    6100         [ +  - ]:      48693 :     const SprmReadInfo* pFound = pDispatcher->search(aSrch);
    6101                 :            : 
    6102         [ +  + ]:      48693 :     if (!pFound)
    6103                 :            :     {
    6104                 :       2970 :         aSrch.nId = 0;
    6105         [ +  - ]:       2970 :         pFound = pDispatcher->search(aSrch);
    6106                 :            :     }
    6107                 :            : 
    6108                 :      48693 :     return *pFound;
    6109                 :            : }
    6110                 :            : 
    6111                 :            : //-----------------------------------------
    6112                 :            : //      Hilfsroutinen : SPRMs
    6113                 :            : //-----------------------------------------
    6114                 :      17790 : void SwWW8ImplReader::EndSprm( sal_uInt16 nId )
    6115                 :            : {
    6116 [ +  - ][ -  + ]:      35580 :     if( ( nId > 255 ) && ( nId < 0x0800 ) ) return;
    6117                 :            : 
    6118                 :      17790 :     const SprmReadInfo& rSprm = GetSprmReadInfo( nId );
    6119                 :            : 
    6120         [ +  + ]:      17790 :     if (rSprm.pReadFnc)
    6121         [ +  - ]:      10605 :         (this->*rSprm.pReadFnc)( nId, 0, -1 );
    6122                 :            : }
    6123                 :            : 
    6124                 :      30903 : short SwWW8ImplReader::ImportSprm(const sal_uInt8* pPos,sal_uInt16 nId)
    6125                 :            : {
    6126         [ +  + ]:      30903 :     if (!nId)
    6127                 :      11601 :         nId = mpSprmParser->GetSprmId(pPos);
    6128                 :            : 
    6129                 :            :     OSL_ENSURE( nId != 0xff, "Sprm FF !!!!" );
    6130                 :            : 
    6131                 :      30903 :     const SprmReadInfo& rSprm = GetSprmReadInfo(nId);
    6132                 :            : 
    6133                 :      30903 :     sal_uInt16 nFixedLen = mpSprmParser->DistanceToData(nId);
    6134                 :      30903 :     sal_uInt16 nL = mpSprmParser->GetSprmSize(nId, pPos);
    6135                 :            : 
    6136         [ +  + ]:      30903 :     if (rSprm.pReadFnc)
    6137         [ +  - ]:      22365 :         (this->*rSprm.pReadFnc)(nId, pPos + nFixedLen, nL - nFixedLen);
    6138                 :            : 
    6139                 :      30903 :     return nL;
    6140 [ +  - ][ +  - ]:         54 : }
    6141                 :            : 
    6142                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10