LCOV - code coverage report
Current view: top level - libreoffice/sw/source/filter/ww8 - ww8par6.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1444 2142 67.4 %
Date: 2012-12-17 Functions: 122 144 84.7 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10