LCOV - code coverage report
Current view: top level - libreoffice/sw/source/filter/ww1 - w1sprm.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 305 0.0 %
Date: 2012-12-27 Functions: 0 42 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include <hintids.hxx>
      22             : #include <tools/solar.h>
      23             : #include <editeng/paperinf.hxx>
      24             : #include <editeng/lrspitem.hxx>
      25             : #include <editeng/adjitem.hxx>
      26             : #include <editeng/spltitem.hxx>
      27             : #include <editeng/keepitem.hxx>
      28             : #include <editeng/boxitem.hxx>
      29             : #include <editeng/shaditem.hxx>
      30             : #include <editeng/ulspitem.hxx>
      31             : #include <editeng/lspcitem.hxx>
      32             : #include <editeng/tstpitem.hxx>
      33             : #include <fmtclds.hxx>
      34             : #include <fmtfsize.hxx>
      35             : #include <pam.hxx>
      36             : #include <ndtxt.hxx>
      37             : #include <charatr.hxx>
      38             : #include <frmatr.hxx>
      39             : #include <doc.hxx>
      40             : #include <fltini.hxx>
      41             : #include <docufld.hxx>
      42             : #include <pagedesc.hxx>
      43             : #include <flddat.hxx>
      44             : #include <reffld.hxx>
      45             : #include <expfld.hxx>
      46             : #include <w1par.hxx>
      47             : #include <mdiexp.hxx>
      48             : #include <swerror.h>
      49             : #include <statstr.hrc>
      50             : 
      51             : using ::editeng::SvxBorderLine;
      52             : using namespace ::com::sun::star;
      53             : 
      54             : /////////////////////////////////////////////////////////////// Ww1Sprm
      55           0 : void Ww1Sprm::Stop( Ww1Shell& rOut, Ww1Manager& rMan)
      56             : {
      57           0 :     if(IsUsed())
      58           0 :         for(short i=Count()-1;i>=0;i--){    // rueckwaerts
      59             :             sal_uInt8 nId;
      60             :             sal_uInt16 nSize;
      61             :             sal_uInt8* pSprm;
      62           0 :             Fill(i, nId, nSize, pSprm);
      63           0 :             GetTab(nId).Stop(rOut, nId, pSprm, nSize, rMan);
      64             :         }
      65           0 : }
      66             : 
      67           0 : void Ww1Sprm::Start(
      68             :     Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 i)
      69             : {
      70             :     sal_uInt8 nId;
      71             :     sal_uInt16 nSize;
      72             :     sal_uInt8* pSprm;
      73           0 :     Fill(i, nId, nSize, pSprm);
      74           0 :     GetTab(nId).Start(rOut, nId, pSprm, nSize, rMan);
      75           0 : }
      76             : 
      77           0 : void Ww1Sprm::Start(
      78             :     Ww1Shell& rOut, Ww1Manager& rMan)
      79             : {
      80           0 :     if(IsUsed())
      81           0 :         for(sal_uInt16 i=0;i<Count();i++)
      82           0 :             Start(rOut, rMan, i);
      83           0 : }
      84             : 
      85             : //////////////////////////////////////////////////////////// SingleSprm
      86           0 : void Ww1SingleSprm::Start(
      87             :     Ww1Shell&, sal_uInt8 /*nId*/, sal_uInt8*, sal_uInt16, Ww1Manager&)
      88             : {
      89           0 : }
      90             : 
      91           0 : void Ww1SingleSprm::Stop(
      92             :     Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&)
      93             : {
      94             : // OSL_ENSURE(FALSE, "Unknown Sprm");
      95           0 : }
      96             : 
      97             : ////////////////////////////////////////////////////////////////// STOP
      98             : //
      99             : // folgende defines werden genutzt zur implementierung der
     100             : // Stop()-Member der SingleSprm-klassen, da diese im normalfalle
     101             : // lediglich EndItem(s) in die shell stellen.
     102             : //
     103             : #define STOP1(Class, Code) \
     104             :     void Class::Stop( \
     105             :      Ww1Shell& rOut, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) { \
     106             :         rOut.EndItem(Code); }
     107             : #define STOP2(Class, Code1, Code2) \
     108             :     void Class::Stop( \
     109             :      Ww1Shell& rOut, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&) { \
     110             :         rOut.EndItem(Code1).EndItem(Code2); }
     111             : 
     112             : /////////////////////////////////////////////////////// SingleSprmXxxxx
     113             : //
     114             : // hier beginnt die auswertung der eigentlichen sprms. jeder sprmtyp
     115             : // hat eine eigene klasse, die die virtualen methoden start und stop
     116             : // implementiert. die klassen stehen in der sprm-tab, die statischer
     117             : // member von Ww1Sprm ist. taucht ein sprm im dokument auf, werden die
     118             : // virtualen methoden bei beginn und ende der formatierung gerufen.
     119             : //
     120           0 : void Ww1SingleSprmPDxaLeft::Start(
     121             :     Ww1Shell& rOut, sal_uInt8, sal_uInt8* pSprm, sal_uInt16, Ww1Manager&)
     122             : {
     123           0 :     SvxLRSpaceItem aLR((SvxLRSpaceItem&)rOut.GetAttr(RES_LR_SPACE));
     124           0 :     short nPara = SVBT16ToShort(pSprm);
     125           0 :     if(nPara < 0)
     126           0 :         nPara = 0;
     127           0 :     if(aLR.GetTxtFirstLineOfst() < -nPara)
     128           0 :         aLR.SetTxtFirstLineOfst(-nPara); // sonst weigert sich SetTxtLeft()
     129           0 :     aLR.SetTxtLeft(nPara);
     130           0 :     rOut << aLR;
     131           0 : }
     132             : 
     133           0 : void Ww1SingleSprmPDxaRight::Start(
     134             :     Ww1Shell& rOut, sal_uInt8, sal_uInt8* pSprm, sal_uInt16, Ww1Manager&)
     135             : {
     136           0 :     SvxLRSpaceItem aLR((SvxLRSpaceItem&)rOut.GetAttr(RES_LR_SPACE));
     137           0 :     short nPara = SVBT16ToShort(pSprm);
     138           0 :     if(nPara < 0)
     139           0 :         nPara = 0;
     140           0 :     aLR.SetRight(nPara);
     141           0 :     rOut << aLR;
     142           0 : }
     143             : 
     144           0 : void Ww1SingleSprmPDxaLeft1::Start(
     145             :     Ww1Shell& rOut, sal_uInt8, sal_uInt8* pSprm, sal_uInt16, Ww1Manager&)
     146             : {
     147           0 :     SvxLRSpaceItem aLR((SvxLRSpaceItem&)rOut.GetAttr(RES_LR_SPACE));
     148           0 :     short nPara = SVBT16ToShort(pSprm);
     149           0 :     if(-nPara >(short)aLR.GetTxtLeft())
     150           0 :         nPara = -(short)aLR.GetTxtLeft();
     151           0 :     aLR.SetTxtFirstLineOfst(nPara);
     152           0 :     rOut << aLR;
     153           0 : }
     154             : 
     155           0 : STOP1(Ww1SingleSprmPDxa, RES_LR_SPACE)
     156             : 
     157           0 : void Ww1SingleSprmPJc::Start(
     158             :     Ww1Shell& rOut, sal_uInt8, sal_uInt8* pSprm, sal_uInt16, Ww1Manager&)
     159             : {
     160             :     static SvxAdjust const aAdj[] = {
     161             :         SVX_ADJUST_LEFT,
     162             :         SVX_ADJUST_CENTER,
     163             :         SVX_ADJUST_RIGHT,
     164             :         SVX_ADJUST_BLOCK };
     165           0 :     sal_uInt8 nPara = SVBT8ToByte(pSprm);
     166           0 :     nPara %=SAL_N_ELEMENTS(aAdj);
     167           0 :     rOut << SvxAdjustItem(aAdj[nPara], RES_PARATR_ADJUST);
     168           0 : }
     169             : 
     170           0 : STOP1(Ww1SingleSprmPJc, RES_PARATR_ADJUST)
     171             : 
     172           0 : void Ww1SingleSprmPFKeep::Start(
     173             :     Ww1Shell& rOut, sal_uInt8, sal_uInt8* pSprm, sal_uInt16, Ww1Manager&)
     174             : {
     175           0 :     rOut << SvxFmtSplitItem((SVBT8ToByte(pSprm) & 1) == 0, RES_PARATR_SPLIT);
     176           0 : }
     177             : 
     178           0 : STOP1(Ww1SingleSprmPFKeep, RES_PARATR_SPLIT)
     179             : 
     180           0 : void Ww1SingleSprmPFKeepFollow::Start(
     181             :     Ww1Shell& rOut, sal_uInt8, sal_uInt8* pSprm, sal_uInt16, Ww1Manager&)
     182             : {
     183           0 :     rOut << SvxFmtKeepItem((SVBT8ToByte(pSprm) & 1) != 0, RES_KEEP);
     184           0 : }
     185             : 
     186           0 : STOP1(Ww1SingleSprmPFKeepFollow, RES_KEEP)
     187             : 
     188           0 : void Ww1SingleSprmPPageBreakBefore::Start(
     189             :     Ww1Shell& rOut, sal_uInt8, sal_uInt8* pSprm, sal_uInt16, Ww1Manager&)
     190             : {
     191           0 :     rOut << SvxFmtBreakItem(SVBT8ToByte(pSprm) & 1?
     192           0 :      SVX_BREAK_PAGE_BEFORE:SVX_BREAK_NONE, RES_BREAK );
     193           0 : }
     194             : 
     195           0 : STOP1(Ww1SingleSprmPPageBreakBefore, RES_BREAK)
     196             : 
     197           0 : SvxBorderLine* Ww1SingleSprmPBrc::SetBorder(SvxBorderLine* pLine, W1_BRC10* pBrc)
     198             : {
     199             :     sal_uInt16 nCode;
     200           0 :     ::editeng::SvxBorderStyle eStyle = table::BorderLineStyle::SOLID;
     201           0 :     if(pBrc->dxpLine2WidthGet() == 0)
     202             :     {
     203           0 :         switch(pBrc->dxpLine1WidthGet())
     204             :         {
     205             :         default: OSL_FAIL("unknown linewidth");
     206           0 :         case 0: return 0;                           // keine Linie
     207           0 :         case 1: nCode = DEF_LINE_WIDTH_0; break;
     208           0 :         case 2: nCode = DEF_LINE_WIDTH_1; break;
     209           0 :         case 3: nCode = DEF_LINE_WIDTH_2; break;
     210           0 :         case 4: nCode = DEF_LINE_WIDTH_3; break;
     211           0 :         case 5: nCode = DEF_LINE_WIDTH_4; break;
     212             :         case 6:
     213           0 :                 nCode = DEF_LINE_WIDTH_5;
     214           0 :                 eStyle = table::BorderLineStyle::DOTTED;
     215           0 :                 break;
     216             :         case 7:
     217           0 :                 nCode = DEF_LINE_WIDTH_5;
     218           0 :                 eStyle = table::BorderLineStyle::DASHED;
     219           0 :                 break;
     220             :         }
     221           0 :         pLine->SetWidth( nCode );
     222           0 :         pLine->SetBorderLineStyle( eStyle );
     223             :     }
     224             :     else
     225             :     {
     226           0 :         if ( pBrc->dxpLine1WidthGet() == 1 && pBrc->dxpLine2WidthGet() == 1 )
     227             :         {
     228           0 :             pLine->SetBorderLineStyle( table::BorderLineStyle::DOUBLE );
     229           0 :             pLine->SetWidth( DEF_LINE_WIDTH_0 );
     230             :         }
     231             :         else
     232             :             OSL_ENSURE(sal_False, "unknown linewidth");
     233             :     }
     234           0 :     return pLine;
     235             : }
     236             : 
     237           0 : void Ww1SingleSprmPBrc::Start(
     238             :     Ww1Shell& rOut, sal_uInt8,
     239             :     W1_BRC10* pBrc,
     240             :     sal_uInt16
     241             : #if OSL_DEBUG_LEVEL > 0
     242             :     nSize
     243             : #endif
     244             :     ,
     245             :     Ww1Manager& /*rMan*/,
     246             :     SvxBoxItem& aBox)
     247             : {
     248             : #if OSL_DEBUG_LEVEL > 0
     249             :     OSL_ENSURE(sizeof(W1_BRC10) == nSize, "sizemissmatch");
     250             : #endif
     251           0 :     if(pBrc->dxpSpaceGet())
     252           0 :         aBox.SetDistance(10 + 20 * pBrc->dxpSpaceGet());
     253             :             //??? Warum 10+... ????
     254             : 
     255           0 :     if( rOut.IsInFly() )
     256           0 :         rOut.SetFlyFrmAttr( aBox );
     257             :     else
     258           0 :         rOut << aBox;
     259             : 
     260           0 :     if(pBrc->fShadowGet())
     261             :     {
     262           0 :         Color aBlack(COL_BLACK); // schwarzer...
     263             :         SvxShadowItem aS(RES_SHADOW,(const Color*)&aBlack, 32,
     264           0 :                          SVX_SHADOW_BOTTOMRIGHT); // 1.6 tw breit
     265           0 :         if( rOut.IsInFly() )
     266           0 :             rOut.SetFlyFrmAttr( aS );
     267             :         else
     268           0 :             rOut << aS;
     269             :     }
     270           0 : }
     271             : 
     272           0 : STOP2(Ww1SingleSprmPBrc, RES_BOX, RES_SHADOW)
     273             : 
     274             : static sal_uInt16 nBrcTrans[BRC_ANZ] =
     275             :      { BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT };
     276             : 
     277           0 : void Ww1SingleSprmPBrc10::Start(
     278             :     Ww1Shell& rOut, sal_uInt8 nId, sal_uInt8* pSprm, sal_uInt16 nSize, Ww1Manager& rMan)
     279             : {
     280             : 
     281           0 :     W1_BRC10* pBrc =(W1_BRC10*)pSprm;
     282           0 :     const SfxPoolItem &rItem = ( ( rOut.IsInFly() ) ?
     283           0 :                      rOut.GetFlyFrmAttr(RES_BOX) :rOut.GetAttr(RES_BOX));
     284           0 :     const SvxBoxItem &rBoxItem = (const SvxBoxItem&)rItem;
     285           0 :     SvxBoxItem aBox( rBoxItem );
     286           0 :     SvxBorderLine aLine;
     287           0 :     aBox.SetLine(SetBorder(&aLine, pBrc), nBrcTrans[nLine] );
     288           0 :     Ww1SingleSprmPBrc::Start(rOut, nId, pBrc, nSize, rMan, aBox);
     289           0 : }
     290             : 
     291           0 : STOP1(Ww1SingleSprmParaSpace, RES_UL_SPACE)
     292             : 
     293           0 : void Ww1SingleSprmPDyaBefore::Start(
     294             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     295             : {
     296           0 :     short nPara = SVBT16ToShort(pSprm);
     297           0 :     if(nPara < 0)
     298           0 :         nPara = -nPara;
     299           0 :     SvxULSpaceItem aUL((SvxULSpaceItem&)rOut.GetAttr(RES_UL_SPACE));
     300           0 :     aUL.SetUpper(nPara);
     301           0 :     rOut << aUL;
     302           0 : }
     303             : 
     304           0 : void Ww1SingleSprmPDyaAfter::Start(
     305             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     306             : {
     307           0 :     short nPara = SVBT16ToShort(pSprm);
     308           0 :     if(nPara < 0)
     309           0 :         nPara = -nPara;
     310           0 :     SvxULSpaceItem aUL((SvxULSpaceItem&)rOut.GetAttr(RES_UL_SPACE));
     311           0 :     aUL.SetLower(nPara);
     312           0 :     rOut << aUL;
     313           0 : }
     314             : 
     315           0 : STOP1(Ww1SingleSprmPDyaLine, RES_PARATR_LINESPACING)
     316             : 
     317           0 : void Ww1SingleSprmPDyaLine::Start(
     318             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     319             : {
     320           0 :     short nSpace = SVBT16ToShort(pSprm);
     321           0 :     if(nSpace < 0)
     322           0 :         nSpace = -nSpace;
     323           0 :     SvxLineSpacingItem aLSpc( LINE_SPACE_DEFAULT_HEIGHT, RES_PARATR_LINESPACING );
     324             :     if(sal_True)
     325             :     {// MultilineSpace(proportional)
     326           0 :         long n = nSpace * 100 / 240;    // W1: 240 = 100%, SW: 100 = 100%
     327           0 :         if(n>200)
     328           0 :             n = 200; // SW_UI-Maximum
     329           0 :         aLSpc.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
     330           0 :         aLSpc.SetPropLineSpace((sal_uInt8)n);
     331             :     }
     332             :     else
     333             :     {// Fixed / Minimum
     334             :         aLSpc.SetLineHeight((sal_uInt16)nSpace);
     335             :         aLSpc.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
     336             :     }
     337           0 :     rOut << aLSpc;
     338           0 : }
     339             : 
     340           0 : void Ww1SingleSprmPChgTabsPapx::Start(
     341             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     342             : {
     343             : 
     344           0 :     short nLeftPMgn = 0;    // Koordinaten etwa gleich ??
     345             : 
     346             :     short i;
     347           0 :     sal_uInt8 nDel = pSprm[1];
     348           0 :     sal_uInt8* pDel = pSprm + 2;                        // Del - Array
     349           0 :     sal_uInt8 nIns = pSprm[nDel*2+2];
     350           0 :     sal_uInt8* pIns = pSprm + 2*nDel + 3;           // Ins - Array
     351           0 :     W1_TBD* pTyp = (W1_TBD*)(pSprm + 2*nDel + 2*nIns + 3);// Typ - Array
     352             : 
     353           0 :     SvxTabStopItem aAttr( (SvxTabStopItem&)rOut.GetNodeOrStyAttr( RES_PARATR_TABSTOP ));
     354             : 
     355           0 :     SvxTabStop aTabStop;
     356             : 
     357           0 :     for( i=0; i<nDel; i++ ){
     358           0 :         sal_uInt16 nPos = aAttr.GetPos( SVBT16ToShort( pDel + i*2 ) - nLeftPMgn );
     359           0 :         if( nPos != SVX_TAB_NOTFOUND )
     360           0 :             aAttr.Remove( nPos, 1 );
     361             :     }
     362             : 
     363           0 :     for( i=0; i<nIns; i++ ){
     364           0 :         short nPos = SVBT16ToShort( pIns + i*2 ) - nLeftPMgn;
     365           0 :         if( nPos < 0 )
     366           0 :             continue;
     367           0 :         aTabStop.GetTabPos() = nPos;
     368           0 :         switch( pTyp[i].jcGet() ){
     369           0 :         case 0: aTabStop.GetAdjustment() = SVX_TAB_ADJUST_LEFT; break;
     370           0 :         case 1: aTabStop.GetAdjustment() = SVX_TAB_ADJUST_CENTER; break;
     371           0 :         case 2: aTabStop.GetAdjustment() = SVX_TAB_ADJUST_RIGHT; break;
     372           0 :         case 3: aTabStop.GetAdjustment() = SVX_TAB_ADJUST_DECIMAL; break;
     373           0 :         case 4: continue;                   // ignoriere Bar
     374             :         }
     375             : 
     376           0 :         switch( pTyp[i].tlcGet() ){
     377           0 :         case 0: aTabStop.GetFill() = ' '; break;
     378           0 :         case 1: aTabStop.GetFill() = '.'; break;
     379           0 :         case 2: aTabStop.GetFill() = '-'; break;
     380             :         case 3:
     381           0 :         case 4: aTabStop.GetFill() = '_'; break;
     382             :         }
     383             : 
     384           0 :         sal_uInt16 nPos2 = aAttr.GetPos( nPos );
     385           0 :         if( nPos2 != SVX_TAB_NOTFOUND )
     386           0 :             aAttr.Remove( nPos2, 1 );       // sonst weigert sich das Insert()
     387             : 
     388           0 :         aAttr.Insert( aTabStop );
     389             :     }
     390           0 :     rOut << aAttr;
     391           0 : }
     392             : 
     393           0 : STOP1(Ww1SingleSprmPChgTabsPapx, RES_PARATR_TABSTOP)
     394             : 
     395           0 : void Ww1SingleSprmSGprfIhdt::Start(
     396             :     Ww1Shell& /*rOut*/, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& rMan)
     397             : {
     398           0 :     rMan.GetSep().SetGrpfIhdt(SVBT8ToByte(pSprm));
     399           0 : }
     400             : 
     401           0 : void Ww1SingleSprmSColumns::Start(
     402             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     403             : {
     404           0 :     short nColSpace = 708; // default 1,25 cm
     405           0 :     short nNettoWidth = -1; //~ mdt: dxaLeft/Right missing...
     406           0 :     short nCols = SVBT16ToShort(pSprm);
     407           0 :     nCols++;
     408           0 :     if (nCols < 2)
     409           0 :         return;
     410           0 :     SwFmtCol aCol;
     411           0 :     aCol.Init(nCols, nColSpace, nNettoWidth);
     412           0 :     rOut.GetPageDesc().GetMaster().SetFmtAttr(aCol);
     413             : }
     414             : 
     415           0 : void Ww1SingleSprmPTtp::Start(
     416             :     Ww1Shell& /*rOut*/, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager& rMan)
     417             : {
     418           0 :     rMan.SetInTtp( sal_True );      // Besonderheit: wird bei InTable::Stop und
     419             :                                 // nicht bei InTtp::Stop zurueckgesetzt,
     420             :                                 // da Auswertung in InTable
     421           0 : }
     422             : 
     423           0 : void Ww1SingleSprmPTtp::Stop(
     424             :     Ww1Shell& rOut, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager& rMan)
     425             : {
     426           0 :     if (rOut.IsInTable() && rMan.HasInTable())
     427           0 :         rOut.NextTableRow();
     428           0 : }
     429             : 
     430           0 : void Ww1SingleSprmPFInTable::Start(
     431             :     Ww1Shell& /*rOut*/, sal_uInt8, sal_uInt8*, sal_uInt16,
     432             :     Ww1Manager& /*rMan*/)
     433             : {
     434           0 : }
     435             : 
     436           0 : void Ww1SingleSprmPFInTable::Stop(
     437             :     Ww1Shell&
     438             : #if OSL_DEBUG_LEVEL > 0
     439             :     rOut
     440             : #endif
     441             :     ,
     442             :     sal_uInt8, sal_uInt8*, sal_uInt16,
     443             :     Ww1Manager& /*rMan*/)
     444             : {
     445             : #if OSL_DEBUG_LEVEL > 0
     446             :     OSL_ENSURE(rOut.IsInTable(), "");
     447             : #endif
     448           0 : }
     449             : 
     450           0 : void Ww1SingleSprmTDxaGapHalf::Start(
     451             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     452             : {
     453           0 :     short nSpace = SVBT16ToShort(pSprm);
     454           0 :     rOut.SetCellSpace(nSpace);
     455           0 : }
     456             : 
     457           0 : void Ww1SingleSprmTDefTable10::Start(
     458             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 nSize, Ww1Manager& /*rMan*/)
     459             : {
     460             :     sal_uInt16 i;
     461           0 :     sal_uInt8 *p = pSprm + 2;   // LaengenWord ueberlesen
     462           0 :     sal_uInt8 nCount = *p;
     463           0 :     p++;
     464           0 :     nSize -= 3;
     465             : // Es fehlt noch:
     466             : // - GapHalf
     467             : // - eventuelle Ausduennung der Zellenumrandungen
     468             : 
     469           0 :     if( nCount < 1 || nCount > 32 || nSize < ( nCount + 1 ) * 2  )
     470           0 :         return;
     471             : 
     472             : // Erstmal die Zellenpositionen einlesen
     473           0 :     short nPos = SVBT16ToShort( p );    // signed, kann auch neg. sein !!!
     474             : 
     475             :     {
     476           0 :         short nWholeWidth = SVBT16ToShort( p + 2 * nCount ) - nPos;
     477           0 :         rOut.SetTableWidth( (sal_uInt16)nWholeWidth );  // Tabellenbreite setzen
     478             : 
     479             : // Pos der Tabelle setzen
     480           0 :         long nMidTab = nPos + nWholeWidth / 2;      // TabellenMitte
     481           0 :         const SwFrmFmt &rFmt = rOut.GetPageDesc().GetMaster();
     482           0 :         const SvxLRSpaceItem& rLR = rFmt.GetLRSpace();
     483           0 :         long nRight = rFmt.GetFrmSize().GetWidth()
     484           0 :                       - rLR.GetLeft() - rLR.GetRight();
     485             : 
     486           0 :         sal_Int16 eOri = text::HoriOrientation::LEFT;
     487           0 :         if( nPos > MINLAY ){                        // per Zuppeln positioniert
     488           0 :             if ( nMidTab <= nRight / 3 )            // 1/3 der Seite
     489           0 :                 eOri = text::HoriOrientation::LEFT;
     490           0 :             else if ( nMidTab <= 2 * nRight / 3 )   // 2/3 der Seite
     491           0 :                 eOri = text::HoriOrientation::CENTER;
     492             :             else
     493           0 :                 eOri = text::HoriOrientation::RIGHT;
     494             :         }
     495           0 :         rOut.SetTableOrient( eOri );
     496             :     }
     497             : 
     498           0 :     sal_uInt8* pEndPos = p+2;
     499           0 :     sal_uInt8* pTc0 = ( nSize >= nCount * 10 ) ? pEndPos + 2 * nCount : 0;
     500           0 :     sal_uInt16 nCellsDeleted = 0;       // fuer gemergte Zellen
     501             : 
     502           0 :     for( i = 0; i < nCount; i++ ){
     503             : // Info sammeln
     504           0 :         W1_TC* pTc = (W1_TC*)pTc0;
     505           0 :         sal_Bool bMerged = (pTc) ? pTc->fMergedGet() : sal_False;
     506             : 
     507             : // Zellenbreiten setzen
     508           0 :         sal_uInt16 nPos1 = SVBT16ToShort( pEndPos );
     509           0 :         if( !bMerged )
     510           0 :             rOut.SetCellWidth( nPos1 - nPos, i - nCellsDeleted );
     511             :                                         // Zellenbreite setzen
     512             :                                         // Wechselwirkung mit GapHalf fehlt noch
     513             :                                         // ( GapHalf wird noch ignoriert )
     514           0 :         pEndPos+=2;
     515           0 :         nPos = nPos1;
     516             : 
     517           0 :         if( pTc0 ){                     // gibts TCs ueberhaupt ?
     518           0 :             W1_TC* pTc2 = (W1_TC*)pTc0;
     519           0 :             sal_Bool bMerged2 = pTc2->fMergedGet();
     520           0 :             if( !bMerged2 ){
     521             : // und nun die Umrandungen
     522           0 :                 SvxBoxItem aBox( (SvxBoxItem&)rOut.GetCellAttr( RES_BOX ));
     523           0 :                 SvxBorderLine aLine;
     524           0 :                 W1_BRC10* pBrc = pTc2->rgbrcGet();
     525           0 :                 for( sal_uInt16 j=0; j<4; j++ ){
     526           0 :                     aBox.SetLine(Ww1SingleSprmPBrc::SetBorder(&aLine, pBrc),
     527           0 :                                  nBrcTrans[j]);
     528           0 :                     pBrc++;
     529             :                 }
     530           0 :                 rOut.SetCellBorder( aBox, i - nCellsDeleted );
     531             :             }else{
     532             : // gemergte Zellen entfernen
     533           0 :                 rOut.DeleteCell( i - nCellsDeleted );
     534           0 :                 nCellsDeleted++;
     535             :             }
     536           0 :             pTc0+=sizeof(W1_TC);    // 10
     537             :         }
     538             :     }
     539             : }
     540             : 
     541             : 
     542           0 : void Ww1SingleSprmTDyaRowHeight::Start(
     543             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     544             : {
     545           0 :     short nSpace = SVBT16ToShort(pSprm);
     546           0 :     rOut.SetCellHeight(nSpace);
     547           0 : }
     548             : 
     549             : // Fastsave-Attribute brauche ich als Dymmys nicht
     550             : 
     551           0 : void Ww1SingleSprmPpc::Start(
     552             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& rMan)
     553             : {
     554           0 :     sal_uInt8 nPpc = SVBT8ToByte(pSprm);
     555             : 
     556           0 :     if (rOut.IsInTable())                       // Flys in Tabellen kann PMW
     557           0 :         return;                                 // nicht
     558             : 
     559             :     RndStdIds eAnchor;          // Bindung
     560             : 
     561           0 :     switch ( ( nPpc & 0x30 ) >> 4 )     // Y - Bindung bestimmt Sw-Bindung
     562             :     {
     563             :         case 0:
     564           0 :             eAnchor = FLY_AT_PARA;      // Vert Margin
     565           0 :             break;
     566             :         default:
     567           0 :             eAnchor = FLY_AT_PAGE;      // Vert Page oder unknown
     568           0 :             break;                          // 2=Vert. Paragraph, 3=Use Default
     569             :     }
     570             : 
     571           0 :     if( !rOut.IsInFly() && rMan.IsInStyle() ){
     572           0 :         rOut.BeginFly( eAnchor );           // Starte StyleFly
     573             :     }else{
     574           0 :         rOut.SetFlyAnchor( eAnchor );       // Setze Anker
     575             :     }
     576             : }
     577             : 
     578           0 : void Ww1SingleSprmPDxaAbs::Start(
     579             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& rMan)
     580             : {
     581           0 :     short nXPos = SVBT16ToShort(pSprm);
     582             : 
     583           0 :     if( rMan.IsInStyle() && !rOut.IsInFly() ){
     584           0 :         rOut.BeginFly();                    // Fly ohne PPc-Attribut
     585             :     }
     586             : 
     587           0 :     sal_Int16 eHRel = text::RelOrientation::FRAME;
     588           0 :     sal_Int16 eHAlign = text::HoriOrientation::NONE;
     589             : 
     590           0 :     switch( nXPos ){                        // besondere X-Positionen ?
     591             :     case 0:
     592           0 :     case -12: eHAlign = text::HoriOrientation::NONE; nXPos = 0; break;   // Mogel: innen -> links
     593             :                             // eigentich text::HoriOrientation::LEFT, aber dann verrueckt
     594             :                             // ein Abstand nach aussen den Fly
     595           0 :     case -4:  eHAlign = text::HoriOrientation::CENTER; nXPos = 0; break; // zentriert
     596             :     case -8:                                           // rechts
     597           0 :     case -16: eHAlign = text::HoriOrientation::RIGHT; nXPos = 0; break;  // Mogel: aussen -> rechts
     598             : 
     599             :     }
     600           0 :     rOut.SetFlyXPos( nXPos, eHRel, eHAlign );
     601           0 : }
     602             : 
     603           0 : void Ww1SingleSprmPDyaAbs::Start(
     604             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     605             : {
     606           0 :     short nYPos = SVBT16ToShort(pSprm);
     607           0 :     sal_Int16 eVRel = text::RelOrientation::FRAME;
     608           0 :     sal_Int16 eVAlign = text::VertOrientation::NONE;
     609             : 
     610           0 :     switch( nYPos ){                            // besondere Y-Positionen ?
     611           0 :     case -4:  eVAlign = text::VertOrientation::TOP; nYPos = 0; break; // oben
     612           0 :     case -8:  eVAlign = text::VertOrientation::CENTER; nYPos = 0; break;  // zentriert
     613           0 :     case -12: eVAlign = text::VertOrientation::BOTTOM; nYPos = 0; break;  // unten
     614             : 
     615             :     }
     616           0 :     rOut.SetFlyYPos( nYPos, eVRel, eVAlign );
     617           0 : }
     618             : 
     619           0 : void Ww1SingleSprmPDxaWidth::Start(
     620             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     621             : {
     622           0 :     short nDxaWidth = SVBT16ToShort(pSprm);
     623           0 :     rOut.SetFlyFrmAttr( SwFmtFrmSize( ATT_VAR_SIZE, nDxaWidth, MINFLY ) );
     624           0 : }
     625             : 
     626           0 : void Ww1SingleSprmPFromText::Start(
     627             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     628             : {
     629           0 :     if( rOut.IsInFly() ){   // Kommt auch ausserhalb eines Flys vor, hat
     630             :                             // dann aber offensichtlich nichts zu bedeuten.
     631             :                             // Einen impliziten Fly-Anfang bedeutet es
     632             :                             // definitiv nicht
     633           0 :         short nFromText = SVBT16ToShort(pSprm);
     634             : 
     635           0 :         SvxLRSpaceItem aLR( RES_LR_SPACE );
     636           0 :         aLR.SetTxtLeft( nFromText );
     637           0 :         aLR.SetRight( nFromText );
     638           0 :         rOut.SetFlyFrmAttr( aLR );
     639             : 
     640           0 :         rOut.SetFlyFrmAttr( SvxULSpaceItem( nFromText, nFromText, RES_UL_SPACE ) );
     641             :     }
     642           0 : }
     643             : 
     644             : #undef STOP1
     645             : #undef STOP2
     646             : 
     647             : 
     648             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10