bump product version to 4.1.6.2
[LibreOffice.git] / sw / source / filter / ww1 / w1sprm.cxx
blob5a62675fb4819d8278decbdfa65f06e3a87f5462
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
51 using ::editeng::SvxBorderLine;
52 using namespace ::com::sun::star;
54 /////////////////////////////////////////////////////////////// Ww1Sprm
55 void Ww1Sprm::Stop( Ww1Shell& rOut, Ww1Manager& rMan)
57 if(IsUsed())
58 for(short i=Count()-1;i>=0;i--){ // rueckwaerts
59 sal_uInt8 nId;
60 sal_uInt16 nSize;
61 sal_uInt8* pSprm;
62 Fill(i, nId, nSize, pSprm);
63 GetTab(nId).Stop(rOut, nId, pSprm, nSize, rMan);
67 void Ww1Sprm::Start(
68 Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 i)
70 sal_uInt8 nId;
71 sal_uInt16 nSize;
72 sal_uInt8* pSprm;
73 Fill(i, nId, nSize, pSprm);
74 GetTab(nId).Start(rOut, nId, pSprm, nSize, rMan);
77 void Ww1Sprm::Start(
78 Ww1Shell& rOut, Ww1Manager& rMan)
80 if(IsUsed())
81 for(sal_uInt16 i=0;i<Count();i++)
82 Start(rOut, rMan, i);
85 //////////////////////////////////////////////////////////// SingleSprm
86 void Ww1SingleSprm::Start(
87 Ww1Shell&, sal_uInt8 /*nId*/, sal_uInt8*, sal_uInt16, Ww1Manager&)
91 void Ww1SingleSprm::Stop(
92 Ww1Shell&, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager&)
94 // OSL_ENSURE(FALSE, "Unknown Sprm");
97 ////////////////////////////////////////////////////////////////// STOP
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.
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); }
112 /////////////////////////////////////////////////////// SingleSprmXxxxx
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.
120 void Ww1SingleSprmPDxaLeft::Start(
121 Ww1Shell& rOut, sal_uInt8, sal_uInt8* pSprm, sal_uInt16, Ww1Manager&)
123 SvxLRSpaceItem aLR((SvxLRSpaceItem&)rOut.GetAttr(RES_LR_SPACE));
124 short nPara = SVBT16ToShort(pSprm);
125 if(nPara < 0)
126 nPara = 0;
127 if(aLR.GetTxtFirstLineOfst() < -nPara)
128 aLR.SetTxtFirstLineOfst(-nPara); // sonst weigert sich SetTxtLeft()
129 aLR.SetTxtLeft(nPara);
130 rOut << aLR;
133 void Ww1SingleSprmPDxaRight::Start(
134 Ww1Shell& rOut, sal_uInt8, sal_uInt8* pSprm, sal_uInt16, Ww1Manager&)
136 SvxLRSpaceItem aLR((SvxLRSpaceItem&)rOut.GetAttr(RES_LR_SPACE));
137 short nPara = SVBT16ToShort(pSprm);
138 if(nPara < 0)
139 nPara = 0;
140 aLR.SetRight(nPara);
141 rOut << aLR;
144 void Ww1SingleSprmPDxaLeft1::Start(
145 Ww1Shell& rOut, sal_uInt8, sal_uInt8* pSprm, sal_uInt16, Ww1Manager&)
147 SvxLRSpaceItem aLR((SvxLRSpaceItem&)rOut.GetAttr(RES_LR_SPACE));
148 short nPara = SVBT16ToShort(pSprm);
149 if(-nPara >(short)aLR.GetTxtLeft())
150 nPara = -(short)aLR.GetTxtLeft();
151 aLR.SetTxtFirstLineOfst(nPara);
152 rOut << aLR;
155 STOP1(Ww1SingleSprmPDxa, RES_LR_SPACE)
157 void Ww1SingleSprmPJc::Start(
158 Ww1Shell& rOut, sal_uInt8, sal_uInt8* pSprm, sal_uInt16, Ww1Manager&)
160 static SvxAdjust const aAdj[] = {
161 SVX_ADJUST_LEFT,
162 SVX_ADJUST_CENTER,
163 SVX_ADJUST_RIGHT,
164 SVX_ADJUST_BLOCK };
165 sal_uInt8 nPara = SVBT8ToByte(pSprm);
166 nPara %=SAL_N_ELEMENTS(aAdj);
167 rOut << SvxAdjustItem(aAdj[nPara], RES_PARATR_ADJUST);
170 STOP1(Ww1SingleSprmPJc, RES_PARATR_ADJUST)
172 void Ww1SingleSprmPFKeep::Start(
173 Ww1Shell& rOut, sal_uInt8, sal_uInt8* pSprm, sal_uInt16, Ww1Manager&)
175 rOut << SvxFmtSplitItem((SVBT8ToByte(pSprm) & 1) == 0, RES_PARATR_SPLIT);
178 STOP1(Ww1SingleSprmPFKeep, RES_PARATR_SPLIT)
180 void Ww1SingleSprmPFKeepFollow::Start(
181 Ww1Shell& rOut, sal_uInt8, sal_uInt8* pSprm, sal_uInt16, Ww1Manager&)
183 rOut << SvxFmtKeepItem((SVBT8ToByte(pSprm) & 1) != 0, RES_KEEP);
186 STOP1(Ww1SingleSprmPFKeepFollow, RES_KEEP)
188 void Ww1SingleSprmPPageBreakBefore::Start(
189 Ww1Shell& rOut, sal_uInt8, sal_uInt8* pSprm, sal_uInt16, Ww1Manager&)
191 rOut << SvxFmtBreakItem(SVBT8ToByte(pSprm) & 1?
192 SVX_BREAK_PAGE_BEFORE:SVX_BREAK_NONE, RES_BREAK );
195 STOP1(Ww1SingleSprmPPageBreakBefore, RES_BREAK)
197 SvxBorderLine* Ww1SingleSprmPBrc::SetBorder(SvxBorderLine* pLine, W1_BRC10* pBrc)
199 sal_uInt16 nCode;
200 ::editeng::SvxBorderStyle eStyle = table::BorderLineStyle::SOLID;
201 if(pBrc->dxpLine2WidthGet() == 0)
203 switch(pBrc->dxpLine1WidthGet())
205 default: OSL_FAIL("unknown linewidth");
206 case 0: return 0; // keine Linie
207 case 1: nCode = DEF_LINE_WIDTH_0; break;
208 case 2: nCode = DEF_LINE_WIDTH_1; break;
209 case 3: nCode = DEF_LINE_WIDTH_2; break;
210 case 4: nCode = DEF_LINE_WIDTH_3; break;
211 case 5: nCode = DEF_LINE_WIDTH_4; break;
212 case 6:
213 nCode = DEF_LINE_WIDTH_5;
214 eStyle = table::BorderLineStyle::DOTTED;
215 break;
216 case 7:
217 nCode = DEF_LINE_WIDTH_5;
218 eStyle = table::BorderLineStyle::DASHED;
219 break;
221 pLine->SetWidth( nCode );
222 pLine->SetBorderLineStyle( eStyle );
224 else
226 if ( pBrc->dxpLine1WidthGet() == 1 && pBrc->dxpLine2WidthGet() == 1 )
228 pLine->SetBorderLineStyle( table::BorderLineStyle::DOUBLE );
229 pLine->SetWidth( DEF_LINE_WIDTH_0 );
231 else
232 OSL_ENSURE(false, "unknown linewidth");
234 return pLine;
237 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
245 Ww1Manager& /*rMan*/,
246 SvxBoxItem& aBox)
248 #if OSL_DEBUG_LEVEL > 0
249 OSL_ENSURE(sizeof(W1_BRC10) == nSize, "sizemissmatch");
250 #endif
251 if(pBrc->dxpSpaceGet())
252 aBox.SetDistance(10 + 20 * pBrc->dxpSpaceGet());
253 //??? Warum 10+... ????
255 if( rOut.IsInFly() )
256 rOut.SetFlyFrmAttr( aBox );
257 else
258 rOut << aBox;
260 if(pBrc->fShadowGet())
262 Color aBlack(COL_BLACK); // schwarzer...
263 SvxShadowItem aS(RES_SHADOW,(const Color*)&aBlack, 32,
264 SVX_SHADOW_BOTTOMRIGHT); // 1.6 tw breit
265 if( rOut.IsInFly() )
266 rOut.SetFlyFrmAttr( aS );
267 else
268 rOut << aS;
272 STOP2(Ww1SingleSprmPBrc, RES_BOX, RES_SHADOW)
274 static sal_uInt16 nBrcTrans[BRC_ANZ] =
275 { BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT };
277 void Ww1SingleSprmPBrc10::Start(
278 Ww1Shell& rOut, sal_uInt8 nId, sal_uInt8* pSprm, sal_uInt16 nSize, Ww1Manager& rMan)
281 W1_BRC10* pBrc =(W1_BRC10*)pSprm;
282 const SfxPoolItem &rItem = ( ( rOut.IsInFly() ) ?
283 rOut.GetFlyFrmAttr(RES_BOX) :rOut.GetAttr(RES_BOX));
284 const SvxBoxItem &rBoxItem = (const SvxBoxItem&)rItem;
285 SvxBoxItem aBox( rBoxItem );
286 SvxBorderLine aLine;
287 aBox.SetLine(SetBorder(&aLine, pBrc), nBrcTrans[nLine] );
288 Ww1SingleSprmPBrc::Start(rOut, nId, pBrc, nSize, rMan, aBox);
291 STOP1(Ww1SingleSprmParaSpace, RES_UL_SPACE)
293 void Ww1SingleSprmPDyaBefore::Start(
294 Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
296 short nPara = SVBT16ToShort(pSprm);
297 if(nPara < 0)
298 nPara = -nPara;
299 SvxULSpaceItem aUL((SvxULSpaceItem&)rOut.GetAttr(RES_UL_SPACE));
300 aUL.SetUpper(nPara);
301 rOut << aUL;
304 void Ww1SingleSprmPDyaAfter::Start(
305 Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
307 short nPara = SVBT16ToShort(pSprm);
308 if(nPara < 0)
309 nPara = -nPara;
310 SvxULSpaceItem aUL((SvxULSpaceItem&)rOut.GetAttr(RES_UL_SPACE));
311 aUL.SetLower(nPara);
312 rOut << aUL;
315 STOP1(Ww1SingleSprmPDyaLine, RES_PARATR_LINESPACING)
317 void Ww1SingleSprmPDyaLine::Start(
318 Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
320 short nSpace = SVBT16ToShort(pSprm);
321 if(nSpace < 0)
322 nSpace = -nSpace;
323 SvxLineSpacingItem aLSpc( LINE_SPACE_DEFAULT_HEIGHT, RES_PARATR_LINESPACING );
324 {// MultilineSpace(proportional)
325 long n = nSpace * 100 / 240; // W1: 240 = 100%, SW: 100 = 100%
326 if(n>200)
327 n = 200; // SW_UI-Maximum
328 aLSpc.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
329 aLSpc.SetPropLineSpace((sal_uInt8)n);
331 rOut << aLSpc;
334 void Ww1SingleSprmPChgTabsPapx::Start(
335 Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
338 short nLeftPMgn = 0; // Koordinaten etwa gleich ??
340 short i;
341 sal_uInt8 nDel = pSprm[1];
342 sal_uInt8* pDel = pSprm + 2; // Del - Array
343 sal_uInt8 nIns = pSprm[nDel*2+2];
344 sal_uInt8* pIns = pSprm + 2*nDel + 3; // Ins - Array
345 W1_TBD* pTyp = (W1_TBD*)(pSprm + 2*nDel + 2*nIns + 3);// Typ - Array
347 SvxTabStopItem aAttr( (SvxTabStopItem&)rOut.GetNodeOrStyAttr( RES_PARATR_TABSTOP ));
349 SvxTabStop aTabStop;
351 for( i=0; i<nDel; i++ ){
352 sal_uInt16 nPos = aAttr.GetPos( SVBT16ToShort( pDel + i*2 ) - nLeftPMgn );
353 if( nPos != SVX_TAB_NOTFOUND )
354 aAttr.Remove( nPos, 1 );
357 for( i=0; i<nIns; i++ ){
358 short nPos = SVBT16ToShort( pIns + i*2 ) - nLeftPMgn;
359 if( nPos < 0 )
360 continue;
361 aTabStop.GetTabPos() = nPos;
362 switch( pTyp[i].jcGet() ){
363 case 0: aTabStop.GetAdjustment() = SVX_TAB_ADJUST_LEFT; break;
364 case 1: aTabStop.GetAdjustment() = SVX_TAB_ADJUST_CENTER; break;
365 case 2: aTabStop.GetAdjustment() = SVX_TAB_ADJUST_RIGHT; break;
366 case 3: aTabStop.GetAdjustment() = SVX_TAB_ADJUST_DECIMAL; break;
367 case 4: continue; // ignoriere Bar
370 switch( pTyp[i].tlcGet() ){
371 case 0: aTabStop.GetFill() = ' '; break;
372 case 1: aTabStop.GetFill() = '.'; break;
373 case 2: aTabStop.GetFill() = '-'; break;
374 case 3:
375 case 4: aTabStop.GetFill() = '_'; break;
378 sal_uInt16 nPos2 = aAttr.GetPos( nPos );
379 if( nPos2 != SVX_TAB_NOTFOUND )
380 aAttr.Remove( nPos2, 1 ); // sonst weigert sich das Insert()
382 aAttr.Insert( aTabStop );
384 rOut << aAttr;
387 STOP1(Ww1SingleSprmPChgTabsPapx, RES_PARATR_TABSTOP)
389 void Ww1SingleSprmSGprfIhdt::Start(
390 Ww1Shell& /*rOut*/, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& rMan)
392 rMan.GetSep().SetGrpfIhdt(SVBT8ToByte(pSprm));
395 void Ww1SingleSprmSColumns::Start(
396 Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
398 short nColSpace = 708; // default 1,25 cm
399 short nNettoWidth = -1; //~ mdt: dxaLeft/Right missing...
400 short nCols = SVBT16ToShort(pSprm);
401 nCols++;
402 if (nCols < 2)
403 return;
404 SwFmtCol aCol;
405 aCol.Init(nCols, nColSpace, nNettoWidth);
406 rOut.GetPageDesc().GetMaster().SetFmtAttr(aCol);
409 void Ww1SingleSprmPTtp::Start(
410 Ww1Shell& /*rOut*/, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager& rMan)
412 rMan.SetInTtp( true ); // Besonderheit: wird bei InTable::Stop und
413 // nicht bei InTtp::Stop zurueckgesetzt,
414 // da Auswertung in InTable
417 void Ww1SingleSprmPTtp::Stop(
418 Ww1Shell& rOut, sal_uInt8, sal_uInt8*, sal_uInt16, Ww1Manager& rMan)
420 if (rOut.IsInTable() && rMan.HasInTable())
421 rOut.NextTableRow();
424 void Ww1SingleSprmPFInTable::Start(
425 Ww1Shell& /*rOut*/, sal_uInt8, sal_uInt8*, sal_uInt16,
426 Ww1Manager& /*rMan*/)
430 void Ww1SingleSprmPFInTable::Stop(
431 Ww1Shell&
432 #if OSL_DEBUG_LEVEL > 0
433 rOut
434 #endif
436 sal_uInt8, sal_uInt8*, sal_uInt16,
437 Ww1Manager& /*rMan*/)
439 #if OSL_DEBUG_LEVEL > 0
440 OSL_ENSURE(rOut.IsInTable(), "");
441 #endif
444 void Ww1SingleSprmTDxaGapHalf::Start(
445 Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
447 short nSpace = SVBT16ToShort(pSprm);
448 rOut.SetCellSpace(nSpace);
451 void Ww1SingleSprmTDefTable10::Start(
452 Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 nSize, Ww1Manager& /*rMan*/)
454 sal_uInt16 i;
455 sal_uInt8 *p = pSprm + 2; // LaengenWord ueberlesen
456 sal_uInt8 nCount = *p;
457 p++;
458 nSize -= 3;
459 // Es fehlt noch:
460 // - GapHalf
461 // - eventuelle Ausduennung der Zellenumrandungen
463 if( nCount < 1 || nCount > 32 || nSize < ( nCount + 1 ) * 2 )
464 return;
466 // Erstmal die Zellenpositionen einlesen
467 short nPos = SVBT16ToShort( p ); // signed, kann auch neg. sein !!!
470 short nWholeWidth = SVBT16ToShort( p + 2 * nCount ) - nPos;
471 rOut.SetTableWidth( (sal_uInt16)nWholeWidth ); // Tabellenbreite setzen
473 // Pos der Tabelle setzen
474 long nMidTab = nPos + nWholeWidth / 2; // TabellenMitte
475 const SwFrmFmt &rFmt = rOut.GetPageDesc().GetMaster();
476 const SvxLRSpaceItem& rLR = rFmt.GetLRSpace();
477 long nRight = rFmt.GetFrmSize().GetWidth()
478 - rLR.GetLeft() - rLR.GetRight();
480 sal_Int16 eOri = text::HoriOrientation::LEFT;
481 if( nPos > MINLAY ){ // per Zuppeln positioniert
482 if ( nMidTab <= nRight / 3 ) // 1/3 der Seite
483 eOri = text::HoriOrientation::LEFT;
484 else if ( nMidTab <= 2 * nRight / 3 ) // 2/3 der Seite
485 eOri = text::HoriOrientation::CENTER;
486 else
487 eOri = text::HoriOrientation::RIGHT;
489 rOut.SetTableOrient( eOri );
492 sal_uInt8* pEndPos = p+2;
493 sal_uInt8* pTc0 = ( nSize >= nCount * 10 ) ? pEndPos + 2 * nCount : 0;
494 sal_uInt16 nCellsDeleted = 0; // fuer gemergte Zellen
496 for( i = 0; i < nCount; i++ ){
497 // Info sammeln
498 W1_TC* pTc = (W1_TC*)pTc0;
499 sal_Bool bMerged = (pTc) ? pTc->fMergedGet() : sal_False;
501 // Zellenbreiten setzen
502 sal_uInt16 nPos1 = SVBT16ToShort( pEndPos );
503 if( !bMerged )
504 rOut.SetCellWidth( nPos1 - nPos, i - nCellsDeleted );
505 // Zellenbreite setzen
506 // Wechselwirkung mit GapHalf fehlt noch
507 // ( GapHalf wird noch ignoriert )
508 pEndPos+=2;
509 nPos = nPos1;
511 if( pTc0 ){ // gibts TCs ueberhaupt ?
512 W1_TC* pTc2 = (W1_TC*)pTc0;
513 sal_Bool bMerged2 = pTc2->fMergedGet();
514 if( !bMerged2 ){
515 // und nun die Umrandungen
516 SvxBoxItem aBox( (SvxBoxItem&)rOut.GetCellAttr( RES_BOX ));
517 SvxBorderLine aLine;
518 W1_BRC10* pBrc = pTc2->rgbrcGet();
519 for( sal_uInt16 j=0; j<4; j++ ){
520 aBox.SetLine(Ww1SingleSprmPBrc::SetBorder(&aLine, pBrc),
521 nBrcTrans[j]);
522 pBrc++;
524 rOut.SetCellBorder( aBox, i - nCellsDeleted );
525 }else{
526 // gemergte Zellen entfernen
527 rOut.DeleteCell( i - nCellsDeleted );
528 nCellsDeleted++;
530 pTc0+=sizeof(W1_TC); // 10
536 void Ww1SingleSprmTDyaRowHeight::Start(
537 Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
539 short nSpace = SVBT16ToShort(pSprm);
540 rOut.SetCellHeight(nSpace);
543 // Fastsave-Attribute brauche ich als Dymmys nicht
545 void Ww1SingleSprmPpc::Start(
546 Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& rMan)
548 sal_uInt8 nPpc = SVBT8ToByte(pSprm);
550 if (rOut.IsInTable()) // Flys in Tabellen kann PMW
551 return; // nicht
553 RndStdIds eAnchor; // Bindung
555 switch ( ( nPpc & 0x30 ) >> 4 ) // Y - Bindung bestimmt Sw-Bindung
557 case 0:
558 eAnchor = FLY_AT_PARA; // Vert Margin
559 break;
560 default:
561 eAnchor = FLY_AT_PAGE; // Vert Page oder unknown
562 break; // 2=Vert. Paragraph, 3=Use Default
565 if( !rOut.IsInFly() && rMan.IsInStyle() ){
566 rOut.BeginFly( eAnchor ); // Starte StyleFly
567 }else{
568 rOut.SetFlyAnchor( eAnchor ); // Setze Anker
572 void Ww1SingleSprmPDxaAbs::Start(
573 Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& rMan)
575 short nXPos = SVBT16ToShort(pSprm);
577 if( rMan.IsInStyle() && !rOut.IsInFly() ){
578 rOut.BeginFly(); // Fly ohne PPc-Attribut
581 sal_Int16 eHRel = text::RelOrientation::FRAME;
582 sal_Int16 eHAlign = text::HoriOrientation::NONE;
584 switch( nXPos ){ // besondere X-Positionen ?
585 case 0:
586 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 case -4: eHAlign = text::HoriOrientation::CENTER; nXPos = 0; break; // zentriert
590 case -8: // rechts
591 case -16: eHAlign = text::HoriOrientation::RIGHT; nXPos = 0; break; // Mogel: aussen -> rechts
594 rOut.SetFlyXPos( nXPos, eHRel, eHAlign );
597 void Ww1SingleSprmPDyaAbs::Start(
598 Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
600 short nYPos = SVBT16ToShort(pSprm);
601 sal_Int16 eVRel = text::RelOrientation::FRAME;
602 sal_Int16 eVAlign = text::VertOrientation::NONE;
604 switch( nYPos ){ // besondere Y-Positionen ?
605 case -4: eVAlign = text::VertOrientation::TOP; nYPos = 0; break; // oben
606 case -8: eVAlign = text::VertOrientation::CENTER; nYPos = 0; break; // zentriert
607 case -12: eVAlign = text::VertOrientation::BOTTOM; nYPos = 0; break; // unten
610 rOut.SetFlyYPos( nYPos, eVRel, eVAlign );
613 void Ww1SingleSprmPDxaWidth::Start(
614 Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
616 short nDxaWidth = SVBT16ToShort(pSprm);
617 rOut.SetFlyFrmAttr( SwFmtFrmSize( ATT_VAR_SIZE, nDxaWidth, MINFLY ) );
620 void Ww1SingleSprmPFromText::Start(
621 Ww1Shell& rOut, sal_uInt8 /*nId*/, sal_uInt8* pSprm, sal_uInt16 /*nSize*/, Ww1Manager& /*rMan*/)
623 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 short nFromText = SVBT16ToShort(pSprm);
629 SvxLRSpaceItem aLR( RES_LR_SPACE );
630 aLR.SetTxtLeft( nFromText );
631 aLR.SetRight( nFromText );
632 rOut.SetFlyFrmAttr( aLR );
634 rOut.SetFlyFrmAttr( SvxULSpaceItem( nFromText, nFromText, RES_UL_SPACE ) );
638 #undef STOP1
639 #undef STOP2
642 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */