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