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 : #include <stdlib.h>
21 : #include <svl/itemiter.hxx>
22 : #include <rtl/tencinfo.h>
23 :
24 : #include <hintids.hxx>
25 : #include <editeng/lspcitem.hxx>
26 : #include <editeng/wrlmitem.hxx>
27 : #include <editeng/udlnitem.hxx>
28 : #include <editeng/kernitem.hxx>
29 : #include <editeng/langitem.hxx>
30 : #include <editeng/cmapitem.hxx>
31 : #include <editeng/shdditem.hxx>
32 : #include <editeng/contouritem.hxx>
33 : #include <editeng/crossedoutitem.hxx>
34 : #include <editeng/postitem.hxx>
35 : #include <editeng/wghtitem.hxx>
36 : #include <editeng/colritem.hxx>
37 : #include <editeng/brushitem.hxx>
38 : #include <editeng/spltitem.hxx>
39 : #include <editeng/keepitem.hxx>
40 : #include <editeng/orphitem.hxx>
41 : #include <editeng/widwitem.hxx>
42 : #include <editeng/adjustitem.hxx>
43 : #include <editeng/escapementitem.hxx>
44 : #include <editeng/fhgtitem.hxx>
45 : #include <editeng/fontitem.hxx>
46 : #include <editeng/shaditem.hxx>
47 : #include <editeng/boxitem.hxx>
48 : #include <editeng/ulspitem.hxx>
49 : #include <editeng/lrspitem.hxx>
50 : #include <editeng/tstpitem.hxx>
51 : #include <editeng/autokernitem.hxx>
52 : #include <editeng/paperinf.hxx>
53 : #include <editeng/emphasismarkitem.hxx>
54 : #include <editeng/forbiddenruleitem.hxx>
55 : #include <editeng/twolinesitem.hxx>
56 : #include <editeng/scriptspaceitem.hxx>
57 : #include <editeng/hngpnctitem.hxx>
58 : #include <editeng/pbinitem.hxx>
59 : #include <editeng/charscaleitem.hxx>
60 : #include <editeng/charrotateitem.hxx>
61 : #include <editeng/charreliefitem.hxx>
62 : #include <editeng/blinkitem.hxx>
63 : #include <editeng/hyphenzoneitem.hxx>
64 : #include <editeng/paravertalignitem.hxx>
65 : #include <editeng/pgrditem.hxx>
66 : #include <editeng/frmdiritem.hxx>
67 : #include <editeng/charhiddenitem.hxx>
68 : #include <i18nlangtag/mslangid.hxx>
69 : #include <filter/msfilter/sprmids.hxx>
70 : #include <fmtpdsc.hxx>
71 : #include <node.hxx>
72 : #include <ndtxt.hxx>
73 : #include <pam.hxx>
74 : #include <doc.hxx>
75 : #include <pagedesc.hxx>
76 : #include <fmtanchr.hxx>
77 : #include <fmtcntnt.hxx>
78 : #include <fchrfmt.hxx>
79 : #include <fmthdft.hxx>
80 : #include <fmtclds.hxx>
81 : #include <fmtftntx.hxx>
82 : #include <frmatr.hxx>
83 : #include <section.hxx>
84 : #include <lineinfo.hxx>
85 : #include <fmtline.hxx>
86 : #include <txatbase.hxx>
87 : #include <fmtflcnt.hxx>
88 : #include <fmtclbl.hxx>
89 : #include <tgrditem.hxx>
90 : #include <hfspacingitem.hxx>
91 : #include <swtable.hxx>
92 : #include <fltini.hxx>
93 : #include "writerhelper.hxx"
94 : #include "writerwordglue.hxx"
95 : #include "ww8scan.hxx"
96 : #include "ww8par2.hxx"
97 : #include "ww8graf.hxx"
98 :
99 : // #i27767#
100 : #include <fmtwrapinfluenceonobjpos.hxx>
101 :
102 : using namespace sw::util;
103 : using namespace sw::types;
104 : using namespace ::com::sun::star;
105 : using namespace nsHdFtFlags;
106 :
107 : // diverses
108 :
109 : #define MM_250 1417 // WW-Default fuer Hor. Seitenraender: 2.5 cm
110 : #define MM_200 1134 // WW-Default fuer u.Seitenrand: 2.0 cm
111 :
112 :
113 : static sal_uInt8 lcl_ReadBorders(bool bVer67, WW8_BRCVer9* brc, WW8PLCFx_Cp_FKP* pPap,
114 : const WW8RStyle* pSty = 0, const WW8PLCFx_SEPX* pSep = 0);
115 :
116 5954 : ColorData SwWW8ImplReader::GetCol(sal_uInt8 nIco)
117 : {
118 : static const ColorData eSwWW8ColA[] =
119 : {
120 : COL_AUTO, COL_BLACK, COL_LIGHTBLUE, COL_LIGHTCYAN, COL_LIGHTGREEN,
121 : COL_LIGHTMAGENTA, COL_LIGHTRED, COL_YELLOW, COL_WHITE, COL_BLUE,
122 : COL_CYAN, COL_GREEN, COL_MAGENTA, COL_RED, COL_BROWN, COL_GRAY,
123 : COL_LIGHTGRAY
124 : };
125 :
126 5954 : return eSwWW8ColA[nIco];
127 : }
128 :
129 172 : inline sal_uInt32 MSRoundTweak(sal_uInt32 x)
130 : {
131 172 : return x;
132 : }
133 :
134 : /***************************************************************************
135 : # Seiten - Attribute, die nicht ueber die Attribut-Verwaltung, sondern
136 : # ueber ...->HasSprm abgearbeitet werden
137 : # ( ausser OLST, dass weiterhin ein normales Attribut ist )
138 : #**************************************************************************/
139 :
140 343 : static short ReadSprm( const WW8PLCFx_SEPX* pSep, sal_uInt16 nId, short nDefaultVal )
141 : {
142 343 : const sal_uInt8* pS = pSep->HasSprm( nId ); // sprm da ?
143 343 : short nVal = ( pS ) ? SVBT16ToShort( pS ) : nDefaultVal;
144 343 : return nVal;
145 : }
146 :
147 1028 : static sal_uInt16 ReadUSprm( const WW8PLCFx_SEPX* pSep, sal_uInt16 nId, short nDefaultVal )
148 : {
149 1028 : const sal_uInt8* pS = pSep->HasSprm( nId ); // sprm da ?
150 1028 : sal_uInt16 nVal = ( pS ) ? SVBT16ToShort( pS ) : nDefaultVal;
151 1028 : return nVal;
152 : }
153 :
154 772 : static sal_uInt8 ReadBSprm( const WW8PLCFx_SEPX* pSep, sal_uInt16 nId, sal_uInt8 nDefaultVal )
155 : {
156 772 : const sal_uInt8* pS = pSep->HasSprm( nId ); // sprm da ?
157 772 : sal_uInt8 nVal = pS ? *pS : nDefaultVal;
158 772 : return nVal;
159 : }
160 :
161 85 : void wwSection::SetDirection()
162 : {
163 : //sprmSTextFlow
164 85 : switch (maSep.wTextFlow)
165 : {
166 : default:
167 : OSL_ENSURE(!this, "Unknown layout type");
168 : //fall-through
169 : case 0:
170 85 : meDir=FRMDIR_HORI_LEFT_TOP;
171 85 : break;
172 : case 1:
173 0 : meDir=FRMDIR_VERT_TOP_RIGHT;
174 0 : break;
175 : case 2:
176 : //asian letters are not rotated, western are. We can't import
177 : //bottom to top going left to right, we can't do this in
178 : //pages, (in drawboxes we could partly hack it with a rotated
179 : //drawing box, though not frame)
180 0 : meDir=FRMDIR_VERT_TOP_RIGHT;
181 0 : break;
182 : case 3:
183 : //asian letters are not rotated, western are. We can't import
184 0 : meDir=FRMDIR_VERT_TOP_RIGHT;
185 0 : break;
186 : case 4:
187 : //asian letters are rotated, western not. We can't import
188 0 : meDir=FRMDIR_HORI_LEFT_TOP;
189 0 : break;
190 : }
191 :
192 85 : sal_uInt8 nRTLPgn = maSep.fBiDi;
193 85 : if ((meDir == FRMDIR_HORI_LEFT_TOP) && nRTLPgn)
194 0 : meDir = FRMDIR_HORI_RIGHT_TOP;
195 85 : }
196 :
197 187 : bool wwSection::IsVertical() const
198 : {
199 187 : if (meDir == FRMDIR_VERT_TOP_RIGHT || meDir == FRMDIR_VERT_TOP_LEFT)
200 0 : return true;
201 187 : return false;
202 : }
203 :
204 : /*
205 : This is something of festering mapping, I'm open to better ways of doing it,
206 : but primarily the grid in writer is different to that in word. In writer the
207 : grid elements are squares with ruby rows inbetween. While in word there is no
208 : ruby stuff, and the elements are rectangles. By misusing the ruby row I can
209 : handle distortions in one direction, but its all a bit of a mess:
210 : */
211 85 : void SwWW8ImplReader::SetDocumentGrid(SwFrmFmt &rFmt, const wwSection &rSection)
212 : {
213 85 : if (bVer67)
214 86 : return;
215 :
216 84 : rFmt.SetFmtAttr(SvxFrameDirectionItem(rSection.meDir, RES_FRAMEDIR));
217 :
218 84 : SwTwips nTextareaHeight = rFmt.GetFrmSize().GetHeight();
219 84 : const SvxULSpaceItem &rUL = ItemGet<SvxULSpaceItem>(rFmt, RES_UL_SPACE);
220 84 : nTextareaHeight -= rUL.GetUpper();
221 84 : nTextareaHeight -= rUL.GetLower();
222 :
223 84 : SwTwips nTextareaWidth = rFmt.GetFrmSize().GetWidth();
224 84 : const SvxLRSpaceItem &rLR = ItemGet<SvxLRSpaceItem>(rFmt, RES_LR_SPACE);
225 84 : nTextareaWidth -= rLR.GetLeft();
226 84 : nTextareaWidth -= rLR.GetRight();
227 :
228 84 : if (rSection.IsVertical())
229 0 : std::swap(nTextareaHeight, nTextareaWidth);
230 :
231 84 : SwTextGridItem aGrid;
232 84 : aGrid.SetDisplayGrid(false);
233 84 : aGrid.SetPrintGrid(false);
234 84 : SwTextGrid eType=GRID_NONE;
235 :
236 84 : switch (rSection.maSep.clm)
237 : {
238 : case 0:
239 82 : eType = GRID_NONE;
240 82 : break;
241 : default:
242 : OSL_ENSURE(!this, "Unknown grid type");
243 : //fall-through
244 : case 3:
245 0 : eType = GRID_LINES_CHARS;
246 0 : aGrid.SetSnapToChars(sal_True);
247 0 : break;
248 : case 1:
249 0 : eType = GRID_LINES_CHARS;
250 0 : aGrid.SetSnapToChars(sal_False);
251 0 : break;
252 : case 2:
253 2 : eType = GRID_LINES_ONLY;
254 2 : break;
255 : }
256 :
257 84 : aGrid.SetGridType(eType);
258 :
259 : // seem to not add external leading in word, or the character would run across
260 : // two line in some cases.
261 84 : if (eType != GRID_NONE)
262 2 : rDoc.set(IDocumentSettingAccess::ADD_EXT_LEADING, false);
263 :
264 : //force to set document as standard page mode
265 84 : sal_Bool bSquaredMode = sal_False;
266 84 : rDoc.SetDefaultPageMode( bSquaredMode );
267 84 : aGrid.SetSquaredMode( bSquaredMode );
268 :
269 : //Get the size of word's default styles font
270 84 : sal_uInt32 nCharWidth=240;
271 84 : for (sal_uInt16 nI = 0; nI < pStyles->GetCount(); ++nI)
272 : {
273 168 : if (vColl[nI].bValid && vColl[nI].pFmt &&
274 84 : vColl[nI].GetWWStyleId() == 0)
275 : {
276 84 : nCharWidth = ItemGet<SvxFontHeightItem>(*(vColl[nI].pFmt),
277 84 : RES_CHRATR_CJK_FONTSIZE).GetHeight();
278 84 : break;
279 : }
280 : }
281 :
282 : //dxtCharSpace
283 84 : if (rSection.maSep.dxtCharSpace)
284 : {
285 4 : sal_uInt32 nCharSpace = rSection.maSep.dxtCharSpace;
286 : //main lives in top 20 bits, and is signed.
287 4 : sal_Int32 nMain = (nCharSpace & 0xFFFFF000);
288 4 : nMain/=0x1000;
289 4 : nCharWidth += nMain*20;
290 :
291 4 : int nFraction = (nCharSpace & 0x00000FFF);
292 4 : nFraction = (nFraction*20)/0xFFF;
293 4 : nCharWidth += nFraction;
294 : }
295 :
296 84 : aGrid.SetBaseWidth( writer_cast<sal_uInt16>(nCharWidth));
297 :
298 : //sep.dyaLinePitch
299 84 : sal_Int32 nLinePitch = rSection.maSep.dyaLinePitch;
300 84 : if (nLinePitch >= 1 && nLinePitch <= 31680)
301 : {
302 83 : aGrid.SetLines(writer_cast<sal_uInt16>(nTextareaHeight/nLinePitch));
303 83 : aGrid.SetBaseHeight(writer_cast<sal_uInt16>(nLinePitch));
304 : }
305 :
306 84 : sal_Int32 nRubyHeight = 0;
307 84 : aGrid.SetRubyHeight(writer_cast<sal_uInt16>(nRubyHeight));
308 :
309 84 : rFmt.SetFmtAttr(aGrid);
310 : }
311 :
312 722 : void SwWW8ImplReader::Read_ParaBiDi(sal_uInt16, const sal_uInt8* pData, short nLen)
313 : {
314 722 : if( nLen < 0 )
315 348 : pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_FRAMEDIR);
316 : else
317 : {
318 : SvxFrameDirection eDir =
319 374 : *pData ? FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP;
320 374 : NewAttr(SvxFrameDirectionItem(eDir, RES_FRAMEDIR));
321 : }
322 722 : }
323 :
324 85 : bool wwSectionManager::SetCols(SwFrmFmt &rFmt, const wwSection &rSection,
325 : sal_uInt32 nNettoWidth) const
326 : {
327 : //sprmSCcolumns - number of columns - 1
328 85 : const sal_Int16 nCols = rSection.NoCols();
329 :
330 85 : if (nCols < 2) //check for no columns or other weird state
331 84 : return false;
332 :
333 1 : SwFmtCol aCol; // Create SwFmtCol
334 :
335 : //sprmSDxaColumns - Default distance is 1.25 cm
336 1 : sal_Int32 nColSpace = rSection.StandardColSeparation();
337 :
338 1 : const SEPr& rSep = rSection.maSep;
339 :
340 : // sprmSLBetween
341 1 : if (rSep.fLBetween)
342 : {
343 0 : aCol.SetLineAdj(COLADJ_TOP); // Line
344 0 : aCol.SetLineHeight(100);
345 0 : aCol.SetLineColor(Color(COL_BLACK));
346 0 : aCol.SetLineWidth(1);
347 : }
348 :
349 1 : aCol.Init(nCols, writer_cast<sal_uInt16>(nColSpace),
350 2 : writer_cast<sal_uInt16>(nNettoWidth));
351 :
352 : // sprmSFEvenlySpaced
353 1 : if (!rSep.fEvenlySpaced)
354 : {
355 1 : aCol._SetOrtho(false);
356 1 : const sal_uInt16 maxIdx = SAL_N_ELEMENTS(rSep.rgdxaColumnWidthSpacing);
357 3 : for (sal_uInt16 i = 0, nIdx = 1; i < nCols && nIdx < maxIdx; i++, nIdx+=2 )
358 : {
359 2 : SwColumn* pCol = &aCol.GetColumns()[i];
360 2 : const sal_Int32 nLeft = rSep.rgdxaColumnWidthSpacing[nIdx-1]/2;
361 2 : const sal_Int32 nRight = rSep.rgdxaColumnWidthSpacing[nIdx+1]/2;
362 2 : const sal_Int32 nWishWidth = rSep.rgdxaColumnWidthSpacing[nIdx]
363 4 : + nLeft + nRight;
364 2 : pCol->SetWishWidth(writer_cast<sal_uInt16>(nWishWidth));
365 2 : pCol->SetLeft(writer_cast<sal_uInt16>(nLeft));
366 2 : pCol->SetRight(writer_cast<sal_uInt16>(nRight));
367 : }
368 1 : aCol.SetWishWidth(writer_cast<sal_uInt16>(nNettoWidth));
369 : }
370 1 : rFmt.SetFmtAttr(aCol);
371 1 : return true;
372 : }
373 :
374 86 : void wwSectionManager::SetLeftRight(wwSection &rSection)
375 : {
376 : // 3. LR-Raender
377 86 : sal_uInt32 nWWLe = MSRoundTweak(rSection.maSep.dxaLeft);
378 86 : sal_uInt32 nWWRi = MSRoundTweak(rSection.maSep.dxaRight);
379 86 : sal_uInt32 nWWGu = rSection.maSep.dzaGutter;
380 :
381 : /*
382 : fRTLGutter is set if the gutter is on the right, the gutter is otherwise
383 : placed on the left unless the global dop options are to put it on top, that
384 : case is handled in GetPageULData.
385 : */
386 86 : if (rSection.maSep.fRTLGutter)
387 0 : nWWRi += nWWGu;
388 86 : else if (!mrReader.pWDop->iGutterPos)
389 85 : nWWLe += nWWGu;
390 :
391 : // Left / Right
392 86 : if ((rSection.nPgWidth - nWWLe - nWWRi) < MINLAY)
393 : {
394 : /*
395 : There are some label templates which are "broken", they specify
396 : margins which make no sense e.g. Left 16.10cm, Right 16.10cm. So the
397 : space left between the margins is less than 0 In word the left margin
398 : is honoured and if the right margin would be past the left margin is
399 : left at the left margin position.
400 :
401 : Now this will work fine for importing, layout and exporting, *but* the
402 : page layout dialog has a hardcoded minimum page width of 0.5cm so it
403 : will report a different value than what is actually being used. i.e.
404 : it will add up the values to give a wider page than is actually being
405 : used.
406 : */
407 0 : nWWRi = rSection.nPgWidth - nWWLe - MINLAY;
408 : }
409 :
410 86 : rSection.nPgLeft = nWWLe;
411 86 : rSection.nPgRight = nWWRi;
412 86 : }
413 :
414 85 : void wwSectionManager::SetPage(SwPageDesc &rInPageDesc, SwFrmFmt &rFmt,
415 : const wwSection &rSection, bool bIgnoreCols) const
416 : {
417 : // 1. Orientierung
418 85 : rInPageDesc.SetLandscape(rSection.IsLandScape());
419 :
420 : // 2. Papiergroesse
421 85 : SwFmtFrmSize aSz( rFmt.GetFrmSize() );
422 85 : aSz.SetWidth(rSection.GetPageWidth());
423 85 : aSz.SetHeight(SvxPaperInfo::GetSloppyPaperDimension(rSection.GetPageHeight()));
424 85 : rFmt.SetFmtAttr(aSz);
425 :
426 : rFmt.SetFmtAttr(
427 85 : SvxLRSpaceItem(rSection.GetPageLeft(), rSection.GetPageRight(), 0, 0, RES_LR_SPACE));
428 :
429 85 : if (!bIgnoreCols)
430 85 : SetCols(rFmt, rSection, rSection.GetTextAreaWidth());
431 85 : }
432 :
433 40 : static sal_uInt16 lcl_MakeSafeNegativeSpacing(sal_uInt16 nIn)
434 : {
435 40 : if (nIn > SHRT_MAX)
436 0 : nIn = 0;
437 40 : return nIn;
438 : }
439 :
440 170 : void SwWW8ImplReader::SetPageBorder(SwFrmFmt &rFmt, const wwSection &rSection) const
441 : {
442 170 : if (!IsBorder(rSection.brc))
443 334 : return;
444 :
445 6 : SfxItemSet aSet(rFmt.GetAttrSet());
446 6 : short aSizeArray[5]={0};
447 6 : SetFlyBordersShadow(aSet, rSection.brc, &aSizeArray[0]);
448 12 : SvxLRSpaceItem aLR(ItemGet<SvxLRSpaceItem>(aSet, RES_LR_SPACE));
449 12 : SvxULSpaceItem aUL(ItemGet<SvxULSpaceItem>(aSet, RES_UL_SPACE));
450 :
451 12 : SvxBoxItem aBox(ItemGet<SvxBoxItem>(aSet, RES_BOX));
452 6 : short aOriginalBottomMargin = aBox.GetDistance(BOX_LINE_BOTTOM);
453 :
454 6 : if (rSection.maSep.pgbOffsetFrom == 1)
455 : {
456 : sal_uInt16 nDist;
457 4 : if (aBox.GetLeft())
458 : {
459 4 : nDist = aBox.GetDistance(BOX_LINE_LEFT);
460 4 : aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aLR.GetLeft() - nDist)), BOX_LINE_LEFT);
461 : aSizeArray[WW8_LEFT] =
462 4 : aSizeArray[WW8_LEFT] - nDist + aBox.GetDistance(BOX_LINE_LEFT);
463 : }
464 :
465 4 : if (aBox.GetRight())
466 : {
467 4 : nDist = aBox.GetDistance(BOX_LINE_RIGHT);
468 4 : aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aLR.GetRight() - nDist)), BOX_LINE_RIGHT);
469 : aSizeArray[WW8_RIGHT] =
470 4 : aSizeArray[WW8_RIGHT] - nDist + aBox.GetDistance(BOX_LINE_RIGHT);
471 : }
472 :
473 4 : if (aBox.GetTop())
474 : {
475 4 : nDist = aBox.GetDistance(BOX_LINE_TOP);
476 4 : aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aUL.GetUpper() - nDist)), BOX_LINE_TOP);
477 : aSizeArray[WW8_TOP] =
478 4 : aSizeArray[WW8_TOP] - nDist + aBox.GetDistance(BOX_LINE_TOP);
479 : }
480 :
481 4 : if (aBox.GetBottom())
482 : {
483 4 : nDist = aBox.GetDistance(BOX_LINE_BOTTOM);
484 4 : aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aUL.GetLower() - nDist)), BOX_LINE_BOTTOM);
485 : aSizeArray[WW8_BOT] =
486 4 : aSizeArray[WW8_BOT] - nDist + aBox.GetDistance(BOX_LINE_BOTTOM);
487 : }
488 :
489 4 : aSet.Put(aBox);
490 : }
491 :
492 6 : if (aBox.GetLeft())
493 6 : aLR.SetLeft(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aLR.GetLeft() - aSizeArray[WW8_LEFT])));
494 6 : if (aBox.GetRight())
495 6 : aLR.SetRight(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aLR.GetRight() - aSizeArray[WW8_RIGHT])));
496 6 : if (aBox.GetTop())
497 6 : aUL.SetUpper(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aUL.GetUpper() - aSizeArray[WW8_TOP])));
498 6 : if (aBox.GetBottom())
499 : {
500 : //#i30088# and #i30074# - do a final sanity check on
501 : //bottom value. Do not allow a resulting zero if bottom
502 : //Border margin value was not originally zero.
503 6 : if(aUL.GetLower() != 0)
504 6 : aUL.SetLower(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aUL.GetLower() - aSizeArray[WW8_BOT])));
505 : else
506 0 : aUL.SetLower(lcl_MakeSafeNegativeSpacing(static_cast<sal_uInt16>(aOriginalBottomMargin - aSizeArray[WW8_BOT])));
507 : }
508 :
509 6 : aSet.Put(aLR);
510 6 : aSet.Put(aUL);
511 12 : rFmt.SetFmtAttr(aSet);
512 : }
513 :
514 85 : void wwSectionManager::GetPageULData(const wwSection &rSection,
515 : wwSectionManager::wwULSpaceData& rData) const
516 : {
517 85 : sal_Int32 nWWUp = rSection.maSep.dyaTop;
518 85 : sal_Int32 nWWLo = rSection.maSep.dyaBottom;
519 85 : sal_uInt32 nWWHTop = rSection.maSep.dyaHdrTop;
520 85 : sal_uInt32 nWWFBot = rSection.maSep.dyaHdrBottom;
521 :
522 : /*
523 : If there is gutter in 97+ and the dop says put it on top then get the
524 : gutter distance and set it to the top margin. When we are "two pages
525 : in one" the gutter is put at the top of odd pages, and bottom of
526 : even pages, something we cannot do. So we will put it on top of all
527 : pages, that way the pages are at least the right size.
528 : */
529 85 : if (
530 169 : (!mrReader.bVer67 && mrReader.pWDop->iGutterPos &&
531 : rSection.maSep.fRTLGutter)
532 : )
533 : {
534 0 : nWWUp += rSection.maSep.dzaGutter;
535 : }
536 :
537 85 : rData.bHasHeader = (rSection.maSep.grpfIhdt &
538 85 : (WW8_HEADER_EVEN | WW8_HEADER_ODD | WW8_HEADER_FIRST)) != 0;
539 :
540 85 : if( rData.bHasHeader )
541 : {
542 26 : rData.nSwUp = nWWHTop; // Header -> umrechnen
543 : // #i19922# - correction:
544 : // consider that <nWWUp> can be negative, compare only if it's positive
545 52 : if ( nWWUp > 0 &&
546 26 : static_cast<sal_uInt32>(abs(nWWUp)) >= nWWHTop )
547 25 : rData.nSwHLo = nWWUp - nWWHTop;
548 : else
549 1 : rData.nSwHLo = 0;
550 :
551 : // #i19922# - minimum page header height is now 1mm
552 : // use new constant <cMinHdFtHeight>
553 26 : if (rData.nSwHLo < sal::static_int_cast< sal_uInt32 >(cMinHdFtHeight))
554 1 : rData.nSwHLo = sal::static_int_cast< sal_uInt32 >(cMinHdFtHeight);
555 : }
556 : else // kein Header -> Up einfach uebernehmen
557 59 : rData.nSwUp = std::abs(nWWUp);
558 :
559 85 : rData.bHasFooter = (rSection.maSep.grpfIhdt &
560 85 : (WW8_FOOTER_EVEN | WW8_FOOTER_ODD | WW8_FOOTER_FIRST)) != 0;
561 :
562 85 : if( rData.bHasFooter )
563 : {
564 29 : rData.nSwLo = nWWFBot; // Footer -> Umrechnen
565 : // #i19922# - correction: consider that <nWWLo> can be negative, compare only if it's positive
566 58 : if ( nWWLo > 0 &&
567 29 : static_cast<sal_uInt32>(abs(nWWLo)) >= nWWFBot )
568 28 : rData.nSwFUp = nWWLo - nWWFBot;
569 : else
570 1 : rData.nSwFUp = 0;
571 :
572 : // #i19922# - minimum page header height is now 1mm
573 : // use new constant <cMinHdFtHeight>
574 29 : if (rData.nSwFUp < sal::static_int_cast< sal_uInt32 >(cMinHdFtHeight))
575 1 : rData.nSwFUp = sal::static_int_cast< sal_uInt32 >(cMinHdFtHeight);
576 : }
577 : else // kein Footer -> Lo einfach uebernehmen
578 56 : rData.nSwLo = std::abs(nWWLo);
579 85 : }
580 :
581 85 : void wwSectionManager::SetPageULSpaceItems(SwFrmFmt &rFmt,
582 : wwSectionManager::wwULSpaceData& rData, const wwSection &rSection) const
583 : {
584 85 : if (rData.bHasHeader) // ... und Header-Lower setzen
585 : {
586 : //Kopfzeilenhoehe minimal sezten
587 26 : if (SwFrmFmt* pHdFmt = (SwFrmFmt*)rFmt.GetHeader().GetHeaderFmt())
588 : {
589 26 : SvxULSpaceItem aHdUL(pHdFmt->GetULSpace());
590 26 : if (!rSection.IsFixedHeightHeader()) //normal
591 : {
592 26 : pHdFmt->SetFmtAttr(SwFmtFrmSize(ATT_MIN_SIZE, 0, rData.nSwHLo));
593 : // #i19922# - minimum page header height is now 1mm
594 : // use new constant <cMinHdFtHeight>
595 26 : aHdUL.SetLower( writer_cast<sal_uInt16>(rData.nSwHLo - cMinHdFtHeight) );
596 : pHdFmt->SetFmtAttr(SwHeaderAndFooterEatSpacingItem(
597 26 : RES_HEADER_FOOTER_EAT_SPACING, true));
598 : }
599 : else
600 : {
601 : // #i48832# - set correct spacing between header and body.
602 0 : const SwTwips nHdLowerSpace( std::abs(rSection.maSep.dyaTop) - rData.nSwUp - rData.nSwHLo );
603 0 : pHdFmt->SetFmtAttr(SwFmtFrmSize(ATT_FIX_SIZE, 0, rData.nSwHLo + nHdLowerSpace));
604 0 : aHdUL.SetLower( static_cast< sal_uInt16 >(nHdLowerSpace) );
605 : pHdFmt->SetFmtAttr(SwHeaderAndFooterEatSpacingItem(
606 0 : RES_HEADER_FOOTER_EAT_SPACING, false));
607 : }
608 26 : pHdFmt->SetFmtAttr(aHdUL);
609 : }
610 : }
611 :
612 85 : if (rData.bHasFooter) // ... und Footer-Upper setzen
613 : {
614 29 : if (SwFrmFmt* pFtFmt = (SwFrmFmt*)rFmt.GetFooter().GetFooterFmt())
615 : {
616 29 : SvxULSpaceItem aFtUL(pFtFmt->GetULSpace());
617 29 : if (!rSection.IsFixedHeightFooter()) //normal
618 : {
619 29 : pFtFmt->SetFmtAttr(SwFmtFrmSize(ATT_MIN_SIZE, 0, rData.nSwFUp));
620 : // #i19922# - minimum page header height is now 1mm
621 : // use new constant <cMinHdFtHeight>
622 29 : aFtUL.SetUpper( writer_cast<sal_uInt16>(rData.nSwFUp - cMinHdFtHeight) );
623 : pFtFmt->SetFmtAttr(SwHeaderAndFooterEatSpacingItem(
624 29 : RES_HEADER_FOOTER_EAT_SPACING, true));
625 : }
626 : else
627 : {
628 : // #i48832# - set correct spacing between footer and body.
629 0 : const SwTwips nFtUpperSpace( std::abs(rSection.maSep.dyaBottom) - rData.nSwLo - rData.nSwFUp );
630 0 : pFtFmt->SetFmtAttr(SwFmtFrmSize(ATT_FIX_SIZE, 0, rData.nSwFUp + nFtUpperSpace));
631 0 : aFtUL.SetUpper( static_cast< sal_uInt16 >(nFtUpperSpace) );
632 : pFtFmt->SetFmtAttr(SwHeaderAndFooterEatSpacingItem(
633 0 : RES_HEADER_FOOTER_EAT_SPACING, false));
634 : }
635 29 : pFtFmt->SetFmtAttr(aFtUL);
636 : }
637 : }
638 :
639 85 : SvxULSpaceItem aUL(writer_cast<sal_uInt16>(rData.nSwUp),
640 170 : writer_cast<sal_uInt16>(rData.nSwLo), RES_UL_SPACE);
641 85 : rFmt.SetFmtAttr(aUL);
642 85 : }
643 :
644 0 : SwSectionFmt *wwSectionManager::InsertSection(
645 : SwPaM& rMyPaM, wwSection &rSection)
646 : {
647 : SwSectionData aSection( CONTENT_SECTION,
648 0 : mrReader.rDoc.GetUniqueSectionName() );
649 :
650 0 : SfxItemSet aSet( mrReader.rDoc.GetAttrPool(), aFrmFmtSetRange );
651 :
652 0 : bool nRTLPgn = !maSegments.empty() && maSegments.back().IsBiDi();
653 : aSet.Put(SvxFrameDirectionItem(
654 0 : nRTLPgn ? FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR));
655 :
656 0 : if (2 == mrReader.pWDop->fpc)
657 0 : aSet.Put( SwFmtFtnAtTxtEnd(FTNEND_ATTXTEND));
658 0 : if (0 == mrReader.pWDop->epc)
659 0 : aSet.Put( SwFmtEndAtTxtEnd(FTNEND_ATTXTEND));
660 :
661 0 : aSection.SetProtectFlag(SectionIsProtected(rSection));
662 :
663 : rSection.mpSection =
664 0 : mrReader.rDoc.InsertSwSection( rMyPaM, aSection, 0, & aSet );
665 : OSL_ENSURE(rSection.mpSection, "section not inserted!");
666 0 : if (!rSection.mpSection)
667 0 : return 0;
668 :
669 0 : SwPageDesc *pPage = 0;
670 0 : mySegrIter aEnd = maSegments.rend();
671 0 : for (mySegrIter aIter = maSegments.rbegin(); aIter != aEnd; ++aIter)
672 : {
673 0 : if (0 != (pPage = aIter->mpPage))
674 0 : break;
675 : }
676 :
677 : OSL_ENSURE(pPage, "no page outside this section!");
678 :
679 0 : if (!pPage)
680 0 : pPage = &mrReader.rDoc.GetPageDesc(0);
681 :
682 0 : if (!pPage)
683 0 : return 0;
684 :
685 0 : SwSectionFmt *pFmt = rSection.mpSection->GetFmt();
686 : OSL_ENSURE(pFmt, "impossible");
687 0 : if (!pFmt)
688 0 : return 0;
689 :
690 0 : SwFrmFmt& rFmt = pPage->GetMaster();
691 0 : const SvxLRSpaceItem& rLR = rFmt.GetLRSpace();
692 0 : long nPageLeft = rLR.GetLeft();
693 0 : long nPageRight = rLR.GetRight();
694 0 : long nSectionLeft = rSection.GetPageLeft() - nPageLeft;
695 0 : long nSectionRight = rSection.GetPageRight() - nPageRight;
696 0 : if ((nSectionLeft != 0) || (nSectionRight != 0))
697 : {
698 0 : SvxLRSpaceItem aLR(nSectionLeft, nSectionRight, 0, 0, RES_LR_SPACE);
699 0 : pFmt->SetFmtAttr(aLR);
700 : }
701 :
702 0 : SetCols(*pFmt, rSection, rSection.GetTextAreaWidth());
703 0 : return pFmt;
704 : }
705 :
706 86 : void SwWW8ImplReader::HandleLineNumbering(const wwSection &rSection)
707 : {
708 : // check if Line Numbering must be activated or resetted
709 86 : if (mbNewDoc && rSection.maSep.nLnnMod)
710 : {
711 : // restart-numbering-mode: 0 per page, 1 per section, 2 never restart
712 0 : bool bRestartLnNumPerSection = (1 == rSection.maSep.lnc);
713 :
714 0 : if (bNoLnNumYet)
715 : {
716 0 : SwLineNumberInfo aInfo( rDoc.GetLineNumberInfo() );
717 :
718 0 : aInfo.SetPaintLineNumbers(true);
719 :
720 0 : aInfo.SetRestartEachPage(rSection.maSep.lnc == 0);
721 :
722 0 : aInfo.SetPosFromLeft(writer_cast<sal_uInt16>(rSection.maSep.dxaLnn));
723 :
724 : //Paint only for every n line
725 0 : aInfo.SetCountBy(rSection.maSep.nLnnMod);
726 :
727 : // to be defaulted features ( HARDCODED in MS Word 6,7,8,9 )
728 0 : aInfo.SetCountBlankLines(true);
729 0 : aInfo.SetCountInFlys(false);
730 0 : aInfo.SetPos( LINENUMBER_POS_LEFT );
731 0 : SvxNumberType aNumType; // this sets SVX_NUM_ARABIC per default
732 0 : aInfo.SetNumType( aNumType );
733 :
734 0 : rDoc.SetLineNumberInfo( aInfo );
735 0 : bNoLnNumYet = false;
736 : }
737 :
738 0 : if (
739 0 : (0 < rSection.maSep.lnnMin) ||
740 0 : (bRestartLnNumPerSection && !bNoLnNumYet)
741 : )
742 : {
743 0 : SwFmtLineNumber aLN;
744 0 : if (const SwFmtLineNumber* pLN
745 0 : = (const SwFmtLineNumber*)GetFmtAttr(RES_LINENUMBER))
746 : {
747 0 : aLN.SetCountLines( pLN->IsCount() );
748 : }
749 0 : aLN.SetStartValue(1 + rSection.maSep.lnnMin);
750 0 : NewAttr(aLN);
751 0 : pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_LINENUMBER);
752 : }
753 0 : bNoLnNumYet = false;
754 : }
755 86 : }
756 :
757 172 : wwSection::wwSection(const SwPosition &rPos) : maStart(rPos.nNode),
758 : mpSection(0), mpPage(0), meDir(FRMDIR_HORI_LEFT_TOP), mLinkId(0),
759 344 : nPgWidth(SvxPaperInfo::GetPaperSize(PAPER_A4).Width()),
760 516 : nPgLeft(MM_250), nPgRight(MM_250), mnBorders(0), mbHasFootnote(false)
761 : {
762 172 : }
763 :
764 85 : void wwSectionManager::SetNumberingType(const wwSection &rNewSection,
765 : SwPageDesc &rPageDesc) const
766 : {
767 : // Seitennummernformat speichern
768 : static const SvxExtNumType aNumTyp[5] =
769 : {
770 : SVX_NUM_ARABIC, SVX_NUM_ROMAN_UPPER, SVX_NUM_ROMAN_LOWER,
771 : SVX_NUM_CHARS_UPPER_LETTER_N, SVX_NUM_CHARS_LOWER_LETTER_N
772 : };
773 :
774 85 : SvxNumberType aType;
775 85 : aType.SetNumberingType( static_cast< sal_Int16 >(aNumTyp[rNewSection.maSep.nfcPgn]) );
776 85 : rPageDesc.SetNumType(aType);
777 85 : }
778 :
779 : // Bei jedem Abschnittswechsel ( auch am Anfang eines Dokuments ) wird
780 : // CreateSep gerufen, dass dann den / die Pagedesc(s) erzeugt und
781 : // mit Attributen un KF-Texten fuellt.
782 : // Dieses Vorgehen ist noetig geworden, da die UEbersetzung der verschiedenen
783 : // Seiten-Attribute zu stark verflochten ist.
784 86 : void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/)
785 : {
786 : /*
787 : #i1909# section/page breaks should not occur in tables or subpage
788 : elements like frames. Word itself ignores them in this case. The bug is
789 : more likely that this filter created such documents in the past!
790 : */
791 86 : if (mrReader.nInTable || mrReader.bTxbxFlySection || mrReader.InLocalApo())
792 0 : return;
793 :
794 86 : WW8PLCFx_SEPX* pSep = mrReader.pPlcxMan->GetSepPLCF();
795 : OSL_ENSURE(pSep, "impossible!");
796 86 : if (!pSep)
797 0 : return;
798 :
799 86 : ww::WordVersion eVer = mrReader.GetFib().GetFIBVersion();
800 :
801 : // M.M. Create a linked section if the WkbPLCF
802 : // has an entry for one at this cp
803 86 : WW8PLCFspecial* pWkb = mrReader.pPlcxMan->GetWkbPLCF();
804 86 : if (pWkb && pWkb->SeekPosExact(nTxtPos) &&
805 0 : pWkb->Where() == nTxtPos)
806 : {
807 : void* pData;
808 : WW8_CP nTest;
809 0 : bool bSuccess = pWkb->Get(nTest, pData);
810 0 : if (!bSuccess)
811 0 : return;
812 0 : OUString sSectionName = mrReader.aLinkStringMap[SVBT16ToShort( ((WW8_WKB*)pData)->nLinkId) ];
813 0 : sSectionName = mrReader.ConvertFFileName(sSectionName);
814 0 : SwSectionData aSection(FILE_LINK_SECTION, sSectionName);
815 0 : aSection.SetLinkFileName( sSectionName );
816 0 : aSection.SetProtectFlag(true);
817 : // #i19922# - improvement: return value of method <Insert> not used.
818 0 : mrReader.rDoc.InsertSwSection(*mrReader.pPaM, aSection, 0, 0, false);
819 : }
820 :
821 86 : wwSection aLastSection(*mrReader.pPaM->GetPoint());
822 86 : if (!maSegments.empty())
823 13 : aLastSection = maSegments.back();
824 :
825 : //Here
826 86 : sal_uInt16 nLIdx = ( ( mrReader.pWwFib->lid & 0xff ) == 0x9 ) ? 1 : 0;
827 :
828 : //BEGIN read section values
829 172 : wwSection aNewSection(*mrReader.pPaM->GetPoint());
830 :
831 : static const sal_uInt16 aVer2Ids0[] =
832 : {
833 : /*sprmSBkc*/ 117,
834 : /*sprmSFTitlePage*/ 118,
835 : /*sprmSNfcPgn*/ 122,
836 : /*sprmSCcolumns*/ 119,
837 : /*sprmSDxaColumns*/ 120,
838 : /*sprmSLBetween*/ 133
839 : };
840 :
841 : static const sal_uInt16 aVer67Ids0[] =
842 : {
843 : /*sprmSBkc*/ 142,
844 : /*sprmSFTitlePage*/ 143,
845 : /*sprmSNfcPgn*/ 147,
846 : /*sprmSCcolumns*/ 144,
847 : /*sprmSDxaColumns*/ 145,
848 : /*sprmSLBetween*/ 158
849 : };
850 :
851 : static const sal_uInt16 aVer8Ids0[] =
852 : {
853 : /*sprmSBkc*/ 0x3009,
854 : /*sprmSFTitlePage*/ 0x300A,
855 : /*sprmSNfcPgn*/ 0x300E,
856 : /*sprmSCcolumns*/ 0x500B,
857 : /*sprmSDxaColumns*/ 0x900C,
858 : /*sprmSLBetween*/ 0x3019
859 : };
860 :
861 86 : const sal_uInt16* pIds = eVer <= ww::eWW2 ? aVer2Ids0 : eVer <= ww::eWW7 ? aVer67Ids0 : aVer8Ids0;
862 :
863 86 : if (!maSegments.empty())
864 : {
865 : // Type of break: break codes are:
866 : // 0 No break
867 : // 1 New column
868 : // 2 New page
869 : // 3 Even page
870 : // 4 Odd page
871 13 : if (const sal_uInt8* pSprmBkc = pSep->HasSprm(pIds[0]))
872 3 : aNewSection.maSep.bkc = *pSprmBkc;
873 : }
874 :
875 : // Has a table page
876 : aNewSection.maSep.fTitlePage =
877 86 : (0 != ReadBSprm( pSep, pIds[1], 0 ));
878 :
879 : // sprmSNfcPgn
880 86 : aNewSection.maSep.nfcPgn = ReadBSprm( pSep, pIds[2], 0 );
881 86 : if (aNewSection.maSep.nfcPgn > 4)
882 0 : aNewSection.maSep.nfcPgn = 0;
883 :
884 86 : aNewSection.maSep.fUnlocked = eVer > ww::eWW2 ? ReadBSprm(pSep, (eVer <= ww::eWW7 ? 139 : 0x3006), 0 ) : 0;
885 :
886 : // sprmSFBiDi
887 86 : aNewSection.maSep.fBiDi = eVer >= ww::eWW8 ? ReadBSprm(pSep, 0x3228, 0) : 0;
888 :
889 : // Reading section property sprmSCcolumns - one less than the number of columns in the section.
890 : // It must be less than MAX_NO_OF_SEP_COLUMNS according the WW8 specification.
891 86 : aNewSection.maSep.ccolM1 = ReadSprm(pSep, pIds[3], 0 );
892 86 : if ( aNewSection.maSep.ccolM1 >= MAX_NO_OF_SEP_COLUMNS )
893 : {
894 : // clip to max
895 0 : aNewSection.maSep.ccolM1 = MAX_NO_OF_SEP_COLUMNS-1;
896 : }
897 :
898 : //sprmSDxaColumns - Default-Abstand 1.25 cm
899 86 : aNewSection.maSep.dxaColumns = ReadUSprm( pSep, pIds[4], 708 );
900 :
901 : // sprmSLBetween
902 86 : aNewSection.maSep.fLBetween = ReadBSprm(pSep, pIds[5], 0 );
903 :
904 86 : if (eVer >= ww::eWW6)
905 : {
906 : // sprmSFEvenlySpaced
907 : aNewSection.maSep.fEvenlySpaced =
908 85 : sal_uInt8(ReadBSprm(pSep, (eVer <= ww::eWW7 ? 138 : 0x3005), 1) ? true : false);
909 :
910 85 : if (aNewSection.maSep.ccolM1 > 0 && !aNewSection.maSep.fEvenlySpaced)
911 : {
912 2 : int nColumnDataIdx = 0;
913 2 : aNewSection.maSep.rgdxaColumnWidthSpacing[nColumnDataIdx] = 0;
914 :
915 2 : const sal_uInt16 nColumnWidthSprmId = ( eVer <= ww::eWW7 ? 136 : 0xF203 );
916 2 : const sal_uInt16 nColumnSpacingSprmId = ( eVer <= ww::eWW7 ? 137 : 0xF204 );
917 2 : const sal_uInt8 nColumnCount = static_cast< sal_uInt8 >(aNewSection.maSep.ccolM1 + 1);
918 6 : for ( sal_uInt8 nColumn = 0; nColumn < nColumnCount; ++nColumn )
919 : {
920 : //sprmSDxaColWidth
921 4 : const sal_uInt8* pSW = pSep->HasSprm( nColumnWidthSprmId, nColumn );
922 :
923 : OSL_ENSURE( pSW, "+Sprm 136 (bzw. 0xF203) (ColWidth) fehlt" );
924 4 : sal_uInt16 nWidth = pSW ? SVBT16ToShort(pSW + 1) : 1440;
925 :
926 4 : aNewSection.maSep.rgdxaColumnWidthSpacing[++nColumnDataIdx] = nWidth;
927 :
928 4 : if ( nColumn < nColumnCount - 1 )
929 : {
930 : //sprmSDxaColSpacing
931 2 : const sal_uInt8* pSD = pSep->HasSprm( nColumnSpacingSprmId, nColumn );
932 :
933 : OSL_ENSURE( pSD, "+Sprm 137 (bzw. 0xF204) (Colspacing) fehlt" );
934 2 : if( pSD )
935 : {
936 2 : nWidth = SVBT16ToShort(pSD + 1);
937 2 : aNewSection.maSep.rgdxaColumnWidthSpacing[++nColumnDataIdx] = nWidth;
938 : }
939 : }
940 : }
941 : }
942 : }
943 :
944 : static const sal_uInt16 aVer2Ids1[] =
945 : {
946 : /*sprmSBOrientation*/ 137,
947 : /*sprmSXaPage*/ 139,
948 : /*sprmSYaPage*/ 140,
949 : /*sprmSDxaLeft*/ 141,
950 : /*sprmSDxaRight*/ 142,
951 : /*sprmSDzaGutter*/ 145,
952 : /*sprmSFPgnRestart*/ 125,
953 : /*sprmSPgnStart*/ 136,
954 : /*sprmSDmBinFirst*/ 115,
955 : /*sprmSDmBinOther*/ 116
956 : };
957 :
958 : static const sal_uInt16 aVer67Ids1[] =
959 : {
960 : /*sprmSBOrientation*/ 162,
961 : /*sprmSXaPage*/ 164,
962 : /*sprmSYaPage*/ 165,
963 : /*sprmSDxaLeft*/ 166,
964 : /*sprmSDxaRight*/ 167,
965 : /*sprmSDzaGutter*/ 170,
966 : /*sprmSFPgnRestart*/ 150,
967 : /*sprmSPgnStart*/ 161,
968 : /*sprmSDmBinFirst*/ 140,
969 : /*sprmSDmBinOther*/ 141
970 : };
971 :
972 : static const sal_uInt16 aVer8Ids1[] =
973 : {
974 : /*sprmSBOrientation*/ 0x301d,
975 : /*sprmSXaPage*/ 0xB01F,
976 : /*sprmSYaPage*/ 0xB020,
977 : /*sprmSDxaLeft*/ 0xB021,
978 : /*sprmSDxaRight*/ 0xB022,
979 : /*sprmSDzaGutter*/ 0xB025,
980 : /*sprmSFPgnRestart*/ 0x3011,
981 : /*sprmSPgnStart*/ 0x501C,
982 : /*sprmSDmBinFirst*/ 0x5007,
983 : /*sprmSDmBinOther*/ 0x5008
984 : };
985 :
986 86 : pIds = eVer <= ww::eWW2 ? aVer2Ids1 : eVer <= ww::eWW7 ? aVer67Ids1 : aVer8Ids1;
987 :
988 : // 1. Orientierung
989 86 : aNewSection.maSep.dmOrientPage = ReadBSprm(pSep, pIds[0], 0);
990 :
991 : // 2. Papiergroesse
992 86 : aNewSection.maSep.xaPage = ReadUSprm(pSep, pIds[1], lLetterWidth);
993 86 : aNewSection.nPgWidth = SvxPaperInfo::GetSloppyPaperDimension(aNewSection.maSep.xaPage);
994 :
995 86 : aNewSection.maSep.yaPage = ReadUSprm(pSep, pIds[2], lLetterHeight);
996 :
997 : // 3. LR-Raender
998 : static const sal_uInt16 nLef[] = { MM_250, 1800 };
999 : static const sal_uInt16 nRig[] = { MM_250, 1800 };
1000 :
1001 86 : aNewSection.maSep.dxaLeft = ReadUSprm( pSep, pIds[3], nLef[nLIdx]);
1002 86 : aNewSection.maSep.dxaRight = ReadUSprm( pSep, pIds[4], nRig[nLIdx]);
1003 :
1004 : // 2pages in 1sheet hackery ?
1005 : // #i31806# but only swap if 2page in 1sheet is enabled.
1006 : // its not clear if dmOrientPage is the correct member to
1007 : // decide on this but I am not about to 2nd guess cmc.
1008 86 : if(mrReader.pWDop->doptypography.f2on1 &&
1009 0 : aNewSection.maSep.dmOrientPage == 2)
1010 0 : std::swap(aNewSection.maSep.dxaLeft, aNewSection.maSep.dxaRight);
1011 :
1012 86 : aNewSection.maSep.dzaGutter = ReadUSprm( pSep, pIds[5], 0);
1013 :
1014 86 : aNewSection.maSep.fRTLGutter = static_cast< sal_uInt8 >(eVer >= ww::eWW8 ? ReadUSprm( pSep, 0x322A, 0 ) : 0);
1015 :
1016 : // Page Number Restarts - sprmSFPgnRestart
1017 86 : aNewSection.maSep.fPgnRestart = ReadBSprm(pSep, pIds[6], 0);
1018 :
1019 86 : aNewSection.maSep.pgnStart = ReadBSprm( pSep, pIds[7], 0 );
1020 :
1021 86 : if (eVer >= ww::eWW6)
1022 : {
1023 85 : if (const sal_uInt8* p = pSep->HasSprm( (eVer <= ww::eWW7 ? 132 : 0x3001) ))
1024 0 : aNewSection.maSep.iHeadingPgn = *p;
1025 :
1026 85 : if (const sal_uInt8* p = pSep->HasSprm( (eVer <= ww::eWW7 ? 131 : 0x3000) ))
1027 0 : aNewSection.maSep.cnsPgn = *p;
1028 : }
1029 :
1030 86 : if(const sal_uInt8* pSprmSDmBinFirst = pSep->HasSprm( pIds[8] ))
1031 3 : aNewSection.maSep.dmBinFirst = *pSprmSDmBinFirst;
1032 :
1033 86 : if (const sal_uInt8* pSprmSDmBinOther = pSep->HasSprm( pIds[9] ))
1034 3 : aNewSection.maSep.dmBinOther = *pSprmSDmBinOther;
1035 :
1036 : static const sal_uInt16 nTop[] = { MM_250, 1440 };
1037 : static const sal_uInt16 nBot[] = { MM_200, 1440 };
1038 :
1039 : static const sal_uInt16 aVer2Ids2[] =
1040 : {
1041 : /*sprmSDyaTop*/ 143,
1042 : /*sprmSDyaBottom*/ 144,
1043 : /*sprmSDyaHdrTop*/ 131,
1044 : /*sprmSDyaHdrBottom*/ 132,
1045 : /*sprmSNLnnMod*/ 129,
1046 : /*sprmSLnc*/ 127,
1047 : /*sprmSDxaLnn*/ 130,
1048 : /*sprmSLnnMin*/ 135
1049 : };
1050 :
1051 : static const sal_uInt16 aVer67Ids2[] =
1052 : {
1053 : /*sprmSDyaTop*/ 168,
1054 : /*sprmSDyaBottom*/ 169,
1055 : /*sprmSDyaHdrTop*/ 156,
1056 : /*sprmSDyaHdrBottom*/ 157,
1057 : /*sprmSNLnnMod*/ 154,
1058 : /*sprmSLnc*/ 152,
1059 : /*sprmSDxaLnn*/ 155,
1060 : /*sprmSLnnMin*/ 160
1061 : };
1062 : static const sal_uInt16 aVer8Ids2[] =
1063 : {
1064 : /*sprmSDyaTop*/ 0x9023,
1065 : /*sprmSDyaBottom*/ 0x9024,
1066 : /*sprmSDyaHdrTop*/ 0xB017,
1067 : /*sprmSDyaHdrBottom*/ 0xB018,
1068 : /*sprmSNLnnMod*/ 0x5015,
1069 : /*sprmSLnc*/ 0x3013,
1070 : /*sprmSDxaLnn*/ 0x9016,
1071 : /*sprmSLnnMin*/ 0x501B
1072 : };
1073 :
1074 86 : pIds = eVer <= ww::eWW2 ? aVer2Ids2 : eVer <= ww::eWW7 ? aVer67Ids2 : aVer8Ids2;
1075 :
1076 86 : aNewSection.maSep.dyaTop = ReadSprm( pSep, pIds[0], nTop[nLIdx] );
1077 86 : aNewSection.maSep.dyaBottom = ReadSprm( pSep, pIds[1], nBot[nLIdx] );
1078 86 : aNewSection.maSep.dyaHdrTop = ReadUSprm( pSep, pIds[2], 720 );
1079 86 : aNewSection.maSep.dyaHdrBottom = ReadUSprm( pSep, pIds[3], 720 );
1080 :
1081 86 : if (eVer >= ww::eWW8)
1082 : {
1083 85 : aNewSection.maSep.wTextFlow = ReadUSprm(pSep, 0x5033, 0);
1084 85 : aNewSection.maSep.clm = ReadUSprm( pSep, 0x5032, 0 );
1085 85 : aNewSection.maSep.dyaLinePitch = ReadUSprm(pSep, 0x9031, 360);
1086 85 : if (const sal_uInt8* pS = pSep->HasSprm(0x7030))
1087 23 : aNewSection.maSep.dxtCharSpace = SVBT32ToUInt32(pS);
1088 :
1089 : //sprmSPgbProp
1090 85 : sal_uInt16 pgbProp = ReadSprm( pSep, 0x522F, 0 );
1091 85 : aNewSection.maSep.pgbApplyTo = pgbProp & 0x0007;
1092 85 : aNewSection.maSep.pgbPageDepth = (pgbProp & 0x0018) >> 3;
1093 85 : aNewSection.maSep.pgbOffsetFrom = (pgbProp & 0x00E0) >> 5;
1094 :
1095 : aNewSection.mnBorders =
1096 85 : ::lcl_ReadBorders(eVer <= ww::eWW7, aNewSection.brc, 0, 0, pSep);
1097 : }
1098 :
1099 : // check if Line Numbering must be activated or resetted
1100 86 : if (const sal_uInt8* pSprmSNLnnMod = pSep->HasSprm( pIds[4] ))
1101 0 : aNewSection.maSep.nLnnMod = *pSprmSNLnnMod;
1102 :
1103 86 : if (const sal_uInt8* pSprmSLnc = pSep->HasSprm( pIds[5] ))
1104 0 : aNewSection.maSep.lnc = *pSprmSLnc;
1105 :
1106 86 : if (const sal_uInt8* pSprmSDxaLnn = pSep->HasSprm( pIds[6] ))
1107 0 : aNewSection.maSep.dxaLnn = SVBT16ToShort( pSprmSDxaLnn );
1108 :
1109 86 : if (const sal_uInt8* pSprmSLnnMin = pSep->HasSprm( pIds[7] ))
1110 0 : aNewSection.maSep.lnnMin = *pSprmSLnnMin;
1111 :
1112 86 : if (eVer <= ww::eWW7)
1113 1 : aNewSection.maSep.grpfIhdt = ReadBSprm(pSep, eVer <= ww::eWW2 ? 128 : 153, 0);
1114 85 : else if (mrReader.pHdFt)
1115 : {
1116 : aNewSection.maSep.grpfIhdt = WW8_HEADER_ODD | WW8_FOOTER_ODD
1117 40 : | WW8_HEADER_FIRST | WW8_FOOTER_FIRST;
1118 :
1119 : // It is possible for a first page header to be provided
1120 : // for this section, but not actually shown in this section. In this
1121 : // case (aNewSection.maSep.grpfIhdt & WW8_HEADER_FIRST) will be nonzero
1122 : // but aNewSection.HasTitlePage() will be false.
1123 : // Likewise for first page footer.
1124 :
1125 40 : if (mrReader.pWDop->fFacingPages)
1126 12 : aNewSection.maSep.grpfIhdt |= WW8_HEADER_EVEN | WW8_FOOTER_EVEN;
1127 :
1128 : //See if we have a header or footer for each enabled possibility
1129 : //if we do not then we inherit the previous sections header/footer,
1130 280 : for (int nI = 0, nMask = 1; nI < 6; ++nI, nMask <<= 1)
1131 : {
1132 240 : if (aNewSection.maSep.grpfIhdt & nMask)
1133 : {
1134 : WW8_CP nStart;
1135 : long nLen;
1136 184 : mrReader.pHdFt->GetTextPosExact( static_cast< short >(nI + ( maSegments.size() + 1) * 6), nStart, nLen);
1137 : //No header or footer, inherit pervious one, or set to zero
1138 : //if no previous one
1139 184 : if (!nLen)
1140 : {
1141 68 : if (
1142 72 : maSegments.empty() ||
1143 4 : !(maSegments.back().maSep.grpfIhdt & nMask)
1144 : )
1145 : {
1146 64 : aNewSection.maSep.grpfIhdt &= ~nMask;
1147 : }
1148 : }
1149 : }
1150 : }
1151 : }
1152 :
1153 86 : SetLeftRight(aNewSection);
1154 : //END read section values
1155 :
1156 86 : if (eVer >= ww::eWW8)
1157 85 : aNewSection.SetDirection();
1158 :
1159 86 : mrReader.HandleLineNumbering(aNewSection);
1160 172 : maSegments.push_back(aNewSection);
1161 : }
1162 :
1163 4 : void SwWW8ImplReader::CopyPageDescHdFt(const SwPageDesc* pOrgPageDesc,
1164 : SwPageDesc* pNewPageDesc, sal_uInt8 nCode )
1165 : {
1166 : // copy odd header content section
1167 4 : if( nCode & WW8_HEADER_ODD )
1168 : {
1169 0 : rDoc.CopyHeader(pOrgPageDesc->GetMaster(),
1170 0 : pNewPageDesc->GetMaster() );
1171 : }
1172 : // copy odd footer content section
1173 4 : if( nCode & WW8_FOOTER_ODD )
1174 : {
1175 0 : rDoc.CopyFooter(pOrgPageDesc->GetMaster(),
1176 0 : pNewPageDesc->GetMaster());
1177 : }
1178 : // copy even header content section
1179 4 : if( nCode & WW8_HEADER_EVEN )
1180 : {
1181 0 : rDoc.CopyHeader(pOrgPageDesc->GetLeft(),
1182 0 : pNewPageDesc->GetLeft());
1183 : }
1184 : // copy even footer content section
1185 4 : if( nCode & WW8_FOOTER_EVEN )
1186 : {
1187 0 : rDoc.CopyFooter(pOrgPageDesc->GetLeft(),
1188 0 : pNewPageDesc->GetLeft());
1189 : }
1190 : // copy first page header content section
1191 4 : if( nCode & WW8_HEADER_FIRST )
1192 : {
1193 2 : rDoc.CopyHeader(pOrgPageDesc->GetFirstMaster(),
1194 4 : pNewPageDesc->GetFirstMaster());
1195 : }
1196 : // copy first page footer content section
1197 4 : if( nCode & WW8_FOOTER_FIRST )
1198 : {
1199 2 : rDoc.CopyFooter(pOrgPageDesc->GetFirstMaster(),
1200 4 : pNewPageDesc->GetFirstMaster());
1201 : }
1202 4 : }
1203 :
1204 : // Hilfsroutinen fuer Grafiken und Apos und Tabellen
1205 :
1206 : // Read BoRder Control structure
1207 : // nBrcVer should be set to the version of the BRC record being read (6, 8 or 9)
1208 : // This will be converted to the latest format (9).
1209 1574 : static bool _SetWW8_BRC(int nBrcVer, WW8_BRCVer9& rVar, const sal_uInt8* pS)
1210 : {
1211 :
1212 1574 : if( pS )
1213 : {
1214 386 : if ( nBrcVer == 9 )
1215 202 : rVar = *(const WW8_BRCVer9*)pS;
1216 184 : else if( nBrcVer == 8 )
1217 184 : rVar = *(const WW8_BRC*)pS;
1218 : else // nBrcVer == 6
1219 0 : rVar = WW8_BRC(*(const WW8_BRCVer6*)pS);
1220 : }
1221 :
1222 1574 : return 0 != pS;
1223 : }
1224 :
1225 238 : static sal_uInt8 lcl_ReadBorders(bool bVer67, WW8_BRCVer9* brc, WW8PLCFx_Cp_FKP* pPap,
1226 : const WW8RStyle* pSty, const WW8PLCFx_SEPX* pSep)
1227 : {
1228 :
1229 : //returns a sal_uInt8 filled with a bit for each position that had a sprm
1230 : //setting that border
1231 :
1232 238 : sal_uInt8 nBorder = 0;
1233 238 : if( pSep )
1234 : {
1235 85 : if( !bVer67 )
1236 : {
1237 : sal_uInt8* pSprm[4];
1238 :
1239 85 : if( pSep->Find4Sprms(
1240 : NS_sprm::LN_SBrcTop80, NS_sprm::LN_SBrcLeft80,
1241 : NS_sprm::LN_SBrcBottom80, NS_sprm::LN_SBrcRight80,
1242 : pSprm[0], pSprm[1], pSprm[2], pSprm[3] ) )
1243 : {
1244 15 : for( int i = 0; i < 4; ++i )
1245 12 : nBorder |= int(_SetWW8_BRC( 8, brc[ i ], pSprm[ i ] ))<<i;
1246 : }
1247 : // Version 9 BRCs if present will override version 8
1248 85 : if( pSep->Find4Sprms(
1249 : NS_sprm::LN_SBrcTop, NS_sprm::LN_SBrcLeft,
1250 : NS_sprm::LN_SBrcBottom, NS_sprm::LN_SBrcRight,
1251 : pSprm[0], pSprm[1], pSprm[2], pSprm[3] ) )
1252 : {
1253 15 : for( int i = 0; i < 4; ++i )
1254 12 : nBorder |= int(_SetWW8_BRC( 9, brc[ i ], pSprm[ i ] ))<<i;
1255 : }
1256 : }
1257 : }
1258 : else
1259 : {
1260 :
1261 : static const sal_uInt16 aVer67Ids[5] = { 38, 39, 40, 41, 42 };
1262 :
1263 : static const sal_uInt16 aVer8Ids[5] =
1264 : { 0x6424, 0x6425, 0x6426, 0x6427, 0x6428 };
1265 :
1266 : static const sal_uInt16 aVer9Ids[5] =
1267 : { 0xC64E, 0xC64F, 0xC650, 0xC651, 0xC652 };
1268 :
1269 153 : if( pPap )
1270 : {
1271 120 : if (bVer67)
1272 : {
1273 0 : for( int i = 0; i < 5; ++i )
1274 0 : nBorder |= int(_SetWW8_BRC( 6 , brc[ i ], pPap->HasSprm( aVer67Ids[ i ] )))<<i;
1275 : }
1276 : else
1277 : {
1278 720 : for( int i = 0; i < 5; ++i )
1279 600 : nBorder |= int(_SetWW8_BRC( 8 , brc[ i ], pPap->HasSprm( aVer8Ids[ i ] )))<<i;
1280 : // Version 9 BRCs if present will override version 8
1281 720 : for( int i = 0; i < 5; ++i )
1282 600 : nBorder |= int(_SetWW8_BRC( 9 , brc[ i ], pPap->HasSprm( aVer9Ids[ i ] )))<<i;
1283 : }
1284 : }
1285 33 : else if( pSty )
1286 : {
1287 33 : if (bVer67)
1288 : {
1289 0 : for( int i = 0; i < 5; ++i )
1290 0 : nBorder |= int(_SetWW8_BRC( 6 , brc[ i ], pSty->HasParaSprm( aVer67Ids[ i ] )))<<i;
1291 : }
1292 : else
1293 : {
1294 198 : for( int i = 0; i < 5; ++i )
1295 165 : nBorder |= int(_SetWW8_BRC( 8 , brc[ i ], pSty->HasParaSprm( aVer8Ids[ i ] )))<<i;
1296 : // Version 9 BRCs if present will override version 8
1297 198 : for( int i = 0; i < 5; ++i )
1298 165 : nBorder |= int(_SetWW8_BRC( 9 , brc[ i ], pSty->HasParaSprm( aVer9Ids[ i ] )))<<i;
1299 : }
1300 : }
1301 : else {
1302 : OSL_ENSURE( pSty || pPap, "WW8PLCFx_Cp_FKP and WW8RStyle "
1303 : "and WW8PLCFx_SEPX is 0" );
1304 : }
1305 : }
1306 :
1307 238 : return nBorder;
1308 : }
1309 :
1310 2528 : void GetLineIndex(SvxBoxItem &rBox, short nLineThickness, short nSpace,
1311 : sal_uInt32 cv, short nIdx, sal_uInt16 nOOIndex, sal_uInt16 nWWIndex,
1312 : short *pSize=0)
1313 : {
1314 : // LO cannot handle outset/inset (new in WW9 BRC) so fall back same as WW8
1315 2528 : if ( nIdx == 0x1A || nIdx == 0x1B )
1316 : {
1317 1 : nIdx = (nIdx == 0x1A) ? 0x12 : 0x11;
1318 1 : cv = 0xc0c0c0;
1319 : }
1320 :
1321 : ::editeng::SvxBorderStyle const eStyle(
1322 2528 : ::editeng::ConvertBorderStyleFromWord(nIdx));
1323 :
1324 2528 : ::editeng::SvxBorderLine aLine;
1325 2528 : aLine.SetBorderLineStyle( eStyle );
1326 : double const fConverted( (table::BorderLineStyle::NONE == eStyle) ? 0.0 :
1327 2528 : ::editeng::ConvertBorderWidthFromWord(eStyle, nLineThickness, nIdx));
1328 2528 : aLine.SetWidth(fConverted);
1329 :
1330 : //No AUTO for borders as yet, so if AUTO, use BLACK
1331 2528 : ColorData col = (cv==0xff000000) ? COL_BLACK : msfilter::util::BGRToRGB(cv);
1332 :
1333 2528 : aLine.SetColor(col);
1334 :
1335 2528 : if (pSize)
1336 184 : pSize[nWWIndex] = fConverted + nSpace;
1337 :
1338 2528 : rBox.SetLine(&aLine, nOOIndex);
1339 2528 : rBox.SetDistance(nSpace, nOOIndex);
1340 :
1341 2528 : }
1342 :
1343 2528 : void Set1Border(SvxBoxItem &rBox, const WW8_BRCVer9& rBor, sal_uInt16 nOOIndex,
1344 : sal_uInt16 nWWIndex, short *pSize, const bool bIgnoreSpace)
1345 : {
1346 : short nSpace;
1347 2528 : short nLineThickness = rBor.DetermineBorderProperties(&nSpace);
1348 :
1349 : GetLineIndex(rBox, nLineThickness, bIgnoreSpace ? 0 : nSpace,
1350 2528 : rBor.cv(), rBor.brcType(), nOOIndex, nWWIndex, pSize );
1351 :
1352 2528 : }
1353 :
1354 1157 : static bool lcl_IsBorder(const WW8_BRCVer9* pbrc, bool bChkBtwn = false)
1355 : {
1356 1647 : return pbrc[WW8_TOP ].brcType() || // brcType != 0
1357 932 : pbrc[WW8_LEFT ].brcType() ||
1358 797 : pbrc[WW8_BOT ].brcType() ||
1359 2669 : pbrc[WW8_RIGHT].brcType() ||
1360 1160 : (bChkBtwn && pbrc[WW8_BETW ].brcType());
1361 : }
1362 :
1363 1155 : bool SwWW8ImplReader::IsBorder(const WW8_BRCVer9* pbrc, bool bChkBtwn) const
1364 : {
1365 1155 : return lcl_IsBorder(pbrc, bChkBtwn);
1366 : }
1367 :
1368 805 : bool SwWW8ImplReader::SetBorder(SvxBoxItem& rBox, const WW8_BRCVer9* pbrc,
1369 : short *pSizeArray, sal_uInt8 nSetBorders) const
1370 : {
1371 805 : bool bChange = false;
1372 : static const sal_uInt16 aIdArr[ 10 ] =
1373 : {
1374 : WW8_TOP, BOX_LINE_TOP,
1375 : WW8_LEFT, BOX_LINE_LEFT,
1376 : WW8_RIGHT, BOX_LINE_RIGHT,
1377 : WW8_BOT, BOX_LINE_BOTTOM,
1378 : WW8_BETW, BOX_LINE_BOTTOM
1379 : };
1380 :
1381 4025 : for( int i = 0, nEnd = 8; i < nEnd; i += 2 )
1382 : {
1383 : // ungueltige Borders ausfiltern
1384 3220 : const WW8_BRCVer9& rB = pbrc[ aIdArr[ i ] ];
1385 3220 : if( !rB.isNil() && rB.brcType() )
1386 : {
1387 2448 : Set1Border(rBox, rB, aIdArr[i+1], aIdArr[i], pSizeArray, false);
1388 2448 : bChange = true;
1389 : }
1390 772 : else if ( nSetBorders & (1 << aIdArr[i]) )
1391 : {
1392 : /*
1393 : ##826##, ##653##
1394 :
1395 : If a style has borders set,and the para attributes attempt remove
1396 : the borders, then this is perfectably acceptable, so we shouldn't
1397 : ignore this blank entry
1398 :
1399 : nSetBorders has a bit set for each location that a sprm set a
1400 : border, so with a sprm set, but no border, then disable the
1401 : appropriate border
1402 : */
1403 695 : rBox.SetLine( 0, aIdArr[ i+1 ] );
1404 : }
1405 : }
1406 805 : return bChange;
1407 : }
1408 :
1409 89 : bool SwWW8ImplReader::SetShadow(SvxShadowItem& rShadow, const short *pSizeArray,
1410 : const WW8_BRCVer9& aRightBrc) const
1411 : {
1412 89 : bool bRet = aRightBrc.fShadow() && pSizeArray && pSizeArray[WW8_RIGHT];
1413 89 : if (bRet)
1414 : {
1415 12 : rShadow.SetColor(Color(COL_BLACK));
1416 : //i120718
1417 12 : short nVal = aRightBrc.DetermineBorderProperties();
1418 : //End
1419 12 : if (nVal < 0x10)
1420 0 : nVal = 0x10;
1421 12 : rShadow.SetWidth(nVal);
1422 12 : rShadow.SetLocation(SVX_SHADOW_BOTTOMRIGHT);
1423 12 : bRet = true;
1424 : }
1425 89 : return bRet;
1426 : }
1427 :
1428 61 : void SwWW8ImplReader::GetBorderDistance(const WW8_BRCVer9* pbrc,
1429 : Rectangle& rInnerDist) const
1430 : {
1431 122 : rInnerDist = Rectangle( pbrc[ 1 ].dptSpace() * 20,
1432 122 : pbrc[ 0 ].dptSpace() * 20,
1433 122 : pbrc[ 3 ].dptSpace() * 20,
1434 305 : pbrc[ 2 ].dptSpace() * 20 );
1435 61 : }
1436 :
1437 32 : bool SwWW8ImplReader::SetFlyBordersShadow(SfxItemSet& rFlySet,
1438 : const WW8_BRCVer9 *pbrc, short *pSizeArray) const
1439 : {
1440 32 : bool bShadowed = false;
1441 32 : if (IsBorder(pbrc))
1442 : {
1443 8 : SvxBoxItem aBox( RES_BOX );
1444 8 : SetBorder(aBox, pbrc, pSizeArray);
1445 :
1446 8 : rFlySet.Put( aBox );
1447 :
1448 : // fShadow
1449 16 : SvxShadowItem aShadow( RES_SHADOW );
1450 8 : if( SetShadow( aShadow, pSizeArray, pbrc[WW8_RIGHT] ))
1451 : {
1452 0 : bShadowed = true;
1453 0 : rFlySet.Put( aShadow );
1454 8 : }
1455 : }
1456 32 : return bShadowed;
1457 : }
1458 :
1459 : // APOs
1460 :
1461 : // fuer Berechnung der minimalen FrameSize
1462 : #define MAX_BORDER_SIZE 210 // so breit ist max. der Border
1463 : #define MAX_EMPTY_BORDER 10 // fuer +-1-Fehler, mindestens 1
1464 :
1465 16 : static void FlySecur1(short& rSize, const bool bBorder)
1466 : {
1467 : short nMin = MINFLY +
1468 16 : (bBorder ? MAX_BORDER_SIZE : MAX_EMPTY_BORDER);
1469 :
1470 16 : if ( rSize < nMin )
1471 8 : rSize = nMin;
1472 16 : }
1473 :
1474 712 : inline bool SetValSprm( sal_Int16* pVar, WW8PLCFx_Cp_FKP* pPap, sal_uInt16 nId )
1475 : {
1476 712 : const sal_uInt8* pS = pPap->HasSprm( nId );
1477 712 : if( pS )
1478 268 : *pVar = (sal_Int16)SVBT16ToShort( pS );
1479 712 : return ( pS != 0 );
1480 : }
1481 :
1482 24 : inline bool SetValSprm( sal_Int16* pVar, const WW8RStyle* pStyle, sal_uInt16 nId )
1483 : {
1484 24 : const sal_uInt8* pS = pStyle->HasParaSprm( nId );
1485 24 : if( pS )
1486 16 : *pVar = (sal_Int16)SVBT16ToShort( pS );
1487 24 : return ( pS != 0 );
1488 : }
1489 :
1490 : /*
1491 : #i1930 revealed that sprm 0x360D as used in tables can affect the frame
1492 : around the table. Its full structure is not fully understood as yet.
1493 : */
1494 102 : void WW8FlyPara::ApplyTabPos(const WW8_TablePos *pTabPos)
1495 : {
1496 102 : if (pTabPos)
1497 : {
1498 96 : nSp26 = pTabPos->nSp26;
1499 96 : nSp27 = pTabPos->nSp27;
1500 96 : nSp29 = pTabPos->nSp29;
1501 96 : nLeMgn = pTabPos->nLeMgn;
1502 96 : nRiMgn = pTabPos->nRiMgn;
1503 96 : nUpMgn = pTabPos->nUpMgn;
1504 96 : nLoMgn = pTabPos->nLoMgn;
1505 96 : nSp37 = pTabPos->nSp37;
1506 : }
1507 102 : }
1508 :
1509 201 : WW8FlyPara::WW8FlyPara(bool bIsVer67, const WW8FlyPara* pSrc /* = 0 */)
1510 : {
1511 201 : if ( pSrc )
1512 0 : memcpy( this, pSrc, sizeof( WW8FlyPara ) ); // Copy-Ctor
1513 : else
1514 : {
1515 201 : memset( this, 0, sizeof( WW8FlyPara ) ); // Default-Ctor
1516 201 : nSp37 = 2; // Default: Umfluss
1517 : }
1518 201 : bVer67 = bIsVer67;
1519 201 : }
1520 :
1521 105 : bool WW8FlyPara::operator==(const WW8FlyPara& rSrc) const
1522 : {
1523 : /*
1524 : Compare the parts that word seems to compare for equivalence.
1525 : Interestingly being autoheight or absolute height (the & 0x7fff) doesn't
1526 : matter to word
1527 : */
1528 : return
1529 : (
1530 189 : (nSp26 == rSrc.nSp26) &&
1531 93 : (nSp27 == rSrc.nSp27) &&
1532 18 : ((nSp45 & 0x7fff) == (rSrc.nSp45 & 0x7fff)) &&
1533 18 : (nSp28 == rSrc.nSp28) &&
1534 18 : (nLeMgn == rSrc.nLeMgn) &&
1535 18 : (nRiMgn == rSrc.nRiMgn) &&
1536 18 : (nUpMgn == rSrc.nUpMgn) &&
1537 18 : (nLoMgn == rSrc.nLoMgn) &&
1538 123 : (nSp29 == rSrc.nSp29) &&
1539 9 : (nSp37 == rSrc.nSp37)
1540 105 : );
1541 : }
1542 :
1543 : // Read fuer normalen Text
1544 89 : void WW8FlyPara::Read(sal_uInt8 nOrigSp29, WW8PLCFx_Cp_FKP* pPap)
1545 : {
1546 89 : const sal_uInt8* pS = 0;
1547 89 : if( bVer67 )
1548 : {
1549 0 : SetValSprm( &nSp26, pPap, 26 ); // X-Position //sprmPDxaAbs
1550 : //set in me or in parent style
1551 0 : mbVertSet |= SetValSprm( &nSp27, pPap, 27 ); // Y-Position //sprmPDyaAbs
1552 0 : SetValSprm( &nSp45, pPap, 45 ); // Hoehe //sprmPWHeightAbs
1553 0 : SetValSprm( &nSp28, pPap, 28 ); // Breite //sprmPDxaWidth
1554 0 : SetValSprm( &nLeMgn, pPap, 49 ); // L-Raender //sprmPDxaFromText
1555 0 : SetValSprm( &nRiMgn, pPap, 49 ); // R-Raender //sprmPDxaFromText
1556 0 : SetValSprm( &nUpMgn, pPap, 48 ); // U-Raender //sprmPDyaFromText
1557 0 : SetValSprm( &nLoMgn, pPap, 48 ); // D-Raender //sprmPDyaFromText
1558 :
1559 0 : pS = pPap->HasSprm( 37 ); //sprmPWr
1560 0 : if( pS )
1561 0 : nSp37 = *pS;
1562 : }
1563 : else
1564 : {
1565 89 : SetValSprm( &nSp26, pPap, NS_sprm::LN_PDxaAbs ); // X-Position
1566 : //set in me or in parent style
1567 89 : mbVertSet |= SetValSprm( &nSp27, pPap, NS_sprm::LN_PDyaAbs ); // Y-Position
1568 89 : SetValSprm( &nSp45, pPap, NS_sprm::LN_PWHeightAbs ); // Hoehe
1569 89 : SetValSprm( &nSp28, pPap, NS_sprm::LN_PDxaWidth ); // Breite
1570 89 : SetValSprm( &nLeMgn, pPap, NS_sprm::LN_PDxaFromText ); // L-Raender
1571 89 : SetValSprm( &nRiMgn, pPap, NS_sprm::LN_PDxaFromText ); // R-Raender
1572 89 : SetValSprm( &nUpMgn, pPap, NS_sprm::LN_PDyaFromText ); // U-Raender
1573 89 : SetValSprm( &nLoMgn, pPap, NS_sprm::LN_PDyaFromText ); // D-Raender
1574 :
1575 89 : pS = pPap->HasSprm( NS_sprm::LN_PWr ); // Umfluss
1576 89 : if( pS )
1577 87 : nSp37 = *pS;
1578 : }
1579 :
1580 89 : if( ::lcl_ReadBorders( bVer67, brc, pPap )) // Umrandung
1581 2 : bBorderLines = ::lcl_IsBorder( brc );
1582 :
1583 : /*
1584 : #i8798#
1585 : Appears that with no dyaAbs set then the actual vert anchoring set is
1586 : ignored and we remain relative to text, so if that is the case we are 0
1587 : from para anchor, so we update the frame to have explicitly this type of
1588 : anchoring
1589 : */
1590 89 : if (!mbVertSet)
1591 0 : nSp29 = (nOrigSp29 & 0xCF) | 0x20;
1592 : else
1593 89 : nSp29 = nOrigSp29;
1594 89 : }
1595 :
1596 80 : void WW8FlyPara::ReadFull(sal_uInt8 nOrigSp29, SwWW8ImplReader* pIo)
1597 : {
1598 80 : WW8PLCFMan* pPlcxMan = pIo->pPlcxMan;
1599 80 : WW8PLCFx_Cp_FKP* pPap = pPlcxMan->GetPapPLCF();
1600 :
1601 80 : Read(nOrigSp29, pPap); // Lies Apo-Parameter
1602 :
1603 : do{ // Block zum rausspringen
1604 80 : if( nSp45 != 0 /* || nSp28 != 0 */ )
1605 2 : break; // bGrafApo nur bei Hoehe automatisch
1606 80 : if( pIo->pWwFib->fComplex )
1607 2 : break; // (*pPap)++ geht bei FastSave schief
1608 : // -> bei FastSave kein Test auf Grafik-APO
1609 78 : SvStream* pIoStrm = pIo->pStrm;
1610 78 : sal_uLong nPos = pIoStrm->Tell();
1611 : WW8PLCFxSave1 aSave;
1612 78 : pPlcxMan->GetPap()->Save( aSave );
1613 78 : bGrafApo = false;
1614 :
1615 : do{ // Block zum rausspringen
1616 : sal_uInt8 nTxt[2];
1617 :
1618 78 : if (!checkRead(*pIoStrm, nTxt, 2)) // lies Text
1619 78 : break;
1620 :
1621 78 : if( nTxt[0] != 0x01 || nTxt[1] != 0x0d )// nur Grafik + CR ?
1622 : break; // Nein
1623 :
1624 0 : pPap->advance(); // Naechste Zeile
1625 :
1626 : // In APO ?
1627 : //sprmPPc
1628 0 : const sal_uInt8* pS = pPap->HasSprm( bVer67 ? 29 : 0x261B );
1629 :
1630 : // Nein -> Grafik-Apo
1631 0 : if (!pS)
1632 : {
1633 0 : bGrafApo = true;
1634 0 : break; // Ende des APO
1635 : }
1636 :
1637 0 : ww::WordVersion eVer = pIo->GetFib().GetFIBVersion();
1638 0 : WW8FlyPara *pNowStyleApo=0;
1639 0 : sal_uInt16 nColl = pPap->GetIstd();
1640 0 : ww::sti eSti = eVer < ww::eWW6 ? ww::GetCanonicalStiFromStc( static_cast< sal_uInt8 >(nColl) ) : static_cast<ww::sti>(nColl);
1641 0 : while (eSti != ww::stiNil && nColl < pIo->vColl.size() && 0 == (pNowStyleApo = pIo->vColl[nColl].pWWFly))
1642 : {
1643 0 : nColl = pIo->vColl[nColl].nBase;
1644 0 : eSti = eVer < ww::eWW6 ? ww::GetCanonicalStiFromStc( static_cast< sal_uInt8 >(nColl) ) : static_cast<ww::sti>(nColl);
1645 : }
1646 :
1647 0 : WW8FlyPara aF(bVer67, pNowStyleApo);
1648 : // Neuer FlaPara zum Vergleich
1649 0 : aF.Read( *pS, pPap ); // WWPara fuer neuen Para
1650 0 : if( !( aF == *this ) ) // selber APO ? ( oder neuer ? )
1651 0 : bGrafApo = true; // nein -> 1-zeiliger APO
1652 : // -> Grafik-APO
1653 : }
1654 : while( false ); // Block zum rausspringen
1655 :
1656 78 : pPlcxMan->GetPap()->Restore( aSave );
1657 78 : pIoStrm->Seek( nPos );
1658 : }while( false ); // Block zum rausspringen
1659 80 : }
1660 :
1661 : // Read fuer Apo-Defs in Styledefs
1662 3 : void WW8FlyPara::Read(sal_uInt8 nOrigSp29, WW8RStyle* pStyle)
1663 : {
1664 3 : const sal_uInt8* pS = 0;
1665 3 : if (bVer67)
1666 : {
1667 0 : SetValSprm( &nSp26, pStyle, 26 ); // X-Position
1668 : //set in me or in parent style
1669 0 : mbVertSet |= SetValSprm(&nSp27, pStyle, 27); // Y-Position
1670 0 : SetValSprm( &nSp45, pStyle, 45 ); // Hoehe
1671 0 : SetValSprm( &nSp28, pStyle, 28 ); // Breite
1672 0 : SetValSprm( &nLeMgn, pStyle, 49 ); // L-Raender
1673 0 : SetValSprm( &nRiMgn, pStyle, 49 ); // R-Raender
1674 0 : SetValSprm( &nUpMgn, pStyle, 48 ); // U-Raender
1675 0 : SetValSprm( &nLoMgn, pStyle, 48 ); // D-Raender
1676 :
1677 0 : pS = pStyle->HasParaSprm( 37 ); // Umfluss
1678 0 : if( pS )
1679 0 : nSp37 = *pS;
1680 : }
1681 : else
1682 : {
1683 3 : SetValSprm( &nSp26, pStyle, 0x8418 ); // X-Position
1684 : //set in me or in parent style
1685 3 : mbVertSet |= SetValSprm(&nSp27, pStyle, 0x8419); // Y-Position
1686 3 : SetValSprm( &nSp45, pStyle, 0x442B ); // Hoehe
1687 3 : SetValSprm( &nSp28, pStyle, 0x841A ); // Breite
1688 3 : SetValSprm( &nLeMgn, pStyle, 0x842F ); // L-Raender
1689 3 : SetValSprm( &nRiMgn, pStyle, 0x842F ); // R-Raender
1690 3 : SetValSprm( &nUpMgn, pStyle, 0x842E ); // U-Raender
1691 3 : SetValSprm( &nLoMgn, pStyle, 0x842E ); // D-Raender
1692 :
1693 3 : pS = pStyle->HasParaSprm( 0x2423 ); // Umfluss
1694 3 : if( pS )
1695 1 : nSp37 = *pS;
1696 : }
1697 :
1698 3 : if (::lcl_ReadBorders(bVer67, brc, 0, pStyle)) // Umrandung
1699 0 : bBorderLines = ::lcl_IsBorder(brc);
1700 :
1701 : /*
1702 : #i8798#
1703 : Appears that with no dyaAbs set then the actual vert anchoring set is
1704 : ignored and we remain relative to text, so if that is the case we are 0
1705 : from para anchor, so we update the frame to have explicitly this type of
1706 : anchoring
1707 : */
1708 3 : if (!mbVertSet)
1709 0 : nSp29 = (nOrigSp29 & 0xCF) | 0x20;
1710 : else
1711 3 : nSp29 = nOrigSp29;
1712 3 : }
1713 :
1714 96 : bool WW8FlyPara::IsEmpty() const
1715 : {
1716 96 : WW8FlyPara aEmpty(bVer67);
1717 : /*
1718 : wr of 0 like 2 appears to me to be equivalent for checking here. See
1719 : #107103# if wrong, so given that the empty is 2, if we are 0 then set
1720 : empty to 0 to make 0 equiv to 2 for empty checking
1721 : */
1722 : OSL_ENSURE(aEmpty.nSp37 == 2, "this is not what we expect for nSp37");
1723 96 : if (this->nSp37 == 0)
1724 0 : aEmpty.nSp37 = 0;
1725 96 : if (aEmpty == *this)
1726 0 : return true;
1727 96 : return false;
1728 : }
1729 :
1730 : // #i18732# - changes made on behalf of CMC
1731 8 : WW8SwFlyPara::WW8SwFlyPara( SwPaM& rPaM,
1732 : SwWW8ImplReader& rIo,
1733 : WW8FlyPara& rWW,
1734 : const sal_uInt32 nWWPgTop,
1735 : const sal_uInt32 nPgLeft,
1736 : const sal_uInt32 nPgWidth,
1737 : const sal_Int32 nIniFlyDx,
1738 : const sal_Int32 nIniFlyDy )
1739 : {
1740 : (void) rPaM;
1741 : (void) nPgLeft;
1742 :
1743 8 : memset( this, 0, sizeof( WW8SwFlyPara ) ); // Initialisieren
1744 8 : nNewNettoWidth = MINFLY; // Minimum
1745 :
1746 8 : eSurround = ( rWW.nSp37 > 1 ) ? SURROUND_IDEAL : SURROUND_NONE;
1747 : //#i119466 mapping "Around" wrap setting to "Parallel" for table
1748 8 : const bool bIsTable = rIo.pPlcxMan->HasParaSprm(0x2416);
1749 8 : if ( bIsTable && rWW.nSp37 == 2 )
1750 5 : eSurround = SURROUND_PARALLEL;
1751 :
1752 : /*
1753 : #95905#, #83307# seems to have gone away now, so reenable parallel
1754 : wrapping support for frames in headers/footers. I don't know if we truly
1755 : have an explictly specified behaviour for these circumstances.
1756 : */
1757 :
1758 8 : nHeight = rWW.nSp45;
1759 8 : if( nHeight & 0x8000 )
1760 : {
1761 0 : nHeight &= 0x7fff;
1762 0 : eHeightFix = ATT_MIN_SIZE;
1763 : }
1764 : else
1765 8 : eHeightFix = ATT_FIX_SIZE;
1766 :
1767 8 : if( nHeight <= MINFLY )
1768 : { // keine Angabe oder Stuss
1769 8 : eHeightFix = ATT_MIN_SIZE;
1770 8 : nHeight = MINFLY;
1771 : }
1772 :
1773 8 : nWidth = nNettoWidth = rWW.nSp28;
1774 8 : if( nWidth <= 10 ) // Auto-Breite
1775 : {
1776 8 : bAutoWidth = true;
1777 : nWidth = nNettoWidth =
1778 8 : msword_cast<sal_Int16>((nPgWidth ? nPgWidth : 2268)); // 4 cm
1779 : }
1780 8 : if( nWidth <= MINFLY )
1781 0 : nWidth = nNettoWidth = MINFLY; // Minimale Breite
1782 :
1783 8 : eVAlign = text::VertOrientation::NONE; // Defaults
1784 8 : eHAlign = text::HoriOrientation::NONE;
1785 8 : nYPos = 0;
1786 8 : nXPos = 0;
1787 :
1788 8 : nRiMgn = rWW.nRiMgn;
1789 8 : nLeMgn = rWW.nLeMgn;
1790 8 : nLoMgn = rWW.nLoMgn;
1791 8 : nUpMgn = rWW.nUpMgn;
1792 :
1793 : /*
1794 : See issue #i9178# for the 9 anchoring options, and make sure they stay
1795 : working if you modify the anchoring logic here.
1796 : */
1797 :
1798 : // Wenn der Fly links, rechts, oben oder unten aligned ist,
1799 : // wird der aeussere Textabstand ignoriert, da sonst
1800 : // der Fly an falscher Position landen wuerde
1801 : // Problematisch wird es nur bei Innen/Aussen
1802 :
1803 : // Bindung
1804 8 : nYBind = (( rWW.nSp29 & 0x30 ) >> 4);
1805 : //#i53725# - absolute positioned objects have to be
1806 : // anchored at-paragraph to assure its correct anchor position.
1807 8 : eAnchor = FLY_AT_PARA;
1808 :
1809 8 : switch (nYBind)
1810 : {
1811 : case 0: //relative to margin
1812 0 : eVRel = text::RelOrientation::PAGE_PRINT_AREA;
1813 0 : break;
1814 : case 1: //relative to page
1815 1 : eVRel = text::RelOrientation::PAGE_FRAME;
1816 1 : break;
1817 : default: //relative to text
1818 7 : eVRel = text::RelOrientation::FRAME;
1819 7 : break;
1820 : }
1821 :
1822 : // #i18732#
1823 8 : switch( rWW.nSp27 ) // besondere Y-Positionen ?
1824 : {
1825 : case -4:
1826 0 : eVAlign = text::VertOrientation::TOP;
1827 0 : if (nYBind < 2)
1828 0 : nUpMgn = 0;
1829 0 : break; // oben
1830 : case -8:
1831 1 : eVAlign = text::VertOrientation::CENTER;
1832 1 : break; // zentriert
1833 : case -12:
1834 0 : eVAlign = text::VertOrientation::BOTTOM;
1835 0 : if (nYBind < 2)
1836 0 : nLoMgn = 0;
1837 0 : break; // unten
1838 : default:
1839 7 : nYPos = rWW.nSp27 + (short)nIniFlyDy;
1840 7 : break; // Korrekturen per Ini-Datei
1841 : }
1842 :
1843 8 : switch( rWW.nSp26 ) // besondere X-Positionen ?
1844 : {
1845 : case 0:
1846 3 : eHAlign = text::HoriOrientation::LEFT;
1847 3 : nLeMgn = 0;
1848 3 : break; // links
1849 : case -4:
1850 4 : eHAlign = text::HoriOrientation::CENTER;
1851 4 : break; // zentriert
1852 : case -8:
1853 0 : eHAlign = text::HoriOrientation::RIGHT;
1854 0 : nRiMgn = 0;
1855 0 : break; // rechts
1856 : case -12:
1857 0 : eHAlign = text::HoriOrientation::LEFT;
1858 0 : bToggelPos = true;
1859 0 : break; // innen
1860 : case -16:
1861 0 : eHAlign = text::HoriOrientation::RIGHT;
1862 0 : bToggelPos = true;
1863 0 : break; // aussen
1864 : default:
1865 1 : nXPos = rWW.nSp26 + (short)nIniFlyDx;
1866 1 : break; // Korrekturen per Ini-Datei
1867 : }
1868 :
1869 8 : nXBind = ( rWW.nSp29 & 0xc0 ) >> 6;
1870 : // #i18732#
1871 8 : switch (nXBind) // X - Bindung -> Koordinatentransformation
1872 : {
1873 : case 0: //relative to column
1874 3 : eHRel = text::RelOrientation::FRAME;
1875 3 : break;
1876 : case 1: //relative to margin
1877 4 : eHRel = text::RelOrientation::PAGE_PRINT_AREA;
1878 4 : break;
1879 : default: //relative to page
1880 1 : eHRel = text::RelOrientation::PAGE_FRAME;
1881 1 : break;
1882 : }
1883 :
1884 : // #i36649# - adjustments for certain horizontal alignments
1885 : // Note: These special adjustments found by an investigation of documents
1886 : // containing frames with different left/right border distances and
1887 : // distances to text. The outcome is some how strange.
1888 : // Note: These adjustments causes wrong horizontal positions for frames,
1889 : // which are aligned inside|outside to page|margin on even pages,
1890 : // the left and right border distances are different.
1891 : // no adjustments possible, if frame has automatic width.
1892 : // determine left border distance
1893 8 : sal_Int16 nLeBorderMgn( 0L );
1894 8 : if ( !bAutoWidth )
1895 : {
1896 0 : WW8_BRCVer9 &rBrc = rWW.brc[WW8_LEFT];
1897 0 : sal_Int16 nTemp = rBrc.DetermineBorderProperties(&nLeBorderMgn);
1898 0 : nLeBorderMgn = nLeBorderMgn + nTemp;
1899 : }
1900 : // determine right border distance
1901 8 : sal_Int16 nRiBorderMgn( 0L );
1902 8 : if ( !bAutoWidth )
1903 : {
1904 0 : WW8_BRCVer9 &rBrc = rWW.brc[WW8_RIGHT];
1905 0 : sal_Int16 nTemp = rBrc.DetermineBorderProperties(&nRiBorderMgn);
1906 0 : nRiBorderMgn = nRiBorderMgn + nTemp;
1907 : }
1908 8 : if ( !bAutoWidth && eHAlign == text::HoriOrientation::LEFT && eHRel == text::RelOrientation::PAGE_FRAME )
1909 : {
1910 : // convert 'left to page' to
1911 : // 'from left -<width>-<2*left border distance>-<right wrap distance>
1912 : // to page text area'
1913 0 : eHAlign = text::HoriOrientation::NONE;
1914 0 : eHRel = text::RelOrientation::PAGE_PRINT_AREA;
1915 0 : nXPos = -nWidth - (2*nLeBorderMgn) - rWW.nRiMgn;
1916 : // re-set left wrap distance
1917 0 : nLeMgn = rWW.nLeMgn;
1918 : }
1919 8 : else if ( !bAutoWidth && eHAlign == text::HoriOrientation::RIGHT && eHRel == text::RelOrientation::PAGE_FRAME )
1920 : {
1921 : // convert 'right to page' to
1922 : // 'from left <right border distance-left border distance>+<left wrap distance>
1923 : // to right page border'
1924 0 : eHAlign = text::HoriOrientation::NONE;
1925 0 : eHRel = text::RelOrientation::PAGE_RIGHT;
1926 0 : nXPos = ( nRiBorderMgn - nLeBorderMgn ) + rWW.nLeMgn;
1927 : // re-set right wrap distance
1928 0 : nRiMgn = rWW.nRiMgn;
1929 : }
1930 8 : else if ( !bAutoWidth && eHAlign == text::HoriOrientation::LEFT && eHRel == text::RelOrientation::PAGE_PRINT_AREA )
1931 : {
1932 : // convert 'left to margin' to
1933 : // 'from left -<left border distance> to page text area'
1934 0 : eHAlign = text::HoriOrientation::NONE;
1935 0 : eHRel = text::RelOrientation::PAGE_PRINT_AREA;
1936 0 : nXPos = -nLeBorderMgn;
1937 : // re-set left wrap distance
1938 0 : nLeMgn = rWW.nLeMgn;
1939 : }
1940 8 : else if ( !bAutoWidth && eHAlign == text::HoriOrientation::RIGHT && eHRel == text::RelOrientation::PAGE_PRINT_AREA )
1941 : {
1942 : // convert 'right to margin' to
1943 : // 'from left -<width>-<left border distance> to right page border'
1944 0 : eHAlign = text::HoriOrientation::NONE;
1945 0 : eHRel = text::RelOrientation::PAGE_RIGHT;
1946 0 : nXPos = -nWidth - nLeBorderMgn;
1947 : // re-set right wrap distance
1948 0 : nRiMgn = rWW.nRiMgn;
1949 : }
1950 8 : else if (rWW.bBorderLines)
1951 : {
1952 : /*
1953 : #i582#
1954 : Word has a curious bug where the offset stored do not take into
1955 : account the internal distance from the corner both
1956 : */
1957 0 : WW8_BRCVer9 &rBrc = rWW.brc[WW8_LEFT];
1958 0 : sal_Int16 nLeLMgn = 0;
1959 0 : sal_Int16 nTemp = rBrc.DetermineBorderProperties(&nLeLMgn);
1960 0 : nLeLMgn = nLeLMgn + nTemp;
1961 :
1962 0 : if (nLeLMgn)
1963 : {
1964 0 : if (eHAlign == text::HoriOrientation::LEFT)
1965 0 : eHAlign = text::HoriOrientation::NONE;
1966 0 : nXPos = nXPos - nLeLMgn;
1967 : }
1968 : }
1969 :
1970 : // adjustments for certain vertical alignments
1971 8 : if ( eVAlign == text::VertOrientation::NONE && eVRel == text::RelOrientation::PAGE_PRINT_AREA )
1972 : {
1973 : // convert "<X> from top page text area" to
1974 : // "<X + page top margin> from page"
1975 0 : eVRel = text::RelOrientation::PAGE_FRAME;
1976 0 : nYPos = static_cast< sal_Int16 >( nYPos + nWWPgTop );
1977 : }
1978 :
1979 8 : FlySecur1( nWidth, rWW.bBorderLines ); // passen Raender ?
1980 8 : FlySecur1( nHeight, rWW.bBorderLines );
1981 :
1982 8 : }
1983 :
1984 : // hat ein Fly in WW eine automatische Breite, dann muss das durch
1985 : // nachtraegliches Anpassen der ( im SW festen ) Fly-Breite simuliert werden.
1986 : // Dabei kann die Fly-Breite groesser oder kleiner werden, da der Default-Wert
1987 : // ohne Wissen ueber den Inhalt eingesetzt wird.
1988 1 : void WW8SwFlyPara::BoxUpWidth( long nInWidth )
1989 : {
1990 1 : if( bAutoWidth && nInWidth > nNewNettoWidth )
1991 1 : nNewNettoWidth = nInWidth;
1992 1 : };
1993 :
1994 : // Die Klasse WW8FlySet ist von SfxItemSet abgeleitet und stellt auch
1995 : // im Prizip nicht mehr zur Verfuegung, ist aber fuer mich besser
1996 : // zu handeln
1997 : // WW8FlySet-ctor fuer Apos und Graf-Apos
1998 8 : WW8FlySet::WW8FlySet(SwWW8ImplReader& rReader, const WW8FlyPara* pFW,
1999 : const WW8SwFlyPara* pFS, bool bGraf)
2000 8 : : SfxItemSet(rReader.rDoc.GetAttrPool(),RES_FRMATR_BEGIN,RES_FRMATR_END-1)
2001 : {
2002 8 : if (!rReader.mbNewDoc)
2003 0 : Reader::ResetFrmFmtAttrs(*this); // Abstand/Umrandung raus
2004 : // Position
2005 8 : Put(SvxFrameDirectionItem(FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR));
2006 :
2007 : /*Below can all go when we have from left in rtl mode*/
2008 8 : SwTwips nXPos = pFS->nXPos;
2009 8 : sal_Int16 eHRel = pFS->eHRel;
2010 8 : rReader.MiserableRTLGraphicsHack(nXPos, pFS->nWidth, pFS->eHAlign, eHRel);
2011 : /*Above can all go when we have from left in rtl mode*/
2012 8 : Put( SwFmtHoriOrient(nXPos, pFS->eHAlign, pFS->eHRel, pFS->bToggelPos ));
2013 8 : Put( SwFmtVertOrient( pFS->nYPos, pFS->eVAlign, pFS->eVRel ) );
2014 :
2015 8 : if (pFS->nLeMgn || pFS->nRiMgn) // Raender setzen
2016 5 : Put(SvxLRSpaceItem(pFS->nLeMgn, pFS->nRiMgn, 0, 0, RES_LR_SPACE));
2017 :
2018 8 : if (pFS->nUpMgn || pFS->nLoMgn)
2019 0 : Put(SvxULSpaceItem(pFS->nUpMgn, pFS->nLoMgn, RES_UL_SPACE));
2020 :
2021 : //we no longer need to hack around the header/footer problems
2022 8 : SwFmtSurround aSurround(pFS->eSurround);
2023 8 : if ( pFS->eSurround == SURROUND_IDEAL )
2024 3 : aSurround.SetAnchorOnly( sal_True );
2025 8 : Put( aSurround );
2026 :
2027 8 : short aSizeArray[5]={0};
2028 8 : rReader.SetFlyBordersShadow(*this,pFW->brc,&aSizeArray[0]);
2029 :
2030 : // der 5. Parameter ist immer 0, daher geht beim Cast nix verloren
2031 :
2032 : // #i27767#
2033 : // #i35017# - constant name has changed
2034 : Put( SwFmtWrapInfluenceOnObjPos(
2035 8 : text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE ) );
2036 :
2037 8 : if( !bGraf )
2038 : {
2039 8 : Put( SwFmtAnchor(pFS->eAnchor) );
2040 : // Groesse einstellen
2041 :
2042 : //Ordinarily with frames, the border width and spacing is
2043 : //placed outside the frame, making it larger. With these
2044 : //types of frames, the left right thickness and space makes
2045 : //it wider, but the top bottom spacing and border thickness
2046 : //is placed inside.
2047 16 : Put( SwFmtFrmSize( pFS->eHeightFix, pFS->nWidth +
2048 24 : aSizeArray[WW8_LEFT] + aSizeArray[WW8_RIGHT],
2049 24 : pFS->nHeight));
2050 8 : }
2051 8 : }
2052 :
2053 : // WW8FlySet-ctor fuer zeichengebundene Grafiken
2054 18 : WW8FlySet::WW8FlySet( SwWW8ImplReader& rReader, const SwPaM* pPaM,
2055 : const WW8_PIC& rPic, long nWidth, long nHeight )
2056 18 : : SfxItemSet(rReader.rDoc.GetAttrPool(),RES_FRMATR_BEGIN,RES_FRMATR_END-1)
2057 : {
2058 18 : Init(rReader, pPaM);
2059 :
2060 18 : Put(SvxFrameDirectionItem(FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR));
2061 :
2062 18 : short aSizeArray[5]={0};
2063 : /*
2064 : If we have set borders then in word the graphic is displaced from the left
2065 : and top the width of the borders of those sides, and then the shadow
2066 : itself is drawn to the bottom and right of the displaced graphic. In word
2067 : the total size is that of the graphic plus the borders, plus the total
2068 : shadow around all edges, for this translation the top and left shadow
2069 : region is translated spacing around the graphic to those sides, and the
2070 : bottom and right shadow size is added to the graphic size.
2071 : */
2072 18 : WW8_BRCVer9 brcVer9[4];
2073 90 : for (int i = 0; i < 4; i++)
2074 72 : brcVer9[i] = rPic.rgbrc[i];
2075 18 : if (rReader.SetFlyBordersShadow( *this, brcVer9, &aSizeArray[0]))
2076 : {
2077 0 : Put(SvxLRSpaceItem( aSizeArray[WW8_LEFT], 0, 0, 0, RES_LR_SPACE ) );
2078 0 : Put(SvxULSpaceItem( aSizeArray[WW8_TOP], 0, RES_UL_SPACE ));
2079 0 : aSizeArray[WW8_RIGHT]*=2;
2080 0 : aSizeArray[WW8_BOT]*=2;
2081 : }
2082 :
2083 18 : Put( SwFmtFrmSize( ATT_FIX_SIZE, nWidth+aSizeArray[WW8_LEFT]+
2084 36 : aSizeArray[WW8_RIGHT], nHeight+aSizeArray[WW8_TOP]
2085 36 : + aSizeArray[WW8_BOT]) );
2086 18 : }
2087 :
2088 18 : void WW8FlySet::Init(const SwWW8ImplReader& rReader, const SwPaM* pPaM)
2089 : {
2090 18 : if (!rReader.mbNewDoc)
2091 0 : Reader::ResetFrmFmtAttrs(*this); // Abstand/Umrandung raus
2092 :
2093 18 : Put(SvxLRSpaceItem(RES_LR_SPACE)); //inline writer ole2 objects start with 0.2cm l/r
2094 18 : SwFmtAnchor aAnchor(FLY_AS_CHAR);
2095 :
2096 18 : aAnchor.SetAnchor(pPaM->GetPoint());
2097 18 : Put(aAnchor);
2098 :
2099 : //The horizontal default is on the baseline, the vertical is centered
2100 : //around the character center it appears
2101 18 : if (rReader.maSectionManager.CurrentSectionIsVertical())
2102 0 : Put(SwFmtVertOrient(0, text::VertOrientation::CHAR_CENTER,text::RelOrientation::CHAR));
2103 : else
2104 18 : Put(SwFmtVertOrient(0, text::VertOrientation::TOP, text::RelOrientation::FRAME));
2105 18 : }
2106 :
2107 142 : WW8DupProperties::WW8DupProperties(SwDoc &rDoc, SwWW8FltControlStack *pStk)
2108 : : pCtrlStck(pStk),
2109 142 : aChrSet(rDoc.GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END - 1 ),
2110 284 : aParSet(rDoc.GetAttrPool(), RES_PARATR_BEGIN, RES_PARATR_END - 1 )
2111 : {
2112 : //Close any open character properties and duplicate them inside the
2113 : //first table cell
2114 142 : size_t nCnt = pCtrlStck->size();
2115 775 : for (size_t i=0; i < nCnt; ++i)
2116 : {
2117 633 : const SwFltStackEntry& rEntry = (*pCtrlStck)[ i ];
2118 633 : if (rEntry.bOpen)
2119 : {
2120 7 : if (isCHRATR(rEntry.pAttr->Which()))
2121 : {
2122 7 : aChrSet.Put( *rEntry.pAttr );
2123 :
2124 : }
2125 0 : else if (isPARATR(rEntry.pAttr->Which()))
2126 : {
2127 0 : aParSet.Put( *rEntry.pAttr );
2128 : }
2129 : }
2130 : }
2131 142 : }
2132 :
2133 142 : void WW8DupProperties::Insert(const SwPosition &rPos)
2134 : {
2135 142 : const SfxItemSet *pSet=&aChrSet;
2136 426 : for(int i=0;i<2;i++)
2137 : {
2138 284 : if (i==1)
2139 142 : pSet = &aParSet;
2140 :
2141 284 : if( pSet->Count() )
2142 : {
2143 7 : SfxItemIter aIter( *pSet );
2144 7 : const SfxPoolItem* pItem = aIter.GetCurItem();
2145 7 : do
2146 : {
2147 7 : pCtrlStck->NewAttr(rPos, *pItem);
2148 14 : }while( !aIter.IsAtEnd() && 0 != ( pItem = aIter.NextItem() ) );
2149 : }
2150 : }
2151 142 : }
2152 :
2153 10 : void SwWW8ImplReader::MoveInsideFly(const SwFrmFmt *pFlyFmt)
2154 : {
2155 10 : WW8DupProperties aDup(rDoc,pCtrlStck);
2156 :
2157 10 : pCtrlStck->SetAttr(*pPaM->GetPoint(), 0, false);
2158 :
2159 : // Setze Pam in den FlyFrame
2160 10 : const SwFmtCntnt& rCntnt = pFlyFmt->GetCntnt();
2161 : OSL_ENSURE( rCntnt.GetCntntIdx(), "Kein Inhalt vorbereitet." );
2162 10 : pPaM->GetPoint()->nNode = rCntnt.GetCntntIdx()->GetIndex() + 1;
2163 10 : pPaM->GetPoint()->nContent.Assign( pPaM->GetCntntNode(), 0 );
2164 :
2165 10 : aDup.Insert(*pPaM->GetPoint());
2166 10 : }
2167 :
2168 14 : SwTwips SwWW8ImplReader::MoveOutsideFly(SwFrmFmt *pFlyFmt,
2169 : const SwPosition &rPos, bool bTableJoin)
2170 : {
2171 14 : SwTwips nRetWidth = 0;
2172 14 : if (!pFlyFmt)
2173 4 : return nRetWidth;
2174 : // Alle Attribute schliessen, da sonst Attribute entstehen koennen,
2175 : // die aus Flys rausragen
2176 10 : WW8DupProperties aDup(rDoc,pCtrlStck);
2177 10 : pCtrlStck->SetAttr(*pPaM->GetPoint(), 0, false);
2178 :
2179 : /*
2180 : #i1291
2181 : If this fly frame consists entirely of one table inside a frame
2182 : followed by an empty paragraph then we want to delete the empty
2183 : paragraph so as to get the frame to autoshrink to the size of the
2184 : table to emulate words behaviour closer.
2185 : */
2186 10 : if (bTableJoin)
2187 : {
2188 4 : const SwNodeIndex* pNodeIndex = pFlyFmt->GetCntnt().
2189 4 : GetCntntIdx();
2190 4 : if (pNodeIndex)
2191 : {
2192 4 : SwNodeIndex aIdx( *pNodeIndex, 1 ),
2193 8 : aEnd( *pNodeIndex->GetNode().EndOfSectionNode() );
2194 :
2195 4 : if (aIdx < aEnd)
2196 : {
2197 4 : if(aIdx.GetNode().IsTableNode())
2198 : {
2199 1 : SwTableNode *pTable = aIdx.GetNode().GetTableNode();
2200 1 : aIdx = *aIdx.GetNode().EndOfSectionNode();
2201 1 : ++aIdx;
2202 1 : if ( (aIdx < aEnd) && aIdx.GetNode().IsTxtNode() )
2203 : {
2204 1 : SwTxtNode *pNd = aIdx.GetNode().GetTxtNode();
2205 1 : ++aIdx;
2206 1 : if (aIdx == aEnd && pNd && pNd->GetTxt().isEmpty())
2207 : {
2208 : //An extra pre-created by writer unused paragraph
2209 :
2210 : //delete after import is complete rather than now
2211 : //to avoid the complication of managing uncommitted
2212 : //ctrlstack properties that refer to it.
2213 1 : m_aExtraneousParas.push_back(pNd);
2214 :
2215 1 : SwTable& rTable = pTable->GetTable();
2216 1 : SwFrmFmt* pTblFmt = rTable.GetFrmFmt();
2217 :
2218 1 : if (pTblFmt)
2219 : {
2220 1 : SwFmtFrmSize aSize = pTblFmt->GetFrmSize();
2221 1 : aSize.SetHeightSizeType(ATT_MIN_SIZE);
2222 1 : aSize.SetHeight(MINLAY);
2223 1 : pFlyFmt->SetFmtAttr(aSize);
2224 2 : SwFmtHoriOrient aHori = pTblFmt->GetHoriOrient();
2225 : // passing the table orientaion of
2226 : // LEFT_AND_WIDTH to the frame seems to
2227 : // work better than FULL, especially if the
2228 : // table width exceeds the page width, however
2229 : // I am not brave enough to set it in all
2230 : // instances
2231 1 : pTblFmt->SetFmtAttr( SwFmtHoriOrient(0, ( aHori.GetHoriOrient() == text::HoriOrientation::LEFT_AND_WIDTH ) ? ::text::HoriOrientation::LEFT_AND_WIDTH : text::HoriOrientation::FULL ) );
2232 2 : nRetWidth = aSize.GetWidth();
2233 : }
2234 : }
2235 : }
2236 : }
2237 4 : }
2238 : }
2239 : }
2240 :
2241 10 : *pPaM->GetPoint() = rPos;
2242 10 : aDup.Insert(*pPaM->GetPoint());
2243 10 : return nRetWidth;
2244 : }
2245 :
2246 93 : WW8FlyPara *SwWW8ImplReader::ConstructApo(const ApoTestResults &rApo,
2247 : const WW8_TablePos *pTabPos)
2248 : {
2249 93 : WW8FlyPara *pRet = 0;
2250 : OSL_ENSURE(rApo.HasFrame() || pTabPos,
2251 : "If no frame found, *MUST* be in a table");
2252 :
2253 93 : pRet = new WW8FlyPara(bVer67, rApo.mpStyleApo);
2254 :
2255 : // APO-Parameter ermitteln und Test auf bGrafApo
2256 93 : if (rApo.HasFrame())
2257 80 : pRet->ReadFull(rApo.m_nSprm29, this);
2258 :
2259 93 : pRet->ApplyTabPos(pTabPos);
2260 :
2261 93 : if (pRet->IsEmpty())
2262 0 : delete pRet, pRet = 0;
2263 93 : return pRet;
2264 : }
2265 :
2266 8 : bool SwWW8ImplReader::IsDropCap()
2267 : {
2268 : // Find the DCS (Drop Cap Specifier) for the paragraph
2269 : // if does not exist or if the first three bits are 0
2270 : // then there is no dropcap on the paragraph
2271 8 : WW8PLCFx_Cp_FKP *pPap = pPlcxMan ? pPlcxMan->GetPapPLCF() : 0;
2272 8 : if (pPap)
2273 : {
2274 : const sal_uInt8 *pDCS;
2275 8 : if (bVer67)
2276 0 : pDCS = pPap->HasSprm(46);
2277 : else
2278 8 : pDCS = pPlcxMan->GetPapPLCF()->HasSprm(0x442C);
2279 8 : if(pDCS)
2280 : {
2281 : /*
2282 : fdct short :3 0007 drop cap type
2283 : 0 no drop cap
2284 : 1 normal drop cap
2285 : 2 drop cap in margin
2286 : */
2287 0 : short nDCS = SVBT16ToShort( pDCS );
2288 0 : if (nDCS & 7)
2289 0 : return true;
2290 : }
2291 : }
2292 8 : return false;
2293 : }
2294 :
2295 8 : bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo,
2296 : const WW8_TablePos *pTabPos)
2297 : {
2298 8 : if (0 == (pWFlyPara = ConstructApo(rApo, pTabPos)))
2299 0 : return false;
2300 :
2301 : // <WW8SwFlyPara> constructor has changed - new 4th parameter
2302 : // containing WW8 page top margin.
2303 : pSFlyPara = new WW8SwFlyPara( *pPaM, *this, *pWFlyPara,
2304 8 : maSectionManager.GetWWPageTopMargin(),
2305 8 : maSectionManager.GetPageLeft(),
2306 8 : maSectionManager.GetTextAreaWidth(),
2307 24 : nIniFlyDx, nIniFlyDy);
2308 :
2309 : // If this paragraph is a Dropcap set the flag and we will deal with it later
2310 8 : if (IsDropCap())
2311 : {
2312 0 : bDropCap = true;
2313 0 : pAktItemSet = new SfxItemSet( rDoc.GetAttrPool(), RES_CHRATR_BEGIN, RES_PARATR_END - 1 );
2314 0 : return false;
2315 : }
2316 :
2317 8 : if( !pWFlyPara->bGrafApo )
2318 : {
2319 :
2320 : // Innerhalb des GrafApo muessen Textattribute ignoriert werden, da
2321 : // sie sonst auf den folgenden Zeilen landen. Der Rahmen wird nur
2322 : // eingefuegt, wenn er *nicht* nur zum Positionieren einer einzelnen
2323 : // Grafik dient. Ist es ein Grafik-Rahmen, dann werden pWFlyPara und
2324 : // pSFlyPara behalten und die
2325 : // daraus resultierenden Attribute beim Einfuegen der Grafik auf die
2326 : // Grafik angewendet.
2327 :
2328 8 : WW8FlySet aFlySet(*this, pWFlyPara, pSFlyPara, false);
2329 :
2330 8 : if (pTabPos && pTabPos->bNoFly)
2331 4 : pSFlyPara->pFlyFmt = 0;
2332 : else
2333 : {
2334 : pSFlyPara->pFlyFmt = rDoc.MakeFlySection( pSFlyPara->eAnchor,
2335 4 : pPaM->GetPoint(), &aFlySet );
2336 : OSL_ENSURE(pSFlyPara->pFlyFmt->GetAnchor().GetAnchorId() ==
2337 : pSFlyPara->eAnchor, "Not the anchor type requested!");
2338 : }
2339 :
2340 8 : if (pSFlyPara->pFlyFmt)
2341 : {
2342 4 : if (!pDrawModel)
2343 3 : GrafikCtor();
2344 :
2345 4 : SdrObject* pOurNewObject = CreateContactObject(pSFlyPara->pFlyFmt);
2346 4 : pWWZOrder->InsertTextLayerObject(pOurNewObject);
2347 : }
2348 :
2349 8 : if (FLY_AS_CHAR != pSFlyPara->eAnchor && pSFlyPara->pFlyFmt)
2350 : {
2351 4 : pAnchorStck->AddAnchor(*pPaM->GetPoint(),pSFlyPara->pFlyFmt);
2352 : }
2353 :
2354 : // merke Pos im Haupttext
2355 8 : pSFlyPara->pMainTextPos = new SwPosition( *pPaM->GetPoint() );
2356 :
2357 : //remove fltanchors, otherwise they will be closed inside the
2358 : //frame, which makes no sense, restore them after the frame is
2359 : //closed
2360 8 : pSFlyPara->pOldAnchorStck = pAnchorStck;
2361 8 : pAnchorStck = new SwWW8FltAnchorStack(&rDoc, nFieldFlags);
2362 :
2363 8 : if (pSFlyPara->pFlyFmt)
2364 4 : MoveInsideFly(pSFlyPara->pFlyFmt);
2365 :
2366 : // 1) ReadText() wird nicht wie beim W4W-Reader rekursiv aufgerufen,
2367 : // da die Laenge des Apo zu diesen Zeitpunkt noch nicht feststeht,
2368 : // ReadText() diese Angabe aber braucht.
2369 : // 2) Der CtrlStck wird nicht neu erzeugt.
2370 : // die Char-Attribute laufen weiter ( AErger mit SW-Attributen )
2371 : // Paraattribute muessten am Ende jeden Absatzes zurueckgesetzt
2372 : // sein, d.h. es duerften am Absatzende keine Paraattribute
2373 : // auf dem Stack liegen
2374 : }
2375 8 : return true;
2376 : }
2377 :
2378 198 : void wwSectionManager::JoinNode(const SwPosition &rPos, const SwNode &rNode)
2379 : {
2380 198 : if ((!maSegments.empty()) && (maSegments.back().maStart == rPos.nNode))
2381 0 : maSegments.back().maStart = SwNodeIndex(rNode);
2382 198 : }
2383 :
2384 198 : bool SwWW8ImplReader::JoinNode(SwPaM &rPam, bool bStealAttr)
2385 : {
2386 198 : bool bRet = false;
2387 198 : rPam.GetPoint()->nContent = 0; // an den Anfang der Zeile gehen
2388 :
2389 198 : SwNodeIndex aPref(rPam.GetPoint()->nNode, -1);
2390 :
2391 198 : if (SwTxtNode* pNode = aPref.GetNode().GetTxtNode())
2392 : {
2393 198 : maSectionManager.JoinNode(*rPam.GetPoint(), aPref.GetNode());
2394 198 : rPam.GetPoint()->nNode = aPref;
2395 198 : rPam.GetPoint()->nContent.Assign(pNode, pNode->GetTxt().getLength());
2396 198 : if (bStealAttr)
2397 0 : pCtrlStck->StealAttr(rPam.GetPoint()->nNode);
2398 :
2399 198 : pNode->JoinNext();
2400 :
2401 198 : bRet = true;
2402 : }
2403 198 : return bRet;
2404 : }
2405 :
2406 8 : void SwWW8ImplReader::StopApo()
2407 : {
2408 : OSL_ENSURE(pWFlyPara, "no pWFlyPara to close");
2409 8 : if (!pWFlyPara)
2410 0 : return;
2411 8 : if (pWFlyPara->bGrafApo)
2412 : {
2413 : // Grafik-Rahmen, der *nicht* eingefuegt wurde leeren Absatz incl.
2414 : // Attributen entfernen
2415 0 : JoinNode(*pPaM, true);
2416 :
2417 : }
2418 : else
2419 : {
2420 8 : if (!pSFlyPara->pMainTextPos || !pWFlyPara)
2421 : {
2422 : OSL_ENSURE( pSFlyPara->pMainTextPos, "StopApo: pMainTextPos ist 0" );
2423 : OSL_ENSURE( pWFlyPara, "StopApo: pWFlyPara ist 0" );
2424 0 : return;
2425 : }
2426 :
2427 : /*
2428 : What we are doing with this temporary nodeindex is as follows: The
2429 : stack of attributes normally only places them into the document when
2430 : the current insertion point has passed them by. Otherwise the end
2431 : point of the attribute gets pushed along with the insertion point. The
2432 : insertion point is moved and the properties commited during
2433 : MoveOutsideFly. We also may want to remove the final paragraph in the
2434 : frame, but we need to wait until the properties for that frame text
2435 : have been commited otherwise they will be lost. So we first get a
2436 : handle to the last the filter inserted. After the attributes are
2437 : commited, if that paragraph exists we join it with the para after it
2438 : that comes with the frame by default so that as normal we don't end up
2439 : with one more paragraph than we wanted.
2440 : */
2441 8 : SwNodeIndex aPref(pPaM->GetPoint()->nNode, -1);
2442 :
2443 : SwTwips nNewWidth =
2444 8 : MoveOutsideFly(pSFlyPara->pFlyFmt, *pSFlyPara->pMainTextPos);
2445 8 : if (nNewWidth)
2446 1 : pSFlyPara->BoxUpWidth(nNewWidth);
2447 :
2448 8 : Color aBg(0xFE, 0xFF, 0xFF, 0xFF); //Transparent by default
2449 :
2450 8 : if (SwTxtNode* pNd = aPref.GetNode().GetTxtNode())
2451 : {
2452 : /*
2453 : #i582#
2454 : Take the last paragraph background colour and fill the frame with
2455 : it. Otherwise, make it transparent, this appears to be how MSWord
2456 : works
2457 : */
2458 3 : const SfxPoolItem &rItm = pNd->SwCntntNode::GetAttr(RES_BACKGROUND);
2459 3 : const SvxBrushItem &rBrush = (const SvxBrushItem&)(rItm);
2460 3 : if (rBrush.GetColor().GetColor() != COL_AUTO)
2461 0 : aBg = rBrush.GetColor();
2462 :
2463 : //Get rid of extra empty paragraph
2464 3 : pNd->JoinNext();
2465 : }
2466 :
2467 8 : if (pSFlyPara->pFlyFmt)
2468 4 : pSFlyPara->pFlyFmt->SetFmtAttr(SvxBrushItem(aBg, RES_BACKGROUND));
2469 :
2470 8 : DeleteAnchorStk();
2471 8 : pAnchorStck = pSFlyPara->pOldAnchorStck;
2472 :
2473 : // When inserting a graphic into the fly frame using the auto
2474 : // function, the extension of the SW-fly has to be set
2475 : // manually as the SW fly has no auto function to adjust the
2476 : // frame´s size.
2477 8 : if( pSFlyPara->nNewNettoWidth > MINFLY ) // BoxUpWidth ?
2478 : {
2479 1 : long nW = pSFlyPara->nNewNettoWidth;
2480 1 : nW += pSFlyPara->nWidth - pSFlyPara->nNettoWidth; // Rand dazu
2481 : pSFlyPara->pFlyFmt->SetFmtAttr(
2482 1 : SwFmtFrmSize( pSFlyPara->eHeightFix, nW, pSFlyPara->nHeight ) );
2483 : }
2484 : /*
2485 : Word set *no* width meaning its an automatic width. The
2486 : SwFlyPara reader will have already set a fallback width of the
2487 : printable regions width, so we should reuse it. Despite the related
2488 : problems with layout addressed with a hack in WW8FlyPara's constructor
2489 : #i27204# Added AutoWidth setting. Left the old CalculateFlySize in place
2490 : so that if the user unselects autowidth, the width doesn't max out
2491 : */
2492 7 : else if( !pWFlyPara->nSp28 && pSFlyPara->pFlyFmt)
2493 : {
2494 : using namespace sw::util;
2495 3 : SfxItemSet aFlySet( pSFlyPara->pFlyFmt->GetAttrSet() );
2496 :
2497 6 : SwFmtFrmSize aSize(ItemGet<SwFmtFrmSize>(aFlySet, RES_FRM_SIZE));
2498 :
2499 3 : aFlySet.ClearItem(RES_FRM_SIZE);
2500 :
2501 : CalculateFlySize(aFlySet, pSFlyPara->pMainTextPos->nNode,
2502 3 : pSFlyPara->nWidth);
2503 :
2504 3 : nNewWidth = ItemGet<SwFmtFrmSize>(aFlySet, RES_FRM_SIZE).GetWidth();
2505 :
2506 3 : aSize.SetWidth(nNewWidth);
2507 3 : aSize.SetWidthSizeType(ATT_VAR_SIZE);
2508 :
2509 6 : pSFlyPara->pFlyFmt->SetFmtAttr(aSize);
2510 : }
2511 :
2512 8 : delete pSFlyPara->pMainTextPos, pSFlyPara->pMainTextPos = 0;
2513 :
2514 : // Damit die Frames bei Einfuegen in existierendes Doc erzeugt werden,
2515 : // wird in fltshell.cxx beim Setzen des FltAnchor-Attributes
2516 : // pFlyFrm->MakeFrms() gerufen
2517 :
2518 : }
2519 :
2520 : //#i8062#
2521 8 : if (pSFlyPara && pSFlyPara->pFlyFmt)
2522 4 : pFmtOfJustInsertedApo = pSFlyPara->pFlyFmt;
2523 :
2524 8 : DELETEZ( pSFlyPara );
2525 8 : DELETEZ( pWFlyPara );
2526 : }
2527 :
2528 : // TestSameApo() beantwortet die Frage, ob es dasselbe APO oder ein neues ist
2529 9 : bool SwWW8ImplReader::TestSameApo(const ApoTestResults &rApo,
2530 : const WW8_TablePos *pTabPos)
2531 : {
2532 9 : if( !pWFlyPara )
2533 : {
2534 : OSL_ENSURE( pWFlyPara, " Wo ist mein pWFlyPara ? " );
2535 0 : return true;
2536 : }
2537 :
2538 : // Es muss ein kompletter Vergleich ( ausser Borders ) stattfinden, um
2539 : // alle Kombinationen Style / Hart richtig einzuordnen. Deshalb wird ein
2540 : // temporaerer WW8FlyPara angelegt ( abh. ob Style oder nicht ), darauf
2541 : // die harten Attrs angewendet, und dann verglichen
2542 :
2543 : // Zum Vergleich
2544 9 : WW8FlyPara aF(bVer67, rApo.mpStyleApo);
2545 : // WWPara fuer akt. Para
2546 9 : if (rApo.HasFrame())
2547 9 : aF.Read(rApo.m_nSprm29, pPlcxMan->GetPapPLCF());
2548 9 : aF.ApplyTabPos(pTabPos);
2549 :
2550 9 : return aF == *pWFlyPara;
2551 : }
2552 :
2553 : /***************************************************************************
2554 : # Attribut - Verwaltung
2555 : #**************************************************************************/
2556 :
2557 27980 : void SwWW8ImplReader::NewAttr( const SfxPoolItem& rAttr,
2558 : const bool bFirstLineOfStSet,
2559 : const bool bLeftIndentSet )
2560 : {
2561 27980 : if( !bNoAttrImport ) // zum Ignorieren von Styles beim Doc-Einfuegen
2562 : {
2563 27949 : if (pAktColl)
2564 : {
2565 : OSL_ENSURE(rAttr.Which() != RES_FLTR_REDLINE, "redline in style!");
2566 4284 : pAktColl->SetFmtAttr(rAttr);
2567 : }
2568 23665 : else if (pAktItemSet)
2569 : {
2570 2515 : pAktItemSet->Put(rAttr);
2571 : }
2572 21150 : else if (rAttr.Which() == RES_FLTR_REDLINE)
2573 : {
2574 0 : mpRedlineStack->open(*pPaM->GetPoint(), rAttr);
2575 : }
2576 : else
2577 : {
2578 21150 : pCtrlStck->NewAttr(*pPaM->GetPoint(), rAttr);
2579 : // #i103711#
2580 21150 : if ( bFirstLineOfStSet )
2581 : {
2582 267 : const SwNode* pNd = &(pPaM->GetPoint()->nNode.GetNode());
2583 267 : maTxtNodesHavingFirstLineOfstSet.insert( pNd );
2584 : }
2585 : // #i105414#
2586 21150 : if ( bLeftIndentSet )
2587 : {
2588 795 : const SwNode* pNd = &(pPaM->GetPoint()->nNode.GetNode());
2589 795 : maTxtNodesHavingLeftIndentSet.insert( pNd );
2590 : }
2591 : }
2592 :
2593 27949 : if (mpPostProcessAttrsInfo && mpPostProcessAttrsInfo->mbCopy)
2594 0 : mpPostProcessAttrsInfo->mItemSet.Put(rAttr);
2595 : }
2596 27980 : }
2597 :
2598 : // holt Attribut aus der FmtColl / Stack / Doc
2599 17842 : const SfxPoolItem* SwWW8ImplReader::GetFmtAttr( sal_uInt16 nWhich )
2600 : {
2601 17842 : const SfxPoolItem* pRet = 0;
2602 17842 : if (pAktColl)
2603 1082 : pRet = &(pAktColl->GetFmtAttr(nWhich));
2604 16760 : else if (pAktItemSet)
2605 : {
2606 0 : pRet = pAktItemSet->GetItem(nWhich);
2607 0 : if (!pRet)
2608 0 : pRet = pStandardFmtColl ? &(pStandardFmtColl->GetFmtAttr(nWhich)) : 0;
2609 0 : if (!pRet)
2610 0 : pRet = &rDoc.GetAttrPool().GetDefaultItem(nWhich);
2611 : }
2612 16760 : else if (pPlcxMan && pPlcxMan->GetDoingDrawTextBox())
2613 : {
2614 108 : pRet = pCtrlStck->GetStackAttr(*pPaM->GetPoint(), nWhich);
2615 108 : if (!pRet)
2616 : {
2617 186 : if (nAktColl < vColl.size() && vColl[nAktColl].pFmt &&
2618 93 : vColl[nAktColl].bColl)
2619 : {
2620 93 : pRet = &(vColl[nAktColl].pFmt->GetFmtAttr(nWhich));
2621 : }
2622 : }
2623 108 : if (!pRet)
2624 0 : pRet = pStandardFmtColl ? &(pStandardFmtColl->GetFmtAttr(nWhich)) : 0;
2625 108 : if (!pRet)
2626 0 : pRet = &rDoc.GetAttrPool().GetDefaultItem(nWhich);
2627 : }
2628 : else
2629 16652 : pRet = pCtrlStck->GetFmtAttr(*pPaM->GetPoint(), nWhich);
2630 17842 : return pRet;
2631 : }
2632 :
2633 : /***************************************************************************
2634 : # eigentliche Attribute
2635 : #
2636 : # Die Methoden erhalten die Token-Id und die Laenge der noch folgenden
2637 : # Parameter gemaess Tabelle in WWScan.cxx als Parameter
2638 : #**************************************************************************/
2639 :
2640 : /***************************************************************************
2641 : # Spezial WW - Attribute
2642 : #**************************************************************************/
2643 :
2644 410 : void SwWW8ImplReader::Read_Special(sal_uInt16, const sal_uInt8* pData, short nLen)
2645 : {
2646 410 : if( nLen < 0 )
2647 : {
2648 205 : bSpec = false;
2649 615 : return;
2650 : }
2651 205 : bSpec = ( *pData != 0 );
2652 : }
2653 :
2654 : // Read_Obj wird fuer fObj und fuer fOle2 benutzt !
2655 16 : void SwWW8ImplReader::Read_Obj(sal_uInt16 , const sal_uInt8* pData, short nLen)
2656 : {
2657 16 : if( nLen < 0 )
2658 8 : bObj = false;
2659 : else
2660 : {
2661 8 : bObj = 0 != *pData;
2662 :
2663 8 : if( bObj && nPicLocFc && bEmbeddObj )
2664 : {
2665 8 : if (!maFieldStack.empty() && maFieldStack.back().mnFieldId == 56)
2666 : {
2667 : // For LINK fields, store the nObjLocFc value in the field entry
2668 0 : maFieldStack.back().mnObjLocFc = nPicLocFc;
2669 : }
2670 : else
2671 : {
2672 8 : nObjLocFc = nPicLocFc;
2673 : }
2674 : }
2675 : }
2676 16 : }
2677 :
2678 361 : void SwWW8ImplReader::Read_PicLoc(sal_uInt16 , const sal_uInt8* pData, short nLen )
2679 : {
2680 361 : if( nLen < 0 )
2681 : {
2682 178 : nPicLocFc = 0;
2683 178 : bSpec = false; // Stimmt das immer ?
2684 : }
2685 : else
2686 : {
2687 183 : nPicLocFc = SVBT32ToUInt32( pData );
2688 183 : bSpec = true;
2689 :
2690 183 : if( bObj && nPicLocFc && bEmbeddObj )
2691 0 : nObjLocFc = nPicLocFc;
2692 : }
2693 361 : }
2694 :
2695 83 : void SwWW8ImplReader::Read_POutLvl(sal_uInt16, const sal_uInt8* pData, short nLen )
2696 : {
2697 83 : if (pAktColl && (0 < nLen))
2698 : {
2699 83 : if (SwWW8StyInf* pSI = GetStyle(nAktColl))
2700 : {
2701 : pSI->nOutlineLevel = static_cast< sal_uInt8 >(
2702 166 : ( (1 <= pSI->GetWWStyleId()) && (9 >= pSI->GetWWStyleId()) )
2703 81 : ? pSI->GetWWStyleId()-1
2704 164 : : (pData ? *pData : 0) );
2705 : }
2706 : }
2707 83 : }
2708 :
2709 0 : void SwWW8ImplReader::Read_Symbol(sal_uInt16, const sal_uInt8* pData, short nLen )
2710 : {
2711 0 : if( !bIgnoreText )
2712 : {
2713 0 : if( nLen < 0 )
2714 : {
2715 : //otherwise disable after we print the char
2716 0 : if (pPlcxMan && pPlcxMan->GetDoingDrawTextBox())
2717 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_FONT );
2718 0 : bSymbol = false;
2719 : }
2720 : else
2721 : {
2722 : // Make new Font-Atribut
2723 : // (will be closed in SwWW8ImplReader::ReadChars() )
2724 :
2725 : //Will not be added to the charencoding stack, for styles the real
2726 : //font setting will be put in as the styles charset, and for plain
2727 : //text encoding for symbols is moot. Drawing boxes will check bSymbol
2728 : //themselves so they don't need to add it to the stack either.
2729 0 : if (SetNewFontAttr(SVBT16ToShort( pData ), false, RES_CHRATR_FONT))
2730 : {
2731 0 : if( bVer67 )
2732 : {
2733 : //convert single byte from MS1252 to Unicode
2734 : cSymbol = OUString(
2735 : reinterpret_cast<const sal_Char*>(pData+2), 1,
2736 0 : RTL_TEXTENCODING_MS_1252).toChar();
2737 : }
2738 : else
2739 : {
2740 : //already is Unicode
2741 0 : cSymbol = SVBT16ToShort( pData+2 );
2742 : }
2743 0 : bSymbol = true;
2744 : }
2745 : }
2746 : }
2747 0 : }
2748 :
2749 2425 : SwWW8StyInf *SwWW8ImplReader::GetStyle(sal_uInt16 nColl) const
2750 : {
2751 2425 : return const_cast<SwWW8StyInf *>(nColl < vColl.size() ? &vColl[nColl] : 0);
2752 : }
2753 :
2754 : /***************************************************************************
2755 : # Zeichen - Attribute
2756 : #**************************************************************************/
2757 :
2758 : // Read_BoldUsw fuer Italic, Bold, Kapitaelchen, Versalien, durchgestrichen,
2759 : // Contour und Shadow
2760 2689 : void SwWW8ImplReader::Read_BoldUsw( sal_uInt16 nId, const sal_uInt8* pData, short nLen )
2761 : {
2762 2689 : const int nContigiousWestern = 8;
2763 2689 : const int nWestern = nContigiousWestern + 1;
2764 2689 : const int nEastern = 2;
2765 2689 : const int nCTL = 2;
2766 2689 : const int nIds = nWestern + nEastern + nCTL;
2767 : static const sal_uInt16 nEndIds[ nIds ] =
2768 : {
2769 : RES_CHRATR_WEIGHT, RES_CHRATR_POSTURE,
2770 : RES_CHRATR_CROSSEDOUT, RES_CHRATR_CONTOUR,
2771 : RES_CHRATR_SHADOWED, RES_CHRATR_CASEMAP,
2772 : RES_CHRATR_CASEMAP, RES_CHRATR_HIDDEN,
2773 :
2774 : RES_CHRATR_CROSSEDOUT,
2775 :
2776 : RES_CHRATR_CJK_WEIGHT, RES_CHRATR_CJK_POSTURE,
2777 :
2778 : RES_CHRATR_CTL_WEIGHT, RES_CHRATR_CTL_POSTURE
2779 : };
2780 :
2781 2689 : ww::WordVersion eVersion = pWwFib->GetFIBVersion();
2782 :
2783 : sal_uInt8 nI;
2784 : // die Attribut-Nr fuer "doppelt durchgestrichen" tanzt aus der Reihe
2785 2689 : if (0x2A53 == nId)
2786 4 : nI = nContigiousWestern; // The out of sequence western id
2787 : else
2788 : {
2789 : // The contigious western ids
2790 2685 : if (eVersion <= ww::eWW2)
2791 1211 : nI = static_cast< sal_uInt8 >(nId - 60);
2792 1474 : else if (eVersion < ww::eWW8)
2793 0 : nI = static_cast< sal_uInt8 >(nId - 85);
2794 : else
2795 1474 : nI = static_cast< sal_uInt8 >(nId - 0x0835);
2796 : }
2797 :
2798 2689 : sal_uInt16 nMask = 1 << nI;
2799 :
2800 2689 : if (nLen < 0)
2801 : {
2802 1225 : if (nI < 2)
2803 : {
2804 776 : if (eVersion <= ww::eWW6)
2805 : {
2806 : // reset the CTL Weight and Posture, because they are the same as their
2807 : // western equivalents in ww6
2808 172 : pCtrlStck->SetAttr( *pPaM->GetPoint(), nEndIds[ nWestern + nEastern + nI ] );
2809 : }
2810 : // reset the CJK Weight and Posture, because they are the same as their
2811 : // western equivalents in word
2812 776 : pCtrlStck->SetAttr( *pPaM->GetPoint(), nEndIds[ nWestern + nI ] );
2813 : }
2814 1225 : pCtrlStck->SetAttr( *pPaM->GetPoint(), nEndIds[ nI ] );
2815 1225 : pCtrlStck->SetToggleAttr(nI, false);
2816 3914 : return;
2817 : }
2818 : // Wert: 0 = Aus, 1 = An, 128 = Wie Style, 129 entgegen Style
2819 1464 : bool bOn = *pData & 1;
2820 1464 : SwWW8StyInf* pSI = GetStyle(nAktColl);
2821 1464 : if (pPlcxMan && eVersion > ww::eWW2)
2822 : {
2823 : const sal_uInt8 *pCharIstd =
2824 654 : pPlcxMan->GetChpPLCF()->HasSprm(bVer67 ? 80 : 0x4A30);
2825 654 : if (pCharIstd)
2826 0 : pSI = GetStyle(SVBT16ToShort(pCharIstd));
2827 : }
2828 :
2829 1464 : if( pAktColl ) // StyleDef -> Flags merken
2830 : {
2831 166 : if (pSI)
2832 : {
2833 : // The style based on has Bit 7 set ?
2834 166 : if (
2835 262 : pSI->nBase < vColl.size() && (*pData & 0x80) &&
2836 96 : (vColl[pSI->nBase].n81Flags & nMask)
2837 : )
2838 : {
2839 0 : bOn = !bOn; // umdrehen
2840 : }
2841 :
2842 166 : if (bOn)
2843 157 : pSI->n81Flags |= nMask; // Flag setzen
2844 : else
2845 9 : pSI->n81Flags &= ~nMask; // Flag loeschen
2846 : }
2847 : }
2848 : else
2849 : {
2850 :
2851 : // im Text -> Flags abfragen
2852 1298 : if( *pData & 0x80 ) // Bit 7 gesetzt ?
2853 : {
2854 1095 : if (pSI && pSI->n81Flags & nMask) // und in StyleDef an ?
2855 13 : bOn = !bOn; // dann invertieren
2856 : // am Stack vermerken, das dieses ein Toggle-Attribut ist
2857 1095 : pCtrlStck->SetToggleAttr(nI, true);
2858 : }
2859 : }
2860 :
2861 1464 : SetToggleAttr( nI, bOn );
2862 : }
2863 :
2864 2158 : void SwWW8ImplReader::Read_Bidi(sal_uInt16, const sal_uInt8* pData, short nLen)
2865 : {
2866 2158 : if( nLen < 0 ) //Property end
2867 : {
2868 1079 : bBidi = false;
2869 1079 : pCtrlStck->SetAttr(*pPaM->GetPoint(),RES_CHRATR_BIDIRTL);
2870 : }
2871 : else //Property start
2872 : {
2873 1079 : bBidi = true;
2874 1079 : sal_uInt8 nBidi = *pData;
2875 1079 : NewAttr( SfxInt16Item( RES_CHRATR_BIDIRTL, (nBidi!=0)? 1 : 0 ) );
2876 : }
2877 2158 : }
2878 :
2879 : // Read_BoldUsw for BiDi Italic, Bold
2880 812 : void SwWW8ImplReader::Read_BoldBiDiUsw(sal_uInt16 nId, const sal_uInt8* pData,
2881 : short nLen)
2882 : {
2883 : static const sal_uInt16 nEndIds[2] =
2884 : {
2885 : RES_CHRATR_CTL_WEIGHT, RES_CHRATR_CTL_POSTURE,
2886 : };
2887 :
2888 : sal_uInt8 nI;
2889 812 : ww::WordVersion eVersion = pWwFib->GetFIBVersion();
2890 812 : if (eVersion <= ww::eWW2)
2891 346 : nI = static_cast< sal_uInt8 >(nId - 80);
2892 466 : else if (eVersion < ww::eWW8)
2893 0 : nI = static_cast< sal_uInt8 >(nId - 111);
2894 : else
2895 466 : nI = static_cast< sal_uInt8 >(nId - 0x085C);
2896 :
2897 : OSL_ENSURE(nI <= 1, "not happening");
2898 812 : if (nI > 1)
2899 0 : return;
2900 :
2901 812 : sal_uInt16 nMask = 1 << nI;
2902 :
2903 812 : if( nLen < 0 )
2904 : {
2905 346 : pCtrlStck->SetAttr(*pPaM->GetPoint(),nEndIds[nI]);
2906 346 : pCtrlStck->SetToggleBiDiAttr(nI, false);
2907 346 : return;
2908 : }
2909 466 : bool bOn = *pData & 1;
2910 466 : SwWW8StyInf* pSI = GetStyle(nAktColl);
2911 466 : if (pPlcxMan)
2912 : {
2913 : const sal_uInt8 *pCharIstd =
2914 364 : pPlcxMan->GetChpPLCF()->HasSprm(bVer67 ? 80 : 0x4A30);
2915 364 : if (pCharIstd)
2916 172 : pSI = GetStyle(SVBT16ToShort(pCharIstd));
2917 : }
2918 :
2919 466 : if (pAktColl && eVersion > ww::eWW2) // StyleDef -> Flags merken
2920 : {
2921 196 : if (pSI)
2922 : {
2923 196 : if( pSI->nBase < vColl.size() // Style Based on
2924 90 : && ( *pData & 0x80 ) // Bit 7 gesetzt ?
2925 146 : && ( vColl[pSI->nBase].n81BiDiFlags & nMask ) ) // BasisMaske ?
2926 0 : bOn = !bOn; // umdrehen
2927 :
2928 98 : if( bOn )
2929 98 : pSI->n81BiDiFlags |= nMask; // Flag setzen
2930 : else
2931 0 : pSI->n81BiDiFlags &= ~nMask; // Flag loeschen
2932 : }
2933 : }
2934 : else
2935 : {
2936 :
2937 : // im Text -> Flags abfragen
2938 368 : if (*pData & 0x80) // Bit 7 gesetzt ?
2939 : {
2940 360 : if (pSI && pSI->n81BiDiFlags & nMask) // und in StyleDef an ?
2941 4 : bOn = !bOn; // dann invertieren
2942 : // am Stack vermerken, das dieses ein Toggle-Attribut ist
2943 360 : pCtrlStck->SetToggleBiDiAttr(nI, true);
2944 : }
2945 : }
2946 :
2947 466 : SetToggleBiDiAttr(nI, bOn);
2948 : }
2949 :
2950 466 : void SwWW8ImplReader::SetToggleBiDiAttr(sal_uInt8 nAttrId, bool bOn)
2951 : {
2952 466 : switch (nAttrId)
2953 : {
2954 : case 0:
2955 : {
2956 335 : SvxWeightItem aAttr( bOn ? WEIGHT_BOLD : WEIGHT_NORMAL, RES_CHRATR_WEIGHT );
2957 335 : aAttr.SetWhich( RES_CHRATR_CTL_WEIGHT );
2958 335 : NewAttr( aAttr );
2959 : }
2960 335 : break;
2961 : case 1:
2962 : {
2963 131 : SvxPostureItem aAttr( bOn ? ITALIC_NORMAL : ITALIC_NONE, RES_CHRATR_POSTURE );
2964 131 : aAttr.SetWhich( RES_CHRATR_CTL_POSTURE );
2965 131 : NewAttr( aAttr );
2966 : }
2967 131 : break;
2968 : default:
2969 : OSL_ENSURE(!this, "Unhandled unknown bidi toggle attribute");
2970 0 : break;
2971 :
2972 : }
2973 466 : }
2974 :
2975 1464 : void SwWW8ImplReader::SetToggleAttr(sal_uInt8 nAttrId, bool bOn)
2976 : {
2977 1464 : ww::WordVersion eVersion = pWwFib->GetFIBVersion();
2978 :
2979 1464 : switch (nAttrId)
2980 : {
2981 : case 0:
2982 : {
2983 674 : SvxWeightItem aAttr( bOn ? WEIGHT_BOLD : WEIGHT_NORMAL, RES_CHRATR_WEIGHT );
2984 674 : NewAttr( aAttr );
2985 674 : aAttr.SetWhich( RES_CHRATR_CJK_WEIGHT );
2986 674 : NewAttr( aAttr );
2987 674 : if (eVersion <= ww::eWW6)
2988 : {
2989 87 : aAttr.SetWhich( RES_CHRATR_CTL_WEIGHT );
2990 87 : NewAttr( aAttr );
2991 674 : }
2992 : }
2993 674 : break;
2994 : case 1:
2995 : {
2996 317 : SvxPostureItem aAttr( bOn ? ITALIC_NORMAL : ITALIC_NONE, RES_CHRATR_POSTURE );
2997 317 : NewAttr( aAttr );
2998 317 : aAttr.SetWhich( RES_CHRATR_CJK_POSTURE );
2999 317 : NewAttr( aAttr );
3000 317 : if (eVersion <= ww::eWW6)
3001 : {
3002 87 : aAttr.SetWhich( RES_CHRATR_CTL_POSTURE );
3003 87 : NewAttr( aAttr );
3004 317 : }
3005 : }
3006 317 : break;
3007 : case 2:
3008 91 : NewAttr(SvxCrossedOutItem(bOn ? STRIKEOUT_SINGLE : STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT));
3009 91 : break;
3010 : case 3:
3011 91 : NewAttr( SvxContourItem( bOn, RES_CHRATR_CONTOUR ) );
3012 91 : break;
3013 : case 4:
3014 8 : NewAttr( SvxShadowedItem( bOn, RES_CHRATR_SHADOWED ) );
3015 8 : break;
3016 : case 5:
3017 : NewAttr( SvxCaseMapItem( bOn ? SVX_CASEMAP_KAPITAELCHEN
3018 87 : : SVX_CASEMAP_NOT_MAPPED, RES_CHRATR_CASEMAP ) );
3019 87 : break;
3020 : case 6:
3021 : NewAttr( SvxCaseMapItem( bOn ? SVX_CASEMAP_VERSALIEN
3022 89 : : SVX_CASEMAP_NOT_MAPPED, RES_CHRATR_CASEMAP ) );
3023 89 : break;
3024 : case 7:
3025 103 : NewAttr(SvxCharHiddenItem(bOn, RES_CHRATR_HIDDEN));
3026 103 : break;
3027 : case 8:
3028 : NewAttr( SvxCrossedOutItem( bOn ? STRIKEOUT_DOUBLE
3029 4 : : STRIKEOUT_NONE, RES_CHRATR_CROSSEDOUT ) );
3030 4 : break;
3031 : default:
3032 : OSL_ENSURE(!this, "Unhandled unknown toggle attribute");
3033 0 : break;
3034 : }
3035 1464 : }
3036 :
3037 0 : void SwWW8ImplReader::_ChkToggleAttr( sal_uInt16 nOldStyle81Mask,
3038 : sal_uInt16 nNewStyle81Mask )
3039 : {
3040 0 : sal_uInt16 i = 1, nToggleAttrFlags = pCtrlStck->GetToggleAttrFlags();
3041 0 : for (sal_uInt8 n = 0; n < 7; ++n, i <<= 1)
3042 : {
3043 0 : if (
3044 0 : (i & nToggleAttrFlags) &&
3045 0 : ((i & nOldStyle81Mask) != (i & nNewStyle81Mask))
3046 : )
3047 : {
3048 0 : SetToggleAttr(n, (i & nOldStyle81Mask));
3049 : }
3050 : }
3051 0 : }
3052 :
3053 0 : void SwWW8ImplReader::_ChkToggleBiDiAttr( sal_uInt16 nOldStyle81Mask,
3054 : sal_uInt16 nNewStyle81Mask )
3055 : {
3056 0 : sal_uInt16 i = 1, nToggleAttrFlags = pCtrlStck->GetToggleBiDiAttrFlags();
3057 0 : for (sal_uInt8 n = 0; n < 7; ++n, i <<= 1)
3058 : {
3059 0 : if (
3060 0 : (i & nToggleAttrFlags) &&
3061 0 : ((i & nOldStyle81Mask) != (i & nNewStyle81Mask))
3062 : )
3063 : {
3064 0 : SetToggleBiDiAttr(n, (i & nOldStyle81Mask));
3065 : }
3066 : }
3067 0 : }
3068 :
3069 31 : void SwWW8ImplReader::Read_SubSuper( sal_uInt16, const sal_uInt8* pData, short nLen )
3070 : {
3071 31 : if( nLen < 0 ){
3072 10 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_ESCAPEMENT );
3073 41 : return;
3074 : }
3075 :
3076 : short nEs;
3077 : sal_uInt8 nProp;
3078 21 : switch( *pData )
3079 : {
3080 : case 1:
3081 16 : nEs = DFLT_ESC_AUTO_SUPER;
3082 16 : nProp = DFLT_ESC_PROP;
3083 16 : break;
3084 : case 2:
3085 0 : nEs = DFLT_ESC_AUTO_SUB;
3086 0 : nProp = DFLT_ESC_PROP;
3087 0 : break;
3088 : default:
3089 5 : nEs = 0;
3090 5 : nProp = 100;
3091 5 : break;
3092 : }
3093 21 : NewAttr( SvxEscapementItem( nEs, nProp, RES_CHRATR_ESCAPEMENT ) );
3094 : }
3095 :
3096 14 : SwFrmFmt *SwWW8ImplReader::ContainsSingleInlineGraphic(const SwPaM &rRegion)
3097 : {
3098 : /*
3099 : For inline graphics and objects word has a hacked in feature to use
3100 : subscripting to force the graphic into a centered position on the line, so
3101 : we must check when applying sub/super to see if it the subscript range
3102 : contains only a single graphic, and if that graphic is anchored as
3103 : FLY_AS_CHAR and then we can change its anchoring to centered in the line.
3104 : */
3105 14 : SwFrmFmt *pRet=0;
3106 14 : SwNodeIndex aBegin(rRegion.Start()->nNode);
3107 14 : const sal_Int32 nBegin(rRegion.Start()->nContent.GetIndex());
3108 28 : SwNodeIndex aEnd(rRegion.End()->nNode);
3109 14 : const sal_Int32 nEnd(rRegion.End()->nContent.GetIndex());
3110 : const SwTxtNode* pTNd;
3111 : const SwTxtAttr* pTFlyAttr;
3112 14 : if (
3113 28 : aBegin == aEnd && nBegin == nEnd - 1 &&
3114 14 : 0 != (pTNd = aBegin.GetNode().GetTxtNode()) &&
3115 : 0 != (pTFlyAttr = pTNd->GetTxtAttrForCharAt(nBegin, RES_TXTATR_FLYCNT))
3116 : )
3117 : {
3118 0 : const SwFmtFlyCnt& rFly = pTFlyAttr->GetFlyCnt();
3119 0 : SwFrmFmt *pFlyFmt = rFly.GetFrmFmt();
3120 0 : if (pFlyFmt &&
3121 0 : (FLY_AS_CHAR == pFlyFmt->GetAnchor().GetAnchorId()))
3122 : {
3123 0 : pRet = pFlyFmt;
3124 : }
3125 : }
3126 28 : return pRet;
3127 : }
3128 :
3129 8 : bool SwWW8ImplReader::ConvertSubToGraphicPlacement()
3130 : {
3131 : /*
3132 : For inline graphics and objects word has a hacked in feature to use
3133 : subscripting to force the graphic into a centered position on the line, so
3134 : we must check when applying sub/super to see if it the subscript range
3135 : contains only a single graphic, and if that graphic is anchored as
3136 : FLY_AS_CHAR and then we can change its anchoring to centered in the line.
3137 : */
3138 8 : bool bIsGraphicPlacementHack = false;
3139 : sal_uInt16 nPos;
3140 8 : if (pCtrlStck->GetFmtStackAttr(RES_CHRATR_ESCAPEMENT, &nPos))
3141 : {
3142 8 : SwPaM aRegion(*pPaM->GetPoint());
3143 :
3144 16 : SwFltPosition aMkPos((*pCtrlStck)[nPos].m_aMkPos);
3145 16 : SwFltPosition aPtPos(*pPaM->GetPoint());
3146 :
3147 8 : SwFrmFmt *pFlyFmt = 0;
3148 8 : if (
3149 8 : SwFltStackEntry::MakeRegion(&rDoc,aRegion,false,aMkPos,aPtPos) &&
3150 : 0 != (pFlyFmt = ContainsSingleInlineGraphic(aRegion))
3151 : )
3152 : {
3153 0 : pCtrlStck->DeleteAndDestroy(nPos);
3154 0 : pFlyFmt->SetFmtAttr(SwFmtVertOrient(0, text::VertOrientation::CHAR_CENTER, text::RelOrientation::CHAR));
3155 0 : bIsGraphicPlacementHack = true;
3156 8 : }
3157 : }
3158 8 : return bIsGraphicPlacementHack;
3159 : }
3160 :
3161 19 : void SwWW8ImplReader::Read_SubSuperProp( sal_uInt16, const sal_uInt8* pData, short nLen )
3162 : {
3163 19 : if( nLen < 0 )
3164 : {
3165 8 : if (!ConvertSubToGraphicPlacement())
3166 8 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_ESCAPEMENT );
3167 27 : return;
3168 : }
3169 :
3170 11 : ww::WordVersion eVersion = pWwFib->GetFIBVersion();
3171 :
3172 : // Font-Position in HalfPoints
3173 11 : short nPos = eVersion <= ww::eWW2 ? static_cast< sal_Int8 >( *pData ) : SVBT16ToShort( pData );
3174 11 : sal_Int32 nPos2 = nPos * ( 10 * 100 ); // HalfPoints in 100 * tw
3175 : const SvxFontHeightItem* pF
3176 11 : = (const SvxFontHeightItem*)GetFmtAttr(RES_CHRATR_FONTSIZE);
3177 : OSL_ENSURE(pF, "Expected to have the fontheight available here");
3178 :
3179 : // #i59022: Check ensure nHeight != 0. Div by zero otherwise.
3180 11 : sal_Int32 nHeight = 240;
3181 11 : if (pF != NULL && pF->GetHeight() != 0)
3182 11 : nHeight = pF->GetHeight();
3183 11 : nPos2 /= nHeight; // ... nun in % ( gerundet )
3184 11 : if( nPos2 > 100 ) // zur Sicherheit
3185 0 : nPos2 = 100;
3186 11 : if( nPos2 < -100 )
3187 0 : nPos2 = -100;
3188 11 : SvxEscapementItem aEs( (short)nPos2, 100, RES_CHRATR_ESCAPEMENT );
3189 11 : NewAttr( aEs );
3190 : }
3191 :
3192 182 : void SwWW8ImplReader::Read_Underline( sal_uInt16, const sal_uInt8* pData, short nLen )
3193 : {
3194 182 : FontUnderline eUnderline = UNDERLINE_NONE;
3195 182 : bool bWordLine = false;
3196 182 : if( pData )
3197 : {
3198 : // Parameter: 0 = none, 1 = single, 2 = by Word,
3199 : // 3 = double, 4 = dotted, 5 = hidden
3200 : // 6 = thick, 7 = dash, 8 = dot(not used)
3201 : // 9 = dotdash 10 = dotdotdash 11 = wave
3202 105 : switch( *pData )
3203 : {
3204 0 : case 2: bWordLine = true; // no break;
3205 86 : case 1: eUnderline = (FontUnderline)UNDERLINE_SINGLE; break;
3206 0 : case 3: eUnderline = (FontUnderline)UNDERLINE_DOUBLE; break;
3207 0 : case 4: eUnderline = (FontUnderline)UNDERLINE_DOTTED; break;
3208 0 : case 7: eUnderline = (FontUnderline)UNDERLINE_DASH; break;
3209 0 : case 9: eUnderline = (FontUnderline)UNDERLINE_DASHDOT; break;
3210 0 : case 10:eUnderline = (FontUnderline)UNDERLINE_DASHDOTDOT; break;
3211 0 : case 6: eUnderline = (FontUnderline)UNDERLINE_BOLD; break;
3212 0 : case 11:eUnderline = (FontUnderline)UNDERLINE_WAVE; break;
3213 0 : case 20:eUnderline = (FontUnderline)UNDERLINE_BOLDDOTTED; break;
3214 0 : case 23:eUnderline = (FontUnderline)UNDERLINE_BOLDDASH; break;
3215 0 : case 39:eUnderline = (FontUnderline)UNDERLINE_LONGDASH; break;
3216 0 : case 55:eUnderline = (FontUnderline)UNDERLINE_BOLDLONGDASH; break;
3217 0 : case 25:eUnderline = (FontUnderline)UNDERLINE_BOLDDASHDOT; break;
3218 0 : case 26:eUnderline = (FontUnderline)UNDERLINE_BOLDDASHDOTDOT;break;
3219 0 : case 27:eUnderline = (FontUnderline)UNDERLINE_BOLDWAVE; break;
3220 0 : case 43:eUnderline = (FontUnderline)UNDERLINE_DOUBLEWAVE; break;
3221 : }
3222 : }
3223 :
3224 : // dann Stack ggfs. verwursteln und exit!
3225 182 : if( nLen < 0 )
3226 : {
3227 77 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_UNDERLINE );
3228 77 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_WORDLINEMODE );
3229 : }
3230 : else
3231 : {
3232 105 : NewAttr( SvxUnderlineItem( eUnderline, RES_CHRATR_UNDERLINE ));
3233 105 : if( bWordLine )
3234 0 : NewAttr(SvxWordLineModeItem(true, RES_CHRATR_WORDLINEMODE));
3235 : }
3236 182 : }
3237 :
3238 : /*
3239 : //The last three vary, measurements, rotation ? ?
3240 : NoBracket 78 CA 06 - 02 00 00 02 34 52
3241 : () 78 CA 06 - 02 01 00 02 34 52
3242 : [] 78 CA 06 - 02 02 00 02 34 52
3243 : <> 78 CA 06 - 02 03 00 02 34 52
3244 : {} 78 CA 06 - 02 04 00 02 34 52
3245 : */
3246 0 : void SwWW8ImplReader::Read_DoubleLine_Rotate( sal_uInt16, const sal_uInt8* pData,
3247 : short nLen )
3248 : {
3249 0 : if( nLen < 0 ) // close the tag
3250 : {
3251 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_TWO_LINES );
3252 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_ROTATE );
3253 : }
3254 0 : else if( pData && 6 == nLen )
3255 : {
3256 0 : switch( *pData )
3257 : {
3258 : case 2: // double line
3259 : {
3260 0 : sal_Unicode cStt = 0, cEnd = 0;
3261 0 : switch( SVBT16ToShort( pData+1 ) )
3262 : {
3263 0 : case 1: cStt = '(', cEnd = ')'; break;
3264 0 : case 2: cStt = '[', cEnd = ']'; break;
3265 0 : case 3: cStt = '<', cEnd = '>'; break;
3266 0 : case 4: cStt = '{', cEnd = '}'; break;
3267 : }
3268 0 : NewAttr( SvxTwoLinesItem( true, cStt, cEnd, RES_CHRATR_TWO_LINES ));
3269 : }
3270 0 : break;
3271 :
3272 : case 1: // rotated characters
3273 : {
3274 0 : bool bFitToLine = 0 != *(pData+1);
3275 0 : NewAttr( SvxCharRotateItem( 900, bFitToLine, RES_CHRATR_ROTATE ));
3276 : }
3277 0 : break;
3278 : }
3279 : }
3280 0 : }
3281 :
3282 2246 : void SwWW8ImplReader::Read_TxtColor( sal_uInt16, const sal_uInt8* pData, short nLen )
3283 : {
3284 : //Has newer colour variant, ignore this old variant
3285 2246 : if (!bVer67 && pPlcxMan && pPlcxMan->GetChpPLCF()->HasSprm(NS_sprm::LN_CCv))
3286 4384 : return;
3287 :
3288 108 : if( nLen < 0 )
3289 6 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_COLOR );
3290 : else
3291 : {
3292 102 : sal_uInt8 b = *pData; // Parameter: 0 = Auto, 1..16 Farben
3293 :
3294 102 : if( b > 16 ) // unbekannt -> Black
3295 0 : b = 0;
3296 :
3297 102 : NewAttr( SvxColorItem(Color(GetCol(b)), RES_CHRATR_COLOR));
3298 102 : if (pAktColl && pStyles)
3299 76 : pStyles->bTxtColChanged = true;
3300 : }
3301 : }
3302 :
3303 2177 : void SwWW8ImplReader::Read_TxtForeColor(sal_uInt16, const sal_uInt8* pData, short nLen)
3304 : {
3305 2177 : if( nLen < 0 )
3306 1045 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_COLOR );
3307 : else
3308 : {
3309 1132 : Color aColor(msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)));
3310 1132 : NewAttr(SvxColorItem(aColor, RES_CHRATR_COLOR));
3311 1132 : if (pAktColl && pStyles)
3312 36 : pStyles->bTxtColChanged = true;
3313 : }
3314 2177 : }
3315 :
3316 0 : void SwWW8ImplReader::Read_UnderlineColor(sal_uInt16, const sal_uInt8* pData, short nLen)
3317 : {
3318 0 : if( nLen < 0 )
3319 : {
3320 : //because the UnderlineColor is not a standalone attribute in SW, it belongs to the underline attribute.
3321 : //And, the .doc file stores attributes separately, this attribute ends here, the "underline"
3322 : //attribute also terminates (if the character next owns underline, that will be a new underline attribute).
3323 : //so nothing is left to be done here.
3324 0 : return;
3325 : }
3326 : else
3327 : {
3328 0 : if ( pAktColl ) //importing style
3329 : {
3330 0 : if( SFX_ITEM_SET == pAktColl->GetItemState( RES_CHRATR_UNDERLINE, sal_False ) )
3331 : {
3332 0 : const SwAttrSet& aSet = pAktColl->GetAttrSet();
3333 : SvxUnderlineItem *pUnderline
3334 0 : = (SvxUnderlineItem *)(aSet.Get( RES_CHRATR_UNDERLINE, false ).Clone());
3335 0 : if(pUnderline){
3336 0 : pUnderline->SetColor( Color( msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)) ) );
3337 0 : pAktColl->SetFmtAttr( *pUnderline );
3338 0 : delete pUnderline;
3339 : }
3340 : }
3341 : }
3342 0 : else if ( pAktItemSet )
3343 : {
3344 0 : if ( SFX_ITEM_SET == pAktItemSet->GetItemState( RES_CHRATR_UNDERLINE, false ) )
3345 : {
3346 : SvxUnderlineItem *pUnderline
3347 0 : = (SvxUnderlineItem *)(pAktItemSet->Get( RES_CHRATR_UNDERLINE, false ) .Clone());
3348 0 : if(pUnderline){
3349 0 : pUnderline->SetColor( Color( msfilter::util::BGRToRGB(SVBT32ToUInt32(pData)) ) );
3350 0 : pAktItemSet->Put( *pUnderline );
3351 0 : delete pUnderline;
3352 : }
3353 : }
3354 : }
3355 : else
3356 : {
3357 0 : SvxUnderlineItem* pUnderlineAttr = (SvxUnderlineItem*)pCtrlStck->GetOpenStackAttr( *pPaM->GetPoint(), RES_CHRATR_UNDERLINE );
3358 0 : if( pUnderlineAttr != NULL )
3359 0 : pUnderlineAttr->SetColor( Color( msfilter::util::BGRToRGB(SVBT32ToUInt32( pData ))));
3360 : }
3361 : }
3362 : }
3363 6344 : bool SwWW8ImplReader::GetFontParams( sal_uInt16 nFCode, FontFamily& reFamily,
3364 : OUString& rName, FontPitch& rePitch, rtl_TextEncoding& reCharSet )
3365 : {
3366 : // Die Defines, aus denen diese Tabellen erzeugt werden, stehen in windows.h
3367 : static const FontPitch ePitchA[] =
3368 : {
3369 : PITCH_DONTKNOW, PITCH_FIXED, PITCH_VARIABLE, PITCH_DONTKNOW
3370 : };
3371 :
3372 : static const FontFamily eFamilyA[] =
3373 : {
3374 : FAMILY_DONTKNOW, FAMILY_ROMAN, FAMILY_SWISS, FAMILY_MODERN,
3375 : FAMILY_SCRIPT, FAMILY_DECORATIVE, FAMILY_DONTKNOW, FAMILY_DONTKNOW
3376 : };
3377 :
3378 6344 : const WW8_FFN* pF = pFonts->GetFont( nFCode ); // Info dazu
3379 6344 : if( !pF ) // FontNummer unbekannt ?
3380 165 : return false; // dann ignorieren
3381 :
3382 6179 : rName = pF->sFontname;
3383 :
3384 : // pF->prg : Pitch
3385 6179 : rePitch = ePitchA[pF->prg];
3386 :
3387 : // pF->chs: Charset
3388 6179 : if( 77 == pF->chs ) // Mac-Font im Mac-Charset oder
3389 0 : reCharSet = eTextCharSet; // auf ANSI-Charset uebersetzt
3390 : else
3391 : { // patch from cmc for #i52786#
3392 : // #i52786#, for word 67 we'll assume that ANSI is basically invalid,
3393 : // might be true for (above) mac as well, but would need a mac example
3394 : // that exercises this to be sure
3395 6179 : if (bVer67 && pF->chs == 0)
3396 0 : reCharSet = RTL_TEXTENCODING_DONTKNOW;
3397 : else
3398 6179 : reCharSet = rtl_getTextEncodingFromWindowsCharset( pF->chs );
3399 : }
3400 :
3401 : // Make sure charset is not set in case of Symbol, otherwise in case a
3402 : // character is missing in our OpenSymbol, the character won't be replaced.
3403 6179 : if (reCharSet == RTL_TEXTENCODING_SYMBOL && rName == "Symbol")
3404 298 : reCharSet = RTL_TEXTENCODING_DONTKNOW;
3405 :
3406 : // make sure Font Family Code is set correctly
3407 : // at least for the most important fonts
3408 : // ( might be set wrong when Doc was not created by
3409 : // Winword but by third party program like Applixware... )
3410 18537 : if (rName.startsWithIgnoreAsciiCase("Tms Rmn") ||
3411 12358 : rName.startsWithIgnoreAsciiCase("Timmons") ||
3412 12356 : rName.startsWithIgnoreAsciiCase("CG Times") ||
3413 12354 : rName.startsWithIgnoreAsciiCase("MS Serif") ||
3414 12354 : rName.startsWithIgnoreAsciiCase("Garamond") ||
3415 18533 : rName.startsWithIgnoreAsciiCase("Times Roman") ||
3416 6177 : rName.startsWithIgnoreAsciiCase("Times New Roman"))
3417 : {
3418 354 : reFamily = FAMILY_ROMAN;
3419 : }
3420 17475 : else if (rName.startsWithIgnoreAsciiCase("Helv") ||
3421 8776 : rName.startsWithIgnoreAsciiCase("Arial") ||
3422 5902 : rName.startsWithIgnoreAsciiCase("Univers") ||
3423 5902 : rName.startsWithIgnoreAsciiCase("LinePrinter") ||
3424 5896 : rName.startsWithIgnoreAsciiCase("Lucida Sans") ||
3425 11715 : rName.startsWithIgnoreAsciiCase("Small Fonts") ||
3426 2945 : rName.startsWithIgnoreAsciiCase("MS Sans Serif"))
3427 : {
3428 2880 : reFamily = FAMILY_SWISS;
3429 : }
3430 : else
3431 : {
3432 2945 : reFamily = eFamilyA[pF->ff];
3433 : }
3434 :
3435 6179 : return true;
3436 : }
3437 :
3438 6344 : bool SwWW8ImplReader::SetNewFontAttr(sal_uInt16 nFCode, bool bSetEnums,
3439 : sal_uInt16 nWhich)
3440 : {
3441 : FontFamily eFamily;
3442 6344 : OUString aName;
3443 : FontPitch ePitch;
3444 : rtl_TextEncoding eSrcCharSet;
3445 :
3446 6344 : if( !GetFontParams( nFCode, eFamily, aName, ePitch, eSrcCharSet ) )
3447 : {
3448 : //If we fail (and are not doing a style) then put something into the
3449 : //character encodings stack anyway so that the property end that pops
3450 : //off the stack will keep in sync
3451 165 : if (!pAktColl && IsListOrDropcap())
3452 : {
3453 118 : if (nWhich == RES_CHRATR_CJK_FONT)
3454 : {
3455 0 : if (!maFontSrcCJKCharSets.empty())
3456 : {
3457 0 : eSrcCharSet = maFontSrcCJKCharSets.top();
3458 : }
3459 : else
3460 : {
3461 0 : eSrcCharSet = RTL_TEXTENCODING_DONTKNOW;
3462 : }
3463 :
3464 0 : maFontSrcCJKCharSets.push(eSrcCharSet);
3465 : }
3466 : else
3467 : {
3468 118 : if (!maFontSrcCharSets.empty())
3469 : {
3470 59 : eSrcCharSet = maFontSrcCharSets.top();
3471 : }
3472 : else
3473 : {
3474 59 : eSrcCharSet = RTL_TEXTENCODING_DONTKNOW;
3475 : }
3476 :
3477 118 : maFontSrcCharSets.push(eSrcCharSet);
3478 : }
3479 : }
3480 165 : return false;
3481 : }
3482 :
3483 6179 : rtl_TextEncoding eDstCharSet = eSrcCharSet;
3484 :
3485 12358 : SvxFontItem aFont( eFamily, aName, OUString(), ePitch, eDstCharSet, nWhich);
3486 :
3487 6179 : if( bSetEnums )
3488 : {
3489 6179 : if( pAktColl && nAktColl < vColl.size() ) // StyleDef
3490 : {
3491 1077 : switch(nWhich)
3492 : {
3493 : default:
3494 : case RES_CHRATR_FONT:
3495 325 : vColl[nAktColl].eLTRFontSrcCharSet = eSrcCharSet;
3496 325 : break;
3497 : case RES_CHRATR_CTL_FONT:
3498 616 : vColl[nAktColl].eRTLFontSrcCharSet = eSrcCharSet;
3499 616 : break;
3500 : case RES_CHRATR_CJK_FONT:
3501 136 : vColl[nAktColl].eCJKFontSrcCharSet = eSrcCharSet;
3502 136 : break;
3503 : }
3504 : }
3505 5102 : else if (IsListOrDropcap())
3506 : {
3507 : //Add character text encoding to stack
3508 4389 : if (nWhich == RES_CHRATR_CJK_FONT)
3509 59 : maFontSrcCJKCharSets.push(eSrcCharSet);
3510 : else
3511 4330 : maFontSrcCharSets.push(eSrcCharSet);
3512 : }
3513 : }
3514 :
3515 6179 : NewAttr( aFont ); // ...und 'reinsetzen
3516 :
3517 12523 : return true;
3518 : }
3519 :
3520 4273 : void SwWW8ImplReader::ResetCharSetVars()
3521 : {
3522 : OSL_ENSURE(!maFontSrcCharSets.empty(),"no charset to remove");
3523 4273 : if (!maFontSrcCharSets.empty())
3524 4273 : maFontSrcCharSets.pop();
3525 4273 : }
3526 :
3527 50 : void SwWW8ImplReader::ResetCJKCharSetVars()
3528 : {
3529 : OSL_ENSURE(!maFontSrcCJKCharSets.empty(),"no charset to remove");
3530 50 : if (!maFontSrcCJKCharSets.empty())
3531 50 : maFontSrcCJKCharSets.pop();
3532 50 : }
3533 :
3534 6170 : void SwWW8ImplReader::openFont(sal_uInt16 nFCode, sal_uInt16 nId)
3535 : {
3536 6170 : if (SetNewFontAttr(nFCode, true, nId) && pAktColl && pStyles)
3537 : {
3538 : // merken zur Simulation Default-Font
3539 927 : if (RES_CHRATR_CJK_FONT == nId)
3540 80 : pStyles->bCJKFontChanged = true;
3541 847 : else if (RES_CHRATR_CTL_FONT == nId)
3542 569 : pStyles->bCTLFontChanged = true;
3543 : else
3544 278 : pStyles->bFontChanged = true;
3545 : }
3546 6170 : }
3547 :
3548 4323 : void SwWW8ImplReader::closeFont(sal_uInt16 nId)
3549 : {
3550 4323 : pCtrlStck->SetAttr( *pPaM->GetPoint(), nId );
3551 4323 : if (nId == RES_CHRATR_CJK_FONT)
3552 50 : ResetCJKCharSetVars();
3553 : else
3554 4273 : ResetCharSetVars();
3555 4323 : }
3556 :
3557 : /*
3558 : Font ein oder ausschalten:
3559 : */
3560 10664 : void SwWW8ImplReader::Read_FontCode( sal_uInt16 nId, const sal_uInt8* pData, short nLen )
3561 : {
3562 10664 : if (!bSymbol) // falls bSymbol, gilt der am Symbol
3563 : { // (siehe sprmCSymbol) gesetzte Font !
3564 10664 : switch( nId )
3565 : {
3566 : case 113: //WW7
3567 : case 0x4A51: //"Other" font, override with BiDi if it exists
3568 : case 0x4A5E: //BiDi Font
3569 7493 : nId = RES_CHRATR_CTL_FONT;
3570 7493 : break;
3571 : case 93: //WW6
3572 : case 111: //WW7
3573 : case 0x4A4f:
3574 2808 : nId = RES_CHRATR_FONT;
3575 2808 : break;
3576 : case 112: //WW7
3577 : case 0x4A50:
3578 192 : nId = RES_CHRATR_CJK_FONT;
3579 192 : break;
3580 : default:
3581 10835 : return ;
3582 : }
3583 :
3584 10493 : ww::WordVersion eVersion = pWwFib->GetFIBVersion();
3585 :
3586 10493 : if( nLen < 0 ) // Ende des Attributes
3587 : {
3588 4323 : if (eVersion <= ww::eWW6)
3589 : {
3590 0 : closeFont(RES_CHRATR_CTL_FONT);
3591 0 : closeFont(RES_CHRATR_CJK_FONT);
3592 : }
3593 4323 : closeFont(nId);
3594 : }
3595 : else
3596 : {
3597 6170 : sal_uInt16 nFCode = SVBT16ToShort( pData ); // Font-Nummer
3598 6170 : openFont(nFCode, nId);
3599 6170 : if (eVersion <= ww::eWW6)
3600 : {
3601 0 : openFont(nFCode, RES_CHRATR_CJK_FONT);
3602 0 : openFont(nFCode, RES_CHRATR_CTL_FONT);
3603 : }
3604 : }
3605 : }
3606 : }
3607 :
3608 5941 : void SwWW8ImplReader::Read_FontSize( sal_uInt16 nId, const sal_uInt8* pData, short nLen )
3609 : {
3610 5941 : switch( nId )
3611 : {
3612 : case 74:
3613 : case 99:
3614 : case 0x4a43:
3615 3972 : nId = RES_CHRATR_FONTSIZE;
3616 3972 : break;
3617 : case 85: //WW2
3618 : case 116: //WW7
3619 : case 0x4a61:
3620 1969 : nId = RES_CHRATR_CTL_FONTSIZE;
3621 1969 : break;
3622 : default:
3623 5941 : return ;
3624 : }
3625 :
3626 5941 : ww::WordVersion eVersion = pWwFib->GetFIBVersion();
3627 :
3628 5941 : if( nLen < 0 ) // Ende des Attributes
3629 : {
3630 2614 : pCtrlStck->SetAttr( *pPaM->GetPoint(), nId );
3631 2614 : if (eVersion <= ww::eWW6) // reset additionally the CTL size
3632 85 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_CTL_FONTSIZE );
3633 2614 : if (RES_CHRATR_FONTSIZE == nId) // reset additionally the CJK size
3634 1772 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_CJK_FONTSIZE );
3635 : }
3636 : else
3637 : {
3638 : // Font-Size in half points e.g. 10 = 1440 / ( 72 * 2 )
3639 3327 : sal_uInt16 nFSize = eVersion <= ww::eWW2 ? *pData : SVBT16ToShort(pData);
3640 3327 : nFSize*= 10;
3641 :
3642 3327 : SvxFontHeightItem aSz( nFSize, 100, nId );
3643 3327 : NewAttr( aSz );
3644 3327 : if (RES_CHRATR_FONTSIZE == nId) // set additionally the CJK size
3645 : {
3646 2200 : aSz.SetWhich( RES_CHRATR_CJK_FONTSIZE );
3647 2200 : NewAttr( aSz );
3648 : }
3649 3327 : if (eVersion <= ww::eWW6) // set additionally the CTL size
3650 : {
3651 86 : aSz.SetWhich( RES_CHRATR_CTL_FONTSIZE );
3652 86 : NewAttr( aSz );
3653 : }
3654 3327 : if (pAktColl && pStyles) // Style-Def ?
3655 : {
3656 : // merken zur Simulation Default-FontSize
3657 581 : if (nId == RES_CHRATR_CTL_FONTSIZE)
3658 241 : pStyles->bFCTLSizeChanged = true;
3659 : else
3660 : {
3661 340 : pStyles->bFSizeChanged = true;
3662 340 : if (eVersion <= ww::eWW6)
3663 1 : pStyles->bFCTLSizeChanged= true;
3664 : }
3665 3327 : }
3666 : }
3667 : }
3668 :
3669 0 : void SwWW8ImplReader::Read_CharSet(sal_uInt16 , const sal_uInt8* pData, short nLen)
3670 : {
3671 0 : if( nLen < 0 )
3672 : { // Ende des Attributes
3673 0 : eHardCharSet = RTL_TEXTENCODING_DONTKNOW;
3674 0 : return;
3675 : }
3676 0 : sal_uInt8 nfChsDiff = *pData;
3677 :
3678 0 : if( nfChsDiff )
3679 0 : eHardCharSet = rtl_getTextEncodingFromWindowsCharset( *(pData + 1) );
3680 : else
3681 0 : eHardCharSet = RTL_TEXTENCODING_DONTKNOW;
3682 : }
3683 :
3684 4378 : void SwWW8ImplReader::Read_Language( sal_uInt16 nId, const sal_uInt8* pData, short nLen )
3685 : {
3686 4378 : switch( nId )
3687 : {
3688 : case 97:
3689 : case 0x486D: //sprmCRgLid0_80
3690 : case 0x4873: //Methinks, uncertain
3691 1596 : nId = RES_CHRATR_LANGUAGE;
3692 1596 : break;
3693 : case 0x486E: //sprmCRgLid1_80
3694 : case 0x4874: //Methinks, uncertain
3695 229 : nId = RES_CHRATR_CJK_LANGUAGE;
3696 229 : break;
3697 : case 83:
3698 : case 114:
3699 : case 0x485F:
3700 2552 : nId = RES_CHRATR_CTL_LANGUAGE;
3701 2552 : break;
3702 : default:
3703 4379 : return;
3704 : }
3705 :
3706 4377 : if( nLen < 0 ) // Ende des Attributes
3707 1998 : pCtrlStck->SetAttr( *pPaM->GetPoint(), nId );
3708 : else
3709 : {
3710 2379 : sal_uInt16 nLang = SVBT16ToShort( pData ); // Language-Id
3711 2379 : NewAttr(SvxLanguageItem((const LanguageType)nLang, nId));
3712 : }
3713 : }
3714 :
3715 : /*
3716 : Einschalten des Zeichen-Styles:
3717 : */
3718 62 : void SwWW8ImplReader::Read_CColl( sal_uInt16, const sal_uInt8* pData, short nLen )
3719 : {
3720 62 : if( nLen < 0 ){ // Ende des Attributes
3721 31 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_TXTATR_CHARFMT );
3722 31 : nCharFmt = -1;
3723 31 : return;
3724 : }
3725 31 : sal_uInt16 nId = SVBT16ToShort( pData ); // Style-Id (NICHT Sprm-Id!)
3726 :
3727 93 : if( nId >= vColl.size() || !vColl[nId].pFmt // ungueltige Id ?
3728 62 : || vColl[nId].bColl ) // oder Para-Style ?
3729 0 : return; // dann ignorieren
3730 :
3731 : // if current on loading a TOC field, and current trying to apply a hyperlink character style,
3732 : // just ignore. For the hyperlinks inside TOC in MS Word is not same with a common hyperlink
3733 : // Character styles: without underline and blue font color. And such type style will be applied in others
3734 : // processes.
3735 31 : if (mbLoadingTOCCache && vColl[nId].GetWWStyleId() == ww::stiHyperlink)
3736 : {
3737 0 : return;
3738 : }
3739 :
3740 31 : NewAttr( SwFmtCharFmt( (SwCharFmt*)vColl[nId].pFmt ) );
3741 31 : nCharFmt = (short) nId;
3742 : }
3743 :
3744 : /*
3745 : enger oder weiter als normal:
3746 : */
3747 29 : void SwWW8ImplReader::Read_Kern( sal_uInt16, const sal_uInt8* pData, short nLen )
3748 : {
3749 29 : if( nLen < 0 ){ // Ende des Attributes
3750 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_KERNING );
3751 29 : return;
3752 : }
3753 29 : sal_Int16 nKern = SVBT16ToShort( pData ); // Kerning in Twips
3754 29 : NewAttr( SvxKerningItem( nKern, RES_CHRATR_KERNING ) );
3755 : }
3756 :
3757 43 : void SwWW8ImplReader::Read_FontKern( sal_uInt16, const sal_uInt8* , short nLen )
3758 : {
3759 43 : if( nLen < 0 ) // Ende des Attributes
3760 4 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_AUTOKERN );
3761 : else
3762 39 : NewAttr(SvxAutoKernItem(true, RES_CHRATR_AUTOKERN));
3763 43 : }
3764 :
3765 28 : void SwWW8ImplReader::Read_CharShadow( sal_uInt16, const sal_uInt8* pData, short nLen )
3766 : {
3767 : //Has newer colour variant, ignore this old variant
3768 28 : if (!bVer67 && pPlcxMan && pPlcxMan->GetChpPLCF()->HasSprm(0xCA71))
3769 56 : return;
3770 :
3771 0 : if( nLen <= 0 )
3772 : {
3773 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_BACKGROUND );
3774 0 : if( bCharShdTxtCol )
3775 : {
3776 : // Zeichenfarbe auch
3777 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_COLOR );
3778 0 : bCharShdTxtCol = false;
3779 : }
3780 : }
3781 : else
3782 : {
3783 0 : WW8_SHD aSHD;
3784 0 : aSHD.SetWWValue( *(SVBT16*)pData );
3785 0 : SwWW8Shade aSh( bVer67, aSHD );
3786 :
3787 0 : NewAttr( SvxBrushItem( aSh.aColor, RES_CHRATR_BACKGROUND ));
3788 : }
3789 : }
3790 :
3791 28 : void SwWW8ImplReader::Read_TxtBackColor(sal_uInt16, const sal_uInt8* pData, short nLen )
3792 : {
3793 28 : if( nLen <= 0 )
3794 : {
3795 14 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_BACKGROUND );
3796 14 : if( bCharShdTxtCol )
3797 : {
3798 : // Zeichenfarbe auch
3799 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_COLOR );
3800 0 : bCharShdTxtCol = false;
3801 : }
3802 : }
3803 : else
3804 : {
3805 : OSL_ENSURE(nLen == 10, "Len of para back colour not 10!");
3806 14 : if (nLen != 10)
3807 28 : return;
3808 14 : Color aColour(ExtractColour(pData, bVer67));
3809 14 : NewAttr(SvxBrushItem(aColour, RES_CHRATR_BACKGROUND));
3810 : }
3811 : }
3812 :
3813 314 : void SwWW8ImplReader::Read_CharHighlight(sal_uInt16, const sal_uInt8* pData, short nLen)
3814 : {
3815 314 : if( nLen <= 0 )
3816 : {
3817 157 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_BACKGROUND );
3818 157 : if( bCharShdTxtCol )
3819 : {
3820 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_COLOR ); // Zeichenfarbe auch
3821 0 : bCharShdTxtCol = false;
3822 : }
3823 : }
3824 : else
3825 : {
3826 157 : sal_uInt8 b = *pData; // Parameter: 0 = Auto, 1..16 Farben
3827 :
3828 157 : if( b > 16 ) // unbekannt -> Black
3829 0 : b = 0; // Auto -> Black
3830 :
3831 157 : Color aCol(GetCol(b));
3832 157 : NewAttr( SvxBrushItem( aCol , RES_CHRATR_BACKGROUND ));
3833 : }
3834 314 : }
3835 :
3836 : /***************************************************************************
3837 : # Absatz - Attribute
3838 : #**************************************************************************/
3839 :
3840 66 : void SwWW8ImplReader::Read_NoLineNumb(sal_uInt16 , const sal_uInt8* pData, short nLen)
3841 : {
3842 66 : if( nLen < 0 ) // Ende des Attributes
3843 : {
3844 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_LINENUMBER );
3845 66 : return;
3846 : }
3847 66 : SwFmtLineNumber aLN;
3848 66 : if (const SwFmtLineNumber* pLN
3849 66 : = (const SwFmtLineNumber*)GetFmtAttr(RES_LINENUMBER))
3850 : {
3851 66 : aLN.SetStartValue( pLN->GetStartValue() );
3852 : }
3853 :
3854 66 : aLN.SetCountLines( pData && (0 == *pData) );
3855 66 : NewAttr( aLN );
3856 : }
3857 :
3858 39 : bool lcl_HasExplicitLeft(const WW8PLCFMan *pPlcxMan, bool bVer67)
3859 : {
3860 39 : WW8PLCFx_Cp_FKP *pPap = pPlcxMan ? pPlcxMan->GetPapPLCF() : 0;
3861 39 : if (pPap)
3862 : {
3863 39 : if (bVer67)
3864 0 : return pPap->HasSprm(17);
3865 : else
3866 39 : return (pPap->HasSprm(0x840F) || pPap->HasSprm(0x845E));
3867 : }
3868 0 : return false;
3869 : }
3870 : // Sprm 16, 17
3871 3289 : void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLen )
3872 : {
3873 3289 : if (nLen < 0) // End of the Attributes
3874 : {
3875 1548 : pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_LR_SPACE);
3876 3096 : return;
3877 : }
3878 :
3879 1741 : short nPara = SVBT16ToShort( pData );
3880 :
3881 1741 : SvxLRSpaceItem aLR( RES_LR_SPACE );
3882 1741 : const SfxPoolItem* pLR = GetFmtAttr(RES_LR_SPACE);
3883 1741 : if( pLR )
3884 1741 : aLR = *static_cast<const SvxLRSpaceItem*>(pLR);
3885 :
3886 : // Fix the regression issue: #i99822#: Discussion?
3887 : // Since the list level formatting doesn't apply into paragraph style
3888 : // for list levels of mode LABEL_ALIGNMENT.(see ww8par3.cxx
3889 : // W8ImplReader::RegisterNumFmtOnTxtNode).
3890 : // Need to apply the list format to the paragraph here.
3891 1741 : SwTxtNode* pTxtNode = pPaM->GetNode()->GetTxtNode();
3892 1741 : if( pTxtNode && pTxtNode->AreListLevelIndentsApplicable() )
3893 : {
3894 92 : SwNumRule * pNumRule = pTxtNode->GetNumRule();
3895 92 : if( pNumRule )
3896 : {
3897 92 : sal_uInt8 nLvl = static_cast< sal_uInt8 >(pTxtNode->GetActualListLevel());
3898 92 : const SwNumFmt* pFmt = pNumRule->GetNumFmt( nLvl );
3899 92 : if ( pFmt && pFmt->GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
3900 : {
3901 92 : aLR.SetTxtLeft( pFmt->GetIndentAt() );
3902 92 : aLR.SetTxtFirstLineOfst( static_cast<short>(pFmt->GetFirstLineIndent()) );
3903 : // make paragraph have hard-set indent attributes
3904 92 : pTxtNode->SetAttr( aLR );
3905 : }
3906 : }
3907 : }
3908 :
3909 : /*
3910 : The older word sprms mean left/right, while the new ones mean before/after.
3911 : Writer now also works with before after, so when we see old left/right and
3912 : we're RTL. We swap them
3913 : */
3914 1741 : if (IsRightToLeft())
3915 : {
3916 710 : switch (nId)
3917 : {
3918 : //Left becomes after;
3919 : case 17:
3920 0 : nId = 16;
3921 0 : break;
3922 : case 0x840F:
3923 342 : nId = 0x840E;
3924 342 : break;
3925 : //Right becomes before;
3926 : case 16:
3927 0 : nId = 17;
3928 0 : break;
3929 : case 0x840E:
3930 342 : nId = 0x840F;
3931 342 : break;
3932 : }
3933 : }
3934 :
3935 1741 : bool bFirstLinOfstSet( false ); // #i103711#
3936 1741 : bool bLeftIndentSet( false ); // #i105414#
3937 :
3938 1741 : switch (nId)
3939 : {
3940 : //sprmPDxaLeft
3941 : case 17:
3942 : case 0x840F:
3943 : case 0x845E:
3944 916 : aLR.SetTxtLeft( nPara );
3945 916 : if (pAktColl && nAktColl < vColl.size())
3946 : {
3947 121 : vColl[nAktColl].bListReleventIndentSet = true;
3948 : }
3949 916 : bLeftIndentSet = true; // #i105414#
3950 916 : break;
3951 : //sprmPDxaLeft1
3952 : case 19:
3953 : case 0x8411:
3954 : case 0x8460:
3955 : /*
3956 : As part of an attempt to break my spirit ww 8+ formats can contain
3957 : ww 7- lists. If they do and the list is part of the style, then
3958 : when removing the list from a paragraph of that style there
3959 : appears to be a bug where the hanging indent value which the list
3960 : set is still factored into the left indent of the paragraph. Its
3961 : not listed in the winword dialogs, but it is clearly there. So if
3962 : our style has a broken ww 7- list and we know that the list has
3963 : been removed then we will factor the original list applied hanging
3964 : into our calculation.
3965 : */
3966 302 : if (pPlcxMan && nAktColl < vColl.size() && vColl[nAktColl].bHasBrokenWW6List)
3967 : {
3968 0 : const sal_uInt8 *pIsZeroed = pPlcxMan->GetPapPLCF()->HasSprm(0x460B);
3969 0 : if (pIsZeroed && *pIsZeroed == 0)
3970 : {
3971 : const SvxLRSpaceItem &rLR =
3972 0 : ItemGet<SvxLRSpaceItem>(*(vColl[nAktColl].pFmt),
3973 0 : RES_LR_SPACE);
3974 0 : nPara = nPara - rLR.GetTxtFirstLineOfst();
3975 : }
3976 : }
3977 :
3978 302 : aLR.SetTxtFirstLineOfst(nPara);
3979 :
3980 302 : if (!pAktColl)
3981 : {
3982 267 : if (const SwTxtNode* pNode = pPaM->GetNode()->GetTxtNode())
3983 : {
3984 267 : if ( const SwNumFmt *pNumFmt = GetNumFmtFromTxtNode(*pNode) )
3985 : {
3986 39 : if (!lcl_HasExplicitLeft(pPlcxMan, bVer67))
3987 : {
3988 0 : aLR.SetTxtLeft(pNumFmt->GetIndentAt());
3989 :
3990 : // If have not explicit left, set number format list tab position is doc default tab
3991 0 : const SvxTabStopItem *pDefaultStopItem = (const SvxTabStopItem *)rDoc.GetAttrPool().GetPoolDefaultItem(RES_PARATR_TABSTOP);
3992 0 : if ( pDefaultStopItem && pDefaultStopItem->Count() > 0 )
3993 0 : ((SwNumFmt*)(pNumFmt))->SetListtabPos( ((SvxTabStop&)(*pDefaultStopItem)[0]).GetTabPos() );
3994 : }
3995 : }
3996 : }
3997 : }
3998 302 : if (pAktColl && nAktColl < vColl.size())
3999 : {
4000 35 : vColl[nAktColl].bListReleventIndentSet = true;
4001 : }
4002 302 : bFirstLinOfstSet = true; // #i103711#
4003 302 : break;
4004 : //sprmPDxaRight
4005 : case 16:
4006 : case 0x840E:
4007 : case 0x845D:
4008 523 : aLR.SetRight( nPara );
4009 523 : break;
4010 : default:
4011 0 : return;
4012 : }
4013 :
4014 1741 : NewAttr( aLR, bFirstLinOfstSet, bLeftIndentSet ); // #i103711#, #i105414#
4015 : }
4016 :
4017 : // Sprm 20
4018 357 : void SwWW8ImplReader::Read_LineSpace( sal_uInt16, const sal_uInt8* pData, short nLen )
4019 : {
4020 : // Kommentear siehe Read_UL()
4021 357 : if (bStyNormal && bWWBugNormal)
4022 118 : return;
4023 :
4024 357 : if( nLen < 0 ){
4025 118 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_LINESPACING );
4026 118 : if( !( nIniFlags & WW8FL_NO_IMPLPASP ) )
4027 118 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_UL_SPACE );
4028 118 : return;
4029 : }
4030 :
4031 239 : short nSpace = SVBT16ToShort( pData );
4032 239 : ww::WordVersion eVersion = pWwFib->GetFIBVersion();
4033 239 : short nMulti = (eVersion <= ww::eWW2) ? 1 : SVBT16ToShort( pData + 2 );
4034 :
4035 : SvxLineSpace eLnSpc;
4036 239 : if( 0 > nSpace )
4037 : {
4038 13 : nSpace = -nSpace;
4039 13 : eLnSpc = SVX_LINE_SPACE_FIX;
4040 : }
4041 : else
4042 226 : eLnSpc = SVX_LINE_SPACE_MIN;
4043 :
4044 : // WW hat einen impliziten zusaetzlichen Absatzabstand abhaengig vom
4045 : // Zeilenabstand. Er betraegt bei "genau", 0.8*Zeilenabstand "vor" und
4046 : // 0.2*Zeilenabstand "nach".
4047 : // Bei "Mindestens" sind es 1*Zeilenabstand "vor" und 0*Zeilenabstand "nach".
4048 : // Bei Mehrfach sind es 0 "vor" und min( 0cm, FontSize*(nFach-1) ) "nach".
4049 :
4050 : // SW hat auch einen impliziten Zeilenabstand. er betraegt bei "mindestens"
4051 : // 1*Zeilenabstand "vor" und 0 "nach"
4052 : // bei proportional betraegt er min( 0cm, FontSize*(nFach-1) ) sowohl "vor"
4053 : // wie auch "nach"
4054 :
4055 239 : sal_uInt16 nSpaceTw = 0;
4056 :
4057 239 : SvxLineSpacingItem aLSpc( LINE_SPACE_DEFAULT_HEIGHT, RES_PARATR_LINESPACING );
4058 :
4059 239 : if( 1 == nMulti ) // MultilineSpace ( proportional )
4060 : {
4061 207 : long n = nSpace * 10 / 24; // WW: 240 = 100%, SW: 100 = 100%
4062 :
4063 : // nach Absprache mit AMA ist die Begrenzung unsinnig
4064 207 : if( n>200 ) n = 200; // SW_UI-Maximum
4065 207 : aLSpc.SetPropLineSpace( (const sal_uInt8)n );
4066 : const SvxFontHeightItem* pH = (const SvxFontHeightItem*)
4067 207 : GetFmtAttr( RES_CHRATR_FONTSIZE );
4068 207 : nSpaceTw = (sal_uInt16)( n * pH->GetHeight() / 100 );
4069 : }
4070 : else // Fixed / Minimum
4071 : {
4072 : // bei negativen Space ist der Abstand exakt, sonst minimum
4073 32 : nSpaceTw = (sal_uInt16)nSpace;
4074 32 : aLSpc.SetLineHeight( nSpaceTw );
4075 32 : aLSpc.GetLineSpaceRule() = eLnSpc;
4076 : }
4077 239 : NewAttr( aLSpc );
4078 239 : if( pSFlyPara )
4079 53 : pSFlyPara->nLineSpace = nSpaceTw; // LineSpace fuer Graf-Apos
4080 : }
4081 :
4082 : //#i18519# AutoSpace value depends on Dop fDontUseHTMLAutoSpacing setting
4083 38 : sal_uInt16 SwWW8ImplReader::GetParagraphAutoSpace(bool fDontUseHTMLAutoSpacing)
4084 : {
4085 38 : if (fDontUseHTMLAutoSpacing)
4086 30 : return 100; //Seems to be always 5points in this case
4087 : else
4088 8 : return 280; //Seems to be always 14points in this case
4089 : }
4090 :
4091 19 : void SwWW8ImplReader::Read_ParaAutoBefore(sal_uInt16, const sal_uInt8 *pData, short nLen)
4092 : {
4093 19 : if (nLen < 0)
4094 : {
4095 0 : pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_UL_SPACE);
4096 19 : return;
4097 : }
4098 :
4099 19 : if (*pData)
4100 : {
4101 19 : SvxULSpaceItem aUL(*(const SvxULSpaceItem*)GetFmtAttr(RES_UL_SPACE));
4102 19 : aUL.SetUpper(GetParagraphAutoSpace(pWDop->fDontUseHTMLAutoSpacing));
4103 19 : NewAttr(aUL);
4104 19 : if (pAktColl && nAktColl < vColl.size())
4105 19 : vColl[nAktColl].bParaAutoBefore = true;
4106 : else
4107 0 : bParaAutoBefore = true;
4108 : }
4109 : else
4110 : {
4111 0 : if (pAktColl && nAktColl < vColl.size())
4112 0 : vColl[nAktColl].bParaAutoBefore = false;
4113 : else
4114 0 : bParaAutoBefore = false;
4115 : }
4116 : }
4117 :
4118 19 : void SwWW8ImplReader::Read_ParaAutoAfter(sal_uInt16, const sal_uInt8 *pData, short nLen)
4119 : {
4120 19 : if (nLen < 0)
4121 : {
4122 0 : pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_UL_SPACE);
4123 19 : return;
4124 : }
4125 :
4126 19 : if (*pData)
4127 : {
4128 19 : SvxULSpaceItem aUL(*(const SvxULSpaceItem*)GetFmtAttr(RES_UL_SPACE));
4129 19 : aUL.SetLower(GetParagraphAutoSpace(pWDop->fDontUseHTMLAutoSpacing));
4130 19 : NewAttr(aUL);
4131 19 : if (pAktColl && nAktColl < vColl.size())
4132 19 : vColl[nAktColl].bParaAutoAfter = true;
4133 : else
4134 0 : bParaAutoAfter = true;
4135 : }
4136 : else
4137 : {
4138 0 : if (pAktColl && nAktColl < vColl.size())
4139 0 : vColl[nAktColl].bParaAutoAfter = false;
4140 : else
4141 0 : bParaAutoAfter = false;
4142 : }
4143 : }
4144 :
4145 : // Sprm 21, 22
4146 1361 : void SwWW8ImplReader::Read_UL( sal_uInt16 nId, const sal_uInt8* pData, short nLen )
4147 : {
4148 : // Nun eine Umpopelung eines WW-Fehlers: Bei nProduct == 0c03d wird
4149 : // faelschlicherweise ein DyaAfter 240 ( delta y abstand after, amn.d.?b.)
4150 : // im Style "Normal" eingefuegt, der
4151 : // gar nicht da ist. Ueber das IniFlag WW8FL_NO_STY_DYA laesst sich dieses
4152 : // Verhalten auch fuer andere WW-Versionen erzwingen
4153 : // OSL_ENSURE( !bStyNormal || bWWBugNormal, "+Dieses Doc deutet evtl. auf einen
4154 : // Fehler in der benutzten WW-Version hin. Wenn sich die Styles <Standard> bzw.
4155 : // <Normal> zwischen WW und SW im Absatz- oder Zeilenabstand unterscheiden,
4156 : // dann bitte dieses Doc SH zukommen lassen." );
4157 : // bWWBugNormal ist kein hinreichendes Kriterium dafuer, dass der
4158 : // angegebene Abstand falsch ist
4159 :
4160 1361 : if( nLen < 0 )
4161 : {
4162 : // Ende des Attributes
4163 482 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_UL_SPACE );
4164 964 : return;
4165 : }
4166 879 : short nPara = SVBT16ToShort( pData );
4167 879 : if( nPara < 0 )
4168 0 : nPara = -nPara;
4169 :
4170 879 : SvxULSpaceItem aUL( *(const SvxULSpaceItem*)GetFmtAttr( RES_UL_SPACE ));
4171 :
4172 879 : switch( nId )
4173 : {
4174 : //sprmPDyaBefore
4175 : case 21:
4176 : case 0xA413:
4177 381 : aUL.SetUpper( nPara );
4178 381 : break;
4179 : //sprmPDyaAfter
4180 : case 22:
4181 : case 0xA414:
4182 498 : aUL.SetLower( nPara );
4183 498 : break;
4184 : default:
4185 0 : return;
4186 : };
4187 :
4188 879 : NewAttr( aUL );
4189 : }
4190 :
4191 1 : void SwWW8ImplReader::Read_ParaContextualSpacing( sal_uInt16, const sal_uInt8* pData, short nLen )
4192 : {
4193 1 : if( nLen < 0 )
4194 : {
4195 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_UL_SPACE );
4196 1 : return;
4197 : }
4198 1 : SvxULSpaceItem aUL( *(const SvxULSpaceItem*)GetFmtAttr( RES_UL_SPACE ));
4199 1 : aUL.SetContextValue(*pData);
4200 1 : NewAttr( aUL );
4201 : }
4202 :
4203 3473 : void SwWW8ImplReader::Read_IdctHint( sal_uInt16, const sal_uInt8* pData, short nLen )
4204 : {
4205 : // sprmcidcthint (opcode 0x286f) specifies a script bias for the text in the run.
4206 : // for unicode characters that are shared between far east and non-far east scripts,
4207 : // this property determines what font and language the character will use.
4208 : // when this value is 0, text properties bias towards non-far east properties.
4209 : // when this value is 1, text properties bias towards far east properties.
4210 3473 : if( nLen < 0 ) //Property end
4211 : {
4212 952 : pCtrlStck->SetAttr(*pPaM->GetPoint(),RES_CHRATR_IDCTHINT);
4213 : }
4214 : else //Property start
4215 : {
4216 2521 : sal_uInt8 nVal = *pData;
4217 2521 : NewAttr( SfxInt16Item( RES_CHRATR_IDCTHINT, (nVal!=0)? 1 : 0 ) );
4218 : }
4219 3473 : }
4220 :
4221 1505 : void SwWW8ImplReader::Read_Justify( sal_uInt16, const sal_uInt8* pData, short nLen )
4222 : {
4223 1505 : if( nLen < 0 )
4224 : {
4225 544 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_ADJUST );
4226 2049 : return;
4227 : }
4228 :
4229 961 : SvxAdjust eAdjust(SVX_ADJUST_LEFT);
4230 961 : bool bDistributed = false;
4231 961 : switch (*pData)
4232 : {
4233 : default:
4234 : case 0:
4235 26 : break;
4236 : case 1:
4237 541 : eAdjust = SVX_ADJUST_CENTER;
4238 541 : break;
4239 : case 2:
4240 176 : eAdjust = SVX_ADJUST_RIGHT;
4241 176 : break;
4242 : case 3:
4243 218 : eAdjust = SVX_ADJUST_BLOCK;
4244 218 : break;
4245 : case 4:
4246 0 : eAdjust = SVX_ADJUST_BLOCK;
4247 0 : bDistributed = true;
4248 0 : break;
4249 : }
4250 961 : SvxAdjustItem aAdjust(eAdjust, RES_PARATR_ADJUST);
4251 961 : if (bDistributed)
4252 0 : aAdjust.SetLastBlock(SVX_ADJUST_BLOCK);
4253 :
4254 961 : NewAttr(aAdjust);
4255 : }
4256 :
4257 2641 : bool SwWW8ImplReader::IsRightToLeft()
4258 : {
4259 2641 : bool bRTL = false;
4260 : const sal_uInt8 *pDir =
4261 2641 : pPlcxMan ? pPlcxMan->GetPapPLCF()->HasSprm(0x2441) : 0;
4262 2641 : if (pDir)
4263 931 : bRTL = *pDir ? true : false;
4264 : else
4265 : {
4266 : const SvxFrameDirectionItem* pItem=
4267 1710 : (const SvxFrameDirectionItem*)GetFmtAttr(RES_FRAMEDIR);
4268 1710 : if (pItem && (pItem->GetValue() == FRMDIR_HORI_RIGHT_TOP))
4269 0 : bRTL = true;
4270 : }
4271 2641 : return bRTL;
4272 : }
4273 :
4274 871 : void SwWW8ImplReader::Read_RTLJustify( sal_uInt16, const sal_uInt8* pData, short nLen )
4275 : {
4276 871 : if( nLen < 0 )
4277 : {
4278 374 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_ADJUST );
4279 1245 : return;
4280 : }
4281 :
4282 : //If we are in a ltr paragraph this is the same as normal Justify,
4283 : //If we are in a rtl paragraph the meaning is reversed.
4284 497 : if (!IsRightToLeft())
4285 296 : Read_Justify(0x2403 /*dummy*/, pData, nLen);
4286 : else
4287 : {
4288 201 : SvxAdjust eAdjust(SVX_ADJUST_RIGHT);
4289 201 : bool bDistributed = false;
4290 201 : switch (*pData)
4291 : {
4292 : default:
4293 : case 0:
4294 0 : break;
4295 : case 1:
4296 201 : eAdjust = SVX_ADJUST_CENTER;
4297 201 : break;
4298 : case 2:
4299 0 : eAdjust = SVX_ADJUST_LEFT;
4300 0 : break;
4301 : case 3:
4302 0 : eAdjust = SVX_ADJUST_BLOCK;
4303 0 : break;
4304 : case 4:
4305 0 : eAdjust = SVX_ADJUST_BLOCK;
4306 0 : bDistributed = true;
4307 0 : break;
4308 : }
4309 201 : SvxAdjustItem aAdjust(eAdjust, RES_PARATR_ADJUST);
4310 201 : if (bDistributed)
4311 0 : aAdjust.SetLastBlock(SVX_ADJUST_BLOCK);
4312 :
4313 201 : NewAttr(aAdjust);
4314 : }
4315 : }
4316 :
4317 170 : void SwWW8ImplReader::Read_BoolItem( sal_uInt16 nId, const sal_uInt8* pData, short nLen )
4318 : {
4319 170 : switch( nId )
4320 : {
4321 : case 0x2433:
4322 9 : nId = RES_PARATR_FORBIDDEN_RULES;
4323 9 : break;
4324 : case 0x2435:
4325 42 : nId = RES_PARATR_HANGINGPUNCTUATION;
4326 42 : break;
4327 : case 0x2437:
4328 119 : nId = RES_PARATR_SCRIPTSPACE;
4329 119 : break;
4330 : default:
4331 : OSL_ENSURE( !this, "wrong Id" );
4332 170 : return ;
4333 : }
4334 :
4335 170 : if( nLen < 0 )
4336 13 : pCtrlStck->SetAttr( *pPaM->GetPoint(), nId );
4337 : else
4338 : {
4339 157 : SfxBoolItem* pI = (SfxBoolItem*)GetDfltAttr( nId )->Clone();
4340 157 : pI->SetValue( 0 != *pData );
4341 157 : NewAttr( *pI );
4342 157 : delete pI;
4343 : }
4344 : }
4345 :
4346 3 : void SwWW8ImplReader::Read_Emphasis( sal_uInt16, const sal_uInt8* pData, short nLen )
4347 : {
4348 3 : if( nLen < 0 )
4349 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_EMPHASIS_MARK );
4350 : else
4351 : {
4352 : LanguageType nLang;
4353 : //Check to see if there is an up and coming cjk language property. If
4354 : //there is use it, if there is not fall back to the currently set one.
4355 : //Only the cjk language setting seems to matter to word, the western
4356 : //one is ignored
4357 : const sal_uInt8 *pLang =
4358 3 : pPlcxMan ? pPlcxMan->GetChpPLCF()->HasSprm(0x486E) : 0;
4359 :
4360 3 : if (pLang)
4361 3 : nLang = SVBT16ToShort( pLang );
4362 : else
4363 : {
4364 : nLang = ((const SvxLanguageItem *)
4365 0 : GetFmtAttr(RES_CHRATR_CJK_LANGUAGE))->GetLanguage();
4366 : }
4367 :
4368 : sal_uInt16 nVal;
4369 3 : switch( *pData )
4370 : {
4371 : case 0:
4372 3 : nVal = EMPHASISMARK_NONE;
4373 3 : break;
4374 : case 2:
4375 0 : if (MsLangId::isKorean(nLang) || MsLangId::isTraditionalChinese(nLang))
4376 0 : nVal = EMPHASISMARK_CIRCLE_ABOVE;
4377 0 : else if (nLang == LANGUAGE_JAPANESE)
4378 0 : nVal = EMPHASISMARK_SIDE_DOTS;
4379 : else
4380 0 : nVal = EMPHASISMARK_DOTS_BELOW;
4381 0 : break;
4382 : case 3:
4383 0 : nVal = EMPHASISMARK_CIRCLE_ABOVE;
4384 0 : break;
4385 : case 4:
4386 0 : nVal = EMPHASISMARK_DOTS_BELOW;
4387 0 : break;
4388 : case 1:
4389 0 : if (MsLangId::isSimplifiedChinese(nLang))
4390 0 : nVal = EMPHASISMARK_DOTS_BELOW;
4391 : else
4392 0 : nVal = EMPHASISMARK_DOTS_ABOVE;
4393 0 : break;
4394 : default:
4395 0 : nVal = EMPHASISMARK_DOTS_ABOVE;
4396 0 : break;
4397 : }
4398 :
4399 3 : NewAttr( SvxEmphasisMarkItem( nVal, RES_CHRATR_EMPHASIS_MARK ) );
4400 : }
4401 3 : }
4402 :
4403 4 : void SwWW8ImplReader::Read_ScaleWidth( sal_uInt16, const sal_uInt8* pData, short nLen )
4404 : {
4405 4 : if( nLen < 0 )
4406 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_SCALEW );
4407 : else
4408 : {
4409 4 : sal_uInt16 nVal = SVBT16ToShort( pData );
4410 : //The number must be between 1 and 600
4411 4 : if (nVal < 1 || nVal > 600)
4412 0 : nVal = 100;
4413 4 : NewAttr( SvxCharScaleWidthItem( nVal, RES_CHRATR_SCALEW ) );
4414 : }
4415 4 : }
4416 :
4417 2 : void SwWW8ImplReader::Read_Relief( sal_uInt16 nId, const sal_uInt8* pData, short nLen )
4418 : {
4419 2 : if( nLen < 0 )
4420 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_RELIEF );
4421 : else
4422 : {
4423 2 : if( *pData )
4424 : {
4425 : // not so eays because this is also a toggle attribute!
4426 : // 2 x emboss on -> no emboss !!!
4427 : // the actual value must be searched over the stack / template
4428 :
4429 : const SvxCharReliefItem* pOld = (const SvxCharReliefItem*)
4430 0 : GetFmtAttr( RES_CHRATR_RELIEF );
4431 : FontRelief nNewValue = 0x854 == nId ? RELIEF_ENGRAVED
4432 : : ( 0x858 == nId ? RELIEF_EMBOSSED
4433 0 : : RELIEF_NONE );
4434 0 : if( pOld->GetValue() == nNewValue )
4435 : {
4436 0 : if( RELIEF_NONE != nNewValue )
4437 0 : nNewValue = RELIEF_NONE;
4438 : }
4439 0 : NewAttr( SvxCharReliefItem( nNewValue, RES_CHRATR_RELIEF ));
4440 : }
4441 : }
4442 2 : }
4443 :
4444 0 : void SwWW8ImplReader::Read_TxtAnim(sal_uInt16 /*nId*/, const sal_uInt8* pData, short nLen)
4445 : {
4446 0 : if (nLen < 0)
4447 0 : pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_CHRATR_BLINK);
4448 : else
4449 : {
4450 0 : if (*pData)
4451 : {
4452 : bool bBlink;
4453 :
4454 : // The 7 animated text effects available in word all get
4455 : // mapped to a blinking text effect in StarOffice
4456 : // 0 no animation 1 Las Vegas lights
4457 : // 2 background blink 3 sparkle text
4458 : // 4 marching ants 5 marchine red ants
4459 : // 6 shimmer
4460 0 : if (*pData > 0 && *pData < 7 )
4461 0 : bBlink = true;
4462 : else
4463 0 : bBlink = false;
4464 :
4465 0 : NewAttr(SvxBlinkItem(bBlink, RES_CHRATR_BLINK));
4466 : }
4467 : }
4468 0 : }
4469 :
4470 7 : SwWW8Shade::SwWW8Shade(bool bVer67, const WW8_SHD& rSHD)
4471 : {
4472 7 : sal_uInt8 b = rSHD.GetFore();
4473 : OSL_ENSURE(b < 17, "ww8: colour out of range");
4474 7 : if (b >= 17)
4475 0 : b = 0;
4476 :
4477 7 : ColorData nFore(SwWW8ImplReader::GetCol(b));
4478 :
4479 7 : b = rSHD.GetBack();
4480 : OSL_ENSURE(b < 17, "ww8: colour out of range");
4481 7 : if( b >= 17 )
4482 0 : b = 0;
4483 :
4484 7 : ColorData nBack(SwWW8ImplReader::GetCol(b));
4485 :
4486 7 : b = rSHD.GetStyle(bVer67);
4487 :
4488 7 : SetShade(nFore, nBack, b);
4489 7 : }
4490 :
4491 579 : void SwWW8Shade::SetShade(ColorData nFore, ColorData nBack, sal_uInt16 nIndex)
4492 : {
4493 : static const sal_uLong eMSGrayScale[] =
4494 : {
4495 : // Clear-Brush
4496 : 0, // 0 clear
4497 : // Solid-Brush
4498 : 1000, // 1 solid
4499 : // Percent values
4500 : 50, // 2 pct5
4501 : 100, // 3 pct10
4502 : 200, // 4 pct20
4503 : 250, // 5 pct25
4504 : 300, // 6 pct30
4505 : 400, // 7 pct40
4506 : 500, // 8 pct50
4507 : 600, // 9 pct60
4508 : 700, // 10 pct70
4509 : 750, // 11 pct75
4510 : 800, // 12 pct80
4511 : 900, // 13 pct90
4512 : // Special cases
4513 : 333, // 14 Dark Horizontal
4514 : 333, // 15 Dark Vertical
4515 : 333, // 16 Dark Forward Diagonal
4516 : 333, // 17 Dark Backward Diagonal
4517 : 333, // 18 Dark Cross
4518 : 333, // 19 Dark Diagonal Cross
4519 : 333, // 20 Horizontal
4520 : 333, // 21 Vertical
4521 : 333, // 22 Forward Diagonal
4522 : 333, // 23 Backward Diagonal
4523 : 333, // 24 Cross
4524 : 333, // 25 Diagonal Cross
4525 : // Undefined values in DOC spec-sheet
4526 : 500, // 26
4527 : 500, // 27
4528 : 500, // 28
4529 : 500, // 29
4530 : 500, // 30
4531 : 500, // 31
4532 : 500, // 32
4533 : 500, // 33
4534 : 500, // 34
4535 : // Different shading types
4536 : 25, // 35 [available in DOC, not available in DOCX]
4537 : 75, // 36 [available in DOC, not available in DOCX]
4538 : 125, // 37 pct12
4539 : 150, // 38 pct15
4540 : 175, // 39 [available in DOC, not available in DOCX]
4541 : 225, // 40 [available in DOC, not available in DOCX]
4542 : 275, // 41 [available in DOC, not available in DOCX]
4543 : 325, // 42 [available in DOC, not available in DOCX]
4544 : 350, // 43 pct35
4545 : 375, // 44 pct37
4546 : 425, // 45 [available in DOC, not available in DOCX]
4547 : 450, // 46 pct45
4548 : 475, // 47 [available in DOC, not available in DOCX]
4549 : 525, // 48 [available in DOC, not available in DOCX]
4550 : 550, // 49 pct55
4551 : 575, // 50 [available in DOC, not available in DOCX]
4552 : 625, // 51 pct62
4553 : 650, // 52 pct65
4554 : 675, // 53 [available in DOC, not available in DOCX]
4555 : 725, // 54 [available in DOC, not available in DOCX]
4556 : 775, // 55 [available in DOC, not available in DOCX]
4557 : 825, // 56 [available in DOC, not available in DOCX]
4558 : 850, // 57 pct85
4559 : 875, // 58 pct87
4560 : 925, // 59 [available in DOC, not available in DOCX]
4561 : 950, // 60 pct95
4562 : 975 // 61 [available in DOC, not available in DOCX]
4563 : };// 62
4564 :
4565 : //NO auto for shading so Foreground: Auto = Black
4566 579 : if (nFore == COL_AUTO)
4567 3 : nFore = COL_BLACK;
4568 :
4569 : //NO auto for shading so background: Auto = Weiss
4570 579 : ColorData nUseBack = nBack;
4571 579 : if (nUseBack == COL_AUTO)
4572 326 : nUseBack = COL_WHITE;
4573 :
4574 579 : if( nIndex >= sizeof( eMSGrayScale ) / sizeof ( eMSGrayScale[ 0 ] ) )
4575 0 : nIndex = 0;
4576 :
4577 579 : sal_uLong nWW8BrushStyle = eMSGrayScale[nIndex];
4578 :
4579 579 : switch (nWW8BrushStyle)
4580 : {
4581 : case 0: // Null-Brush
4582 575 : aColor.SetColor( nBack );
4583 575 : break;
4584 : default:
4585 : {
4586 4 : Color aForeColor(nFore);
4587 4 : Color aBackColor(nUseBack);
4588 :
4589 4 : sal_uInt32 nRed = aForeColor.GetRed() * nWW8BrushStyle;
4590 4 : sal_uInt32 nGreen = aForeColor.GetGreen() * nWW8BrushStyle;
4591 4 : sal_uInt32 nBlue = aForeColor.GetBlue() * nWW8BrushStyle;
4592 4 : nRed += aBackColor.GetRed() * (1000L - nWW8BrushStyle);
4593 4 : nGreen += aBackColor.GetGreen()* (1000L - nWW8BrushStyle);
4594 4 : nBlue += aBackColor.GetBlue() * (1000L - nWW8BrushStyle);
4595 :
4596 4 : aColor.SetColor( RGB_COLORDATA( nRed/1000, nGreen/1000,
4597 4 : nBlue/1000 ) );
4598 : }
4599 4 : break;
4600 : }
4601 579 : }
4602 :
4603 53 : void SwWW8ImplReader::Read_Shade( sal_uInt16, const sal_uInt8* pData, short nLen )
4604 : {
4605 53 : if (!bVer67 && pPlcxMan && pPlcxMan->GetPapPLCF()->HasSprm(0xC64D))
4606 99 : return;
4607 :
4608 7 : if (nLen <= 0)
4609 : {
4610 : // Ende des Attributes
4611 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_BACKGROUND );
4612 0 : if (bShdTxtCol)
4613 : {
4614 : // Zeichenfarbe auch
4615 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_COLOR );
4616 0 : bShdTxtCol = false;
4617 : }
4618 : }
4619 : else
4620 : {
4621 7 : WW8_SHD aSHD;
4622 7 : aSHD.SetWWValue( *(SVBT16*)pData );
4623 7 : SwWW8Shade aSh( bVer67, aSHD );
4624 :
4625 7 : NewAttr(SvxBrushItem(aSh.aColor, RES_BACKGROUND));
4626 : }
4627 : }
4628 :
4629 58 : void SwWW8ImplReader::Read_ParaBackColor(sal_uInt16, const sal_uInt8* pData, short nLen)
4630 : {
4631 58 : if (nLen <= 0)
4632 : {
4633 : // Ende des Attributes
4634 23 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_BACKGROUND );
4635 23 : if (bShdTxtCol)
4636 : {
4637 : // Zeichenfarbe auch
4638 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_COLOR );
4639 0 : bShdTxtCol = false;
4640 : }
4641 : }
4642 : else
4643 : {
4644 : OSL_ENSURE(nLen == 10, "Len of para back colour not 10!");
4645 35 : if (nLen != 10)
4646 58 : return;
4647 35 : NewAttr(SvxBrushItem(Color(ExtractColour(pData, bVer67)), RES_BACKGROUND));
4648 : }
4649 : }
4650 :
4651 572 : sal_uInt32 SwWW8ImplReader::ExtractColour(const sal_uInt8* &rpData, bool bVer67)
4652 : {
4653 : (void) bVer67; // unused in non-debug
4654 : OSL_ENSURE(bVer67 == false, "Impossible");
4655 572 : sal_uInt32 nFore = msfilter::util::BGRToRGB(SVBT32ToUInt32(rpData));
4656 572 : rpData+=4;
4657 572 : sal_uInt32 nBack = msfilter::util::BGRToRGB(SVBT32ToUInt32(rpData));
4658 572 : rpData+=4;
4659 572 : sal_uInt16 nIndex = SVBT16ToShort(rpData);
4660 572 : rpData+=2;
4661 : //Being a transparent background colour doesn't actually show the page
4662 : //background through, it merely acts like white
4663 572 : if (nBack == 0xFF000000)
4664 325 : nBack = COL_AUTO;
4665 : OSL_ENSURE(nBack == COL_AUTO || !(nBack & 0xFF000000),
4666 : "ww8: don't know what to do with such a transparent bg colour, report");
4667 572 : SwWW8Shade aShade(nFore, nBack, nIndex);
4668 572 : return aShade.aColor.GetColor();
4669 : }
4670 :
4671 508 : void SwWW8ImplReader::Read_Border(sal_uInt16 , const sal_uInt8*, short nLen)
4672 : {
4673 508 : if( nLen < 0 )
4674 : {
4675 186 : if( bHasBorder )
4676 : {
4677 31 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_BOX );
4678 31 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_SHADOW );
4679 31 : bHasBorder = false;
4680 : }
4681 : }
4682 322 : else if( !bHasBorder )
4683 : {
4684 : // die Borders auf allen 4 Seiten werden gebuendelt. dieses
4685 : // vereinfacht die Verwaltung, d.h. die Box muss nicht 4 mal auf den
4686 : // CtrlStack und wieder runter
4687 61 : bHasBorder = true;
4688 :
4689 61 : WW8_BRCVer9_5 aBrcs; // Top, Left, Bottom, Right, Between
4690 : sal_uInt8 nBorder;
4691 :
4692 61 : if( pAktColl )
4693 30 : nBorder = ::lcl_ReadBorders(bVer67, aBrcs, 0, pStyles);
4694 : else
4695 31 : nBorder = ::lcl_ReadBorders(bVer67, aBrcs, pPlcxMan ? pPlcxMan->GetPapPLCF() : NULL);
4696 :
4697 61 : if( nBorder ) // Border
4698 : {
4699 61 : bool bIsB = IsBorder(aBrcs, true);
4700 122 : if (!InLocalApo() || !bIsB ||
4701 0 : (pWFlyPara && !pWFlyPara->bBorderLines ))
4702 : {
4703 : // in Apo keine Umrandungen *ein*-schalten, da ich
4704 : // sonst die Flyumrandungen doppelt bekomme
4705 : // aber nur wenn am Fly ein gesetzt ist, keine
4706 : // uebernehmen. Sonst wird gar keine gesetzt!
4707 :
4708 : // auch wenn kein Rand gesetzt ist, muss das Attribut gesetzt
4709 : // werden, sonst ist kein hartes Ausschalten von Style-Attrs
4710 : // moeglich
4711 : const SvxBoxItem* pBox
4712 61 : = (const SvxBoxItem*)GetFmtAttr( RES_BOX );
4713 61 : SvxBoxItem aBox(RES_BOX);
4714 61 : if (pBox)
4715 61 : aBox = *pBox;
4716 61 : short aSizeArray[5]={0};
4717 :
4718 61 : SetBorder(aBox, aBrcs, &aSizeArray[0], nBorder);
4719 :
4720 61 : Rectangle aInnerDist;
4721 61 : GetBorderDistance( aBrcs, aInnerDist );
4722 :
4723 61 : if ((nBorder & WW8_LEFT)==WW8_LEFT)
4724 46 : aBox.SetDistance( (sal_uInt16)aInnerDist.Left(), BOX_LINE_LEFT );
4725 :
4726 : if ((nBorder & WW8_TOP)==WW8_TOP)
4727 61 : aBox.SetDistance( (sal_uInt16)aInnerDist.Top(), BOX_LINE_TOP );
4728 :
4729 61 : if ((nBorder & WW8_RIGHT)==WW8_RIGHT)
4730 35 : aBox.SetDistance( (sal_uInt16)aInnerDist.Right(), BOX_LINE_RIGHT );
4731 :
4732 61 : if ((nBorder & WW8_BOT)==WW8_BOT)
4733 35 : aBox.SetDistance( (sal_uInt16)aInnerDist.Bottom(), BOX_LINE_BOTTOM );
4734 :
4735 61 : NewAttr( aBox );
4736 :
4737 122 : SvxShadowItem aS(RES_SHADOW);
4738 61 : if( SetShadow( aS, &aSizeArray[0], aBrcs[WW8_RIGHT] ) )
4739 61 : NewAttr( aS );
4740 : }
4741 : }
4742 : }
4743 508 : }
4744 :
4745 40 : void SwWW8ImplReader::Read_CharBorder(sal_uInt16 nId, const sal_uInt8* pData, short nLen )
4746 : {
4747 : //Ignore this old border type
4748 : //if (!bVer67 && pPlcxMan && pPlcxMan->GetChpPLCF()->HasSprm(0xCA72))
4749 : // return;
4750 :
4751 40 : if( nLen < 0 )
4752 : {
4753 20 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_BOX );
4754 20 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_CHRATR_SHADOW );
4755 : }
4756 : else
4757 : {
4758 : const SvxBoxItem* pBox
4759 20 : = (const SvxBoxItem*)GetFmtAttr( RES_CHRATR_BOX );
4760 20 : if( pBox )
4761 : {
4762 20 : SvxBoxItem aBoxItem(RES_CHRATR_BOX);
4763 20 : aBoxItem = *pBox;
4764 20 : WW8_BRCVer9 aBrc;
4765 20 : int nBrcVer = (nId == NS_sprm::LN_CBrc) ? 9 : (bVer67 ? 6 : 8);
4766 :
4767 20 : _SetWW8_BRC(nBrcVer, aBrc, pData);
4768 :
4769 20 : Set1Border(aBoxItem, aBrc, BOX_LINE_TOP, 0, 0, true);
4770 20 : Set1Border(aBoxItem, aBrc, BOX_LINE_BOTTOM, 0, 0, true);
4771 20 : Set1Border(aBoxItem, aBrc, BOX_LINE_LEFT, 0, 0, true);
4772 20 : Set1Border(aBoxItem, aBrc, BOX_LINE_RIGHT, 0, 0, true);
4773 20 : NewAttr( aBoxItem );
4774 :
4775 20 : short aSizeArray[WW8_RIGHT+1]={0}; aSizeArray[WW8_RIGHT] = 1;
4776 40 : SvxShadowItem aShadowItem(RES_CHRATR_SHADOW);
4777 20 : if( SetShadow( aShadowItem, &aSizeArray[0], aBrc ) )
4778 32 : NewAttr( aShadowItem );
4779 : }
4780 : }
4781 :
4782 40 : }
4783 :
4784 31 : void SwWW8ImplReader::Read_Hyphenation( sal_uInt16, const sal_uInt8* pData, short nLen )
4785 : {
4786 : // set Hyphenation flag
4787 31 : if( nLen <= 0 )
4788 1 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_HYPHENZONE );
4789 : else
4790 : {
4791 : SvxHyphenZoneItem aAttr(
4792 30 : *(const SvxHyphenZoneItem*)GetFmtAttr( RES_PARATR_HYPHENZONE ) );
4793 :
4794 30 : aAttr.SetHyphen( 0 == *pData ); // sic !
4795 :
4796 30 : if( !*pData )
4797 : {
4798 1 : aAttr.GetMinLead() = 2;
4799 1 : aAttr.GetMinTrail() = 2;
4800 1 : aAttr.GetMaxHyphens() = 0;
4801 : }
4802 :
4803 30 : NewAttr( aAttr );
4804 : }
4805 31 : }
4806 :
4807 61 : void SwWW8ImplReader::Read_WidowControl( sal_uInt16, const sal_uInt8* pData, short nLen )
4808 : {
4809 61 : if( nLen <= 0 )
4810 : {
4811 15 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_WIDOWS );
4812 15 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_ORPHANS );
4813 : }
4814 : else
4815 : {
4816 46 : sal_uInt8 nL = ( *pData & 1 ) ? 2 : 0;
4817 :
4818 46 : NewAttr( SvxWidowsItem( nL, RES_PARATR_WIDOWS ) ); // Aus -> nLines = 0
4819 46 : NewAttr( SvxOrphansItem( nL, RES_PARATR_ORPHANS ) );
4820 :
4821 46 : if( pAktColl && pStyles ) // Style-Def ?
4822 31 : pStyles->bWidowsChanged = true; // merken zur Simulation
4823 : // Default-Widows
4824 : }
4825 61 : }
4826 :
4827 398 : void SwWW8ImplReader::Read_UsePgsuSettings(sal_uInt16,const sal_uInt8* pData,short nLen)
4828 : {
4829 398 : if( nLen <= 0 )
4830 197 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_SNAPTOGRID);
4831 : else
4832 : {
4833 201 : if(nInTable)
4834 197 : NewAttr( SvxParaGridItem(false, RES_PARATR_SNAPTOGRID) );
4835 : else
4836 4 : NewAttr( SvxParaGridItem(*pData, RES_PARATR_SNAPTOGRID) );
4837 : }
4838 398 : }
4839 :
4840 33 : void SwWW8ImplReader::Read_AlignFont( sal_uInt16, const sal_uInt8* pData, short nLen )
4841 : {
4842 33 : if( nLen <= 0 )
4843 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_VERTALIGN);
4844 : else
4845 : {
4846 33 : sal_uInt16 nVal = SVBT16ToShort( pData );
4847 33 : switch (nVal)
4848 : {
4849 : case 0:
4850 0 : nVal = SvxParaVertAlignItem::TOP;
4851 0 : break;
4852 : case 1:
4853 8 : nVal = SvxParaVertAlignItem::CENTER;
4854 8 : break;
4855 : case 2:
4856 2 : nVal = SvxParaVertAlignItem::BASELINE;
4857 2 : break;
4858 : case 3:
4859 0 : nVal = SvxParaVertAlignItem::BOTTOM;
4860 0 : break;
4861 : case 4:
4862 23 : nVal = SvxParaVertAlignItem::AUTOMATIC;
4863 23 : break;
4864 : default:
4865 0 : nVal = SvxParaVertAlignItem::AUTOMATIC;
4866 : OSL_ENSURE(!this,"Unknown paragraph vertical align");
4867 0 : break;
4868 : }
4869 33 : NewAttr( SvxParaVertAlignItem( nVal, RES_PARATR_VERTALIGN ) );
4870 : }
4871 33 : }
4872 :
4873 12 : void SwWW8ImplReader::Read_KeepLines( sal_uInt16, const sal_uInt8* pData, short nLen )
4874 : {
4875 12 : if( nLen <= 0 )
4876 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_PARATR_SPLIT );
4877 : else
4878 12 : NewAttr( SvxFmtSplitItem( ( *pData & 1 ) == 0, RES_PARATR_SPLIT ) );
4879 12 : }
4880 :
4881 93 : void SwWW8ImplReader::Read_KeepParas( sal_uInt16, const sal_uInt8* pData, short nLen )
4882 : {
4883 93 : if( nLen <= 0 )
4884 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_KEEP );
4885 : else
4886 93 : NewAttr( SvxFmtKeepItem( ( *pData & 1 ) != 0 , RES_KEEP) );
4887 93 : }
4888 :
4889 0 : void SwWW8ImplReader::Read_BreakBefore( sal_uInt16, const sal_uInt8* pData, short nLen )
4890 : {
4891 0 : if( nLen <= 0 )
4892 0 : pCtrlStck->SetAttr( *pPaM->GetPoint(), RES_BREAK );
4893 : else
4894 : NewAttr( SvxFmtBreakItem(
4895 0 : ( *pData & 1 ) ? SVX_BREAK_PAGE_BEFORE : SVX_BREAK_NONE, RES_BREAK ) );
4896 0 : }
4897 :
4898 139 : void SwWW8ImplReader::Read_ApoPPC( sal_uInt16, const sal_uInt8* pData, short )
4899 : {
4900 139 : if (pAktColl && nAktColl < vColl.size()) // only for Styledef, sonst anders geloest
4901 : {
4902 3 : SwWW8StyInf& rSI = vColl[nAktColl];
4903 3 : WW8FlyPara* pFly = rSI.pWWFly ? rSI.pWWFly : new WW8FlyPara(bVer67);
4904 3 : vColl[nAktColl].pWWFly = pFly;
4905 3 : pFly->Read(*pData, pStyles);
4906 3 : if (pFly->IsEmpty())
4907 0 : delete vColl[nAktColl].pWWFly, vColl[nAktColl].pWWFly = 0;
4908 : }
4909 139 : }
4910 :
4911 1732 : bool SwWW8ImplReader::ParseTabPos(WW8_TablePos *pTabPos, WW8PLCFx_Cp_FKP* pPap)
4912 : {
4913 1732 : bool bRet = false;
4914 1732 : const sal_uInt8 *pRes=0;
4915 1732 : memset(pTabPos, 0, sizeof(WW8_TablePos));
4916 1732 : if (0 != (pRes = pPap->HasSprm(0x360D)))
4917 : {
4918 82 : pTabPos->nSp29 = *pRes;
4919 82 : pTabPos->nSp37 = 2; //Possible fail area, always parallel wrap
4920 82 : if (0 != (pRes = pPap->HasSprm(0x940E)))
4921 10 : pTabPos->nSp26 = SVBT16ToShort(pRes);
4922 82 : if (0 != (pRes = pPap->HasSprm(0x940F)))
4923 82 : pTabPos->nSp27 = SVBT16ToShort(pRes);
4924 82 : if (0 != (pRes = pPap->HasSprm(0x9410)))
4925 82 : pTabPos->nLeMgn = SVBT16ToShort(pRes);
4926 82 : if (0 != (pRes = pPap->HasSprm(0x941E)))
4927 82 : pTabPos->nRiMgn = SVBT16ToShort(pRes);
4928 82 : if (0 != (pRes = pPap->HasSprm(0x9411)))
4929 0 : pTabPos->nUpMgn = SVBT16ToShort(pRes);
4930 82 : if (0 != (pRes = pPap->HasSprm(0x941F)))
4931 0 : pTabPos->nLoMgn = SVBT16ToShort(pRes);
4932 82 : bRet = true;
4933 : }
4934 1732 : if (0 != (pRes = pPap->HasSprm(NS_sprm::LN_TDefTable)))
4935 : {
4936 1718 : WW8TabBandDesc aDesc;
4937 1718 : aDesc.ReadDef(false, pRes);
4938 1718 : int nTableWidth = aDesc.nCenter[aDesc.nWwCols] - aDesc.nCenter[0];
4939 1718 : int nTextAreaWidth = maSectionManager.GetTextAreaWidth();
4940 : // If the table is wider than the text area, then don't create a fly
4941 : // for the table: no wrapping will be performed anyway, but multi-page
4942 : // tables will be broken.
4943 1718 : pTabPos->bNoFly = nTableWidth >= nTextAreaWidth;
4944 : }
4945 1732 : return bRet;
4946 : }
4947 :
4948 : /***************************************************************************
4949 : # Seiten - Attribute werden nicht mehr als Attribute gehandhabt
4950 : # ( ausser OLST )
4951 : #**************************************************************************/
4952 :
4953 100 : long SwWW8ImplReader::ImportExtSprm(WW8PLCFManResult* pRes)
4954 : {
4955 : /*************************************************************************
4956 : # Arrays zum Lesen der erweiterten ( selbstdefinierten ) SPRMs
4957 : #*************************************************************************/
4958 : typedef long (SwWW8ImplReader:: *FNReadRecordExt)(WW8PLCFManResult*);
4959 :
4960 : static const FNReadRecordExt aWwSprmTab[] =
4961 : {
4962 : /* 0 (256) */ &SwWW8ImplReader::Read_Ftn, // FootNote
4963 : /* 1 (257) */ &SwWW8ImplReader::Read_Ftn, // EndNote
4964 : /* 2 (258) */ &SwWW8ImplReader::Read_Field, // Feld
4965 : /* 3 (259) */ &SwWW8ImplReader::Read_Book, // Bookmark
4966 : /* 4 (260) */ &SwWW8ImplReader::Read_And // Annotation
4967 : };
4968 :
4969 100 : if( pRes->nSprmId < 280 )
4970 : {
4971 100 : sal_uInt8 nIdx = static_cast< sal_uInt8 >(pRes->nSprmId - eFTN);
4972 100 : if( nIdx < SAL_N_ELEMENTS(aWwSprmTab)
4973 100 : && aWwSprmTab[nIdx] )
4974 100 : return (this->*aWwSprmTab[nIdx])(pRes);
4975 : else
4976 0 : return 0;
4977 : }
4978 : else
4979 0 : return 0;
4980 : }
4981 :
4982 65 : void SwWW8ImplReader::EndExtSprm(sal_uInt16 nSprmId)
4983 : {
4984 : typedef sal_uInt16 (SwWW8ImplReader:: *FNReadRecordExt)();
4985 :
4986 : static const FNReadRecordExt aWwSprmTab[] =
4987 : {
4988 : /* 0 (256) */ &SwWW8ImplReader::End_Ftn, // FootNote
4989 : /* 1 (257) */ &SwWW8ImplReader::End_Ftn, // EndNote
4990 : /* 2 (258) */ &SwWW8ImplReader::End_Field, // Feld
4991 : /* 3 (259) */ 0, // Bookmark
4992 : /* 4 (260) */ 0 // Annotation
4993 : };
4994 :
4995 65 : sal_uInt8 nIdx = static_cast< sal_uInt8 >(nSprmId - eFTN);
4996 65 : if( nIdx < SAL_N_ELEMENTS(aWwSprmTab)
4997 65 : && aWwSprmTab[nIdx] )
4998 50 : (this->*aWwSprmTab[nIdx])();
4999 65 : }
5000 :
5001 : /***************************************************************************
5002 : # Arrays zum Lesen der SPRMs
5003 : #**************************************************************************/
5004 :
5005 : // Funktion zum Einlesen von Sprms. Par1: SprmId
5006 : typedef void (SwWW8ImplReader:: *FNReadRecord)( sal_uInt16, const sal_uInt8*, short );
5007 :
5008 : struct SprmReadInfo
5009 : {
5010 : sal_uInt16 nId;
5011 : FNReadRecord pReadFnc;
5012 : };
5013 :
5014 0 : bool operator==(const SprmReadInfo &rFirst, const SprmReadInfo &rSecond)
5015 : {
5016 0 : return (rFirst.nId == rSecond.nId);
5017 : }
5018 :
5019 1121891 : bool operator<(const SprmReadInfo &rFirst, const SprmReadInfo &rSecond)
5020 : {
5021 1121891 : return (rFirst.nId < rSecond.nId);
5022 : }
5023 :
5024 : typedef ww::SortedArray<SprmReadInfo> wwSprmDispatcher;
5025 :
5026 1994 : const wwSprmDispatcher *GetWW2SprmDispatcher()
5027 : {
5028 : static SprmReadInfo aSprms[] =
5029 : {
5030 : {0, 0}, // "0" Default bzw. Error
5031 : //wird uebersprungen! ,
5032 : {2, &SwWW8ImplReader::Read_StyleCode}, //"sprmPIstd", pap.istd
5033 : //(style code)
5034 : {3, 0}, //"sprmPIstdPermute", pap.istd
5035 : //permutation
5036 : {4, 0}, //"sprmPIncLv1",
5037 : //pap.istddifference
5038 : {5, &SwWW8ImplReader::Read_Justify}, //"sprmPJc", pap.jc
5039 : //(justification)
5040 : {6, 0}, //"sprmPFSideBySide",
5041 : //pap.fSideBySide
5042 : {7, &SwWW8ImplReader::Read_KeepLines}, //"sprmPFKeep", pap.fKeep
5043 : {8, &SwWW8ImplReader::Read_KeepParas}, //"sprmPFKeepFollow ",
5044 : //pap.fKeepFollow
5045 : {9, &SwWW8ImplReader::Read_BreakBefore}, //"sprmPPageBreakBefore",
5046 : //pap.fPageBreakBefore
5047 : {10, 0}, //"sprmPBrcl", pap.brcl
5048 : {11, 0}, //"sprmPBrcp ", pap.brcp
5049 : {12, &SwWW8ImplReader::Read_ANLevelDesc}, //"sprmPAnld", pap.anld (ANLD
5050 : //structure)
5051 : {13, &SwWW8ImplReader::Read_ANLevelNo}, //"sprmPNLvlAnm", pap.nLvlAnm
5052 : //nn
5053 : {14, &SwWW8ImplReader::Read_NoLineNumb}, //"sprmPFNoLineNumb", ap.fNoLnn
5054 : {15, &SwWW8ImplReader::Read_Tab}, //"?sprmPChgTabsPapx",
5055 : //pap.itbdMac, ...
5056 : {16, &SwWW8ImplReader::Read_LR}, //"sprmPDxaRight", pap.dxaRight
5057 : {17, &SwWW8ImplReader::Read_LR}, //"sprmPDxaLeft", pap.dxaLeft
5058 : {18, 0}, //"sprmPNest", pap.dxaLeft
5059 : {19, &SwWW8ImplReader::Read_LR}, //"sprmPDxaLeft1", pap.dxaLeft1
5060 : {20, &SwWW8ImplReader::Read_LineSpace}, //"sprmPDyaLine", pap.lspd
5061 : //an LSPD
5062 : {21, &SwWW8ImplReader::Read_UL}, //"sprmPDyaBefore",
5063 : //pap.dyaBefore
5064 : {22, &SwWW8ImplReader::Read_UL}, //"sprmPDyaAfter", pap.dyaAfter
5065 : {23, 0}, //"?sprmPChgTabs", pap.itbdMac,
5066 : //pap.rgdxaTab, ...
5067 : {24, 0}, //"sprmPFInTable", pap.fInTable
5068 : {25, &SwWW8ImplReader::Read_TabRowEnd}, //"sprmPTtp", pap.fTtp
5069 : {26, 0}, //"sprmPDxaAbs", pap.dxaAbs
5070 : {27, 0}, //"sprmPDyaAbs", pap.dyaAbs
5071 : {28, 0}, //"sprmPDxaWidth", pap.dxaWidth
5072 : {29, &SwWW8ImplReader::Read_ApoPPC}, //"sprmPPc", pap.pcHorz,
5073 : //pap.pcVert
5074 : {30, 0}, //"sprmPBrcTop10", pap.brcTop
5075 : //BRC10
5076 : {31, 0}, //"sprmPBrcLeft10",
5077 : //pap.brcLeft BRC10
5078 : {32, 0}, //"sprmPBrcBottom10",
5079 : //pap.brcBottom BRC10
5080 : {33, 0}, //"sprmPBrcRight10",
5081 : //pap.brcRight BRC10
5082 : {34, 0}, //"sprmPBrcBetween10",
5083 : //pap.brcBetween BRC10
5084 : {35, 0}, //"sprmPBrcBar10", pap.brcBar
5085 : //BRC10
5086 : {36, 0}, //"sprmPFromText10",
5087 : //pap.dxaFromText dxa
5088 : {37, 0}, //"sprmPWr", pap.wr wr
5089 : {38, &SwWW8ImplReader::Read_Border}, //"sprmPBrcTop", pap.brcTop BRC
5090 : {39, &SwWW8ImplReader::Read_Border}, //"sprmPBrcLeft",
5091 : //pap.brcLeft BRC
5092 : {40, &SwWW8ImplReader::Read_Border}, //"sprmPBrcBottom",
5093 : //pap.brcBottom BRC
5094 : {41, &SwWW8ImplReader::Read_Border}, //"sprmPBrcRight",
5095 : //pap.brcRight BRC
5096 : {42, &SwWW8ImplReader::Read_Border}, //"sprmPBrcBetween",
5097 : //pap.brcBetween BRC
5098 : {43, 0}, //"sprmPBrcBar", pap.brcBar
5099 : //BRC word
5100 : {44, &SwWW8ImplReader::Read_Hyphenation}, //"sprmPFNoAutoHyph",
5101 : //pap.fNoAutoHyph
5102 : {45, 0}, //"sprmPWHeightAbs",
5103 : //pap.wHeightAbs w
5104 : {46, 0}, //"sprmPDcs", pap.dcs DCS
5105 : {47, &SwWW8ImplReader::Read_Shade}, //"sprmPShd", pap.shd SHD
5106 : {48, 0}, //"sprmPDyaFromText",
5107 : //pap.dyaFromText dya
5108 : {49, 0}, //"sprmPDxaFromText",
5109 : //pap.dxaFromText dxa
5110 : {50, 0}, //"sprmPFLocked", pap.fLocked
5111 : //0 or 1 byte
5112 : {51, &SwWW8ImplReader::Read_WidowControl}, //"sprmPFWidowControl",
5113 : //pap.fWidowControl 0 or 1 byte
5114 : {52, 0}, //"?sprmPRuler 52",
5115 : {53, 0}, //"??53",
5116 : {54, 0}, //"??54",
5117 : {55, 0}, //"??55",
5118 : {56, 0}, //"??56",
5119 : {57, 0}, //"??57",
5120 : {58, 0}, //"??58",
5121 : {59, 0}, //"??59",
5122 :
5123 : {60, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFBold", chp.fBold 0,1,
5124 : //128, or 129 byte
5125 : {61, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFItalic", chp.fItalic
5126 : //0,1, 128, or 129 byte
5127 : {62, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFStrike", chp.fStrike
5128 : //0,1, 128, or 129 byte
5129 : {63, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFOutline", chp.fOutline
5130 : //0,1, 128, or 129 byte
5131 : {64, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFShadow", chp.fShadow
5132 : //0,1, 128, or 129 byte
5133 : {65, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFSmallCaps",
5134 : //chp.fSmallCaps 0,1, 128, or
5135 : //129 byte
5136 : {66, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFCaps", chp.fCaps 0,1,
5137 : //128, or 129 byte
5138 : {67, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFVanish", chp.fVanish
5139 : //0,1, 128, or 129 byte
5140 : {68, &SwWW8ImplReader::Read_FontCode}, //"sprmCFtc", chp.ftc ftc word
5141 : {69, &SwWW8ImplReader::Read_Underline}, // "sprmCKul", chp.kul kul byte
5142 : {70, 0}, //"sprmCSizePos", chp.hps,
5143 : //chp.hpsPos 3 bytes
5144 : {71, &SwWW8ImplReader::Read_Kern}, //"sprmCDxaSpace",
5145 : //chp.dxaSpace dxa word
5146 : {72, &SwWW8ImplReader::Read_Language}, //"sprmCLid", chp.lid LID word
5147 : {73, &SwWW8ImplReader::Read_TxtColor}, //"sprmCIco", chp.ico ico byte
5148 : {74, &SwWW8ImplReader::Read_FontSize}, //"sprmCHps", chp.hps hps word!
5149 : {75, 0}, //"sprmCHpsInc", chp.hps byte
5150 : {76, &SwWW8ImplReader::Read_SubSuperProp}, //"sprmCHpsPos", chp.hpsPos
5151 : //hps byte
5152 : {77, 0}, //"sprmCHpsPosAdj", chp.hpsPos
5153 : //hps byte
5154 : {78, &SwWW8ImplReader::Read_Majority}, //"?sprmCMajority", chp.fBold,
5155 : //chp.fItalic, chp.fSmallCaps
5156 : {80, &SwWW8ImplReader::Read_BoldBiDiUsw}, //sprmCFBoldBi
5157 : {81, &SwWW8ImplReader::Read_BoldBiDiUsw}, //sprmCFItalicBi
5158 : {82, &SwWW8ImplReader::Read_FontCode}, //sprmCFtcBi
5159 : {83, &SwWW8ImplReader::Read_Language}, //sprmClidBi
5160 : {84, &SwWW8ImplReader::Read_TxtColor}, //sprmCIcoBi
5161 : {85, &SwWW8ImplReader::Read_FontSize}, //sprmCHpsBi
5162 : {86, 0}, //sprmCFBiDi
5163 : {87, 0}, //sprmCFDiacColor
5164 : {94, 0}, //"sprmPicBrcl", pic.brcl brcl
5165 : //(see PIC structure
5166 : //definition) byte
5167 : {95, 0}, //"sprmPicScale", pic.mx,
5168 : //pic.my, pic.dxaCropleft,
5169 : {96, 0}, //"sprmPicBrcTop", pic.brcTop
5170 : //BRC word
5171 : {97, 0}, //"sprmPicBrcLeft",
5172 : //pic.brcLeft BRC word
5173 : {98, 0}, //"sprmPicBrcBottom",
5174 : //pic.brcBottom BRC word
5175 : {99, 0} //"sprmPicBrcRight",
5176 : };
5177 :
5178 1994 : static wwSprmDispatcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
5179 1994 : return &aSprmSrch;
5180 : }
5181 :
5182 0 : const wwSprmDispatcher *GetWW6SprmDispatcher()
5183 : {
5184 : static SprmReadInfo aSprms[] =
5185 : {
5186 : {0, 0}, // "0" Default bzw. Error
5187 : //wird uebersprungen! ,
5188 : {2, &SwWW8ImplReader::Read_StyleCode}, //"sprmPIstd", pap.istd
5189 : //(style code)
5190 : {3, 0}, //"sprmPIstdPermute", pap.istd
5191 : //permutation
5192 : {4, 0}, //"sprmPIncLv1",
5193 : //pap.istddifference
5194 : {5, &SwWW8ImplReader::Read_Justify}, //"sprmPJc", pap.jc
5195 : //(justification)
5196 : {6, 0}, //"sprmPFSideBySide",
5197 : //pap.fSideBySide
5198 : {7, &SwWW8ImplReader::Read_KeepLines}, //"sprmPFKeep", pap.fKeep
5199 : {8, &SwWW8ImplReader::Read_KeepParas}, //"sprmPFKeepFollow ",
5200 : //pap.fKeepFollow
5201 : {9, &SwWW8ImplReader::Read_BreakBefore}, //"sprmPPageBreakBefore",
5202 : //pap.fPageBreakBefore
5203 : {10, 0}, //"sprmPBrcl", pap.brcl
5204 : {11, 0}, //"sprmPBrcp ", pap.brcp
5205 : {12, &SwWW8ImplReader::Read_ANLevelDesc}, //"sprmPAnld", pap.anld (ANLD
5206 : //structure)
5207 : {13, &SwWW8ImplReader::Read_ANLevelNo}, //"sprmPNLvlAnm", pap.nLvlAnm
5208 : //nn
5209 : {14, &SwWW8ImplReader::Read_NoLineNumb}, //"sprmPFNoLineNumb", ap.fNoLnn
5210 : {15, &SwWW8ImplReader::Read_Tab}, //"?sprmPChgTabsPapx",
5211 : //pap.itbdMac, ...
5212 : {16, &SwWW8ImplReader::Read_LR}, //"sprmPDxaRight", pap.dxaRight
5213 : {17, &SwWW8ImplReader::Read_LR}, //"sprmPDxaLeft", pap.dxaLeft
5214 : {18, 0}, //"sprmPNest", pap.dxaLeft
5215 : {19, &SwWW8ImplReader::Read_LR}, //"sprmPDxaLeft1", pap.dxaLeft1
5216 : {20, &SwWW8ImplReader::Read_LineSpace}, //"sprmPDyaLine", pap.lspd
5217 : //an LSPD
5218 : {21, &SwWW8ImplReader::Read_UL}, //"sprmPDyaBefore",
5219 : //pap.dyaBefore
5220 : {22, &SwWW8ImplReader::Read_UL}, //"sprmPDyaAfter", pap.dyaAfter
5221 : {23, 0}, //"?sprmPChgTabs", pap.itbdMac,
5222 : //pap.rgdxaTab, ...
5223 : {24, 0}, //"sprmPFInTable", pap.fInTable
5224 : {25, &SwWW8ImplReader::Read_TabRowEnd}, //"sprmPTtp", pap.fTtp
5225 : {26, 0}, //"sprmPDxaAbs", pap.dxaAbs
5226 : {27, 0}, //"sprmPDyaAbs", pap.dyaAbs
5227 : {28, 0}, //"sprmPDxaWidth", pap.dxaWidth
5228 : {29, &SwWW8ImplReader::Read_ApoPPC}, //"sprmPPc", pap.pcHorz,
5229 : //pap.pcVert
5230 : {30, 0}, //"sprmPBrcTop10", pap.brcTop
5231 : //BRC10
5232 : {31, 0}, //"sprmPBrcLeft10",
5233 : //pap.brcLeft BRC10
5234 : {32, 0}, //"sprmPBrcBottom10",
5235 : //pap.brcBottom BRC10
5236 : {33, 0}, //"sprmPBrcRight10",
5237 : //pap.brcRight BRC10
5238 : {34, 0}, //"sprmPBrcBetween10",
5239 : //pap.brcBetween BRC10
5240 : {35, 0}, //"sprmPBrcBar10", pap.brcBar
5241 : //BRC10
5242 : {36, 0}, //"sprmPFromText10",
5243 : //pap.dxaFromText dxa
5244 : {37, 0}, //"sprmPWr", pap.wr wr
5245 : {38, &SwWW8ImplReader::Read_Border}, //"sprmPBrcTop", pap.brcTop BRC
5246 : {39, &SwWW8ImplReader::Read_Border}, //"sprmPBrcLeft",
5247 : //pap.brcLeft BRC
5248 : {40, &SwWW8ImplReader::Read_Border}, //"sprmPBrcBottom",
5249 : //pap.brcBottom BRC
5250 : {41, &SwWW8ImplReader::Read_Border}, //"sprmPBrcRight",
5251 : //pap.brcRight BRC
5252 : {42, &SwWW8ImplReader::Read_Border}, //"sprmPBrcBetween",
5253 : //pap.brcBetween BRC
5254 : {43, 0}, //"sprmPBrcBar", pap.brcBar
5255 : //BRC word
5256 : {44, &SwWW8ImplReader::Read_Hyphenation}, //"sprmPFNoAutoHyph",
5257 : //pap.fNoAutoHyph
5258 : {45, 0}, //"sprmPWHeightAbs",
5259 : //pap.wHeightAbs w
5260 : {46, 0}, //"sprmPDcs", pap.dcs DCS
5261 : {47, &SwWW8ImplReader::Read_Shade}, //"sprmPShd", pap.shd SHD
5262 : {48, 0}, //"sprmPDyaFromText",
5263 : //pap.dyaFromText dya
5264 : {49, 0}, //"sprmPDxaFromText",
5265 : //pap.dxaFromText dxa
5266 : {50, 0}, //"sprmPFLocked", pap.fLocked
5267 : //0 or 1 byte
5268 : {51, &SwWW8ImplReader::Read_WidowControl}, //"sprmPFWidowControl",
5269 : //pap.fWidowControl 0 or 1 byte
5270 : {52, 0}, //"?sprmPRuler 52",
5271 : {53, 0}, //"??53",
5272 : {54, 0}, //"??54",
5273 : {55, 0}, //"??55",
5274 : {56, 0}, //"??56",
5275 : {57, 0}, //"??57",
5276 : {58, 0}, //"??58",
5277 : {59, 0}, //"??59",
5278 : {60, 0}, //"??60",
5279 : {61, 0}, //"??61",
5280 : {62, 0}, //"??62",
5281 : {63, 0}, //"??63",
5282 : {64, &SwWW8ImplReader::Read_ParaBiDi}, //"rtl bidi ?
5283 : {65, &SwWW8ImplReader::Read_CFRMarkDel}, //"sprmCFStrikeRM",
5284 : //chp.fRMarkDel 1 or 0 bit
5285 : {66, &SwWW8ImplReader::Read_CFRMark}, //"sprmCFRMark", chp.fRMark
5286 : //1 or 0 bit
5287 : {67, &SwWW8ImplReader::Read_FldVanish}, //"sprmCFFldVanish",
5288 : //chp.fFldVanish 1 or 0 bit
5289 : {68, &SwWW8ImplReader::Read_PicLoc}, //"sprmCPicLocation",
5290 : //chp.fcPic and chp.fSpec
5291 : {69, 0}, //"sprmCIbstRMark",
5292 : //chp.ibstRMark index into
5293 : //sttbRMark
5294 : {70, 0}, //"sprmCDttmRMark", chp.dttm
5295 : //DTTM long
5296 : {71, 0}, //"sprmCFData", chp.fData 1 or
5297 : //0 bit
5298 : {72, 0}, //"sprmCRMReason",
5299 : //chp.idslRMReason an index to
5300 : //a table
5301 : {73, &SwWW8ImplReader::Read_CharSet}, //"sprmCChse", chp.fChsDiff
5302 : //and chp.chse 3 bytes
5303 : {74, &SwWW8ImplReader::Read_Symbol}, //"sprmCSymbol", chp.fSpec,
5304 : //chp.chSym and chp.ftcSym
5305 : {75, &SwWW8ImplReader::Read_Obj}, //"sprmCFOle2", chp.fOle2 1
5306 : //or 0 bit
5307 : {76, 0}, //"??76",
5308 : {77, 0}, //"??77",
5309 : {78, 0}, //"??78",
5310 : {79, 0}, //"??79",
5311 : {80, &SwWW8ImplReader::Read_CColl}, //"sprmCIstd", chp.istd istd,
5312 : //see stylesheet definition
5313 : //short
5314 : {81, 0}, //"sprmCIstdPermute", chp.istd
5315 : //permutation vector
5316 : {82, 0}, //"sprmCDefault", whole CHP
5317 : //none variable length
5318 : {83, 0}, //"sprmCPlain", whole CHP
5319 : //none 0
5320 : {84, 0}, //"??84",
5321 : {85, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFBold", chp.fBold 0,1,
5322 : //128, or 129 byte
5323 : {86, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFItalic", chp.fItalic
5324 : //0,1, 128, or 129 byte
5325 : {87, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFStrike", chp.fStrike
5326 : //0,1, 128, or 129 byte
5327 : {88, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFOutline", chp.fOutline
5328 : //0,1, 128, or 129 byte
5329 : {89, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFShadow", chp.fShadow
5330 : //0,1, 128, or 129 byte
5331 : {90, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFSmallCaps",
5332 : //chp.fSmallCaps 0,1, 128, or
5333 : //129 byte
5334 : {91, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFCaps", chp.fCaps 0,1,
5335 : //128, or 129 byte
5336 : {92, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFVanish", chp.fVanish
5337 : //0,1, 128, or 129 byte
5338 : {93, &SwWW8ImplReader::Read_FontCode}, //"sprmCFtc", chp.ftc ftc word
5339 : {94, &SwWW8ImplReader::Read_Underline}, // "sprmCKul", chp.kul kul byte
5340 : {95, 0}, //"sprmCSizePos", chp.hps,
5341 : //chp.hpsPos 3 bytes
5342 : {96, &SwWW8ImplReader::Read_Kern}, //"sprmCDxaSpace",
5343 : //chp.dxaSpace dxa word
5344 : {97, &SwWW8ImplReader::Read_Language}, //"sprmCLid", chp.lid LID word
5345 : {98, &SwWW8ImplReader::Read_TxtColor}, //"sprmCIco", chp.ico ico byte
5346 : {99, &SwWW8ImplReader::Read_FontSize}, //"sprmCHps", chp.hps hps word!
5347 : {100, 0}, //"sprmCHpsInc", chp.hps byte
5348 : {101, &SwWW8ImplReader::Read_SubSuperProp}, //"sprmCHpsPos", chp.hpsPos
5349 : //hps byte
5350 : {102, 0}, //"sprmCHpsPosAdj", chp.hpsPos
5351 : //hps byte
5352 : {103, &SwWW8ImplReader::Read_Majority}, //"?sprmCMajority", chp.fBold,
5353 : //chp.fItalic, chp.fSmallCaps
5354 : {104, &SwWW8ImplReader::Read_SubSuper}, //"sprmCIss", chp.iss iss byte
5355 : {105, 0}, //"sprmCHpsNew50", chp.hps hps
5356 : //variable width, length
5357 : //always recorded as 2
5358 : {106, 0}, //"sprmCHpsInc1", chp.hps
5359 : //complex variable width,
5360 : //length always recorded as 2
5361 : {107, &SwWW8ImplReader::Read_FontKern}, //"sprmCHpsKern", chp.hpsKern
5362 : //hps short
5363 : {108, &SwWW8ImplReader::Read_Majority}, //"sprmCMajority50", chp.fBold,
5364 : //chp.fItalic, chp.fSmallCaps,
5365 : // chp.fVanish, ...
5366 : {109, 0}, //"sprmCHpsMul", chp.hps
5367 : //percentage to grow hps short
5368 : {110, 0}, //"sprmCCondHyhen", chp.ysri
5369 : //ysri short
5370 : {111, &SwWW8ImplReader::Read_FontCode}, //ww7 font
5371 : {112, &SwWW8ImplReader::Read_FontCode}, //ww7 CJK font
5372 : {113, &SwWW8ImplReader::Read_FontCode}, //ww7 rtl font
5373 : {114, &SwWW8ImplReader::Read_Language}, //ww7 lid
5374 : {115, &SwWW8ImplReader::Read_TxtColor}, //ww7 rtl colour ?
5375 : {116, &SwWW8ImplReader::Read_FontSize},
5376 : {117, &SwWW8ImplReader::Read_Special}, //"sprmCFSpec", chp.fSpec 1
5377 : //or 0 bit
5378 : {118, &SwWW8ImplReader::Read_Obj}, //"sprmCFObj", chp.fObj 1 or 0
5379 : //bit
5380 : {119, 0}, //"sprmPicBrcl", pic.brcl brcl
5381 : //(see PIC structure
5382 : //definition) byte
5383 : {120, 0}, //"sprmPicScale", pic.mx,
5384 : //pic.my, pic.dxaCropleft,
5385 : {121, 0}, //"sprmPicBrcTop", pic.brcTop
5386 : //BRC word
5387 : {122, 0}, //"sprmPicBrcLeft",
5388 : //pic.brcLeft BRC word
5389 : {123, 0}, //"sprmPicBrcBottom",
5390 : //pic.brcBottom BRC word
5391 : {124, 0}, //"sprmPicBrcRight",
5392 : //pic.brcRight BRC word
5393 : {125, 0}, //"??125",
5394 : {126, 0}, //"??126",
5395 : {127, 0}, //"??127",
5396 : {128, 0}, //"??128",
5397 : {129, 0}, //"??129",
5398 : {130, 0}, //"??130",
5399 : {131, 0}, //"sprmSScnsPgn", sep.cnsPgn
5400 : //cns byte
5401 : {132, 0}, //"sprmSiHeadingPgn",
5402 : //sep.iHeadingPgn heading
5403 : //number level byte
5404 : {133, &SwWW8ImplReader::Read_OLST}, //"sprmSOlstAnm", sep.olstAnm
5405 : //OLST variable length
5406 : {134, 0}, //"??135",
5407 : {135, 0}, //"??135",
5408 : {136, 0}, //"sprmSDxaColWidth",
5409 : //sep.rgdxaColWidthSpacing
5410 : //complex 3 bytes
5411 : {137, 0}, //"sprmSDxaColSpacing",
5412 : //sep.rgdxaColWidthSpacing
5413 : //complex 3 bytes
5414 : {138, 0}, //"sprmSFEvenlySpaced",
5415 : //sep.fEvenlySpaced 1 or 0 byte
5416 : {139, 0}, //"sprmSFProtected",
5417 : //sep.fUnlocked 1 or 0 byte
5418 : {140, 0}, //"sprmSDmBinFirst",
5419 : //sep.dmBinFirst word
5420 : {141, 0}, //"sprmSDmBinOther",
5421 : //sep.dmBinOther word
5422 : {142, 0}, //"sprmSBkc", sep.bkc bkc
5423 : //byte BreakCode
5424 : {143, 0}, //"sprmSFTitlePage",
5425 : //sep.fTitlePage 0 or 1 byte
5426 : {144, 0}, //"sprmSCcolumns", sep.ccolM1
5427 : //# of cols - 1 word
5428 : {145, 0}, //"sprmSDxaColumns",
5429 : //sep.dxaColumns dxa word
5430 : {146, 0}, //"sprmSFAutoPgn",
5431 : //sep.fAutoPgn obsolete byte
5432 : {147, 0}, //"sprmSNfcPgn", sep.nfcPgn
5433 : //nfc byte
5434 : {148, 0}, //"sprmSDyaPgn", sep.dyaPgn
5435 : //dya short
5436 : {149, 0}, //"sprmSDxaPgn", sep.dxaPgn
5437 : //dya short
5438 : {150, 0}, //"sprmSFPgnRestart",
5439 : //sep.fPgnRestart 0 or 1 byte
5440 : {151, 0}, //"sprmSFEndnote", sep.fEndnote
5441 : //0 or 1 byte
5442 : {152, 0}, //"sprmSLnc", sep.lnc lnc byte
5443 : {153, 0}, //"sprmSGprfIhdt", sep.grpfIhdt
5444 : //grpfihdt byte
5445 : {154, 0}, //"sprmSNLnnMod", sep.nLnnMod
5446 : //non-neg int. word
5447 : {155, 0}, //"sprmSDxaLnn", sep.dxaLnn
5448 : //dxa word
5449 : {156, 0}, //"sprmSDyaHdrTop",
5450 : //sep.dyaHdrTop dya word
5451 : {157, 0}, //"sprmSDyaHdrBottom",
5452 : //sep.dyaHdrBottom dya word
5453 : {158, 0}, //"sprmSLBetween",
5454 : //sep.fLBetween 0 or 1 byte
5455 : {159, 0}, //"sprmSVjc", sep.vjc vjc byte
5456 : {160, 0}, //"sprmSLnnMin", sep.lnnMin
5457 : //lnn word
5458 : {161, 0}, //"sprmSPgnStart", sep.pgnStart
5459 : //pgn word
5460 : {162, 0}, //"sprmSBOrientation",
5461 : //sep.dmOrientPage dm byte
5462 : {163, 0}, //"?SprmSBCustomize 163", ?
5463 : {164, 0}, //"sprmSXaPage", sep.xaPage xa
5464 : //word
5465 : {165, 0}, //"sprmSYaPage", sep.yaPage ya
5466 : //word
5467 : {166, 0}, //"sprmSDxaLeft", sep.dxaLeft
5468 : //dxa word
5469 : {167, 0}, //"sprmSDxaRight", sep.dxaRight
5470 : //dxa word
5471 : {168, 0}, //"sprmSDyaTop", sep.dyaTop //dya word
5472 : {169, 0}, //"sprmSDyaBottom",
5473 : //sep.dyaBottom dya word
5474 : {170, 0}, //"sprmSDzaGutter",
5475 : //sep.dzaGutter dza word
5476 : {171, 0}, //"sprmSDMPaperReq",
5477 : //sep.dmPaperReq dm word
5478 : {172, 0}, //"??172",
5479 : {173, 0}, //"??173",
5480 : {174, 0}, //"??174",
5481 : {175, 0}, //"??175",
5482 : {176, 0}, //"??176",
5483 : {177, 0}, //"??177",
5484 : {178, 0}, //"??178",
5485 : {179, 0}, //"??179",
5486 : {180, 0}, //"??180",
5487 : {181, 0}, //"??181",
5488 : {182, 0}, //"sprmTJc", tap.jc jc word
5489 : //(low order byte is
5490 : //significant)
5491 : {183, 0}, //"sprmTDxaLeft",
5492 : //tap.rgdxaCenter dxa word
5493 : {184, 0}, //"sprmTDxaGapHalf",
5494 : //tap.dxaGapHalf,
5495 : //tap.rgdxaCenter dxa word
5496 : {185, 0}, //"sprmTFCantSplit"
5497 : //tap.fCantSplit 1 or 0 byte
5498 : {186, 0}, //"sprmTTableHeader",
5499 : //tap.fTableHeader 1 or 0 byte
5500 : {187, 0}, //"sprmTTableBorders",
5501 : //tap.rgbrcTable complex
5502 : //12 bytes
5503 : {188, 0}, //"sprmTDefTable10",
5504 : //tap.rgdxaCenter, tap.rgtc
5505 : //complex variable length
5506 : {189, 0}, //"sprmTDyaRowHeight",
5507 : //tap.dyaRowHeight dya word
5508 : {190, 0}, //"?sprmTDefTable", tap.rgtc
5509 : //complex
5510 : {191, 0}, //"?sprmTDefTableShd",
5511 : //tap.rgshd complex
5512 : {192, 0}, //"sprmTTlp", tap.tlp TLP
5513 : //4 bytes
5514 : {193, 0}, //"sprmTSetBrc",
5515 : //tap.rgtc[].rgbrc complex
5516 : //5 bytes
5517 : {194, 0}, //"sprmTInsert",
5518 : //tap.rgdxaCenter,
5519 : //tap.rgtc complex 4 bytes
5520 : {195, 0}, //"sprmTDelete",
5521 : //tap.rgdxaCenter,
5522 : //tap.rgtc complex word
5523 : {196, 0}, //"sprmTDxaCol",
5524 : //tap.rgdxaCenter complex
5525 : //4 bytes
5526 : {197, 0}, //"sprmTMerge",
5527 : //tap.fFirstMerged,
5528 : //tap.fMerged complex word
5529 : {198, 0}, //"sprmTSplit",
5530 : //tap.fFirstMerged,
5531 : //tap.fMerged complex word
5532 : {199, 0}, //"sprmTSetBrc10",
5533 : //tap.rgtc[].rgbrc complex
5534 : //5 bytes
5535 : {200, 0}, //"sprmTSetShd", tap.rgshd
5536 : //complex 4 bytes
5537 : {207, 0}, //dunno
5538 : };
5539 :
5540 0 : static wwSprmDispatcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
5541 0 : return &aSprmSrch;
5542 : }
5543 :
5544 79482 : const wwSprmDispatcher *GetWW8SprmDispatcher()
5545 : {
5546 : static SprmReadInfo aSprms[] =
5547 : {
5548 : {0, 0}, // "0" Default bzw. Error
5549 :
5550 : {0x4600, &SwWW8ImplReader::Read_StyleCode}, //"sprmPIstd" pap.istd;istd
5551 : //(style code);short;
5552 : {0xC601, 0}, //"sprmPIstdPermute" pap.istd;
5553 : //permutation vector;
5554 : //variable length;
5555 : {0x2602, 0}, //"sprmPIncLvl" pap.istd,
5556 : //pap.lvl;difference between
5557 : //istd of base PAP and istd of
5558 : //PAP to be produced; byte;
5559 : {0x2403, &SwWW8ImplReader::Read_Justify}, //"sprmPJc" pap.jc;jc
5560 : //(justification);byte;
5561 : {0x2404, 0}, //"sprmPFSideBySide"
5562 : //pap.fSideBySide;0 or 1;byte;
5563 : {0x2405, &SwWW8ImplReader::Read_KeepLines}, //"sprmPFKeep" pap.fKeep;0 or
5564 : //1;byte;
5565 : {0x2406, &SwWW8ImplReader::Read_KeepParas}, //"sprmPFKeepFollow"
5566 : //pap.fKeepFollow;0 or 1;byte;
5567 : {0x2407, &SwWW8ImplReader::Read_BreakBefore},//"sprmPFPageBreakBefore"
5568 : //pap.fPageBreakBefore;0 or 1;
5569 : //byte;
5570 : {0x2408, 0}, //"sprmPBrcl" pap.brcl;brcl;
5571 : //byte;
5572 : {0x2409, 0}, //"sprmPBrcp" pap.brcp;brcp;
5573 : //byte;
5574 : {0x260A, &SwWW8ImplReader::Read_ListLevel}, //"sprmPIlvl" pap.ilvl;ilvl;
5575 : //byte;
5576 : {0x460B, &SwWW8ImplReader::Read_LFOPosition},//"sprmPIlfo" pap.ilfo;ilfo
5577 : //(list index) ;short;
5578 : {0x240C, &SwWW8ImplReader::Read_NoLineNumb}, //"sprmPFNoLineNumb"
5579 : //pap.fNoLnn;0 or 1;byte;
5580 : {0xC60D, &SwWW8ImplReader::Read_Tab}, //"sprmPChgTabsPapx"
5581 : //pap.itbdMac, pap.rgdxaTab,
5582 : //pap.rgtbd;complex;variable
5583 : //length
5584 : {0x840E, &SwWW8ImplReader::Read_LR}, //Word 97 version of "sprmPDxaRight" pap.dxaRight;
5585 : //dxa;word;
5586 : {0x840F, &SwWW8ImplReader::Read_LR}, //Apparently Word 97 version of "sprmPDxaLeft" pap.dxaLeft;
5587 : //dxa;word;
5588 : {0x4610, 0}, //"sprmPNest" pap.dxaLeft;
5589 : //dxa;word;
5590 : {0x8411, &SwWW8ImplReader::Read_LR}, //Word 97 version of "sprmPDxaLeft1" pap.dxaLeft1;
5591 : //dxa;word;
5592 : {0x6412, &SwWW8ImplReader::Read_LineSpace}, //"sprmPDyaLine" pap.lspd;
5593 : //an LSPD, a long word
5594 : //structure consisting of a
5595 : //short of dyaLine followed by
5596 : //a short of fMultLinespace;
5597 : //long;
5598 : {0xA413, &SwWW8ImplReader::Read_UL}, //"sprmPDyaBefore"
5599 : //pap.dyaBefore;dya;word;
5600 : {0xA414, &SwWW8ImplReader::Read_UL}, //"sprmPDyaAfter" pap.dyaAfter;
5601 : //dya;word;
5602 : {0xC615, 0}, //"sprmPChgTabs" pap.itbdMac,
5603 : //pap.rgdxaTab, pap.rgtbd;
5604 : //complex;variable length;
5605 : {0x2416, 0}, //"sprmPFInTable" pap.fInTable;
5606 : //0 or 1;byte;
5607 : {0x2417, &SwWW8ImplReader::Read_TabRowEnd}, //"sprmPFTtp" pap.fTtp;0 or 1;
5608 : //byte;
5609 : {0x8418, 0}, //"sprmPDxaAbs" pap.dxaAbs;dxa;
5610 : //word;
5611 : {0x8419, 0}, //"sprmPDyaAbs" pap.dyaAbs;dya;
5612 : //word;
5613 : {0x841A, 0}, //"sprmPDxaWidth" pap.dxaWidth;
5614 : //dxa;word;
5615 : {0x261B, &SwWW8ImplReader::Read_ApoPPC}, //"sprmPPc" pap.pcHorz,
5616 : //pap.pcVert;complex;byte;
5617 : {0x461C, 0}, //"sprmPBrcTop10" pap.brcTop;
5618 : //BRC10;word;
5619 : {0x461D, 0}, //"sprmPBrcLeft10" pap.brcLeft;
5620 : //BRC10;word;
5621 : {0x461E, 0}, //"sprmPBrcBottom10"
5622 : //pap.brcBottom;BRC10;word;
5623 : {0x461F, 0}, //"sprmPBrcRight10"
5624 : //pap.brcRight;BRC10;word;
5625 : {0x4620, 0}, //"sprmPBrcBetween10"
5626 : //pap.brcBetween;BRC10;word;
5627 : {0x4621, 0}, //"sprmPBrcBar10" pap.brcBar;
5628 : //BRC10;word;
5629 : {0x4622, 0}, //"sprmPDxaFromText10"
5630 : //pap.dxaFromText;dxa;word;
5631 : {0x2423, 0}, //"sprmPWr" pap.wr;wr;byte;
5632 : {0x6424, &SwWW8ImplReader::Read_Border}, //"sprmPBrcTop80" pap.brcTop;BRC;
5633 : //long;
5634 : {0x6425, &SwWW8ImplReader::Read_Border}, //"sprmPBrcLeft80" pap.brcLeft;
5635 : //BRC;long;
5636 : {0x6426, &SwWW8ImplReader::Read_Border}, //"sprmPBrcBottom80"
5637 : //pap.brcBottom;BRC;long;
5638 : {0x6427, &SwWW8ImplReader::Read_Border}, //"sprmPBrcRight80" pap.brcRight;
5639 : //BRC;long;
5640 : {0x6428, &SwWW8ImplReader::Read_Border}, //"sprmPBrcBetween80"
5641 : //pap.brcBetween;BRC;long;
5642 : {0x6629, 0}, //"sprmPBrcBar" pap.brcBar;BRC;
5643 : //long;
5644 : {0x242A, &SwWW8ImplReader::Read_Hyphenation},//"sprmPFNoAutoHyph"
5645 : //pap.fNoAutoHyph;0 or 1;byte;
5646 : {0x442B, 0}, //"sprmPWHeightAbs"
5647 : //pap.wHeightAbs;w;word;
5648 : {0x442C, 0}, //"sprmPDcs" pap.dcs;DCS;short;
5649 : {0x442D, &SwWW8ImplReader::Read_Shade}, //"sprmPShd" pap.shd;SHD;word;
5650 : {0x842E, 0}, //"sprmPDyaFromText"
5651 : //pap.dyaFromText;dya;word;
5652 : {0x842F, 0}, //"sprmPDxaFromText"
5653 : //pap.dxaFromText;dxa;word;
5654 : {0x2430, 0}, //"sprmPFLocked" pap.fLocked;
5655 : //0 or 1;byte;
5656 : {0x2431, &SwWW8ImplReader::Read_WidowControl},//"sprmPFWidowControl"
5657 : //pap.fWidowControl;0 or 1;byte
5658 : {0xC632, 0}, //"sprmPRuler" variable length;
5659 : {0x2433, &SwWW8ImplReader::Read_BoolItem}, //"sprmPFKinsoku" pap.fKinsoku;
5660 : //0 or 1;byte;
5661 : {0x2434, 0}, //"sprmPFWordWrap"
5662 : //pap.fWordWrap;0 or 1;byte;
5663 : {0x2435, &SwWW8ImplReader::Read_BoolItem}, //"sprmPFOverflowPunct"
5664 : //pap.fOverflowPunct; 0 or 1;
5665 : //byte;
5666 : {0x2436, 0}, //"sprmPFTopLinePunct"
5667 : //pap.fTopLinePunct;0 or 1;byte
5668 : {0x2437, &SwWW8ImplReader::Read_BoolItem}, //"sprmPFAutoSpaceDE"
5669 : //pap.fAutoSpaceDE;0 or 1;byte;
5670 : {0x2438, 0}, //"sprmPFAutoSpaceDN"
5671 : //pap.fAutoSpaceDN;0 or 1;byte;
5672 : {NS_sprm::LN_PWAlignFont, &SwWW8ImplReader::Read_AlignFont}, //"sprmPWAlignFont"
5673 : //pap.wAlignFont;iFa; word;
5674 : {0x443A, 0}, //"sprmPFrameTextFlow"
5675 : //pap.fVertical pap.fBackward
5676 : //pap.fRotateFont;complex; word
5677 : {0x243B, 0}, //"sprmPISnapBaseLine" obsolete
5678 : //not applicable in Word97
5679 : //and later versions;;byte;
5680 : {0xC63E, &SwWW8ImplReader::Read_ANLevelDesc},//"sprmPAnld" pap.anld;;
5681 : //variable length;
5682 : {0xC63F, 0}, //"sprmPPropRMark"
5683 : //pap.fPropRMark;complex;
5684 : //variable length;
5685 : {0x2640, &SwWW8ImplReader::Read_POutLvl}, //"sprmPOutLvl" pap.lvl;has no
5686 : //effect if pap.istd is < 1 or
5687 : //is > 9;byte;
5688 : {0x2441, &SwWW8ImplReader::Read_ParaBiDi}, //"sprmPFBiDi" ;;byte;
5689 : {0x2443, 0}, //"sprmPFNumRMIns"
5690 : //pap.fNumRMIns;1 or 0;bit;
5691 : {0x2444, 0}, //"sprmPCrLf" ;;byte;
5692 : {0xC645, 0}, //"sprmPNumRM" pap.numrm;;
5693 : //variable length;
5694 : {0x6645, 0}, //"sprmPHugePapx" ;fc in the
5695 : //data stream to locate the
5696 : //huge grpprl; long;
5697 : {0x6646, 0}, //"sprmPHugePapx" ;fc in the
5698 : //data stream to locate the
5699 : //huge grpprl; long;
5700 : {0x2447, &SwWW8ImplReader::Read_UsePgsuSettings},//"sprmPFUsePgsuSettings"
5701 : //pap.fUsePgsuSettings;1 or 0;
5702 : //byte;
5703 : {0x2448, 0}, //"sprmPFAdjustRight"
5704 : //pap.fAdjustRight;1 or 0;byte;
5705 : {0x0800, &SwWW8ImplReader::Read_CFRMarkDel}, //"sprmCFRMarkDel"
5706 : //chp.fRMarkDel;1 or 0;bit;
5707 : {0x0801, &SwWW8ImplReader::Read_CFRMark}, //"sprmCFRMark" chp.fRMark;1
5708 : //or 0;bit;
5709 : {0x0802, &SwWW8ImplReader::Read_FldVanish}, //"sprmCFFldVanish"
5710 : //chp.fFldVanish;1 or 0;bit;
5711 : {0x6A03, &SwWW8ImplReader::Read_PicLoc}, //"sprmCPicLocation" chp.fcPic
5712 : //and chp.fSpec;variable
5713 : //length, length recorded is
5714 : //always 4;
5715 : {0x4804, 0}, //"sprmCIbstRMark"
5716 : //chp.ibstRMark;index into
5717 : //sttbRMark;short;
5718 : {0x6805, 0}, //"sprmCDttmRMark"
5719 : //chp.dttmRMark;DTTM;long;
5720 : {0x0806, 0}, //"sprmCFData" chp.fData;1 or
5721 : //0;bit;
5722 : {0x4807, 0}, //"sprmCIdslRMark"
5723 : //chp.idslRMReason;an index to
5724 : //a table of strings defined in
5725 : //Word 6.0 executables;short;
5726 : {0xEA08, &SwWW8ImplReader::Read_CharSet}, //"sprmCChs" chp.fChsDiff and
5727 : //chp.chse;3 bytes;
5728 : {0x6A09, &SwWW8ImplReader::Read_Symbol}, //"sprmCSymbol" chp.fSpec,
5729 : //chp.xchSym and chp.ftcSym;
5730 : //variable length, length
5731 : //recorded is always 4;
5732 : {0x080A, &SwWW8ImplReader::Read_Obj}, //"sprmCFOle2" chp.fOle2;1 or
5733 : //0;bit;
5734 : //0x480B, //"sprmCIdCharType", obsolete:
5735 : //not applicable in Word97
5736 : //and later versions
5737 : {0x2A0C, &SwWW8ImplReader::Read_CharHighlight},//"sprmCHighlight"
5738 : //chp.fHighlight,
5739 : //chp.icoHighlight;ico
5740 : //(fHighlight is set to 1 iff
5741 : //ico is not 0);byte;
5742 : {0x680E, &SwWW8ImplReader::Read_PicLoc}, //"sprmCObjLocation" chp.fcObj;
5743 : //FC;long;
5744 : //0x2A10, ? ? ?, //"sprmCFFtcAsciSymb"
5745 : {0x4A30, &SwWW8ImplReader::Read_CColl}, //"sprmCIstd" chp.istd;istd,
5746 : //short;
5747 : {0xCA31, 0}, //"sprmCIstdPermute" chp.istd;
5748 : //permutation vector; variable
5749 : //length;
5750 : {0x2A32, 0}, //"sprmCDefault" whole CHP;none
5751 : //;variable length;
5752 : {0x2A33, 0}, //"sprmCPlain" whole CHP;none;
5753 : //Laenge: 0;
5754 : {0x2A34, &SwWW8ImplReader::Read_Emphasis}, //"sprmCKcd"
5755 : {0x0835, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFBold" chp.fBold;0,1,
5756 : //128, or 129; byte;
5757 : {0x0836, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFItalic" chp.fItalic;0,
5758 : //1, 128, or 129; byte;
5759 : {0x0837, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFStrike" chp.fStrike;0,
5760 : //1, 128, or 129; byte;
5761 : {0x0838, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFOutline" chp.fOutline;
5762 : //0,1, 128, or 129; byte;
5763 : {0x0839, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFShadow" chp.fShadow;0,
5764 : //1, 128, or 129; byte;
5765 : {0x083A, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFSmallCaps"
5766 : //chp.fSmallCaps;0,1, 128, or
5767 : //129;byte;
5768 : {0x083B, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFCaps" chp.fCaps;0,1,
5769 : //128, or 129; byte;
5770 : {0x083C, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFVanish" chp.fVanish;0,
5771 : //1, 128, or 129; byte;
5772 : //0x4A3D, 0, //"sprmCFtcDefault" ftc, only
5773 : //used internally, never
5774 : //stored in file;word;
5775 : {0x2A3E, &SwWW8ImplReader::Read_Underline}, //"sprmCKul" chp.kul;kul;byte;
5776 : {0xEA3F, 0}, //"sprmCSizePos" chp.hps,
5777 : //chp.hpsPos;3 bytes;
5778 : {0x8840, &SwWW8ImplReader::Read_Kern}, //"sprmCDxaSpace" chp.dxaSpace;
5779 : //dxa;word;
5780 : {0x4A41, &SwWW8ImplReader::Read_Language}, //"sprmCLid" ;only used
5781 : //internally never stored;word;
5782 : {0x2A42, &SwWW8ImplReader::Read_TxtColor}, //"sprmCIco" chp.ico;ico;byte;
5783 : {0x4A43, &SwWW8ImplReader::Read_FontSize}, //"sprmCHps" chp.hps;hps;byte;
5784 : {0x2A44, 0}, //"sprmCHpsInc" chp.hps;byte;
5785 : {0x4845, &SwWW8ImplReader::Read_SubSuperProp},//"sprmCHpsPos" chp.hpsPos;
5786 : //hps; byte;
5787 : {0x2A46, 0}, //"sprmCHpsPosAdj" chp.hpsPos;
5788 : //hps; byte;
5789 : {0xCA47, &SwWW8ImplReader::Read_Majority}, //"sprmCMajority" chp.fBold,
5790 : //chp.fItalic, chp.fSmallCaps,
5791 : //chp.fVanish, chp.fStrike,
5792 : //chp.fCaps, chp.rgftc,
5793 : //chp.hps, chp.hpsPos, chp.kul,
5794 : //chp.dxaSpace, chp.ico,
5795 : //chp.rglid;complex;variable
5796 : //length, length byte plus
5797 : //size of following grpprl;
5798 : {0x2A48, &SwWW8ImplReader::Read_SubSuper}, //"sprmCIss" chp.iss;iss;byte;
5799 : {0xCA49, 0}, //"sprmCHpsNew50" chp.hps;hps;
5800 : //variable width, length
5801 : //always recorded as 2;
5802 : {0xCA4A, 0}, //"sprmCHpsInc1" chp.hps;
5803 : //complex; variable width,
5804 : //length always recorded as 2;
5805 : {0x484B, &SwWW8ImplReader::Read_FontKern}, //"sprmCHpsKern" chp.hpsKern;
5806 : //hps;short;
5807 : {0xCA4C, &SwWW8ImplReader::Read_Majority}, //"sprmCMajority50" chp.fBold,
5808 : //chp.fItalic, chp.fSmallCaps,
5809 : //chp.fVanish, chp.fStrike,
5810 : //chp.fCaps, chp.ftc, chp.hps,
5811 : //chp.hpsPos, chp.kul,
5812 : //chp.dxaSpace, chp.ico;
5813 : //complex; variable length;
5814 : {0x4A4D, 0}, //"sprmCHpsMul" chp.hps;
5815 : //percentage to grow hps;short;
5816 : {0x484E, 0}, //"sprmCYsri" chp.ysri;ysri;
5817 : //short;
5818 : {0x4A4F, &SwWW8ImplReader::Read_FontCode}, //"sprmCRgFtc0" chp.rgftc[0];
5819 : //ftc for ASCII text; short;
5820 : {0x4A50, &SwWW8ImplReader::Read_FontCode}, //"sprmCRgFtc1" chp.rgftc[1];
5821 : //ftc for Far East text;short;
5822 : {0x4A51, &SwWW8ImplReader::Read_FontCode}, //"sprmCRgFtc2" chp.rgftc[2];
5823 : //ftc for non-Far East text;
5824 : //short;
5825 : {0x4852, &SwWW8ImplReader::Read_ScaleWidth}, //"sprmCCharScale"
5826 : {0x2A53, &SwWW8ImplReader::Read_BoldUsw}, //"sprmCFDStrike" chp.fDStrike;
5827 : //;byte;
5828 : {0x0854, &SwWW8ImplReader::Read_Relief}, //"sprmCFImprint" chp.fImprint;
5829 : //1 or 0;bit;
5830 : {0x0855, &SwWW8ImplReader::Read_Special}, //"sprmCFSpec" chp.fSpec;
5831 : //1 or 0;bit;
5832 : {0x0856, &SwWW8ImplReader::Read_Obj}, //"sprmCFObj" chp.fObj;1 or 0;
5833 : //bit;
5834 : {0xCA57, &SwWW8ImplReader::Read_CPropRMark}, //"sprmCPropRMark"
5835 : //chp.fPropRMark,
5836 : //chp.ibstPropRMark,
5837 : //chp.dttmPropRMark;Complex;
5838 : //variable length always
5839 : //recorded as 7 bytes;
5840 : {0x0858, &SwWW8ImplReader::Read_Relief}, //"sprmCFEmboss" chp.fEmboss;
5841 : //1 or 0;bit;
5842 : {0x2859, &SwWW8ImplReader::Read_TxtAnim}, //"sprmCSfxText" chp.sfxtText;
5843 : //text animation;byte;
5844 : {0x085A, &SwWW8ImplReader::Read_Bidi}, //"sprmCFBiDi"
5845 : {0x085B, 0}, //"sprmCFDiacColor"
5846 : {0x085C, &SwWW8ImplReader::Read_BoldBiDiUsw},//"sprmCFBoldBi"
5847 : {0x085D, &SwWW8ImplReader::Read_BoldBiDiUsw},//"sprmCFItalicBi"
5848 : {0x4A5E, &SwWW8ImplReader::Read_FontCode}, //"sprmCFtcBi"
5849 : {0x485F, &SwWW8ImplReader::Read_Language}, //"sprmCLidBi"
5850 : //0x4A60, ? ? ?, //"sprmCIcoBi",
5851 : {0x4A61, &SwWW8ImplReader::Read_FontSize}, //"sprmCHpsBi"
5852 : {0xCA62, 0}, //"sprmCDispFldRMark"
5853 : //chp.fDispFldRMark,
5854 : //chp.ibstDispFldRMark,
5855 : //chp.dttmDispFldRMark ;
5856 : //Complex;variable length
5857 : //always recorded as 39 bytes;
5858 : {0x4863, 0}, //"sprmCIbstRMarkDel"
5859 : //chp.ibstRMarkDel;index into
5860 : //sttbRMark;short;
5861 : {NS_sprm::LN_CDttmRMarkDel, 0},
5862 : //chp.dttmRMarkDel;DTTM;long;
5863 : {0x6865, &SwWW8ImplReader::Read_CharBorder}, //"sprmCBrc80" chp.brc;BRC;long;
5864 : {0xca72, &SwWW8ImplReader::Read_CharBorder}, //"sprmCBrc" chp.brc;BRC;long;
5865 : {0x4866, &SwWW8ImplReader::Read_CharShadow}, //"sprmCShd80" chp.shd;SHD;short;
5866 : {0x4867, 0}, //"sprmCIdslRMarkDel"
5867 : //chp.idslRMReasonDel;an index
5868 : //to a table of strings
5869 : //defined in Word 6.0
5870 : //executables;short;
5871 : {0x0868, 0}, //"sprmCFUsePgsuSettings"
5872 : //chp.fUsePgsuSettings; 1 or 0;
5873 : //bit;
5874 : {0x486B, 0}, //"sprmCCpg" ;;word;
5875 : {0x486D, &SwWW8ImplReader::Read_Language}, //"sprmCRgLid0_80" chp.rglid[0];
5876 : //LID: for non-Far East text;
5877 : //word;
5878 : {0x486E, &SwWW8ImplReader::Read_Language}, //"sprmCRgLid1_80" chp.rglid[1];
5879 : //LID: for Far East text;word;
5880 : {0x286F, &SwWW8ImplReader::Read_IdctHint}, //"sprmCIdctHint" chp.idctHint;
5881 : //IDCT: byte;
5882 : {0x2E00, 0}, //"sprmPicBrcl" pic.brcl;brcl
5883 : //(see PIC structure
5884 : //definition);byte;
5885 : {0xCE01, 0}, //"sprmPicScale" pic.mx,
5886 : //pic.my, pic.dxaCropleft,
5887 : //pic.dyaCropTop
5888 : //pic.dxaCropRight,
5889 : //pic.dyaCropBottom;Complex;
5890 : //length byte plus 12 bytes;
5891 : {0x6C02, 0}, //"sprmPicBrcTop80" pic.brcTop;
5892 : //BRC;long;
5893 : {0x6C03, 0}, //"sprmPicBrcLeft80" pic.brcLeft;
5894 : //BRC;long;
5895 : {0x6C04, 0}, //"sprmPicBrcBottom80"
5896 : //pic.brcBottom;BRC;long;
5897 : {0x6C05, 0}, //"sprmPicBrcRight80"
5898 : //pic.brcRight;BRC;long;
5899 : {0x3000, 0}, //"sprmScnsPgn" sep.cnsPgn;cns;
5900 : //byte;
5901 : {0x3001, 0}, //"sprmSiHeadingPgn"
5902 : //sep.iHeadingPgn;heading
5903 : //number level;byte;
5904 : {0xD202, &SwWW8ImplReader::Read_OLST}, //"sprmSOlstAnm" sep.olstAnm;
5905 : //OLST;variable length;
5906 : {0xF203, 0}, //"sprmSDxaColWidth"
5907 : //sep.rgdxaColWidthSpacing;
5908 : //complex; 3 bytes;
5909 : {0xF204, 0}, //"sprmSDxaColSpacing"
5910 : //sep.rgdxaColWidthSpacing;
5911 : //complex; 3 bytes;
5912 : {0x3005, 0}, //"sprmSFEvenlySpaced"
5913 : //sep.fEvenlySpaced; 1 or 0;
5914 : //byte;
5915 : {0x3006, 0}, //"sprmSFProtected"
5916 : //sep.fUnlocked;1 or 0;byte;
5917 : {0x5007, 0}, //"sprmSDmBinFirst"
5918 : //sep.dmBinFirst;;word;
5919 : {0x5008, 0}, //"sprmSDmBinOther"
5920 : //sep.dmBinOther;;word;
5921 : {0x3009, 0}, //"sprmSBkc" sep.bkc;bkc;byte;
5922 : {0x300A, 0}, //"sprmSFTitlePage"
5923 : //sep.fTitlePage;0 or 1;byte;
5924 : {0x500B, 0}, //"sprmSCcolumns" sep.ccolM1;
5925 : //# of cols - 1;word;
5926 : {0x900C, 0}, //"sprmSDxaColumns"
5927 : //sep.dxaColumns;dxa;word;
5928 : {0x300D, 0}, //"sprmSFAutoPgn" sep.fAutoPgn;
5929 : //obsolete;byte;
5930 : {0x300E, 0}, //"sprmSNfcPgn" sep.nfcPgn;nfc;
5931 : //byte;
5932 : {0xB00F, 0}, //"sprmSDyaPgn" sep.dyaPgn;dya;
5933 : //short;
5934 : {0xB010, 0}, //"sprmSDxaPgn" sep.dxaPgn;dya;
5935 : //short;
5936 : {0x3011, 0}, //"sprmSFPgnRestart"
5937 : //sep.fPgnRestart;0 or 1;byte;
5938 : {0x3012, 0}, //"sprmSFEndnote" sep.fEndnote;
5939 : //0 or 1;byte;
5940 : {0x3013, 0}, //"sprmSLnc" sep.lnc;lnc;byte;
5941 : {0x3014, 0}, //"sprmSGprfIhdt" sep.grpfIhdt;
5942 : //grpfihdt; byte;
5943 : {0x5015, 0}, //"sprmSNLnnMod" sep.nLnnMod;
5944 : //non-neg int.;word;
5945 : {0x9016, 0}, //"sprmSDxaLnn" sep.dxaLnn;dxa;
5946 : //word;
5947 : {0xB017, 0}, //"sprmSDyaHdrTop"
5948 : //sep.dyaHdrTop;dya;word;
5949 : {0xB018, 0}, //"sprmSDyaHdrBottom"
5950 : //sep.dyaHdrBottom;dya;word;
5951 : {0x3019, 0}, //"sprmSLBetween"
5952 : //sep.fLBetween;0 or 1;byte;
5953 : {0x301A, 0}, //"sprmSVjc" sep.vjc;vjc;byte;
5954 : {0x501B, 0}, //"sprmSLnnMin" sep.lnnMin;lnn;
5955 : //word;
5956 : {0x501C, 0}, //"sprmSPgnStart" sep.pgnStart;
5957 : //pgn;word;
5958 : {0x301D, 0}, //"sprmSBOrientation"
5959 : //sep.dmOrientPage;dm;byte;
5960 : //0x301E, ? ? ?, //"sprmSBCustomize"
5961 : {0xB01F, 0}, //"sprmSXaPage" sep.xaPage;xa;
5962 : //word;
5963 : {0xB020, 0}, //"sprmSYaPage" sep.yaPage;ya;
5964 : //word;
5965 : {0x2205, 0}, //"sprmSDxaLeft" sep.dxaLeft;
5966 : //dxa;word;
5967 : {0xB022, 0}, //"sprmSDxaRight" sep.dxaRight;
5968 : //dxa;word;
5969 : {0x9023, 0}, //"sprmSDyaTop" sep.dyaTop;dya;
5970 : //word;
5971 : {0x9024, 0}, //"sprmSDyaBottom"
5972 : //sep.dyaBottom;dya;word;
5973 : {0xB025, 0}, //"sprmSDzaGutter"
5974 : //sep.dzaGutter;dza;word;
5975 : {0x5026, 0}, //"sprmSDmPaperReq"
5976 : //sep.dmPaperReq;dm;word;
5977 : {0xD227, 0}, //"sprmSPropRMark"
5978 : //sep.fPropRMark,
5979 : //sep.ibstPropRMark,
5980 : //sep.dttmPropRMark ;complex;
5981 : //variable length always
5982 : //recorded as 7 bytes;
5983 : //0x3228, ? ? ?, //"sprmSFBiDi",
5984 : //0x3229, ? ? ?, //"sprmSFFacingCol"
5985 : {0x322A, 0}, //"sprmSFRTLGutter", set to 1
5986 : //if gutter is on the right.
5987 : {0x702B, 0}, //"sprmSBrcTop80" sep.brcTop;BRC;
5988 : //long;
5989 : {0x702C, 0}, //"sprmSBrcLeft80" sep.brcLeft;
5990 : //BRC;long;
5991 : {0x702D, 0}, //"sprmSBrcBottom80"
5992 : //sep.brcBottom;BRC;long;
5993 : {0x702E, 0}, //"sprmSBrcRight80" sep.brcRight;
5994 : //BRC;long;
5995 : {0x522F, 0}, //"sprmSPgbProp" sep.pgbProp;
5996 : //word;
5997 : {0x7030, 0}, //"sprmSDxtCharSpace"
5998 : //sep.dxtCharSpace;dxt;long;
5999 : {0x9031, 0}, //"sprmSDyaLinePitch"
6000 : //sep.dyaLinePitch;dya;
6001 : //WRONG:long; RIGHT:short; !
6002 : //0x5032, ? ? ?, //"sprmSClm"
6003 : {0x5033, 0}, //"sprmSTextFlow"
6004 : //sep.wTextFlow;complex ;short
6005 : {0x5400, 0}, //"sprmTJc90" tap.jc;jc;word (low
6006 : //order byte is significant);
6007 : {0x9601, 0}, //"sprmTDxaLeft"
6008 : //tap.rgdxaCenter; dxa; word;
6009 : {0x9602, 0}, //"sprmTDxaGapHalf"
6010 : //tap.dxaGapHalf,
6011 : //tap.rgdxaCenter; dxa; word;
6012 : {0x3403, 0}, //"sprmTFCantSplit"
6013 : //tap.fCantSplit;1 or 0;byte;
6014 : {0x3404, 0}, //"sprmTTableHeader"
6015 : //tap.fTableHeader;1 or 0;byte;
6016 : {0x3466, 0}, //"sprmTFCantSplit90"
6017 : //tap.fCantSplit90;1 or 0;byte;
6018 : {0xD605, 0}, //"sprmTTableBorders80"
6019 : //tap.rgbrcTable;complex;
6020 : //24 bytes;
6021 : {0xD606, 0}, //"sprmTDefTable10"
6022 : //tap.rgdxaCenter,
6023 : //tap.rgtc;complex; variable
6024 : //length;
6025 : {0x9407, 0}, //"sprmTDyaRowHeight"
6026 : //tap.dyaRowHeight;dya;word;
6027 : {0xD608, 0}, //"sprmTDefTable"
6028 : //tap.rgtc;complex
6029 : {0xD609, 0}, //"sprmTDefTableShd80"
6030 : //tap.rgshd;complex
6031 : {0x740A, 0}, //"sprmTTlp" tap.tlp;TLP;
6032 : //4 bytes;
6033 : //0x560B, ? ? ?, //"sprmTFBiDi"
6034 : //0x740C, ? ? ?, //"sprmTHTMLProps"
6035 : {0xD620, 0}, //"sprmTSetBrc80"
6036 : //tap.rgtc[].rgbrc;complex;
6037 : //5 bytes;
6038 : {0x7621, 0}, //"sprmTInsert"
6039 : //tap.rgdxaCenter,
6040 : //tap.rgtc;complex ;4 bytes;
6041 : {0x5622, 0}, //"sprmTDelete"
6042 : //tap.rgdxaCenter,
6043 : //tap.rgtc;complex ;word;
6044 : {0x7623, 0}, //"sprmTDxaCol"
6045 : //tap.rgdxaCenter;complex;
6046 : //4 bytes;
6047 : {0x5624, 0}, //"sprmTMerge"
6048 : //tap.fFirstMerged,
6049 : //tap.fMerged;complex; word;
6050 : {0x5625, 0}, //"sprmTSplit"
6051 : //tap.fFirstMerged,
6052 : //tap.fMerged;complex ;word;
6053 : {0xD626, 0}, //"sprmTSetBrc10"
6054 : //tap.rgtc[].rgbrc;complex;
6055 : //5 bytes;
6056 : {0x7627, 0}, //"sprmTSetShd80" tap.rgshd;
6057 : //complex; 4 bytes;
6058 : {0x7628, 0}, //"sprmTSetShdOdd80"
6059 : //tap.rgshd;complex;4 bytes;
6060 : {0x7629, 0}, //"sprmTTextFlow"
6061 : //tap.rgtc[].fVertical
6062 : //tap.rgtc[].fBackward
6063 : //tap.rgtc[].fRotateFont
6064 : //0 or 10 or 10 or 1;word;
6065 : //0xD62A, ? ? ? , //"sprmTDiagLine"
6066 : {0xD62B, 0}, //"sprmTVertMerge"
6067 : //tap.rgtc[].vertMerge;complex;
6068 : //variable length always
6069 : //recorded as 2 bytes;
6070 : {0xD62C, 0}, //"sprmTVertAlign"
6071 : //tap.rgtc[].vertAlign;complex
6072 : //variable length always
6073 : //recorded as 3 byte;
6074 : {NS_sprm::LN_CFELayout, &SwWW8ImplReader::Read_DoubleLine_Rotate},
6075 : {0x6649, 0}, //undocumented
6076 : {0xF614, 0}, //"sprmTTableWidth"
6077 : //recorded as 3 bytes;
6078 : {0xD612, 0}, //"sprmTCellShd"
6079 : {0xD613, 0}, //"sprmTTableBorders"
6080 : {0xD61A, 0}, //undocumented
6081 : {0xD61B, 0}, //undocumented
6082 : {0xD61C, 0}, //undocumented
6083 : {0xD61D, 0}, //undocumented
6084 : {0xD634, 0}, //undocumented
6085 : {0xD632, 0}, //undocumented
6086 : {0xD238, 0}, //undocumented sep
6087 : {0xC64E, &SwWW8ImplReader::Read_Border}, //"sprmPBrcTop"
6088 : {0xC64F, &SwWW8ImplReader::Read_Border}, //"sprmPBrcLeft"
6089 : {0xC650, &SwWW8ImplReader::Read_Border}, //"sprmPBrcBottom"
6090 : {0xC651, &SwWW8ImplReader::Read_Border}, //"sprmPBrcRight"
6091 : {0xC652, &SwWW8ImplReader::Read_Border}, //"sprmPBorderBetween"
6092 : {0xF661, 0}, //undocumented
6093 : {0x4873, &SwWW8ImplReader::Read_Language}, //"sprmCRgLid0" chp.rglid[0];
6094 : //LID: for non-Far East text;
6095 : //(like a duplicate of 486D)
6096 : {0x4874, 0}, //"sprmCRgLid1" chp.rglid[1];
6097 : //LID: for Far East text
6098 : //(like a duplicate of 486E)
6099 : {0x6463, 0}, //undocumented
6100 : {0x2461, &SwWW8ImplReader::Read_RTLJustify}, //undoc, must be asian version
6101 : //of "sprmPJc"
6102 : {0x845E, &SwWW8ImplReader::Read_LR}, //Apparently post-Word 97 version of "sprmPDxaLeft"
6103 : {0x8460, &SwWW8ImplReader::Read_LR}, //Post-Word 97 version of "sprmPDxaLeft1"
6104 : {0x845D, &SwWW8ImplReader::Read_LR}, //Post-Word 97 version of "sprmPDxaRight"
6105 : {0x3615, 0}, //undocumented
6106 : {0x360D, 0}, //undocumented
6107 : {0x940E, 0}, //undocumented
6108 : {0x940F, 0}, //undocumented
6109 : {0x9410, 0}, //undocumented
6110 : {0x703A, 0}, //undocumented
6111 : {0x303B, 0}, //undocumented
6112 : {0x244B, &SwWW8ImplReader::Read_TabCellEnd}, //undocumented, must be
6113 : //subtable "sprmPFInTable"
6114 : {0x244C, &SwWW8ImplReader::Read_TabRowEnd}, //undocumented, must be
6115 : // subtable "sprmPFTtp"
6116 : {0x6815, 0}, //undocumented
6117 : {0x6816, 0}, //undocumented
6118 : {NS_sprm::LN_CCv, &SwWW8ImplReader::Read_TxtForeColor},
6119 : {0x6877, &SwWW8ImplReader::Read_UnderlineColor},
6120 : {0xC64D, &SwWW8ImplReader::Read_ParaBackColor},
6121 : {0x6467, 0}, //undocumented
6122 : {0xF617, 0}, //undocumented
6123 : {0xD660, 0}, //undocumented
6124 : {0xD670, 0}, //undocumented
6125 : {0xCA71, &SwWW8ImplReader::Read_TxtBackColor},//"sprmCShd"
6126 : {0x303C, 0}, //undocumented
6127 : {0x245B, &SwWW8ImplReader::Read_ParaAutoBefore},//undocumented, para
6128 : {0x245C, &SwWW8ImplReader::Read_ParaAutoAfter},//undocumented, para
6129 : {0x246D, &SwWW8ImplReader::Read_ParaContextualSpacing} //"sprmPFContextualSpacing"
6130 : };
6131 :
6132 79482 : static wwSprmDispatcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
6133 79482 : return &aSprmSrch;
6134 : }
6135 :
6136 : // Hilfsroutinen : SPRM finden
6137 :
6138 81476 : const SprmReadInfo& SwWW8ImplReader::GetSprmReadInfo(sal_uInt16 nId) const
6139 : {
6140 81476 : ww::WordVersion eVersion = pWwFib->GetFIBVersion();
6141 : const wwSprmDispatcher *pDispatcher;
6142 81476 : if (eVersion <= ww::eWW2)
6143 1994 : pDispatcher = GetWW2SprmDispatcher();
6144 79482 : else if (eVersion < ww::eWW8)
6145 0 : pDispatcher = GetWW6SprmDispatcher();
6146 : else
6147 79482 : pDispatcher = GetWW8SprmDispatcher();
6148 :
6149 81476 : SprmReadInfo aSrch = {0, 0};
6150 81476 : aSrch.nId = nId;
6151 81476 : const SprmReadInfo* pFound = pDispatcher->search(aSrch);
6152 :
6153 81476 : if (!pFound)
6154 : {
6155 4686 : aSrch.nId = 0;
6156 4686 : pFound = pDispatcher->search(aSrch);
6157 : }
6158 :
6159 81476 : return *pFound;
6160 : }
6161 :
6162 : // Hilfsroutinen : SPRMs
6163 :
6164 36926 : void SwWW8ImplReader::EndSprm( sal_uInt16 nId )
6165 : {
6166 73852 : if( ( nId > 255 ) && ( nId < 0x0800 ) ) return;
6167 :
6168 36926 : const SprmReadInfo& rSprm = GetSprmReadInfo( nId );
6169 :
6170 36926 : if (rSprm.pReadFnc)
6171 20703 : (this->*rSprm.pReadFnc)( nId, 0, -1 );
6172 : }
6173 :
6174 44550 : short SwWW8ImplReader::ImportSprm(const sal_uInt8* pPos,sal_uInt16 nId)
6175 : {
6176 44550 : if (!nId)
6177 6786 : nId = mpSprmParser->GetSprmId(pPos);
6178 :
6179 : OSL_ENSURE( nId != 0xff, "Sprm FF !!!!" );
6180 :
6181 44550 : const SprmReadInfo& rSprm = GetSprmReadInfo(nId);
6182 :
6183 44550 : sal_uInt16 nFixedLen = mpSprmParser->DistanceToData(nId);
6184 44550 : sal_uInt16 nL = mpSprmParser->GetSprmSize(nId, pPos);
6185 :
6186 44550 : if (rSprm.pReadFnc)
6187 27706 : (this->*rSprm.pReadFnc)(nId, pPos + nFixedLen, nL - nFixedLen);
6188 :
6189 44550 : return nL;
6190 33 : }
6191 :
6192 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|