LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/filter/ww1 - w1sprm.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 305 0.3 %
Date: 2013-07-09 Functions: 2 44 4.5 %
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/adjustitem.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(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             :     {// MultilineSpace(proportional)
     325           0 :         long n = nSpace * 100 / 240;    // W1: 240 = 100%, SW: 100 = 100%
     326           0 :         if(n>200)
     327           0 :             n = 200; // SW_UI-Maximum
     328           0 :         aLSpc.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
     329           0 :         aLSpc.SetPropLineSpace((sal_uInt8)n);
     330             :     }
     331           0 :     rOut << aLSpc;
     332           0 : }
     333             : 
     334           0 : void Ww1SingleSprmPChgTabsPapx::Start(
     335             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     336             : {
     337             : 
     338           0 :     short nLeftPMgn = 0;    // Koordinaten etwa gleich ??
     339             : 
     340             :     short i;
     341           0 :     sal_uInt8 nDel = pSprm[1];
     342           0 :     sal_uInt8* pDel = pSprm + 2;                        // Del - Array
     343           0 :     sal_uInt8 nIns = pSprm[nDel*2+2];
     344           0 :     sal_uInt8* pIns = pSprm + 2*nDel + 3;           // Ins - Array
     345           0 :     W1_TBD* pTyp = (W1_TBD*)(pSprm + 2*nDel + 2*nIns + 3);// Typ - Array
     346             : 
     347           0 :     SvxTabStopItem aAttr( (SvxTabStopItem&)rOut.GetNodeOrStyAttr( RES_PARATR_TABSTOP ));
     348             : 
     349           0 :     SvxTabStop aTabStop;
     350             : 
     351           0 :     for( i=0; i<nDel; i++ ){
     352           0 :         sal_uInt16 nPos = aAttr.GetPos( SVBT16ToShort( pDel + i*2 ) - nLeftPMgn );
     353           0 :         if( nPos != SVX_TAB_NOTFOUND )
     354           0 :             aAttr.Remove( nPos, 1 );
     355             :     }
     356             : 
     357           0 :     for( i=0; i<nIns; i++ ){
     358           0 :         short nPos = SVBT16ToShort( pIns + i*2 ) - nLeftPMgn;
     359           0 :         if( nPos < 0 )
     360           0 :             continue;
     361           0 :         aTabStop.GetTabPos() = nPos;
     362           0 :         switch( pTyp[i].jcGet() ){
     363           0 :         case 0: aTabStop.GetAdjustment() = SVX_TAB_ADJUST_LEFT; break;
     364           0 :         case 1: aTabStop.GetAdjustment() = SVX_TAB_ADJUST_CENTER; break;
     365           0 :         case 2: aTabStop.GetAdjustment() = SVX_TAB_ADJUST_RIGHT; break;
     366           0 :         case 3: aTabStop.GetAdjustment() = SVX_TAB_ADJUST_DECIMAL; break;
     367           0 :         case 4: continue;                   // ignoriere Bar
     368             :         }
     369             : 
     370           0 :         switch( pTyp[i].tlcGet() ){
     371           0 :         case 0: aTabStop.GetFill() = ' '; break;
     372           0 :         case 1: aTabStop.GetFill() = '.'; break;
     373           0 :         case 2: aTabStop.GetFill() = '-'; break;
     374             :         case 3:
     375           0 :         case 4: aTabStop.GetFill() = '_'; break;
     376             :         }
     377             : 
     378           0 :         sal_uInt16 nPos2 = aAttr.GetPos( nPos );
     379           0 :         if( nPos2 != SVX_TAB_NOTFOUND )
     380           0 :             aAttr.Remove( nPos2, 1 );       // sonst weigert sich das Insert()
     381             : 
     382           0 :         aAttr.Insert( aTabStop );
     383             :     }
     384           0 :     rOut << aAttr;
     385           0 : }
     386             : 
     387           0 : STOP1(Ww1SingleSprmPChgTabsPapx, RES_PARATR_TABSTOP)
     388             : 
     389           0 : void Ww1SingleSprmSGprfIhdt::Start(
     390             :     Ww1Shell& /*rOut*/, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& rMan)
     391             : {
     392           0 :     rMan.GetSep().SetGrpfIhdt(SVBT8ToByte(pSprm));
     393           0 : }
     394             : 
     395           0 : void Ww1SingleSprmSColumns::Start(
     396             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     397             : {
     398           0 :     short nColSpace = 708; // default 1,25 cm
     399           0 :     short nNettoWidth = -1; //~ mdt: dxaLeft/Right missing...
     400           0 :     short nCols = SVBT16ToShort(pSprm);
     401           0 :     nCols++;
     402           0 :     if (nCols < 2)
     403           0 :         return;
     404           0 :     SwFmtCol aCol;
     405           0 :     aCol.Init(nCols, nColSpace, nNettoWidth);
     406           0 :     rOut.GetPageDesc().GetMaster().SetFmtAttr(aCol);
     407             : }
     408             : 
     409           0 : void Ww1SingleSprmPTtp::Start(
     410             :     Ww1Shell& /*rOut*/, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager& rMan)
     411             : {
     412           0 :     rMan.SetInTtp( true );      // Besonderheit: wird bei InTable::Stop und
     413             :                                 // nicht bei InTtp::Stop zurueckgesetzt,
     414             :                                 // da Auswertung in InTable
     415           0 : }
     416             : 
     417           0 : void Ww1SingleSprmPTtp::Stop(
     418             :     Ww1Shell& rOut, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager& rMan)
     419             : {
     420           0 :     if (rOut.IsInTable() && rMan.HasInTable())
     421           0 :         rOut.NextTableRow();
     422           0 : }
     423             : 
     424           0 : void Ww1SingleSprmPFInTable::Start(
     425             :     Ww1Shell& /*rOut*/, sal_uInt8, sal_uInt8*, sal_uInt16,
     426             :     Ww1Manager& /*rMan*/)
     427             : {
     428           0 : }
     429             : 
     430           0 : void Ww1SingleSprmPFInTable::Stop(
     431             :     Ww1Shell&
     432             : #if OSL_DEBUG_LEVEL > 0
     433             :     rOut
     434             : #endif
     435             :     ,
     436             :     sal_uInt8, sal_uInt8*, sal_uInt16,
     437             :     Ww1Manager& /*rMan*/)
     438             : {
     439             : #if OSL_DEBUG_LEVEL > 0
     440             :     OSL_ENSURE(rOut.IsInTable(), "");
     441             : #endif
     442           0 : }
     443             : 
     444           0 : void Ww1SingleSprmTDxaGapHalf::Start(
     445             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     446             : {
     447           0 :     short nSpace = SVBT16ToShort(pSprm);
     448           0 :     rOut.SetCellSpace(nSpace);
     449           0 : }
     450             : 
     451           0 : void Ww1SingleSprmTDefTable10::Start(
     452             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 nSize, Ww1Manager& /*rMan*/)
     453             : {
     454             :     sal_uInt16 i;
     455           0 :     sal_uInt8 *p = pSprm + 2;   // LaengenWord ueberlesen
     456           0 :     sal_uInt8 nCount = *p;
     457           0 :     p++;
     458           0 :     nSize -= 3;
     459             : // Es fehlt noch:
     460             : // - GapHalf
     461             : // - eventuelle Ausduennung der Zellenumrandungen
     462             : 
     463           0 :     if( nCount < 1 || nCount > 32 || nSize < ( nCount + 1 ) * 2  )
     464           0 :         return;
     465             : 
     466             : // Erstmal die Zellenpositionen einlesen
     467           0 :     short nPos = SVBT16ToShort( p );    // signed, kann auch neg. sein !!!
     468             : 
     469             :     {
     470           0 :         short nWholeWidth = SVBT16ToShort( p + 2 * nCount ) - nPos;
     471           0 :         rOut.SetTableWidth( (sal_uInt16)nWholeWidth );  // Tabellenbreite setzen
     472             : 
     473             : // Pos der Tabelle setzen
     474           0 :         long nMidTab = nPos + nWholeWidth / 2;      // TabellenMitte
     475           0 :         const SwFrmFmt &rFmt = rOut.GetPageDesc().GetMaster();
     476           0 :         const SvxLRSpaceItem& rLR = rFmt.GetLRSpace();
     477           0 :         long nRight = rFmt.GetFrmSize().GetWidth()
     478           0 :                       - rLR.GetLeft() - rLR.GetRight();
     479             : 
     480           0 :         sal_Int16 eOri = text::HoriOrientation::LEFT;
     481           0 :         if( nPos > MINLAY ){                        // per Zuppeln positioniert
     482           0 :             if ( nMidTab <= nRight / 3 )            // 1/3 der Seite
     483           0 :                 eOri = text::HoriOrientation::LEFT;
     484           0 :             else if ( nMidTab <= 2 * nRight / 3 )   // 2/3 der Seite
     485           0 :                 eOri = text::HoriOrientation::CENTER;
     486             :             else
     487           0 :                 eOri = text::HoriOrientation::RIGHT;
     488             :         }
     489           0 :         rOut.SetTableOrient( eOri );
     490             :     }
     491             : 
     492           0 :     sal_uInt8* pEndPos = p+2;
     493           0 :     sal_uInt8* pTc0 = ( nSize >= nCount * 10 ) ? pEndPos + 2 * nCount : 0;
     494           0 :     sal_uInt16 nCellsDeleted = 0;       // fuer gemergte Zellen
     495             : 
     496           0 :     for( i = 0; i < nCount; i++ ){
     497             : // Info sammeln
     498           0 :         W1_TC* pTc = (W1_TC*)pTc0;
     499           0 :         sal_Bool bMerged = (pTc) ? pTc->fMergedGet() : sal_False;
     500             : 
     501             : // Zellenbreiten setzen
     502           0 :         sal_uInt16 nPos1 = SVBT16ToShort( pEndPos );
     503           0 :         if( !bMerged )
     504           0 :             rOut.SetCellWidth( nPos1 - nPos, i - nCellsDeleted );
     505             :                                         // Zellenbreite setzen
     506             :                                         // Wechselwirkung mit GapHalf fehlt noch
     507             :                                         // ( GapHalf wird noch ignoriert )
     508           0 :         pEndPos+=2;
     509           0 :         nPos = nPos1;
     510             : 
     511           0 :         if( pTc0 ){                     // gibts TCs ueberhaupt ?
     512           0 :             W1_TC* pTc2 = (W1_TC*)pTc0;
     513           0 :             sal_Bool bMerged2 = pTc2->fMergedGet();
     514           0 :             if( !bMerged2 ){
     515             : // und nun die Umrandungen
     516           0 :                 SvxBoxItem aBox( (SvxBoxItem&)rOut.GetCellAttr( RES_BOX ));
     517           0 :                 SvxBorderLine aLine;
     518           0 :                 W1_BRC10* pBrc = pTc2->rgbrcGet();
     519           0 :                 for( sal_uInt16 j=0; j<4; j++ ){
     520           0 :                     aBox.SetLine(Ww1SingleSprmPBrc::SetBorder(&aLine, pBrc),
     521           0 :                                  nBrcTrans[j]);
     522           0 :                     pBrc++;
     523             :                 }
     524           0 :                 rOut.SetCellBorder( aBox, i - nCellsDeleted );
     525             :             }else{
     526             : // gemergte Zellen entfernen
     527           0 :                 rOut.DeleteCell( i - nCellsDeleted );
     528           0 :                 nCellsDeleted++;
     529             :             }
     530           0 :             pTc0+=sizeof(W1_TC);    // 10
     531             :         }
     532             :     }
     533             : }
     534             : 
     535             : 
     536           0 : void Ww1SingleSprmTDyaRowHeight::Start(
     537             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     538             : {
     539           0 :     short nSpace = SVBT16ToShort(pSprm);
     540           0 :     rOut.SetCellHeight(nSpace);
     541           0 : }
     542             : 
     543             : // Fastsave-Attribute brauche ich als Dymmys nicht
     544             : 
     545           0 : void Ww1SingleSprmPpc::Start(
     546             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& rMan)
     547             : {
     548           0 :     sal_uInt8 nPpc = SVBT8ToByte(pSprm);
     549             : 
     550           0 :     if (rOut.IsInTable())                       // Flys in Tabellen kann PMW
     551           0 :         return;                                 // nicht
     552             : 
     553             :     RndStdIds eAnchor;          // Bindung
     554             : 
     555           0 :     switch ( ( nPpc & 0x30 ) >> 4 )     // Y - Bindung bestimmt Sw-Bindung
     556             :     {
     557             :         case 0:
     558           0 :             eAnchor = FLY_AT_PARA;      // Vert Margin
     559           0 :             break;
     560             :         default:
     561           0 :             eAnchor = FLY_AT_PAGE;      // Vert Page oder unknown
     562           0 :             break;                          // 2=Vert. Paragraph, 3=Use Default
     563             :     }
     564             : 
     565           0 :     if( !rOut.IsInFly() && rMan.IsInStyle() ){
     566           0 :         rOut.BeginFly( eAnchor );           // Starte StyleFly
     567             :     }else{
     568           0 :         rOut.SetFlyAnchor( eAnchor );       // Setze Anker
     569             :     }
     570             : }
     571             : 
     572           0 : void Ww1SingleSprmPDxaAbs::Start(
     573             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& rMan)
     574             : {
     575           0 :     short nXPos = SVBT16ToShort(pSprm);
     576             : 
     577           0 :     if( rMan.IsInStyle() && !rOut.IsInFly() ){
     578           0 :         rOut.BeginFly();                    // Fly ohne PPc-Attribut
     579             :     }
     580             : 
     581           0 :     sal_Int16 eHRel = text::RelOrientation::FRAME;
     582           0 :     sal_Int16 eHAlign = text::HoriOrientation::NONE;
     583             : 
     584           0 :     switch( nXPos ){                        // besondere X-Positionen ?
     585             :     case 0:
     586           0 :     case -12: eHAlign = text::HoriOrientation::NONE; nXPos = 0; break;   // Mogel: innen -> links
     587             :                             // eigentich text::HoriOrientation::LEFT, aber dann verrueckt
     588             :                             // ein Abstand nach aussen den Fly
     589           0 :     case -4:  eHAlign = text::HoriOrientation::CENTER; nXPos = 0; break; // zentriert
     590             :     case -8:                                           // rechts
     591           0 :     case -16: eHAlign = text::HoriOrientation::RIGHT; nXPos = 0; break;  // Mogel: aussen -> rechts
     592             : 
     593             :     }
     594           0 :     rOut.SetFlyXPos( nXPos, eHRel, eHAlign );
     595           0 : }
     596             : 
     597           0 : void Ww1SingleSprmPDyaAbs::Start(
     598             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     599             : {
     600           0 :     short nYPos = SVBT16ToShort(pSprm);
     601           0 :     sal_Int16 eVRel = text::RelOrientation::FRAME;
     602           0 :     sal_Int16 eVAlign = text::VertOrientation::NONE;
     603             : 
     604           0 :     switch( nYPos ){                            // besondere Y-Positionen ?
     605           0 :     case -4:  eVAlign = text::VertOrientation::TOP; nYPos = 0; break; // oben
     606           0 :     case -8:  eVAlign = text::VertOrientation::CENTER; nYPos = 0; break;  // zentriert
     607           0 :     case -12: eVAlign = text::VertOrientation::BOTTOM; nYPos = 0; break;  // unten
     608             : 
     609             :     }
     610           0 :     rOut.SetFlyYPos( nYPos, eVRel, eVAlign );
     611           0 : }
     612             : 
     613           0 : void Ww1SingleSprmPDxaWidth::Start(
     614             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     615             : {
     616           0 :     short nDxaWidth = SVBT16ToShort(pSprm);
     617           0 :     rOut.SetFlyFrmAttr( SwFmtFrmSize( ATT_VAR_SIZE, nDxaWidth, MINFLY ) );
     618           0 : }
     619             : 
     620           0 : void Ww1SingleSprmPFromText::Start(
     621             :     Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
     622             : {
     623           0 :     if( rOut.IsInFly() ){   // Kommt auch ausserhalb eines Flys vor, hat
     624             :                             // dann aber offensichtlich nichts zu bedeuten.
     625             :                             // Einen impliziten Fly-Anfang bedeutet es
     626             :                             // definitiv nicht
     627           0 :         short nFromText = SVBT16ToShort(pSprm);
     628             : 
     629           0 :         SvxLRSpaceItem aLR( RES_LR_SPACE );
     630           0 :         aLR.SetTxtLeft( nFromText );
     631           0 :         aLR.SetRight( nFromText );
     632           0 :         rOut.SetFlyFrmAttr( aLR );
     633             : 
     634           0 :         rOut.SetFlyFrmAttr( SvxULSpaceItem( nFromText, nFromText, RES_UL_SPACE ) );
     635             :     }
     636          99 : }
     637             : 
     638             : #undef STOP1
     639             : #undef STOP2
     640             : 
     641             : 
     642             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10