update dev300-m58
[ooovba.git] / sw / source / filter / ww1 / w1sprm.cxx
blob8d3c5701b95c490338c3dd6187a9b1d293698a56
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: w1sprm.cxx,v $
10 * $Revision: 1.15 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
37 #include <hintids.hxx>
39 #include <tools/solar.h>
40 #include <svx/paperinf.hxx>
41 #include <svx/lrspitem.hxx>
42 #include <svx/adjitem.hxx>
43 #include <svx/spltitem.hxx>
44 #include <svx/keepitem.hxx>
45 #include <svx/boxitem.hxx>
46 #include <svx/shaditem.hxx>
47 #include <svx/ulspitem.hxx>
48 #include <svx/lspcitem.hxx>
49 #ifndef _SVX_TSTPITEM_HXX //autogen
50 #include <svx/tstpitem.hxx>
51 #endif
54 #include <fmtclds.hxx>
55 #include <fmtfsize.hxx>
56 #include <pam.hxx>
57 #include <ndtxt.hxx>
58 #include <charatr.hxx>
59 #include <frmatr.hxx>
60 #include <doc.hxx>
61 #include <errhdl.hxx>
62 #include <fltini.hxx>
63 #include <docufld.hxx>
64 #include <pagedesc.hxx>
65 #include <flddat.hxx>
66 #include <reffld.hxx>
67 #include <expfld.hxx>
68 #include <w1par.hxx>
69 #include <mdiexp.hxx>
70 #include <swerror.h>
71 #ifndef _STATSTR_HRC
72 #include <statstr.hrc>
73 #endif
75 using namespace ::com::sun::star;
77 /////////////////////////////////////////////////////////////// Ww1Sprm
78 void Ww1Sprm::Stop( Ww1Shell& rOut, Ww1Manager& rMan)
80 if(IsUsed())
81 // for(USHORT i=0;i<Count();i++)
82 for(short i=Count()-1;i>=0;i--){ // rueckwaerts
83 BYTE nId;
84 USHORT nSize;
85 BYTE* pSprm;
86 Fill(i, nId, nSize, pSprm);
87 GetTab(nId).Stop(rOut, nId, pSprm, nSize, rMan);
91 void Ww1Sprm::Start(
92 Ww1Shell& rOut, Ww1Manager& rMan, USHORT i)
94 BYTE nId;
95 USHORT nSize;
96 BYTE* pSprm;
97 Fill(i, nId, nSize, pSprm);
98 GetTab(nId).Start(rOut, nId, pSprm, nSize, rMan);
101 void Ww1Sprm::Start(
102 Ww1Shell& rOut, Ww1Manager& rMan)
104 if(IsUsed())
105 for(USHORT i=0;i<Count();i++)
106 Start(rOut, rMan, i);
109 //////////////////////////////////////////////////////////// SingleSprm
110 void Ww1SingleSprm::Start(
111 Ww1Shell&, BYTE /*nId*/, BYTE*, USHORT, Ww1Manager&)
115 void Ww1SingleSprm::Stop(
116 Ww1Shell&, BYTE, BYTE*, USHORT, Ww1Manager&)
118 // ASSERT(FALSE, "Unknown Sprm");
121 ////////////////////////////////////////////////////////////////// STOP
123 // folgende defines werden genutzt zur implementierung der
124 // Stop()-Member der SingleSprm-klassen, da diese im normalfalle
125 // lediglich EndItem(s) in die shell stellen.
127 #define STOP1(Class, Code) \
128 void Class::Stop( \
129 Ww1Shell& rOut, BYTE, BYTE*, USHORT, Ww1Manager&) { \
130 rOut.EndItem(Code); }
131 #define STOP2(Class, Code1, Code2) \
132 void Class::Stop( \
133 Ww1Shell& rOut, BYTE, BYTE*, USHORT, Ww1Manager&) { \
134 rOut.EndItem(Code1).EndItem(Code2); }
136 /////////////////////////////////////////////////////// SingleSprmXxxxx
138 // hier beginnt die auswertung der eigentlichen sprms. jeder sprmtyp
139 // hat eine eigene klasse, die die virtualen methoden start und stop
140 // implementiert. die klassen stehen in der sprm-tab, die statischer
141 // member von Ww1Sprm ist. taucht ein sprm im dokument auf, werden die
142 // virtualen methoden bei beginn und ende der formatierung gerufen.
144 void Ww1SingleSprmPDxaLeft::Start(
145 Ww1Shell& rOut, BYTE, BYTE* pSprm, USHORT, Ww1Manager&)
147 SvxLRSpaceItem aLR((SvxLRSpaceItem&)rOut.GetAttr(RES_LR_SPACE));
148 short nPara = SVBT16ToShort(pSprm);
149 if(nPara < 0)
150 nPara = 0;
151 if(aLR.GetTxtFirstLineOfst() < -nPara)
152 aLR.SetTxtFirstLineOfst(-nPara); // sonst weigert sich SetTxtLeft()
153 aLR.SetTxtLeft(nPara);
154 rOut << aLR;
157 void Ww1SingleSprmPDxaRight::Start(
158 Ww1Shell& rOut, BYTE, BYTE* pSprm, USHORT, Ww1Manager&)
160 SvxLRSpaceItem aLR((SvxLRSpaceItem&)rOut.GetAttr(RES_LR_SPACE));
161 short nPara = SVBT16ToShort(pSprm);
162 if(nPara < 0)
163 nPara = 0;
164 aLR.SetRight(nPara);
165 rOut << aLR;
168 void Ww1SingleSprmPDxaLeft1::Start(
169 Ww1Shell& rOut, BYTE, BYTE* pSprm, USHORT, Ww1Manager&)
171 SvxLRSpaceItem aLR((SvxLRSpaceItem&)rOut.GetAttr(RES_LR_SPACE));
172 short nPara = SVBT16ToShort(pSprm);
173 if(-nPara >(short)aLR.GetTxtLeft())
174 nPara = -(short)aLR.GetTxtLeft();
175 aLR.SetTxtFirstLineOfst(nPara);
176 rOut << aLR;
179 STOP1(Ww1SingleSprmPDxa, RES_LR_SPACE)
181 void Ww1SingleSprmPJc::Start(
182 Ww1Shell& rOut, BYTE, BYTE* pSprm, USHORT, Ww1Manager&)
184 static SvxAdjust __READONLY_DATA aAdj[] = {
185 SVX_ADJUST_LEFT,
186 SVX_ADJUST_CENTER,
187 SVX_ADJUST_RIGHT,
188 SVX_ADJUST_BLOCK };
189 BYTE nPara = SVBT8ToByte(pSprm);
190 nPara %=(sizeof(aAdj)/sizeof(*aAdj));
191 rOut << SvxAdjustItem(aAdj[nPara], RES_PARATR_ADJUST);
194 STOP1(Ww1SingleSprmPJc, RES_PARATR_ADJUST)
196 void Ww1SingleSprmPFKeep::Start(
197 Ww1Shell& rOut, BYTE, BYTE* pSprm, USHORT, Ww1Manager&)
199 rOut << SvxFmtSplitItem((SVBT8ToByte(pSprm) & 1) == 0, RES_PARATR_SPLIT);
202 STOP1(Ww1SingleSprmPFKeep, RES_PARATR_SPLIT)
204 void Ww1SingleSprmPFKeepFollow::Start(
205 Ww1Shell& rOut, BYTE, BYTE* pSprm, USHORT, Ww1Manager&)
207 rOut << SvxFmtKeepItem((SVBT8ToByte(pSprm) & 1) != 0, RES_KEEP);
210 STOP1(Ww1SingleSprmPFKeepFollow, RES_KEEP)
212 void Ww1SingleSprmPPageBreakBefore::Start(
213 Ww1Shell& rOut, BYTE, BYTE* pSprm, USHORT, Ww1Manager&)
215 rOut << SvxFmtBreakItem(SVBT8ToByte(pSprm) & 1?
216 SVX_BREAK_PAGE_BEFORE:SVX_BREAK_NONE, RES_BREAK );
219 STOP1(Ww1SingleSprmPPageBreakBefore, RES_BREAK)
221 SvxBorderLine* Ww1SingleSprmPBrc::SetBorder(SvxBorderLine* pLine, W1_BRC10* pBrc)
223 USHORT nCode;
224 if(pBrc->dxpLine2WidthGet() == 0)
226 switch(pBrc->dxpLine1WidthGet())
228 default: ASSERT(FALSE, "unknown linewidth");
229 case 0: return 0; // keine Linie
230 case 1: nCode = DEF_LINE_WIDTH_0; break;
231 case 2: nCode = DEF_LINE_WIDTH_1; break;
232 case 3: nCode = DEF_LINE_WIDTH_2; break;
233 case 4: nCode = DEF_LINE_WIDTH_3; break;
234 case 5: nCode = DEF_LINE_WIDTH_4; break;
236 pLine->SetOutWidth(nCode);
237 pLine->SetInWidth(0);
239 else
241 switch(pBrc->dxpLine1WidthGet())
243 default: ASSERT(FALSE, "unknown linewidth");
244 case 1: nCode = DEF_DOUBLE_LINE0_IN; break;
246 pLine->SetOutWidth(nCode);
247 switch(pBrc->dxpLine2WidthGet())
249 default: ASSERT(FALSE, "unknown linewidth");
250 case 1: nCode = DEF_DOUBLE_LINE0_OUT; break;
252 pLine->SetInWidth(nCode);
254 switch(pBrc->dxpLine1WidthGet())
256 default: ASSERT(FALSE, "unknown space");
257 case 0: nCode = DEF_DOUBLE_LINE0_DIST; break;
258 case 1: nCode = DEF_DOUBLE_LINE1_DIST; break;
259 case 2: nCode = DEF_DOUBLE_LINE2_DIST; break;
260 case 3: nCode = DEF_DOUBLE_LINE3_DIST; break;
262 pLine->SetDistance(nCode);
263 return pLine;
266 void Ww1SingleSprmPBrc::Start(
267 Ww1Shell& rOut, BYTE,
268 W1_BRC10* pBrc,
269 USHORT
270 #ifndef PRODUCT
271 nSize
272 #endif
274 Ww1Manager& /*rMan*/,
275 SvxBoxItem& aBox)
277 ASSERT(sizeof(W1_BRC10) == nSize, "sizemissmatch");
278 if(pBrc->dxpSpaceGet())
279 aBox.SetDistance(10 + 20 * pBrc->dxpSpaceGet());
280 //??? Warum 10+... ????
282 if( rOut.IsInFly() )
283 rOut.SetFlyFrmAttr( aBox );
284 else
285 rOut << aBox;
287 if(pBrc->fShadowGet())
289 Color aBlack(COL_BLACK); // schwarzer...
290 SvxShadowItem aS(RES_SHADOW,(const Color*)&aBlack, 32,
291 SVX_SHADOW_BOTTOMRIGHT); // 1.6 tw breit
292 if( rOut.IsInFly() )
293 rOut.SetFlyFrmAttr( aS );
294 else
295 rOut << aS;
299 STOP2(Ww1SingleSprmPBrc, RES_BOX, RES_SHADOW)
301 static USHORT __READONLY_DATA nBrcTrans[BRC_ANZ] =
302 { BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT };
304 void Ww1SingleSprmPBrc10::Start(
305 Ww1Shell& rOut, BYTE nId, BYTE* pSprm, USHORT nSize, Ww1Manager& rMan)
308 W1_BRC10* pBrc =(W1_BRC10*)pSprm;
309 const SfxPoolItem &rItem = ( ( rOut.IsInFly() ) ?
310 rOut.GetFlyFrmAttr(RES_BOX) :rOut.GetAttr(RES_BOX));
311 const SvxBoxItem &rBoxItem = (const SvxBoxItem&)rItem;
312 SvxBoxItem aBox( rBoxItem );
313 // rOut >> aBox;
314 SvxBorderLine aLine;
315 aBox.SetLine(SetBorder(&aLine, pBrc), nBrcTrans[nLine] );
316 Ww1SingleSprmPBrc::Start(rOut, nId, pBrc, nSize, rMan, aBox);
319 STOP1(Ww1SingleSprmParaSpace, RES_UL_SPACE)
321 void Ww1SingleSprmPDyaBefore::Start(
322 Ww1Shell& rOut, BYTE /*nId*/, BYTE* pSprm, USHORT /*nSize*/, Ww1Manager& /*rMan*/)
324 short nPara = SVBT16ToShort(pSprm);
325 if(nPara < 0)
326 nPara = -nPara;
327 SvxULSpaceItem aUL((SvxULSpaceItem&)rOut.GetAttr(RES_UL_SPACE));
328 aUL.SetUpper(nPara);
329 rOut << aUL;
332 void Ww1SingleSprmPDyaAfter::Start(
333 Ww1Shell& rOut, BYTE /*nId*/, BYTE* pSprm, USHORT /*nSize*/, Ww1Manager& /*rMan*/)
335 short nPara = SVBT16ToShort(pSprm);
336 if(nPara < 0)
337 nPara = -nPara;
338 SvxULSpaceItem aUL((SvxULSpaceItem&)rOut.GetAttr(RES_UL_SPACE));
339 aUL.SetLower(nPara);
340 rOut << aUL;
343 STOP1(Ww1SingleSprmPDyaLine, RES_PARATR_LINESPACING)
345 void Ww1SingleSprmPDyaLine::Start(
346 Ww1Shell& rOut, BYTE /*nId*/, BYTE* pSprm, USHORT /*nSize*/, Ww1Manager& /*rMan*/)
348 short nSpace = SVBT16ToShort(pSprm);
349 if(nSpace < 0)
350 nSpace = -nSpace;
351 SvxLineSpacingItem aLSpc( LINE_SPACE_DEFAULT_HEIGHT, RES_PARATR_LINESPACING );
352 if(TRUE)
353 {// MultilineSpace(proportional)
354 long n = nSpace * 100 / 240; // W1: 240 = 100%, SW: 100 = 100%
355 if(n>200)
356 n = 200; // SW_UI-Maximum
357 aLSpc.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
358 aLSpc.SetPropLineSpace((BYTE)n);
360 else
361 {// Fixed / Minimum
362 aLSpc.SetLineHeight((USHORT)nSpace);
363 aLSpc.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
365 rOut << aLSpc;
368 void Ww1SingleSprmPChgTabsPapx::Start(
369 Ww1Shell& rOut, BYTE /*nId*/, BYTE* pSprm, USHORT /*nSize*/, Ww1Manager& /*rMan*/)
371 #if OSL_DEBUG_LEVEL > 1
372 // rOut << 'T';
373 #endif
374 short nLeftPMgn = 0; // Koordinaten etwa gleich ??
375 // ( pAktColl ) ? pCollA[nAktColl].nLeftParaMgn
376 // : nLeftParaMgn; // Absatz L-Space
378 short i;
379 BYTE nDel = pSprm[1];
380 BYTE* pDel = pSprm + 2; // Del - Array
381 BYTE nIns = pSprm[nDel*2+2];
382 BYTE* pIns = pSprm + 2*nDel + 3; // Ins - Array
383 W1_TBD* pTyp = (W1_TBD*)(pSprm + 2*nDel + 2*nIns + 3);// Typ - Array
385 SvxTabStopItem aAttr( (SvxTabStopItem&)rOut.GetNodeOrStyAttr( RES_PARATR_TABSTOP ));
387 SvxTabStop aTabStop;
389 for( i=0; i<nDel; i++ ){
390 USHORT nPos = aAttr.GetPos( SVBT16ToShort( pDel + i*2 ) - nLeftPMgn );
391 if( nPos != SVX_TAB_NOTFOUND )
392 aAttr.Remove( nPos, 1 );
395 for( i=0; i<nIns; i++ ){
396 short nPos = SVBT16ToShort( pIns + i*2 ) - nLeftPMgn;
397 if( nPos < 0 )
398 continue;
399 aTabStop.GetTabPos() = nPos;
400 switch( pTyp[i].jcGet() ){
401 case 0: aTabStop.GetAdjustment() = SVX_TAB_ADJUST_LEFT; break;
402 case 1: aTabStop.GetAdjustment() = SVX_TAB_ADJUST_CENTER; break;
403 case 2: aTabStop.GetAdjustment() = SVX_TAB_ADJUST_RIGHT; break;
404 case 3: aTabStop.GetAdjustment() = SVX_TAB_ADJUST_DECIMAL; break;
405 case 4: continue; // ignoriere Bar
408 switch( pTyp[i].tlcGet() ){
409 case 0: aTabStop.GetFill() = ' '; break;
410 case 1: aTabStop.GetFill() = '.'; break;
411 case 2: aTabStop.GetFill() = '-'; break;
412 case 3:
413 case 4: aTabStop.GetFill() = '_'; break;
416 USHORT nPos2 = aAttr.GetPos( nPos );
417 if( nPos2 != SVX_TAB_NOTFOUND )
418 aAttr.Remove( nPos2, 1 ); // sonst weigert sich das Insert()
420 aAttr.Insert( aTabStop );
422 rOut << aAttr;
425 STOP1(Ww1SingleSprmPChgTabsPapx, RES_PARATR_TABSTOP)
427 void Ww1SingleSprmSGprfIhdt::Start(
428 Ww1Shell& /*rOut*/, BYTE /*nId*/, BYTE* pSprm, USHORT /*nSize*/, Ww1Manager& rMan)
430 rMan.GetSep().SetGrpfIhdt(SVBT8ToByte(pSprm));
433 void Ww1SingleSprmSColumns::Start(
434 Ww1Shell& rOut, BYTE /*nId*/, BYTE* pSprm, USHORT /*nSize*/, Ww1Manager& /*rMan*/)
436 short nColSpace = 708; // default 1,25 cm
437 short nNettoWidth = -1; //~ mdt: dxaLeft/Right missing...
438 short nCols = SVBT16ToShort(pSprm);
439 nCols++;
440 if (nCols < 2)
441 return;
442 SwFmtCol aCol;
443 aCol.Init(nCols, nColSpace, nNettoWidth);
444 rOut.GetPageDesc().GetMaster().SetFmtAttr(aCol);
447 void Ww1SingleSprmPTtp::Start(
448 Ww1Shell& /*rOut*/, BYTE, BYTE*, USHORT, Ww1Manager& rMan)
450 rMan.SetInTtp( TRUE ); // Besonderheit: wird bei InTable::Stop und
451 // nicht bei InTtp::Stop zurueckgesetzt,
452 // da Auswertung in InTable
455 void Ww1SingleSprmPTtp::Stop(
456 Ww1Shell& rOut, BYTE, BYTE*, USHORT, Ww1Manager& rMan)
458 if (rOut.IsInTable() && rMan.HasInTable())
459 rOut.NextTableRow();
462 void Ww1SingleSprmPFInTable::Start(
463 Ww1Shell& /*rOut*/, BYTE, BYTE*, USHORT,
464 Ww1Manager& /*rMan*/)
468 void Ww1SingleSprmPFInTable::Stop(
469 Ww1Shell&
470 #ifndef PRODUCT
471 rOut
472 #endif
474 BYTE, BYTE*, USHORT,
475 Ww1Manager& rMan)
477 ASSERT(rOut.IsInTable(), "");
478 rMan.SetInTtp( FALSE );
481 void Ww1SingleSprmTDxaGapHalf::Start(
482 Ww1Shell& rOut, BYTE /*nId*/, BYTE* pSprm, USHORT /*nSize*/, Ww1Manager& /*rMan*/)
484 short nSpace = SVBT16ToShort(pSprm);
485 rOut.SetCellSpace(nSpace);
488 void Ww1SingleSprmTDefTable10::Start(
489 Ww1Shell& rOut, BYTE /*nId*/, BYTE* pSprm, USHORT nSize, Ww1Manager& /*rMan*/)
491 USHORT i;
492 BYTE *p = pSprm + 2; // LaengenWord ueberlesen
493 BYTE nCount = *p;
494 p++;
495 nSize -= 3;
496 // Es fehlt noch:
497 // - GapHalf
498 // - eventuelle Ausduennung der Zellenumrandungen
500 if( nCount < 1 || nCount > 32 || nSize < ( nCount + 1 ) * 2 )
501 return;
503 // Erstmal die Zellenpositionen einlesen
504 short nPos = SVBT16ToShort( p ); // signed, kann auch neg. sein !!!
506 // if( !rOut.IsTableWidthSet() ){ // Muss Tabellenbreite und -Ausrichtung
507 // noch gesetzt werden ?
509 short nWholeWidth = SVBT16ToShort( p + 2 * nCount ) - nPos;
510 rOut.SetTableWidth( (USHORT)nWholeWidth ); // Tabellenbreite setzen
512 // Pos der Tabelle setzen
513 long nMidTab = nPos + nWholeWidth / 2; // TabellenMitte
514 const SwFrmFmt &rFmt = rOut.GetPageDesc().GetMaster();
515 const SvxLRSpaceItem& rLR = rFmt.GetLRSpace();
516 long nRight = rFmt.GetFrmSize().GetWidth()
517 - rLR.GetLeft() - rLR.GetRight();
519 sal_Int16 eOri = text::HoriOrientation::LEFT;
520 if( nPos > MINLAY ){ // per Zuppeln positioniert
521 if ( nMidTab <= nRight / 3 ) // 1/3 der Seite
522 eOri = text::HoriOrientation::LEFT;
523 else if ( nMidTab <= 2 * nRight / 3 ) // 2/3 der Seite
524 eOri = text::HoriOrientation::CENTER;
525 else
526 eOri = text::HoriOrientation::RIGHT;
528 rOut.SetTableOrient( eOri );
531 BYTE* pEndPos = p+2;
532 BYTE* pTc0 = ( nSize >= nCount * 10 ) ? pEndPos + 2 * nCount : 0;
533 USHORT nCellsDeleted = 0; // fuer gemergte Zellen
535 for( i = 0; i < nCount; i++ ){
536 // Info sammeln
537 W1_TC* pTc = (W1_TC*)pTc0;
538 BOOL bMerged = (pTc) ? pTc->fMergedGet() : FALSE;
540 // Zellenbreiten setzen
541 USHORT nPos1 = SVBT16ToShort( pEndPos );
542 if( !bMerged )
543 rOut.SetCellWidth( nPos1 - nPos, i - nCellsDeleted );
544 // Zellenbreite setzen
545 // Wechselwirkung mit GapHalf fehlt noch
546 // ( GapHalf wird noch ignoriert )
547 pEndPos+=2;
548 nPos = nPos1;
550 if( pTc0 ){ // gibts TCs ueberhaupt ?
551 W1_TC* pTc2 = (W1_TC*)pTc0;
552 BOOL bMerged2 = pTc2->fMergedGet();
553 // ASSERT( !bMerged2, "Gemergte Tabellenzellen noch nicht vollstaendig implementiert" );
554 if( !bMerged2 ){
555 // und nun die Umrandungen
556 SvxBoxItem aBox( (SvxBoxItem&)rOut.GetCellAttr( RES_BOX ));
557 SvxBorderLine aLine;
558 W1_BRC10* pBrc = pTc2->rgbrcGet();
559 for( USHORT j=0; j<4; j++ ){
560 aBox.SetLine(Ww1SingleSprmPBrc::SetBorder(&aLine, pBrc),
561 nBrcTrans[j]);
562 pBrc++;
564 rOut.SetCellBorder( aBox, i - nCellsDeleted );
565 }else{
566 // gemergte Zellen entfernen
567 rOut.DeleteCell( i - nCellsDeleted );
568 nCellsDeleted++;
570 pTc0+=sizeof(W1_TC); // 10
576 void Ww1SingleSprmTDyaRowHeight::Start(
577 Ww1Shell& rOut, BYTE /*nId*/, BYTE* pSprm, USHORT /*nSize*/, Ww1Manager& /*rMan*/)
579 short nSpace = SVBT16ToShort(pSprm);
580 rOut.SetCellHeight(nSpace);
583 // Fastsave-Attribute brauche ich als Dymmys nicht
585 void Ww1SingleSprmPpc::Start(
586 Ww1Shell& rOut, BYTE /*nId*/, BYTE* pSprm, USHORT /*nSize*/, Ww1Manager& rMan)
588 BYTE nPpc = SVBT8ToByte(pSprm);
590 if (rOut.IsInTable()) // Flys in Tabellen kann PMW
591 return; // nicht
593 RndStdIds eAnchor; // Bindung
594 sal_Int16 eHRel; // Seite oder Seitenrand
595 sal_Int16 eVRel; // Seite oder Seitenrand
597 switch ( ( nPpc & 0x30 ) >> 4 ){ // Y - Bindung bestimmt Sw-Bindung
598 case 0: eAnchor = FLY_AT_CNTNT; // Vert Margin
599 eVRel = text::RelOrientation::PRINT_AREA;
600 // if( nYPos < 0 )
601 // nYPos = 0; // koennen wir nicht
602 break;
603 /* case 1:*/ // Vert. Seite
604 default:eAnchor = FLY_PAGE; // Vert Page oder unknown
605 eVRel = text::RelOrientation::FRAME;
606 break; // 2=Vert. Paragraph, 3=Use Default
609 switch ( ( nPpc & 0xc0 ) >> 6 ){ // X - Bindung -> Koordinatentransformation
610 case 0: // Hor. Spalte
611 case 1: // Hor. Absatz
612 eHRel = text::RelOrientation::PRINT_AREA;
613 // nXPos += nPgLeft; // in Seiten-Koordinaten umrechnen
614 break;
615 /* case 2:*/ // Hor. Seite
616 default:
617 eHRel = text::RelOrientation::FRAME;
618 break;
621 if( !rOut.IsInFly() && rMan.IsInStyle() ){
622 rOut.BeginFly( eAnchor ); // Starte StyleFly
623 }else{
624 rOut.SetFlyAnchor( eAnchor ); // Setze Anker
628 void Ww1SingleSprmPDxaAbs::Start(
629 Ww1Shell& rOut, BYTE /*nId*/, BYTE* pSprm, USHORT /*nSize*/, Ww1Manager& rMan)
631 short nXPos = SVBT16ToShort(pSprm);
633 if( rMan.IsInStyle() && !rOut.IsInFly() ){
634 rOut.BeginFly(); // Fly ohne PPc-Attribut
637 sal_Int16 eHRel = text::RelOrientation::FRAME;
638 sal_Int16 eHAlign = text::HoriOrientation::NONE;
640 switch( nXPos ){ // besondere X-Positionen ?
641 case 0:
642 case -12: eHAlign = text::HoriOrientation::NONE; nXPos = 0; break; // Mogel: innen -> links
643 // eigentich text::HoriOrientation::LEFT, aber dann verrueckt
644 // ein Abstand nach aussen den Fly
645 case -4: eHAlign = text::HoriOrientation::CENTER; nXPos = 0; break; // zentriert
646 case -8: // rechts
647 case -16: eHAlign = text::HoriOrientation::RIGHT; nXPos = 0; break; // Mogel: aussen -> rechts
648 // default: nXPos += (short)nIniFlyDx; break; // Korrekturen per Ini-Datei
650 rOut.SetFlyXPos( nXPos, eHRel, eHAlign );
653 void Ww1SingleSprmPDyaAbs::Start(
654 Ww1Shell& rOut, BYTE /*nId*/, BYTE* pSprm, USHORT /*nSize*/, Ww1Manager& /*rMan*/)
656 short nYPos = SVBT16ToShort(pSprm);
657 sal_Int16 eVRel = text::RelOrientation::FRAME;
658 sal_Int16 eVAlign = text::VertOrientation::NONE;
660 switch( nYPos ){ // besondere Y-Positionen ?
661 case -4: eVAlign = text::VertOrientation::TOP; nYPos = 0; break; // oben
662 case -8: eVAlign = text::VertOrientation::CENTER; nYPos = 0; break; // zentriert
663 case -12: eVAlign = text::VertOrientation::BOTTOM; nYPos = 0; break; // unten
664 // default: nYPos += (short)nIniFlyDy; break; // Korrekturen per Ini-Datei
666 rOut.SetFlyYPos( nYPos, eVRel, eVAlign );
669 void Ww1SingleSprmPDxaWidth::Start(
670 Ww1Shell& rOut, BYTE /*nId*/, BYTE* pSprm, USHORT /*nSize*/, Ww1Manager& /*rMan*/)
672 short nDxaWidth = SVBT16ToShort(pSprm);
673 rOut.SetFlyFrmAttr( SwFmtFrmSize( ATT_VAR_SIZE, nDxaWidth, MINFLY ) );
676 void Ww1SingleSprmPFromText::Start(
677 Ww1Shell& rOut, BYTE /*nId*/, BYTE* pSprm, USHORT /*nSize*/, Ww1Manager& /*rMan*/)
679 if( rOut.IsInFly() ){ // Kommt auch ausserhalb eines Flys vor, hat
680 // dann aber offensichtlich nichts zu bedeuten.
681 // Einen impliziten Fly-Anfang bedeutet es
682 // definitiv nicht
683 short nFromText = SVBT16ToShort(pSprm);
685 SvxLRSpaceItem aLR( RES_LR_SPACE );
686 aLR.SetTxtLeft( nFromText );
687 aLR.SetRight( nFromText );
688 rOut.SetFlyFrmAttr( aLR );
690 rOut.SetFlyFrmAttr( SvxULSpaceItem( nFromText, nFromText, RES_UL_SPACE ) );
694 #undef STOP1
695 #undef STOP2