LibreOffice Module sw (master)  1
ww8par3.cxx
Go to the documentation of this file.
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 <memory>
21 #include <svl/itemiter.hxx>
22 #include <vcl/svapp.hxx>
23 #include <vcl/outdev.hxx>
24 #include <sal/log.hxx>
25 
26 #include <vcl/unohelp.hxx>
27 #include <com/sun/star/form/XForm.hpp>
28 #include <com/sun/star/drawing/XShape.hpp>
29 #include <com/sun/star/drawing/XShapes.hpp>
30 #include <com/sun/star/drawing/XControlShape.hpp>
31 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32 #include <com/sun/star/container/XIndexContainer.hpp>
33 #include <com/sun/star/text/VertOrientation.hpp>
34 #include <com/sun/star/text/TextContentAnchorType.hpp>
35 #include <com/sun/star/beans/XPropertyContainer.hpp>
36 #include <com/sun/star/beans/PropertyAttribute.hpp>
37 
38 #include <algorithm>
39 #include <hintids.hxx>
40 #include <editeng/fontitem.hxx>
41 #include <editeng/lrspitem.hxx>
42 #include <editeng/fhgtitem.hxx>
43 #include <editeng/colritem.hxx>
44 #include <editeng/wghtitem.hxx>
46 #include <editeng/udlnitem.hxx>
47 #include <editeng/postitem.hxx>
48 #include <o3tl/safeint.hxx>
49 #include <unotextrange.hxx>
50 #include <doc.hxx>
51 #include <docary.hxx>
53 #include <IDocumentMarkAccess.hxx>
54 #include <docsh.hxx>
55 #include <numrule.hxx>
56 #include <paratr.hxx>
57 #include <charatr.hxx>
58 #include <charfmt.hxx>
59 #include <ndtxt.hxx>
60 #include <expfld.hxx>
61 #include <fmtfld.hxx>
62 #include <flddropdown.hxx>
63 #include "sprmids.hxx"
64 #include "writerhelper.hxx"
65 #include "writerwordglue.hxx"
66 #include "ww8par.hxx"
67 #include "ww8par2.hxx"
68 
69 #include <IMark.hxx>
70 #include <unotools/fltrcfg.hxx>
71 #include <rtl/character.hxx>
72 #include <xmloff/odffields.hxx>
73 
74 using namespace com::sun::star;
75 using namespace sw::util;
76 using namespace sw::types;
77 using namespace sw::mark;
78 
79 // UNO-Controls
80 
81 // OCX i.e. word 97 form controls
83 {
84  if( m_bObj && m_nPicLocFc )
85  m_nObjLocFc = m_nPicLocFc;
86  m_bEmbeddObj = true;
87  return eF_ResT::TEXT;
88 }
89 
91 {
92  WW8FormulaEditBox aFormula(*this);
93 
94  if (pF->nLCode && rStr[pF->nLCode-1]==0x01) {
95  ImportFormulaControl(aFormula,pF->nSCode+pF->nLCode-1, WW8_CT_EDIT);
96  }
97 
98  /*
99  Here we have a small complication. This formula control contains
100  the default text that is displayed if you edit the form field in
101  the "default text" area. But MSOffice does not display that
102  information, instead it display the result of the field,
103  MSOffice just uses the default text of the control as its
104  initial value for the displayed default text. So we will swap in
105  the field result into the formula here in place of the default
106  text.
107  */
108 
109  const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
110  const bool bUseEnhFields = rOpt.IsUseEnhancedFields();
111 
112  if (!bUseEnhFields)
113  {
114  aFormula.msDefault = GetFieldResult(pF);
115 
116  SwInputField aField(
117  static_cast<SwInputFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Input )),
118  aFormula.msDefault,
119  aFormula.msTitle,
120  INP_TXT,
121  0 );
122  aField.SetHelp(aFormula.msHelp);
123  aField.SetToolTip(aFormula.msToolTip);
124 
125  m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, SwFormatField(aField));
126  return eF_ResT::OK;
127  }
128  else
129  {
130  WW8PLCFx_Book* pB = m_xPlcxMan->GetBook();
131  OUString aBookmarkName;
132  if (pB!=nullptr) {
133  WW8_CP currentCP=pF->nSCode;
134  WW8_CP currentLen=pF->nLen;
135 
136  WW8_CP nEnd;
137  if (o3tl::checked_add(currentCP, currentLen-1, nEnd)) {
138  SAL_WARN("sw.ww8", "broken offset, ignoring");
139  }
140  else
141  {
142  sal_uInt16 bkmFindIdx;
143  OUString aBookmarkFind=pB->GetBookmark(currentCP-1, nEnd, bkmFindIdx);
144 
145  if (!aBookmarkFind.isEmpty()) {
146  pB->SetStatus(bkmFindIdx, BOOK_FIELD); // mark bookmark as consumed, such that tl'll not get inserted as a "normal" bookmark again
147  if (!aBookmarkFind.isEmpty()) {
148  aBookmarkName=aBookmarkFind;
149  }
150  }
151  }
152  }
153 
154  if (pB!=nullptr && aBookmarkName.isEmpty()) {
155  aBookmarkName=pB->GetUniqueBookmarkName(aFormula.msTitle);
156  }
157 
158  if (!aBookmarkName.isEmpty()) {
159  m_aFieldStack.back().SetBookmarkName(aBookmarkName);
160  m_aFieldStack.back().SetBookmarkType(ODF_FORMTEXT);
161  if ( aFormula.msToolTip.getLength() < 139 )
162  m_aFieldStack.back().getParameters()["Description"] <<= aFormula.msToolTip;
163  m_aFieldStack.back().getParameters()["Name"] <<= aFormula.msTitle;
164  if (aFormula.mnMaxLen && aFormula.mnMaxLen < 32768 )
165  m_aFieldStack.back().getParameters()["MaxLength"] <<= aFormula.mnMaxLen;
166 
167  if ( aFormula.mfType == 1 )
168  m_aFieldStack.back().getParameters()["Type"] <<= OUString("number");
169  else if ( aFormula.mfType == 2 )
170  m_aFieldStack.back().getParameters()["Type"] <<= OUString("date");
171  else if ( aFormula.mfType == 3 )
172  m_aFieldStack.back().getParameters()["Type"] <<= OUString("currentTime");
173  else if ( aFormula.mfType == 4 )
174  m_aFieldStack.back().getParameters()["Type"] <<= OUString("currentDate");
175  else if ( aFormula.mfType == 5 )
176  m_aFieldStack.back().getParameters()["Type"] <<= OUString("calculated");
177  }
178  return eF_ResT::TEXT;
179  }
180 }
181 
183 {
184  WW8FormulaCheckBox aFormula(*this);
185 
186  if (!m_xFormImpl)
187  m_xFormImpl.reset(new SwMSConvertControls(m_pDocShell, m_pPaM));
188 
189  if (rStr[pF->nLCode-1]==0x01)
190  ImportFormulaControl(aFormula,pF->nSCode+pF->nLCode-1, WW8_CT_CHECKBOX);
191  const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
192  const bool bUseEnhFields = rOpt.IsUseEnhancedFields();
193 
194  if (!bUseEnhFields)
195  {
196  m_xFormImpl->InsertFormula(aFormula);
197  return eF_ResT::OK;
198  }
199 
200  OUString aBookmarkName;
201  WW8PLCFx_Book* pB = m_xPlcxMan->GetBook();
202  if (pB!=nullptr) {
203  WW8_CP currentCP=pF->nSCode;
204  WW8_CP currentLen=pF->nLen;
205 
206  sal_uInt16 bkmFindIdx;
207  OUString aBookmarkFind=pB->GetBookmark(currentCP-1, currentCP+currentLen-1, bkmFindIdx);
208 
209  if (!aBookmarkFind.isEmpty()) {
210  pB->SetStatus(bkmFindIdx, BOOK_FIELD); // mark as consumed by field
211  if (!aBookmarkFind.isEmpty()) {
212  aBookmarkName=aBookmarkFind;
213  }
214  }
215  }
216 
217  if (pB!=nullptr && aBookmarkName.isEmpty()) {
218  aBookmarkName=pB->GetUniqueBookmarkName(aFormula.msTitle);
219  }
220 
221  if (!aBookmarkName.isEmpty())
222  {
223  IDocumentMarkAccess* pMarksAccess = m_rDoc.getIDocumentMarkAccess( );
224  IFieldmark* pFieldmark = pMarksAccess->makeNoTextFieldBookmark(
225  *m_pPaM, aBookmarkName, ODF_FORMCHECKBOX );
226  OSL_ENSURE(pFieldmark!=nullptr, "hmmm; why was the bookmark not created?");
227  if (pFieldmark!=nullptr) {
228  IFieldmark::parameter_map_t* const pParameters = pFieldmark->GetParameters();
229  ICheckboxFieldmark* pCheckboxFm = dynamic_cast<ICheckboxFieldmark*>(pFieldmark);
230  (*pParameters)[ODF_FORMCHECKBOX_NAME] <<= aFormula.msTitle;
231  (*pParameters)[ODF_FORMCHECKBOX_HELPTEXT] <<= aFormula.msToolTip;
232 
233  if(pCheckboxFm)
234  pCheckboxFm->SetChecked(aFormula.mnChecked != 0);
235  // set field data here...
236  }
237  }
238  return eF_ResT::OK;
239 }
240 
242 {
243  WW8FormulaListBox aFormula(*this);
244 
245  if (pF->nLCode > 0 && rStr.getLength() >= pF->nLCode && rStr[pF->nLCode-1] == 0x01)
246  ImportFormulaControl(aFormula,pF->nSCode+pF->nLCode-1, WW8_CT_DROPDOWN);
247 
248  const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
249  bool bUseEnhFields = rOpt.IsUseEnhancedFields();
250 
251  if (!bUseEnhFields)
252  {
253  SwDropDownField aField(static_cast<SwDropDownFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Dropdown)));
254 
255  aField.SetName(aFormula.msTitle);
256  aField.SetHelp(aFormula.msHelp);
257  aField.SetToolTip(aFormula.msToolTip);
258 
259  if (!aFormula.maListEntries.empty())
260  {
261  aField.SetItems(aFormula.maListEntries);
262  int nIndex = aFormula.mfDropdownIndex < aFormula.maListEntries.size() ? aFormula.mfDropdownIndex : 0;
263  aField.SetSelectedItem(aFormula.maListEntries[nIndex]);
264  }
265 
266  m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, SwFormatField(aField));
267  return eF_ResT::OK;
268  }
269  else
270  {
271  // TODO: review me
272  OUString aBookmarkName;
273  WW8PLCFx_Book* pB = m_xPlcxMan->GetBook();
274  if (pB!=nullptr)
275  {
276  WW8_CP currentCP=pF->nSCode;
277  WW8_CP currentLen=pF->nLen;
278 
279  sal_uInt16 bkmFindIdx;
280  OUString aBookmarkFind=pB->GetBookmark(currentCP-1, currentCP+currentLen-1, bkmFindIdx);
281 
282  if (!aBookmarkFind.isEmpty())
283  {
284  pB->SetStatus(bkmFindIdx, BOOK_FIELD); // mark as consumed by field
285  if (!aBookmarkFind.isEmpty())
286  aBookmarkName=aBookmarkFind;
287  }
288  }
289 
290  if (pB!=nullptr && aBookmarkName.isEmpty())
291  aBookmarkName=pB->GetUniqueBookmarkName(aFormula.msTitle);
292 
293  if (!aBookmarkName.isEmpty())
294  {
295  IDocumentMarkAccess* pMarksAccess = m_rDoc.getIDocumentMarkAccess( );
296  IFieldmark *pFieldmark =
297  pMarksAccess->makeNoTextFieldBookmark( *m_pPaM, aBookmarkName, ODF_FORMDROPDOWN );
298  OSL_ENSURE(pFieldmark!=nullptr, "hmmm; why was the bookmark not created?");
299  if ( pFieldmark != nullptr )
300  {
301  uno::Sequence< OUString > vListEntries(aFormula.maListEntries.size());
302  std::copy(aFormula.maListEntries.begin(), aFormula.maListEntries.end(), vListEntries.begin());
303  (*pFieldmark->GetParameters())[ODF_FORMDROPDOWN_LISTENTRY] <<= vListEntries;
304  sal_Int32 nIndex = aFormula.mfDropdownIndex < aFormula.maListEntries.size() ? aFormula.mfDropdownIndex : 0;
305  (*pFieldmark->GetParameters())[ODF_FORMDROPDOWN_RESULT] <<= nIndex;
306  // set field data here...
307  }
308  }
309 
310  return eF_ResT::OK;
311  }
312 }
313 
315 {
316  if( m_bObj && m_nPicLocFc )
317  m_nObjLocFc = m_nPicLocFc;
318  m_bEmbeddObj = true;
319  return eF_ResT::TEXT;
320 }
321 
322 // Helper declarations
323 
324 // Style Id's for each level
326 // Character Style Pointer
328 
329 struct WW8LST // only THOSE entries, WE need!
330 {
331  WW8aIdSty aIdSty; // Style Id's for each level,
332  // nIStDNil if no style linked
333  sal_uInt32 nIdLst; // Unique List ID
334  sal_uInt32 nTplC; // Unique template code - What is this?
335  bool bSimpleList:1; // Flag: List only has ONE level
336  bool bRestartHdn:1; // WW6-Compatibility-Flag:
337  // true if the list should start numbering over
338 }; // at the beginning of each section
339 
340 const sal_uInt32 cbLSTF=28;
341 
342 struct WW8LFO // only THOSE entries, WE need!
343 {
344  SwNumRule* pNumRule; // Parent NumRule
345  sal_uInt32 nIdLst; // Unique List ID
346  sal_uInt8 nLfoLvl; // count of levels whose format is overridden
348 };
349 
350 struct WW8LVL // only THE entries, WE need!
351 {
352  sal_Int32 nStartAt; // start at value for this value
353  sal_Int32 nV6DxaSpace;// Ver6-Compatible: min Space between Num and text::Paragraph
354  sal_Int32 nV6Indent; // Ver6-Compatible: Width of prefix text;
355  // Use definition of first line indent if appropriate!
356  // Paragraph attributes from GrpprlPapx
357  sal_uInt16 nDxaLeft; // left indent
358  short nDxaLeft1; // first line indent
359 
360  sal_uInt8 nNFC; // number format code
361  // Offset of fieldcodes in Num-X-String
363  sal_uInt8 nLenGrpprlChpx; // length, in bytes, of the LVL's grpprlChpx
364  sal_uInt8 nLenGrpprlPapx; // length, in bytes, of the LVL's grpprlPapx
365  sal_uInt8 nAlign: 2; // alignment (left, right, centered) of the number
366  sal_uInt8 bLegal: 1; // doesn't matter
367  sal_uInt8 bNoRest:1; // doesn't matter
368  sal_uInt8 bV6Prev:1; // Ver6-Compatible: number will include previous levels
369  sal_uInt8 bV6PrSp:1; // Ver6-Compatible: doesn't matter
370  sal_uInt8 bV6: 1; // if true, pay attention to the V6-Compatible Entries!
371  sal_uInt8 bDummy: 1; // (fills the byte)
372 
373 };
374 
375 struct WW8LFOLVL
376 {
377  sal_Int32 nStartAt; // start-at value if bFormat==false and bStartAt == true
378  // (if bFormat==true, the start-at is stored in the LVL)
379  sal_uInt8 nLevel; // the level to be overridden
380  // this byte has not been packed into the following byte on _purpose_ !!
381  // (see comment of struct WW8LFOInfo)
382 
383  bool bStartAt :1; // true if the start-at value is overridden
384  bool bFormat :1; // true if the formatting is overridden
385 
387  nStartAt(1), nLevel(0), bStartAt(true), bFormat(false) {}
388 };
389 
390 // Data to be saved in ListInfo
391 
392 struct WW8LSTInfo // sorted by nIdLst (in WW8 used list-Id)
393 {
394  std::vector<ww::bytes> maParaSprms;
395  WW8aIdSty aIdSty; // Style Id's for each level
396  WW8aCFormat aCharFormat; // Character Style Pointer
397 
398  SwNumRule* pNumRule; // Pointer to list-template in Writer
399  sal_uInt32 nIdLst; // WW8Id of this list
400  bool bSimpleList:1;// Flag, if this NumRule only uses one Level
401  bool bUsedInDoc :1;// Flag, if this NumRule is used in the Doc,
402  // or is supposed to be deleted on Reader-End
403 
404  WW8LSTInfo(SwNumRule* pNumRule_, const WW8LST& aLST)
405  : pNumRule(pNumRule_), nIdLst(aLST.nIdLst),
406  bSimpleList(aLST.bSimpleList), bUsedInDoc(false)
407  {
408  memcpy( aIdSty, aLST.aIdSty, sizeof( aIdSty ));
409  memset(&aCharFormat, 0, sizeof( aCharFormat ));
410  }
411 
412 };
413 
414 // Data to be saved in ListenFormatOverrideInfos
415 
416 struct WW8LFOInfo // unordered, means ordered like in WW8 Stream
417 {
418  std::vector<ww::bytes> maParaSprms;
419  std::vector<WW8LFOLVL> maOverrides;
420  SwNumRule* pNumRule; // Pointer to list template in Writer
421  // either List in LSTInfos or own List
422  // (in Ctor use the list from LSTInfos first)
423 
424  sal_uInt32 nIdLst; // WW8-Id of the relevant list
425  sal_uInt8 nLfoLvl; // count of levels whose format is overridden
426  // yes we could include nLfoLvl (via :4) into the following byte,
427  // but it probably would be a source of error once MS increases their Listformat
428  // to more than 15 levels
429 
430  bool bOverride :1;// Flag if NumRule is not included in maLSTInfos,
431  // but was created for m_LFOInfos
432  bool bUsedInDoc :1;// Flag if NumRule is used in Doc,
433  // or should be deleted on Reader-End
434  bool bLSTbUIDSet :1;// Flag, if bUsedInDoc is set in maLSTInfos
435 
436  explicit WW8LFOInfo(const WW8LFO& rLFO);
437 };
438 
440  : maParaSprms(WW8ListManager::nMaxLevel)
441  , maOverrides(WW8ListManager::nMaxLevel)
442  , pNumRule(rLFO.pNumRule)
443  , nIdLst(rLFO.nIdLst)
444  , nLfoLvl(rLFO.nLfoLvl)
445  , bOverride(rLFO.nLfoLvl != 0)
446  , bUsedInDoc(false)
447  , bLSTbUIDSet(false)
448 {
449 }
450 
451 // Helper methods
452 
453 // find Sprm-Parameter-Data, if Sprm is included in Grpprl
455  sal_uInt8 nLen)
456 {
457  return maSprmParser.findSprmData(nId, &rSprms, nLen);
458 }
459 
461 {
462 private:
463  sal_uInt32 mnIdLst;
464 public:
465  explicit ListWithId(sal_uInt32 nIdLst) : mnIdLst(nIdLst) {}
466  bool operator() (const std::unique_ptr<WW8LSTInfo>& pEntry) const
467  { return (pEntry->nIdLst == mnIdLst); }
468 };
469 
470 // Access via List-Id of LST Entry
471 WW8LSTInfo* WW8ListManager::GetLSTByListId( sal_uInt32 nIdLst ) const
472 {
473  auto aResult =
474  std::find_if(maLSTInfos.begin(),maLSTInfos.end(),ListWithId(nIdLst));
475  if (aResult == maLSTInfos.end())
476  return nullptr;
477  return aResult->get();
478 }
479 
480 static void lcl_CopyGreaterEight(OUString &rDest, OUString const &rSrc,
481  sal_Int32 nStart, sal_Int32 nLen = SAL_MAX_INT32)
482 {
483  const sal_Int32 nMaxLen = std::min(rSrc.getLength(), nLen);
484  for( sal_Int32 nI = nStart; nI < nMaxLen; ++nI)
485  {
486  sal_Unicode nChar = rSrc[nI];
487  if (nChar > WW8ListManager::nMaxLevel)
488  rDest += OUStringLiteral1(nChar);
489  }
490 }
491 
492 static OUString sanitizeString(const OUString& rString)
493 {
494  sal_Int32 i=0;
495  while (i < rString.getLength())
496  {
497  sal_Unicode c = rString[i];
498  if (rtl::isHighSurrogate(c))
499  {
500  if (i+1 == rString.getLength()
501  || !rtl::isLowSurrogate(rString[i+1]))
502  {
503  SAL_WARN("sw.ww8", "Surrogate error: high without low");
504  return rString.copy(0, i);
505  }
506  ++i; //skip correct low
507  }
508  if (rtl::isLowSurrogate(c)) //bare low without preceding high
509  {
510  SAL_WARN("sw.ww8", "Surrogate error: low without high");
511  return rString.copy(0, i);
512  }
513  ++i;
514  }
515  return rString;
516 }
517 
518 bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr<SfxItemSet>& rpItemSet,
519  sal_uInt16 nLevelStyle, bool bSetStartNo,
520  std::deque<bool> &rNotReallyThere, sal_uInt16 nLevel,
521  ww::bytes &rParaSprms)
522 {
523  sal_uInt8 aBits1(0);
524  sal_uInt16 nStartNo(0); // Start-No. for Writer
526  SvxAdjust eAdj; // Alignment (Left/right/centered)
527  sal_Unicode cBullet(0x2190); // default safe bullet
528 
529  sal_Unicode cGrfBulletCP(USHRT_MAX);
530 
531  OUString sPrefix;
532  OUString sPostfix;
533  WW8LVL aLVL;
534 
535  // 1. read LVLF
536 
537  memset(&aLVL, 0, sizeof( aLVL ));
538  rSt.ReadInt32( aLVL.nStartAt );
539  rSt.ReadUChar( aLVL.nNFC );
540  rSt.ReadUChar( aBits1 );
541  if( ERRCODE_NONE != rSt.GetError() ) return false;
542  aLVL.nAlign = (aBits1 & 0x03);
543  if( aBits1 & 0x10 ) aLVL.bV6Prev = sal_uInt8(true);
544  if( aBits1 & 0x20 ) aLVL.bV6PrSp = sal_uInt8(true);
545  if( aBits1 & 0x40 ) aLVL.bV6 = sal_uInt8(true);
546  bool bLVLOkB = true;
547  for(sal_uInt8 nLevelB = 0; nLevelB < nMaxLevel; ++nLevelB)
548  {
549  rSt.ReadUChar( aLVL.aOfsNumsXCH[ nLevelB ] );
550  if( ERRCODE_NONE != rSt.GetError() )
551  {
552  bLVLOkB = false;
553  break;
554  }
555  }
556 
557  if( !bLVLOkB )
558  return false;
559 
560  sal_uInt8 ixchFollow(0);
561  rSt.ReadUChar( ixchFollow );
562  rSt.ReadInt32( aLVL.nV6DxaSpace );
563  rSt.ReadInt32( aLVL.nV6Indent );
564  rSt.ReadUChar( aLVL.nLenGrpprlChpx );
565  rSt.ReadUChar( aLVL.nLenGrpprlPapx );
566  rSt.SeekRel( 2 );
567  if( ERRCODE_NONE != rSt.GetError()) return false;
568 
569  // 2. read PAPx if needed and search for indent values
570 
571  short nTabPos = 0; // #i86652# - read tab setting
572  if( aLVL.nLenGrpprlPapx )
573  {
574  sal_uInt8 aGrpprlPapx[ 255 ];
575  if (aLVL.nLenGrpprlPapx != rSt.ReadBytes(&aGrpprlPapx, aLVL.nLenGrpprlPapx))
576  return false;
577  // "sprmPDxaLeft" pap.dxaLeft;dxa;word;
578  SprmResult aSprm = GrpprlHasSprm(0x840F,aGrpprlPapx[0],aLVL.nLenGrpprlPapx);
579  if (!aSprm.pSprm)
580  aSprm = GrpprlHasSprm(0x845E,aGrpprlPapx[0],aLVL.nLenGrpprlPapx);
581 
582  if (aSprm.pSprm && aSprm.nRemainingData >= 2)
583  {
584  const sal_uInt8 *pBegin = aSprm.pSprm - 2;
585  for(int i=0;i<4;++i)
586  rParaSprms.push_back(*pBegin++);
587  short nDxaLeft = SVBT16ToUInt16(aSprm.pSprm);
588  aLVL.nDxaLeft = (0 < nDxaLeft) ? static_cast<sal_uInt16>(nDxaLeft)
589  : static_cast<sal_uInt16>(-nDxaLeft);
590  }
591 
592  // "sprmPDxaLeft1" pap.dxaLeft1;dxa;word;
593  aSprm = GrpprlHasSprm(0x8411,aGrpprlPapx[0],aLVL.nLenGrpprlPapx);
594  if (!aSprm.pSprm)
595  aSprm = GrpprlHasSprm(0x8460,aGrpprlPapx[0],aLVL.nLenGrpprlPapx);
596 
597  if (aSprm.pSprm && aSprm.nRemainingData >= 2)
598  {
599  const sal_uInt8 *pBegin = aSprm.pSprm - 2;
600  for(int i=0;i<4;++i)
601  rParaSprms.push_back(*pBegin++);
602  aLVL.nDxaLeft1 = SVBT16ToUInt16(aSprm.pSprm);
603  }
604 
605  // #i86652# - read tab setting
606  aSprm = GrpprlHasSprm(0xC615,aGrpprlPapx[0],aLVL.nLenGrpprlPapx);
607  const sal_uInt8* pSprm = aSprm.pSprm;
608  if (pSprm && aSprm.nRemainingData >= 5)
609  {
610  bool bDone = false;
611  if (*(pSprm-1) == 5)
612  {
613  if (*pSprm++ == 0) //nDel
614  {
615  if (*pSprm++ == 1) //nIns
616  {
617  nTabPos = SVBT16ToUInt16(pSprm);
618  pSprm+=2;
619  if (*pSprm == 6) //type
620  {
621  bDone = true;
622  }
623  }
624  }
625  }
626  OSL_ENSURE(bDone, "tab setting in numbering is "
627  "of unexpected configuration");
628  }
629  if ( rNumFormat.GetPositionAndSpaceMode() ==
631  {
632  // If there is a tab setting with a larger value, then use that.
633  // Ideally we would allow tabs to be used in numbering fields and set
634  // this on the containing paragraph which would make it actually work
635  // most of the time.
636  if ( nTabPos != 0 )
637  {
638  const sal_uInt16 nDesired = aLVL.nDxaLeft + aLVL.nDxaLeft1;
639 
640  bool bDoAdjust = false;
641  if ( nDesired < aLVL.nDxaLeft )
642  {
643  if ( nDesired < nTabPos && nTabPos < aLVL.nDxaLeft )
644  {
645  bDoAdjust = true;
646  }
647  }
648  else
649  {
650  if ( aLVL.nDxaLeft < nTabPos && nTabPos < nDesired )
651  {
652  bDoAdjust = true;
653  }
654  }
655 
656  if (bDoAdjust)
657  {
658  aLVL.nDxaLeft = (0 < nTabPos)
659  ? static_cast<sal_uInt16>(nTabPos)
660  : static_cast<sal_uInt16>(-nTabPos);
661 
662  aLVL.nDxaLeft1 = nDesired - aLVL.nDxaLeft;
663  }
664  }
665  }
666  }
667 
668  // 3. read CHPx if needed
669 
670  sal_uInt16 nWitchPicIsBullet = USHRT_MAX;
671  bool bIsPicBullet = false;
672 
673  if( aLVL.nLenGrpprlChpx )
674  {
675  sal_uInt8 aGrpprlChpx[ 255 ];
676  memset(&aGrpprlChpx, 0, sizeof( aGrpprlChpx ));
677  if (aLVL.nLenGrpprlChpx != rSt.ReadBytes(&aGrpprlChpx, aLVL.nLenGrpprlChpx))
678  return false;
679 
680  //For i120928,parse the graphic info of bullets
681  SprmResult aSprmWhichPis = GrpprlHasSprm(NS_sprm::sprmCPbiIBullet, aGrpprlChpx[0],aLVL.nLenGrpprlChpx);
682  SprmResult aSprmIsPicBullet = GrpprlHasSprm(NS_sprm::sprmCPbiGrf, aGrpprlChpx[0],aLVL.nLenGrpprlChpx);
683  if (aSprmWhichPis.pSprm && aSprmWhichPis.nRemainingData >= 1)
684  {
685  nWitchPicIsBullet = *aSprmWhichPis.pSprm;
686  }
687  if (aSprmIsPicBullet.pSprm && aSprmIsPicBullet.nRemainingData >= 1)
688  {
689  bIsPicBullet = (*aSprmIsPicBullet.pSprm) & 0x0001;
690  }
691 
692  // create new Itemset for character attributes
693  rpItemSet.reset(new SfxItemSet( rDoc.GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END - 1>{}));
694 
695  // Set Reader-ItemSet-Pointer to the newly created set
696  rReader.SetCurrentItemSet(std::move(rpItemSet));
697  // Set Reader-Style to Style of this Level
698  sal_uInt16 nOldColl = rReader.GetCurrentColl();
699  sal_uInt16 nNewColl = nLevelStyle;
700  if (ww::stiNil == nNewColl)
701  nNewColl = 0;
702  rReader.SetNCurrentColl( nNewColl );
703 
704  // The Read_xy() methods in WW8PAR6.cxx are calling their respective
705  // NewAttr() or GetFormatAttr() which can determine, by using the assigned
706  // Reader-ItemSet-Pointer, whether this specific ItemSet is relevant
707  // and not a Stack or Style!
708  sal_uInt16 nOldFlags1 = rReader.GetToggleAttrFlags();
709  sal_uInt16 nOldFlags2 = rReader.GetToggleBiDiAttrFlags();
710 
711  WW8SprmIter aSprmIter(&aGrpprlChpx[0], aLVL.nLenGrpprlChpx,
712  maSprmParser);
713  while (const sal_uInt8* pSprm = aSprmIter.GetSprms())
714  {
715  rReader.ImportSprm(pSprm, aSprmIter.GetRemLen(), aSprmIter.GetCurrentId());
716  aSprmIter.advance();
717  }
718 
719  // Reset Reader-ItemSet-Pointer and Reader-Style
720  rpItemSet = rReader.SetCurrentItemSet(nullptr);
721  rReader.SetNCurrentColl( nOldColl );
722  rReader.SetToggleAttrFlags(nOldFlags1);
723  rReader.SetToggleBiDiAttrFlags(nOldFlags2);
724  }
725 
726  // 4. Read numbering String. Results in prefix and postfix
727 
728  OUString sNumString(sanitizeString(read_uInt16_PascalString(rSt)));
729 
730  // 5. convert read values into Writer syntax
731 
732  if( 0 <= aLVL.nStartAt )
733  nStartNo = static_cast<sal_uInt16>(aLVL.nStartAt);
734 
735  switch( aLVL.nNFC )
736  {
737  case 0:
738  nType = SVX_NUM_ARABIC;
739  break;
740  case 1:
741  nType = SVX_NUM_ROMAN_UPPER;
742  break;
743  case 2:
744  nType = SVX_NUM_ROMAN_LOWER;
745  break;
746  case 3:
748  break;
749  case 4:
751  break;
752  case 5:
753  // actually: ORDINAL
754  nType = SVX_NUM_ARABIC;
755  break;
756  case 23:
757  nType = SVX_NUM_CHAR_SPECIAL;
758  //For i120928,type info
759  if (bIsPicBullet)
760  {
761  nType = SVX_NUM_BITMAP;
762  }
763 
764  break;
765  case 255:
766  nType = SVX_NUM_NUMBER_NONE;
767  break;
768  case 14:
769  case 19:nType = SVX_NUM_FULL_WIDTH_ARABIC; break;
770  case 30:nType = SVX_NUM_TIAN_GAN_ZH; break;
771  case 31:nType = SVX_NUM_DI_ZI_ZH; break;
772  case 35:
773  case 36:
774  case 37:
775  case 11:
776  case 39:nType = SVX_NUM_NUMBER_LOWER_ZH; break;
777  case 34:nType = SVX_NUM_NUMBER_UPPER_ZH_TW; break;
778  case 38:nType = SVX_NUM_NUMBER_UPPER_ZH; break;
779  case 10:nType = SVX_NUM_NUMBER_TRADITIONAL_JA; break;
780  case 20:nType = SVX_NUM_AIU_FULLWIDTH_JA; break;
781  case 12:nType = SVX_NUM_AIU_HALFWIDTH_JA; break;
782  case 21:nType = SVX_NUM_IROHA_FULLWIDTH_JA; break;
783  case 13:nType = SVX_NUM_IROHA_HALFWIDTH_JA; break;
784  case 24:nType = SVX_NUM_HANGUL_SYLLABLE_KO; break;
785  case 25:nType = SVX_NUM_HANGUL_JAMO_KO; break;
786  case 41:nType = SVX_NUM_NUMBER_HANGUL_KO; break;
787  //case 42:
788  //case 43:
789  case 44:nType = SVX_NUM_NUMBER_UPPER_KO; break;
790  default:
791  nType= SVX_NUM_ARABIC; break;
792  }
793 
794  //If a number level is not going to be used, then record this fact
795  if (SVX_NUM_NUMBER_NONE == nType)
796  rNotReallyThere[nLevel] = true;
797 
798  /*
799  If a number level was not used (i.e. is in NotReallyThere), and that
800  number level appears at one of the positions in the display string of the
801  list, then it effectively is not there at all. So remove that level entry
802  from a copy of the aOfsNumsXCH.
803  */
804  std::vector<sal_uInt8> aOfsNumsXCH;
805  aOfsNumsXCH.reserve(nMaxLevel);
806 
807  for(sal_uInt8 nLevelB = 0; nLevelB < nMaxLevel; ++nLevelB)
808  aOfsNumsXCH.push_back(aLVL.aOfsNumsXCH[nLevelB]);
809 
810  // nLevelB is an index in the aOfsNumsXCH array.
811  for(sal_uInt16 nLevelB = 0; nLevelB <= nLevel; ++nLevelB)
812  {
813  // nPos is a one-based character offset to a level placeholder in
814  // sNumString.
815  sal_uInt8 nPos = aOfsNumsXCH[nLevelB];
816  if (nPos && nPos < sNumString.getLength())
817  {
818  // nPosValue is the actual numbering level.
819  sal_Unicode nPosValue = sNumString[nPos-1];
820  if (nPosValue < nMaxLevel)
821  {
822  if (rNotReallyThere[nPosValue])
823  aOfsNumsXCH[nLevelB] = 0;
824  }
825  }
826  }
827  auto aIter = std::remove(aOfsNumsXCH.begin(), aOfsNumsXCH.end(), 0);
828  auto aEnd = aOfsNumsXCH.end();
829  // #i60633# - suppress access on <aOfsNumsXCH.end()>
830  if ( aIter != aEnd )
831  {
832  // Somehow the first removed vector element, at which <aIter>
833  // points to, isn't reset to zero.
834  // Investigation is needed to clarify why. It seems that only
835  // special arrays are handled correctly by this code.
836  ++aIter;
837  while (aIter != aEnd)
838  {
839  (*aIter) = 0;
840  ++aIter;
841  }
842  }
843 
844  sal_uInt8 nUpperLevel = 0; // current displaydepth for Writer
845  for(sal_uInt8 nLevelB = 0; nLevelB < nMaxLevel; ++nLevelB)
846  {
847  if (!nUpperLevel && !aOfsNumsXCH[nLevelB])
848  nUpperLevel = nLevelB;
849  }
850 
851  // If the terminating char was not NULL, all indices of the list are
852  // filled, so the levels have to be displayed.
853  if (!nUpperLevel)
854  nUpperLevel = nMaxLevel;
855 
856  if (style::NumberingType::CHAR_SPECIAL == nType)
857  {
858  cBullet = !sNumString.isEmpty() ? sNumString[0] : 0x2190;
859 
860  if (!cBullet) // unsave control code?
861  cBullet = 0x2190;
862  }
863  else if (style::NumberingType::BITMAP == nType) //For i120928,position index info of graphic
864  {
865  cGrfBulletCP = nWitchPicIsBullet; // This is a bullet picture ID
866  }
867  else
868  {
869  /*
870  #i173#
871  Our aOfsNumsXCH seems generally to be an array that contains the
872  offset into sNumString of locations where the numbers should be
873  filled in, so if the first "fill in a number" slot is greater than
874  1 there is a "prefix" before the number
875  */
876  //First number appears at
877  sal_uInt8 nOneBasedFirstNoIndex = aOfsNumsXCH[0];
878  const sal_Int32 nFirstNoIndex =
879  nOneBasedFirstNoIndex > 0 ? nOneBasedFirstNoIndex -1 : SAL_MAX_INT32;
880  lcl_CopyGreaterEight(sPrefix, sNumString, 0, nFirstNoIndex);
881 
882  //Next number appears at
883  assert(nUpperLevel > 0);
884  sal_uInt8 nOneBasedNextNoIndex = aOfsNumsXCH[nUpperLevel-1];
885  const sal_Int32 nNextNoIndex =
886  nOneBasedNextNoIndex > 0 ? nOneBasedNextNoIndex : SAL_MAX_INT32;
887  if (sNumString.getLength() > nNextNoIndex)
888  lcl_CopyGreaterEight(sPostfix, sNumString, nNextNoIndex);
889 
890  /*
891  We use lcl_CopyGreaterEight because once if we have removed unused
892  number indexes from the aOfsNumsXCH then placeholders remain in
893  sNumString which must not be copied into the final numbering strings
894  */
895  }
896 
897  switch( aLVL.nAlign )
898  {
899  case 0:
900  eAdj = SvxAdjust::Left;
901  break;
902  case 1:
903  eAdj = SvxAdjust::Center;
904  break;
905  case 2:
906  eAdj = SvxAdjust::Right;
907  break;
908  case 3:
909  // Writer here cannot do block justification
910  eAdj = SvxAdjust::Left;
911  break;
912  default:
913  // undefined value
914  OSL_ENSURE( false, "Value of aLVL.nAlign is not supported" );
915  // take default
916  eAdj = SvxAdjust::Left;
917  break;
918  }
919 
920  // 6. Configure NumFormat
921  if( bSetStartNo )
922  rNumFormat.SetStart( nStartNo );
923  rNumFormat.SetNumberingType( nType );
924  rNumFormat.SetNumAdjust( eAdj );
925 
926  if( style::NumberingType::CHAR_SPECIAL == nType )
927  {
928  // first character of the Prefix-Text is the Bullet
929  rNumFormat.SetBulletChar(cBullet);
930  // Don't forget: further below, after building styles
931  // Call SetBulletFont() !!!
932  }
933  //For i120928,position index info
934  else if (style::NumberingType::BITMAP == nType)
935  {
936  rNumFormat.SetGrfBulletCP(cGrfBulletCP);
937  }
938  else
939  {
940  // reminder: Garnix is default Prefix
941  if( !sPrefix.isEmpty() )
942  rNumFormat.SetPrefix( sPrefix );
943  // reminder: Point is default Postfix
944  rNumFormat.SetSuffix( sPostfix );
945  rNumFormat.SetIncludeUpperLevels( nUpperLevel );
946  }
947 
948  // #i89181#
949  if ( rNumFormat.GetPositionAndSpaceMode() ==
951  {
952  if (eAdj == SvxAdjust::Right)
953  {
954  rNumFormat.SetAbsLSpace(aLVL.nDxaLeft);
955  rNumFormat.SetFirstLineOffset(-aLVL.nDxaLeft);
956  rNumFormat.SetCharTextDistance(-aLVL.nDxaLeft1);
957  }
958  else
959  {
960  rNumFormat.SetAbsLSpace( aLVL.nDxaLeft );
961  rNumFormat.SetFirstLineOffset(aLVL.nDxaLeft1);
962  }
963  }
964  else
965  {
966  rNumFormat.SetIndentAt( aLVL.nDxaLeft );
967  rNumFormat.SetFirstLineIndent(aLVL.nDxaLeft1);
968  if ( !aLVL.bV6 )
969  rNumFormat.SetListtabPos( nTabPos );
970  else
971  rNumFormat.SetListtabPos( aLVL.nV6Indent );
973  switch ( ixchFollow )
974  {
975  case 0:
976  {
977  eNumLabelFollowedBy = SvxNumberFormat::LISTTAB;
978  }
979  break;
980  case 1:
981  {
982  eNumLabelFollowedBy = SvxNumberFormat::SPACE;
983  }
984  break;
985  case 2:
986  {
987  eNumLabelFollowedBy = SvxNumberFormat::NOTHING;
988  }
989  break;
990  }
991  rNumFormat.SetLabelFollowedBy( eNumLabelFollowedBy );
992  }
993 
994  return true;
995 }
996 
998  WW8aISet const & rListItemSet, WW8aCFormat& rCharFormat, bool& bNewCharFormatCreated,
999  const OUString& sPrefix )
1000 {
1001  bNewCharFormatCreated = false;
1002  sal_uInt8 nIdenticalItemSetLevel;
1003  const SfxPoolItem* pItem;
1004 
1005  SwNumFormat aNumFormat = rNumRule.Get( nLevel );
1006 
1007  SfxItemSet* pThisLevelItemSet = rListItemSet[nLevel].get();
1008 
1009  if( pThisLevelItemSet && pThisLevelItemSet->Count())
1010  {
1011  nIdenticalItemSetLevel = nMaxLevel;
1012  SfxItemIter aIter( *pThisLevelItemSet );
1013  for (sal_uInt8 nLowerLevel = 0; nLowerLevel < nLevel; ++nLowerLevel)
1014  {
1015  SfxItemSet* pLowerLevelItemSet = rListItemSet[nLowerLevel].get();
1016  if( pLowerLevelItemSet
1017  && (pLowerLevelItemSet->Count() == pThisLevelItemSet->Count()) )
1018  {
1019  nIdenticalItemSetLevel = nLowerLevel;
1020  sal_uInt16 nWhich = aIter.GetCurItem()->Which();
1021  while (true)
1022  {
1023  if( // search for appropriate pItem in pLowerLevelItemSet
1024  (SfxItemState::SET != pLowerLevelItemSet->GetItemState(
1025  nWhich, false, &pItem ) )
1026  || // use virtual "!=" Operator
1027  (*pItem != *aIter.GetCurItem() ) )
1028  // if no Item with equal nWhich was found or Item value was not equal
1029  // store inequality and break!
1030  {
1031  nIdenticalItemSetLevel = nMaxLevel;
1032  break;
1033  }
1034  if( aIter.IsAtEnd() )
1035  break;
1036  nWhich = aIter.NextItem()->Which();
1037  }
1038 
1039  if( nIdenticalItemSetLevel != nMaxLevel )
1040  break;
1041  }
1042  }
1043 
1044  SwCharFormat* pFormat;
1045  if (nMaxLevel == nIdenticalItemSetLevel)
1046  {
1047  // Define Style
1048  const OUString aName( (!sPrefix.isEmpty() ? sPrefix : rNumRule.GetName())
1049  + "z" + OUString::number( nLevel ) );
1050 
1051  // remove const by casting
1053  bNewCharFormatCreated = true;
1054  // Set Attributes
1055  pFormat->SetFormatAttr( *pThisLevelItemSet );
1056  }
1057  else
1058  {
1059  // append Style
1060  pFormat = rCharFormat[ nIdenticalItemSetLevel ];
1061  }
1062 
1063  // store
1064  rCharFormat[ nLevel ] = pFormat;
1065 
1066  // Append Style to NumFormat
1067 
1068  aNumFormat.SetCharFormat( pFormat );
1069  }
1070  //Ensure the default char fmt is initialized for any level of num ruler if no customized attr
1071  else
1072  {
1073  SwCharFormat* pFormat = aNumFormat.GetCharFormat();
1074  if ( !pFormat)
1075  {
1076  const OUString aName( (!sPrefix.isEmpty() ? sPrefix : rNumRule.GetName())
1077  + "z" + OUString::number( nLevel ) );
1078 
1080  bNewCharFormatCreated = true;
1081  rCharFormat[ nLevel ] = pFormat;
1082  aNumFormat.SetCharFormat( pFormat );
1083  }
1084  }
1085 
1086  // if necessary: Append Bullet Font to NumFormat
1087 
1088  if( SVX_NUM_CHAR_SPECIAL == aNumFormat.GetNumberingType() )
1089  {
1090  SwCharFormat* pFormat = aNumFormat.GetCharFormat();
1091  vcl::Font aFont;
1092  if( !pFormat )
1093  {
1094  aFont = numfunc::GetDefBulletFont();
1095  }
1096  else
1097  {
1098  const SvxFontItem& rFontItem = pFormat->GetFont();
1099  aFont.SetFamily( rFontItem.GetFamily() );
1100  aFont.SetFamilyName( rFontItem.GetFamilyName() );
1101  aFont.SetStyleName( rFontItem.GetStyleName() );
1102  aFont.SetPitch( rFontItem.GetPitch() );
1103  aFont.SetCharSet( rFontItem.GetCharSet() );
1104  }
1105  aNumFormat.SetBulletFont( &aFont );
1106  }
1107 
1108  // Set NumFormat in NumRule
1109 
1110  rNumRule.Set(nLevel, aNumFormat);
1111 }
1112 
1114 {
1115  // Used to build the Style Name
1116  const OUString sPrefix("WW8Num" + OUString::number(nUniqueList++));
1117  // #i86652#
1118  sal_uInt16 nRul =
1119  rDoc.MakeNumRule( rDoc.GetUniqueNumRuleName(&sPrefix), nullptr, false,
1121  SwNumRule* pMyNumRule = rDoc.GetNumRuleTable()[nRul];
1122  pMyNumRule->SetAutoRule(false);
1123  pMyNumRule->SetContinusNum(bSimple);
1124  return pMyNumRule;
1125 }
1126 
1128 {
1129  if (i < maLSTInfos.size())
1130  return maLSTInfos[i]->pNumRule;
1131  else
1132  return nullptr;
1133 }
1134 
1135 // public methods
1136 
1138  : maSprmParser(rReader_.GetFib()), rReader(rReader_)
1139  , rDoc(rReader.GetDoc())
1140  , rFib(rReader.GetFib()), rSt(rSt_)
1141  , nUniqueList(1)
1142  , nLastLFOPosition(USHRT_MAX)
1143 {
1144 
1145  // LST and LFO only since WW8
1146  if( ( 8 > rFib.m_nVersion )
1147  || ( rFib.m_fcPlcfLst == rFib.m_fcPlfLfo )
1148  || ( rFib.m_lcbPlcfLst < 2 )
1149  || ( rFib.m_lcbPlfLfo < 2) ) return; // no public lists
1150 
1151  // create Arrays
1152  bool bLVLOk = true;
1153 
1154  long nOriginalPos = rSt.Tell();
1155 
1156  // 1. read PLCF LST and create list templates in Writer
1157 
1158  bool bOk = checkSeek(rSt, rFib.m_fcPlcfLst);
1159 
1160  if (!bOk)
1161  return;
1162 
1163  sal_uInt32 nRemainingPlcfLst = rFib.m_lcbPlcfLst;
1164 
1165  sal_uInt16 nListCount(0);
1166  rSt.ReadUInt16( nListCount );
1167  nRemainingPlcfLst -= 2;
1168  bOk = nListCount > 0;
1169 
1170  if (!bOk)
1171  return;
1172 
1173  // 1.1 read all LST
1174  const size_t nMinRecordSize = 10 + 2*nMaxLevel;
1175  const size_t nMaxRecords = rSt.remainingSize() / nMinRecordSize;
1176  if (nListCount > nMaxRecords)
1177  {
1178  SAL_WARN("sw.ww8", "Parsing error: " << nMaxRecords <<
1179  " max possible entries, but " << nListCount << " claimed, truncating");
1180  nListCount = nMaxRecords;
1181  }
1182  for (sal_uInt16 nList=0; nList < nListCount; ++nList)
1183  {
1184  if (nRemainingPlcfLst < cbLSTF)
1185  break;
1186 
1187  WW8LST aLST;
1188  memset(&aLST, 0, sizeof( aLST ));
1189 
1190  // 1.1.1 read Data
1191 
1192  rSt.ReadUInt32( aLST.nIdLst );
1193  rSt.ReadUInt32( aLST.nTplC );
1194  for (sal_uInt16 & nLevel : aLST.aIdSty)
1195  rSt.ReadUInt16( nLevel );
1196 
1197  sal_uInt8 aBits1(0);
1198  rSt.ReadUChar( aBits1 );
1199 
1200  rSt.SeekRel( 1 );
1201 
1202  if( aBits1 & 0x01 )
1203  aLST.bSimpleList = true;
1204  if( aBits1 & 0x02 )
1205  aLST.bRestartHdn = true;
1206 
1207  // 1.1.2 new NumRule inserted in Doc and WW8LSTInfo marked
1208 
1209  /*
1210  #i1869#
1211  In word 2000 microsoft got rid of creating new "simple lists" with
1212  only 1 level, all new lists are created with 9 levels. To hack it
1213  so that the list types formerly known as simple lists still have
1214  their own tab page to themselves one of the reserved bits is used
1215  to show that a given list is to be in the simple list tabpage.
1216  This has now nothing to do with the actual number of list level a
1217  list has, only how many will be shown in the user interface.
1218 
1219  i.e. create a simple list in 2000 and open it in 97 and 97 will
1220  claim (correctly) that it is an outline list. We can set our
1221  continuous flag in these lists to store this information.
1222  */
1223  SwNumRule* pMyNumRule = CreateNextRule(
1224  aLST.bSimpleList || (aBits1 & 0x10));
1225 
1226  WW8LSTInfo* pLSTInfo = new WW8LSTInfo(pMyNumRule, aLST);
1227  maLSTInfos.emplace_back(pLSTInfo);
1228 
1229  nRemainingPlcfLst -= cbLSTF;
1230  }
1231 
1232  // 1.2 read all LVL of all aLST
1233 
1234  sal_uInt16 nLSTInfos = static_cast< sal_uInt16 >(maLSTInfos.size());
1235  for (sal_uInt16 nList = 0; nList < nLSTInfos; ++nList)
1236  {
1237  WW8aISet aItemSet; // Character attributes from GrpprlChpx
1238 
1239  WW8LSTInfo* pListInfo = maLSTInfos[nList].get();
1240  if( !pListInfo || !pListInfo->pNumRule ) break;
1241  SwNumRule& rMyNumRule = *pListInfo->pNumRule;
1242 
1243  // 1.2.1 read specific LVL(s) for this aLST
1244 
1245  sal_uInt16 nLvlCount = static_cast< sal_uInt16 >(pListInfo->bSimpleList ? nMinLevel : nMaxLevel);
1246  std::deque<bool> aNotReallyThere;
1247  aNotReallyThere.resize(nMaxLevel);
1248  pListInfo->maParaSprms.resize(nMaxLevel);
1249  for (sal_uInt16 nLevel = 0; nLevel < nLvlCount; ++nLevel)
1250  {
1251  SwNumFormat aNumFormat( rMyNumRule.Get( nLevel ) );
1252  // read LVLF
1253  bLVLOk = ReadLVL( aNumFormat, aItemSet[nLevel],
1254  pListInfo->aIdSty[nLevel], true, aNotReallyThere, nLevel,
1255  pListInfo->maParaSprms[nLevel]);
1256  if( !bLVLOk )
1257  break;
1258  // and set in rMyNumRule
1259  rMyNumRule.Set( nLevel, aNumFormat );
1260  }
1261  if( !bLVLOk )
1262  break;
1263 
1264  // 1.2.2 compare ItemPools and CHPx Settings of different Levels
1265  // and create Style(s) if necessary
1266 
1267  for (sal_uInt16 nLevel = 0; nLevel < nLvlCount; ++nLevel)
1268  {
1269  bool bDummy;
1270  AdjustLVL( nLevel, rMyNumRule, aItemSet,
1271  pListInfo->aCharFormat, bDummy );
1272  }
1273  }
1274 
1275  // 2. read and save PLF LFO
1276 
1277  bOk = checkSeek(rSt, rFib.m_fcPlfLfo);
1278 
1279  if (!bOk)
1280  return;
1281 
1282  sal_Int32 nLfoCount(0);
1283  rSt.ReadInt32( nLfoCount );
1284  bOk = nLfoCount > 0;
1285 
1286  if (!bOk)
1287  return;
1288 
1289  // 2.1 read all LFO
1290 
1291  for (sal_Int32 nLfo = 0; nLfo < nLfoCount; ++nLfo)
1292  {
1293  bOk = false;
1294 
1295  WW8LFO aLFO;
1296  memset(&aLFO, 0, sizeof( aLFO ));
1297 
1298  rSt.ReadUInt32( aLFO.nIdLst );
1299  rSt.SeekRel( 8 );
1300  rSt.ReadUChar( aLFO.nLfoLvl );
1301  if (!rSt.good())
1302  break;
1303  rSt.SeekRel( 3 );
1304  // as many Overrides as there are
1305  if ((nMaxLevel < aLFO.nLfoLvl) || rSt.GetError())
1306  break;
1307 
1308  // get the Parent NumRule of the current List
1309  WW8LSTInfo* pParentListInfo = GetLSTByListId(aLFO.nIdLst);
1310  if (pParentListInfo)
1311  {
1312  // Save the NumRule in this first step
1313  aLFO.pNumRule = pParentListInfo->pNumRule;
1314 
1315  // are there multiple Levels in the List?
1316  aLFO.bSimpleList = pParentListInfo->bSimpleList;
1317  }
1318  // store in Array
1319  std::unique_ptr<WW8LFOInfo> pLFOInfo(new WW8LFOInfo(aLFO));
1320  if (pParentListInfo)
1321  {
1322  //Copy the basic paragraph properties for each level from the
1323  //original list into the list format override levels.
1324  int nMaxSize = pParentListInfo->maParaSprms.size();
1325  pLFOInfo->maParaSprms.resize(nMaxSize);
1326  for (int i = 0; i < nMaxSize; ++i)
1327  pLFOInfo->maParaSprms[i] = pParentListInfo->maParaSprms[i];
1328  }
1329  m_LFOInfos.push_back(std::move(pLFOInfo));
1330  bOk = true;
1331  }
1332 
1333  if( bOk )
1334  {
1335 
1336  // 2.2 read specific LFOLVL for all LFO
1337 
1338  size_t nLFOInfos = m_LFOInfos.size();
1339  for (size_t nLfo = 0; nLfo < nLFOInfos; ++nLfo)
1340  {
1341  WW8LFOInfo& rLFOInfo = *m_LFOInfos[nLfo];
1342  // Do LFOLVL exist?
1343  if( rLFOInfo.bOverride )
1344  {
1345  WW8LSTInfo* pParentListInfo = GetLSTByListId(rLFOInfo.nIdLst);
1346  if (!pParentListInfo)
1347  break;
1348 
1349  // 2.2.1 create new NumRule for this List
1350 
1351  SwNumRule* pParentNumRule = rLFOInfo.pNumRule;
1352  OSL_ENSURE(pParentNumRule, "ww: Impossible lists, please report");
1353  if( !pParentNumRule )
1354  break;
1355  // create name-prefix for NumRule-Name
1356  // and (if necessary) for Style-Name
1357  const OUString sPrefix("WW8NumSt" + OUString::number( nLfo + 1 ));
1358  // Now assign pNumRule its actual value!!!
1359  // (it contained the parent NumRule up to this point)
1360 
1361  // check if a Style is referencing this LFO
1362  if( USHRT_MAX > rReader.StyleUsingLFO( nLfo ) )
1363  {
1364  sal_uInt16 nRul = rDoc.MakeNumRule(
1365  rDoc.GetUniqueNumRuleName( &sPrefix ), pParentNumRule);
1366  rLFOInfo.pNumRule = rDoc.GetNumRuleTable()[ nRul ];
1367  rLFOInfo.pNumRule->SetAutoRule(false);
1368  }
1369  else
1370  {
1371  sal_uInt16 nRul = rDoc.MakeNumRule(
1372  rDoc.GetUniqueNumRuleName(), pParentNumRule);
1373  rLFOInfo.pNumRule = rDoc.GetNumRuleTable()[ nRul ];
1374  rLFOInfo.pNumRule->SetAutoRule(true); // = default
1375  }
1376 
1377  // 2.2.2 read all LFOLVL (and LVL) for the new NumRule
1378 
1379  WW8aISet aItemSet; // Character attributes from GrpprlChpx
1380  WW8aCFormat aCharFormat; // Character Style Pointer
1381  memset(&aCharFormat, 0, sizeof( aCharFormat ));
1382 
1383  //2.2.2.0 skip inter-group of override header ?
1384  //See #i25438# for why I moved this here, compare
1385  //that original bugdoc's binary to what it looks like
1386  //when resaved with word, i.e. there is always a
1387  //4 byte header, there might be more than one if
1388  //that header was 0xFFFFFFFF, e.g. #114412# ?
1389  sal_uInt32 nTest;
1390  rSt.ReadUInt32( nTest );
1391  do
1392  {
1393  nTest = 0;
1394  rSt.ReadUInt32( nTest );
1395  }
1396  while (nTest == 0xFFFFFFFF);
1397  rSt.SeekRel(-4);
1398 
1399  std::deque<bool> aNotReallyThere(WW8ListManager::nMaxLevel);
1400  for (sal_uInt8 nLevel = 0; nLevel < rLFOInfo.nLfoLvl; ++nLevel)
1401  {
1402  WW8LFOLVL aLFOLVL;
1403  bLVLOk = false;
1404 
1405  // 2.2.2.1 read LFOLVL
1406 
1407  rSt.ReadInt32( aLFOLVL.nStartAt );
1408  sal_uInt8 aBits1(0);
1409  rSt.ReadUChar( aBits1 );
1410  rSt.SeekRel( 3 );
1411  if (rSt.GetError())
1412  break;
1413 
1414  // Note: MS writes the Override-Level-Number into 4 bit.
1415  // We do not! (See comment at "struct WW8LFOInfo")
1416  aLFOLVL.nLevel = aBits1 & 0x0F;
1417  if( (0xFF > aBits1) &&
1418  (nMaxLevel > aLFOLVL.nLevel) )
1419  {
1420  if (aBits1 & 0x10)
1421  aLFOLVL.bStartAt = true;
1422  else
1423  aLFOLVL.bStartAt = false;
1424 
1425  // 2.2.2.2 load dedicated LVL if necessary
1426 
1427  SwNumFormat aNumFormat(
1428  rLFOInfo.pNumRule->Get(aLFOLVL.nLevel));
1429  if (aBits1 & 0x20)
1430  {
1431  aLFOLVL.bFormat = true;
1432  // if bStartup is true, replace Startup-Level
1433  // with the LVLF that is saved in the LVL
1434  bLVLOk = nLevel < rLFOInfo.maParaSprms.size() &&
1435  ReadLVL(aNumFormat, aItemSet[nLevel],
1436  pParentListInfo->aIdSty[nLevel],
1437  aLFOLVL.bStartAt, aNotReallyThere, nLevel,
1438  rLFOInfo.maParaSprms[nLevel]);
1439 
1440  if (!bLVLOk)
1441  break;
1442  }
1443  else if (aLFOLVL.bStartAt)
1444  {
1445  aNumFormat.SetStart(
1446  writer_cast<sal_uInt16>(aLFOLVL.nStartAt));
1447  }
1448 
1449  // 2.2.2.3 Set NumFormat in NumRule
1450 
1451  rLFOInfo.pNumRule->Set(aLFOLVL.nLevel, aNumFormat);
1452  }
1453  bLVLOk = true;
1454 
1455  if (nMaxLevel > aLFOLVL.nLevel)
1456  rLFOInfo.maOverrides[aLFOLVL.nLevel] = aLFOLVL;
1457  }
1458  if( !bLVLOk )
1459  break;
1460 
1461  // 2.2.3 adjust LVL of the new NumRule
1462 
1463  bool bNewCharFormatCreated = false;
1464  for (sal_uInt8 nLevel = 0; nLevel < rLFOInfo.nLfoLvl; ++nLevel)
1465  {
1466  AdjustLVL( nLevel, *rLFOInfo.pNumRule, aItemSet, aCharFormat,
1467  bNewCharFormatCreated, sPrefix );
1468  }
1469  }
1470  }
1471  }
1472  // and we're done!
1473  rSt.Seek( nOriginalPos );
1474 }
1475 
1476 WW8ListManager::~WW8ListManager() COVERITY_NOEXCEPT_FALSE
1477 {
1478  /*
1479  named lists remain in document
1480  unused automatic lists are removed from document (DelNumRule)
1481  */
1482  for(auto & rpInfo : maLSTInfos)
1483  {
1484  if (rpInfo->pNumRule && !rpInfo->bUsedInDoc &&
1485  rpInfo->pNumRule->IsAutoRule())
1486  {
1487  rDoc.DelNumRule(rpInfo->pNumRule->GetName());
1488  }
1489  rpInfo.reset();
1490  }
1491  for (auto aIter = m_LFOInfos.rbegin(); aIter != m_LFOInfos.rend(); ++aIter)
1492  {
1493  if ((*aIter)->bOverride
1494  && (*aIter)->pNumRule
1495  && !(*aIter)->bUsedInDoc
1496  && (*aIter)->pNumRule->IsAutoRule())
1497  {
1498  rDoc.DelNumRule( (*aIter)->pNumRule->GetName() );
1499  }
1500  }
1501 }
1502 
1503 static bool IsEqualFormatting(const SwNumRule &rOne, const SwNumRule &rTwo)
1504 {
1505  bool bRet =
1506  (
1507  rOne.GetRuleType() == rTwo.GetRuleType() &&
1508  rOne.IsContinusNum() == rTwo.IsContinusNum() &&
1509  rOne.IsAbsSpaces() == rTwo.IsAbsSpaces() &&
1510  rOne.GetPoolFormatId() == rTwo.GetPoolFormatId() &&
1511  rOne.GetPoolHelpId() == rTwo.GetPoolHelpId() &&
1512  rOne.GetPoolHlpFileId() == rTwo.GetPoolHlpFileId()
1513  );
1514 
1515  if (bRet)
1516  {
1517  for (sal_uInt8 n = 0; n < MAXLEVEL; ++n )
1518  {
1519  //The SvxNumberFormat compare, not the SwNumFormat compare
1520  const SvxNumberFormat &rO = rOne.Get(n);
1521  const SvxNumberFormat &rT = rTwo.Get(n);
1522  if (rO != rT)
1523  {
1524  bRet = false;
1525  break;
1526  }
1527  }
1528  }
1529  return bRet;
1530 }
1531 
1533  const sal_uInt8 nLevel, std::vector<sal_uInt8> &rParaSprms, SwTextNode *pNode)
1534 {
1535  if (m_LFOInfos.size() <= nLFOPosition)
1536  return nullptr;
1537 
1538  WW8LFOInfo& rLFOInfo = *m_LFOInfos[nLFOPosition];
1539 
1540  bool bFirstUse = !rLFOInfo.bUsedInDoc;
1541  rLFOInfo.bUsedInDoc = true;
1542 
1543  if( !rLFOInfo.pNumRule )
1544  return nullptr;
1545 
1546  // #i25545#
1547  // #i100132# - a number format does not have to exist on given list level
1548  SwNumFormat aFormat(rLFOInfo.pNumRule->Get(nLevel));
1549 
1550  if (rReader.IsRightToLeft() && nLastLFOPosition != nLFOPosition) {
1551  if ( aFormat.GetNumAdjust() == SvxAdjust::Right)
1552  aFormat.SetNumAdjust(SvxAdjust::Left);
1553  else if ( aFormat.GetNumAdjust() == SvxAdjust::Left)
1554  aFormat.SetNumAdjust(SvxAdjust::Right);
1555  rLFOInfo.pNumRule->Set(nLevel, aFormat);
1556  }
1557  nLastLFOPosition = nLFOPosition;
1558  /*
1559  #i1869#
1560  If this list has had its bits set in word 2000 to pretend that it is a
1561  simple list from the point of view of the user, then it is almost
1562  certainly a simple continuous list, and we will try to keep it like that.
1563  Otherwise when we save again it will be shown as the true outline list
1564  that it is, confusing the user that just wanted what they thought was a
1565  simple list. On the other hand it is possible that some of the other levels
1566  were used by the user, in which case we will not pretend anymore that it
1567  is a simple list. Something that word 2000 does anyway, that 97 didn't, to
1568  my bewilderment.
1569  */
1570  if (nLevel && rLFOInfo.pNumRule->IsContinusNum())
1571  rLFOInfo.pNumRule->SetContinusNum(false);
1572 
1573  if( (!rLFOInfo.bOverride) && (!rLFOInfo.bLSTbUIDSet) )
1574  {
1575  WW8LSTInfo* pParentListInfo = GetLSTByListId( rLFOInfo.nIdLst );
1576  if( pParentListInfo )
1577  pParentListInfo->bUsedInDoc = true;
1578  rLFOInfo.bLSTbUIDSet = true;
1579  }
1580 
1581  if (rLFOInfo.maParaSprms.size() > nLevel)
1582  rParaSprms = rLFOInfo.maParaSprms[nLevel];
1583 
1584  SwNumRule *pRet = rLFOInfo.pNumRule;
1585 
1586  bool bRestart(false);
1587  sal_uInt16 nStart(0);
1588  bool bNewstart(false);
1589  /*
1590  Note: If you fiddle with this then you have to make sure that #i18322#
1591  #i13833#, #i20095# and #112466# continue to work
1592 
1593  Check if there were overrides for this level
1594  */
1595  if (rLFOInfo.bOverride && nLevel < rLFOInfo.nLfoLvl)
1596  {
1597  WW8LSTInfo* pParentListInfo = GetLSTByListId(rLFOInfo.nIdLst);
1598  OSL_ENSURE(pParentListInfo, "ww: Impossible lists, please report");
1599  if (pParentListInfo && pParentListInfo->pNumRule)
1600  {
1601  const WW8LFOLVL &rOverride = rLFOInfo.maOverrides[nLevel];
1602  bool bNoChangeFromParent =
1603  IsEqualFormatting(*pRet, *(pParentListInfo->pNumRule));
1604 
1605  //If so then I think word still uses the parent (maybe)
1606  if (bNoChangeFromParent)
1607  {
1608  pRet = pParentListInfo->pNumRule;
1609 
1610  //did it not affect start at value ?
1611  if (bFirstUse && rOverride.bStartAt)
1612  {
1613  const SwNumFormat &rFormat =
1614  pParentListInfo->pNumRule->Get(nLevel);
1615  if (
1616  rFormat.GetStart() ==
1617  rLFOInfo.maOverrides[nLevel].nStartAt
1618  )
1619  {
1620  bRestart = true;
1621  }
1622  else
1623  {
1624  bNewstart = true;
1625  nStart = writer_cast<sal_uInt16>
1626  (rLFOInfo.maOverrides[nLevel].nStartAt);
1627  }
1628  }
1629 
1630  pParentListInfo->bUsedInDoc = true;
1631  }
1632  }
1633  }
1634 
1635  if (pNode)
1636  {
1637  pNode->SetAttrListLevel(nLevel);
1638 
1639  if (bRestart || bNewstart)
1640  pNode->SetListRestart(true);
1641  if (bNewstart)
1642  pNode->SetAttrListRestartValue(nStart);
1643  }
1644  return pRet;
1645 }
1646 
1647 // SwWW8ImplReader: append a List to a Style or Paragraph
1648 
1650  SwWW8StyInf& rStyleInfo)
1651 {
1652  bool bRes = true;
1653  if( rStyleInfo.m_pFormat && rStyleInfo.m_bColl )
1654  {
1655  bRes = m_rDoc.SetTextFormatColl(rRg, static_cast<SwTextFormatColl*>(rStyleInfo.m_pFormat));
1656  SwTextNode* pTextNode = m_pPaM->GetNode().GetTextNode();
1657  OSL_ENSURE( pTextNode, "No Text-Node at PaM-Position" );
1658  if ( !pTextNode )
1659  {
1660  // make code robust
1661  return bRes;
1662  }
1663 
1664  const SwNumRule * pNumRule = pTextNode->GetNumRule(); // #i27610#
1665 
1667  ! (pNumRule && pNumRule->IsOutlineRule()) ) // #i27610#
1668  {
1669  pTextNode->ResetAttr( RES_PARATR_NUMRULE );
1670  }
1671 
1672  if (USHRT_MAX > rStyleInfo.m_nLFOIndex && WW8ListManager::nMaxLevel
1673  > rStyleInfo.m_nListLevel)
1674  {
1675  const bool bApplyListStyle = false;
1676  RegisterNumFormatOnTextNode(rStyleInfo.m_nLFOIndex, rStyleInfo.m_nListLevel,
1677  bApplyListStyle);
1678  }
1679  }
1680  return bRes;
1681 }
1682 
1683 void UseListIndent(SwWW8StyInf &rStyle, const SwNumFormat &rFormat)
1684 {
1685  // #i86652#
1687  {
1688  const auto nAbsLSpace = rFormat.GetAbsLSpace();
1689  const long nListFirstLineIndent = GetListFirstLineIndent(rFormat);
1690  SvxLRSpaceItem aLR(ItemGet<SvxLRSpaceItem>(*rStyle.m_pFormat, RES_LR_SPACE));
1691  aLR.SetTextLeft(nAbsLSpace);
1692  aLR.SetTextFirstLineOfst(writer_cast<short>(nListFirstLineIndent));
1693  rStyle.m_pFormat->SetFormatAttr(aLR);
1694  rStyle.m_bListReleventIndentSet = true;
1695  }
1696 }
1697 
1698 void SetStyleIndent(SwWW8StyInf &rStyle, const SwNumFormat &rFormat)
1699 {
1701  {
1702  SvxLRSpaceItem aLR(ItemGet<SvxLRSpaceItem>(*rStyle.m_pFormat, RES_LR_SPACE));
1703  if (rStyle.m_bListReleventIndentSet)
1704  {
1705 
1706  SyncIndentWithList( aLR, rFormat, false, false ); // #i103711#, #i105414#
1707  }
1708  else
1709  {
1710  aLR.SetTextLeft(0);
1711  aLR.SetTextFirstLineOfst(0);
1712  }
1713  rStyle.m_pFormat->SetFormatAttr(aLR);
1714  }
1715 }
1716 
1717 void SwWW8ImplReader::SetStylesList(sal_uInt16 nStyle, sal_uInt16 nCurrentLFO,
1718  sal_uInt8 nCurrentLevel)
1719 {
1720  if (nStyle >= m_vColl.size())
1721  return;
1722 
1723  SwWW8StyInf &rStyleInf = m_vColl[nStyle];
1724  if (rStyleInf.m_bValid)
1725  {
1726  OSL_ENSURE(m_pCurrentColl, "Cannot be called outside of style import");
1727  // Phase 1: Numbering attributes when reading a StyleDef
1728  if( m_pCurrentColl )
1729  {
1730  // only save the Parameters for now. The actual List will be appended
1731  // at a later point, when the Listdefinitions is read...
1732  if (
1733  (USHRT_MAX > nCurrentLFO) &&
1734  (WW8ListManager::nMaxLevel > nCurrentLevel)
1735  )
1736  {
1737  rStyleInf.m_nLFOIndex = nCurrentLFO;
1738  rStyleInf.m_nListLevel = nCurrentLevel;
1739 
1740  std::vector<sal_uInt8> aParaSprms;
1741  SwNumRule* pNmRule = m_xLstManager->GetNumRuleForActivation(
1742  nCurrentLFO, nCurrentLevel, aParaSprms);
1743  if (pNmRule)
1744  UseListIndent(rStyleInf, pNmRule->Get(nCurrentLevel));
1745  }
1746  }
1747  }
1748 }
1749 
1751 {
1752 
1753  if (nStyle >= m_vColl.size())
1754  return;
1755 
1756  SwWW8StyInf &rStyleInf = m_vColl[nStyle];
1757  if (rStyleInf.m_bValid && rStyleInf.m_pFormat)
1758  {
1759  //Save old pre-list modified indent, which are the word indent values
1760  rStyleInf.maWordLR.reset(static_cast<SvxLRSpaceItem*>(ItemGet<SvxLRSpaceItem>(*rStyleInf.m_pFormat, RES_LR_SPACE).Clone()));
1761 
1762  // Phase 2: refresh StyleDef after reading all Lists
1763  SwNumRule* pNmRule = nullptr;
1764  const sal_uInt16 nLFO = rStyleInf.m_nLFOIndex;
1765  const sal_uInt8 nLevel = rStyleInf.m_nListLevel;
1766  if (
1767  (USHRT_MAX > nLFO) &&
1768  (WW8ListManager::nMaxLevel > nLevel)
1769  )
1770  {
1771  std::vector<sal_uInt8> aParaSprms;
1772  pNmRule = m_xLstManager->GetNumRuleForActivation(nLFO, nLevel,
1773  aParaSprms);
1774 
1775  if (pNmRule != nullptr)
1776  {
1777  if (rStyleInf.IsWW8BuiltInHeadingStyle()
1778  && rStyleInf.HasWW8OutlineLevel())
1779  {
1780  rStyleInf.m_pOutlineNumrule = pNmRule;
1781  }
1782  else
1783  {
1784  rStyleInf.m_pFormat->SetFormatAttr(
1785  SwNumRuleItem(pNmRule->GetName()));
1786  rStyleInf.m_bHasStyNumRule = true;
1787  }
1788  }
1789  }
1790 
1791  if (pNmRule)
1792  SetStyleIndent(rStyleInf, pNmRule->Get(nLevel));
1793  }
1794 }
1795 
1797  sal_uInt8 nCurrentLevel,
1798  const bool bSetAttr)
1799 {
1800  // Note: the method appends NumRule to the Text Node if
1801  // bSetAttr (of course the lists have to be read before)
1802  // and only sets the Level. It does not check if there is a NumRule
1803  // attached to the STYLE !!!
1804 
1805  if (m_xLstManager) // are all list declarations read?
1806  {
1807  SwTextNode* pTextNd = m_pPaM->GetNode().GetTextNode();
1808  OSL_ENSURE(pTextNd, "No Text-Node at PaM-Position");
1809  if (!pTextNd)
1810  return;
1811 
1812  std::vector<sal_uInt8> aParaSprms;
1813  const SwNumRule* pRule = bSetAttr ?
1814  m_xLstManager->GetNumRuleForActivation( nCurrentLFO, nCurrentLevel,
1815  aParaSprms, pTextNd) : nullptr;
1816 
1817  if (pRule != nullptr || !bSetAttr)
1818  {
1819  if (bSetAttr && pTextNd->GetNumRule() != pRule
1820  && pTextNd->GetNumRule() != m_rDoc.GetOutlineNumRule())
1821  {
1822  pTextNd->SetAttr(SwNumRuleItem(pRule->GetName()));
1823  }
1824  pTextNd->SetAttrListLevel(nCurrentLevel);
1825 
1826  // <IsCounted()> state of text node has to be adjusted accordingly.
1827  if ( /*nCurrentLevel >= 0 &&*/ nCurrentLevel < MAXLEVEL )
1828  {
1829  pTextNd->SetCountedInList( true );
1830  }
1831 
1832  // #i99822#
1833  // Direct application of the list level formatting no longer
1834  // needed for list levels of mode LABEL_ALIGNMENT
1835  bool bApplyListLevelIndentDirectlyAtPara(true);
1836  {
1837  if (pTextNd->GetNumRule() && nCurrentLevel < MAXLEVEL)
1838  {
1839  const SwNumFormat& rFormat = pTextNd->GetNumRule()->Get(nCurrentLevel);
1840  if (rFormat.GetPositionAndSpaceMode()
1842  {
1843  bApplyListLevelIndentDirectlyAtPara = false;
1844  }
1845  }
1846  }
1847 
1848  if (bApplyListLevelIndentDirectlyAtPara)
1849  {
1850  std::unique_ptr<SfxItemSet> xListIndent(new SfxItemSet(m_rDoc.GetAttrPool(), svl::Items<RES_LR_SPACE,
1851  RES_LR_SPACE>{}));
1852  const SvxLRSpaceItem *pItem = static_cast<const SvxLRSpaceItem*>(
1853  GetFormatAttr(RES_LR_SPACE));
1854  OSL_ENSURE(pItem, "impossible");
1855  if (pItem)
1856  xListIndent->Put(*pItem);
1857 
1858  /*
1859  Take the original paragraph sprms attached to this list level
1860  formatting and apply them to the paragraph. I'm convinced that
1861  this is exactly what word does.
1862  */
1863  if (short nLen = static_cast< short >(aParaSprms.size()))
1864  {
1865  std::unique_ptr<SfxItemSet> xOldCurrentItemSet(SetCurrentItemSet(std::move(xListIndent)));
1866 
1867  sal_uInt8* pSprms1 = aParaSprms.data();
1868  while (0 < nLen)
1869  {
1870  sal_uInt16 nL1 = ImportSprm(pSprms1, nLen);
1871  nLen = nLen - nL1;
1872  pSprms1 += nL1;
1873  }
1874 
1875  xListIndent = SetCurrentItemSet(std::move(xOldCurrentItemSet));
1876  }
1877 
1878  if (const SvxLRSpaceItem *pLR = xListIndent->GetItem<SvxLRSpaceItem>(RES_LR_SPACE))
1879  {
1880  m_xCtrlStck->NewAttr(*m_pPaM->GetPoint(), *pLR);
1881  m_xCtrlStck->SetAttr(*m_pPaM->GetPoint(), RES_LR_SPACE);
1882  }
1883  }
1884  }
1885  }
1886 }
1887 
1888 void SwWW8ImplReader::RegisterNumFormat(sal_uInt16 nCurrentLFO, sal_uInt8 nCurrentLevel)
1889 {
1890  // Are we reading the StyleDef ?
1891  if (m_pCurrentColl)
1892  SetStylesList( m_nCurrentColl , nCurrentLFO, nCurrentLevel);
1893  else
1894  RegisterNumFormatOnTextNode(nCurrentLFO, nCurrentLevel);
1895 }
1896 
1897 void SwWW8ImplReader::Read_ListLevel(sal_uInt16, const sal_uInt8* pData,
1898  short nLen)
1899 {
1900  if (m_xPlcxMan && m_xPlcxMan->GetDoingDrawTextBox())
1901  return;
1902 
1903  if( nLen < 0 )
1904  {
1905  // the current level is finished, what should we do ?
1907  if (m_xStyles && !m_bVer67)
1908  m_xStyles->mnWwNumLevel = 0;
1909  }
1910  else
1911  {
1912  // security check
1913  if( !pData )
1914  return;
1915 
1916  // the Streamdata is zero based
1917  m_nListLevel = *pData;
1918 
1919  if (m_xStyles && !m_bVer67)
1920  {
1921  /*
1922  if this is the case, then if the numbering is actually stored in
1923  winword 6 format, and its likely that sprmPIlvl has been abused
1924  to set the ww6 list level information which we will need when we
1925  reach the true ww6 list def. So set it now
1926  */
1927  m_xStyles->mnWwNumLevel = m_nListLevel;
1928  }
1929 
1932  else if (USHRT_MAX > m_nLFOPosition)
1933  {
1937  }
1938  }
1939 }
1940 
1941 void SwWW8ImplReader::Read_LFOPosition(sal_uInt16, const sal_uInt8* pData,
1942  short nLen)
1943 {
1944  if (m_xPlcxMan && m_xPlcxMan->GetDoingDrawTextBox())
1945  return;
1946 
1947  if( nLen < 0 )
1948  {
1949  // the current level is finished, what should we do ?
1952  }
1953  else
1954  {
1955  // security check
1956  if( !pData )
1957  return;
1958 
1959  short nData = SVBT16ToUInt16( pData );
1960  if( 0 >= nData )
1961  {
1962  // disable the numbering/list style apply to the paragraph or the style
1963 
1964  /*
1965  If you have a paragraph in word with left and/or hanging indent
1966  and remove its numbering, then the indentation appears to get
1967  reset, but not back to the base style, instead its goes to a blank
1968  setting.
1969  Unless it's a broken ww6 list in 97 in which case more hackery is
1970  required, some more details about broken ww6 list in
1971  ww8par6.cxx#SwWW8ImplReader::Read_LR
1972  */
1973 
1974  if (m_pCurrentColl)
1975  {
1976  // here a "named" style is being configured
1977 
1978  // disable the numbering/list in the style currently configured
1980 
1981  // reset/blank the indent
1983  }
1984  else if (SwTextNode* pTextNode = m_pPaM->GetNode().GetTextNode())
1985  {
1986  // here a paragraph is being directly formatted
1987 
1988  // empty the numbering/list style applied to the current paragraph
1989  SwNumRuleItem aEmptyRule;
1990  pTextNode->SetAttr( aEmptyRule );
1991 
1992  // create an empty SvxLRSpaceItem
1993  std::shared_ptr<SvxLRSpaceItem> aLR(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE));
1994 
1995  // replace it with the one of the current node if it exist
1996  const SfxPoolItem* pLR = GetFormatAttr(RES_LR_SPACE);
1997  if( pLR )
1998  aLR.reset(static_cast<SvxLRSpaceItem*>(pLR->Clone()));
1999 
2000  // reset/blank the left indent (and only the left)
2001  aLR->SetTextLeft(0);
2002  aLR->SetTextFirstLineOfst(0);
2003 
2004  // apply the modified SvxLRSpaceItem to the current paragraph
2005  pTextNode->SetAttr( *aLR );
2006  }
2007 
2009  }
2010  else // nData in (0..0x7FFF]
2011  {
2012  m_nLFOPosition = static_cast<sal_uInt16>(nData)-1; // m_nLFOPosition in [0..0x7FFF)
2013  /*
2014  If we are a ww8+ style with ww7- style lists then there is a
2015  bizarre broken word bug where when the list is removed from a para
2016  the ww6 list first line indent still affects the first line
2017  indentation. Setting this flag will allow us to recover from this
2018  braindeadness
2019  */
2020  if (m_pCurrentColl && (m_nLFOPosition == 2047-1) && m_nCurrentColl < m_vColl.size())
2021  m_vColl[m_nCurrentColl].m_bHasBrokenWW6List = true;
2022 
2023  // here the stream data is 1-based, we subtract ONE
2024  if (m_nLFOPosition != 2047-1) //Normal ww8+ list behaviour
2025  {
2027  m_nListLevel = 0;
2029  {
2033  }
2034  }
2035  else if (m_xPlcxMan && m_xPlcxMan->HasParaSprm(NS_sprm::LN_PAnld).pSprm)
2036  {
2037  /*
2038  #i8114# Horrific backwards compatible ww7- lists in ww8+
2039  docs
2040  */
2041  Read_ANLevelNo(13 /*equiv ww7- sprm no*/, &m_nListLevel, 1);
2042  }
2043  }
2044  }
2045 }
2046 
2047 // Reading Controls
2048 
2050  WW8_CP nStart, SwWw8ControlType nWhich )
2051 {
2052  bool bRet=false;
2053  /*
2054  * Save the reader state and process the sprms for this anchor cp.
2055  * Doing so will set the nPicLocFc to the offset to find the hypertext
2056  * data in the data stream.
2057  */
2058  WW8_CP nEndCp = nStart+1; //Only interested in the single 0x01 character
2059 
2060  WW8ReaderSave aSave(this,nStart);
2061 
2062  WW8PLCFManResult aRes;
2063  nStart = m_xPlcxMan->Where();
2064  while(nStart <= nEndCp)
2065  {
2066  if ( m_xPlcxMan->Get(&aRes)
2067  && aRes.pMemPos && aRes.nSprmId )
2068  {
2069  //only interested in sprms which would set nPicLocFc
2070  if ( (68 == aRes.nSprmId) || (0x6A03 == aRes.nSprmId) )
2071  {
2072  Read_PicLoc( aRes.nSprmId, aRes.pMemPos +
2073  m_xSprmParser->DistanceToData(aRes.nSprmId), 4);
2074  break;
2075  }
2076  }
2077  m_xPlcxMan->advance();
2078  nStart = m_xPlcxMan->Where();
2079  }
2080  sal_uLong nOffset = m_nPicLocFc;
2081  aSave.Restore(this);
2082 
2083  sal_uLong nOldPos = m_pDataStream->Tell();
2084  WW8_PIC aPic;
2085  m_pDataStream->Seek( nOffset);
2086  PicRead( m_pDataStream, &aPic, m_bVer67);
2087 
2088  if((aPic.lcb > 0x3A) && !m_pDataStream->GetError() )
2089  {
2090  aFormula.FormulaRead(nWhich,m_pDataStream);
2091  bRet = true;
2092  }
2093 
2094  /*
2095  There is a problem with aPic, the WW8_PIC is always used even though it
2096  is too big for the WW95 files, it needs to be modified to check the
2097  version C.
2098  */
2099  m_pDataStream->Seek( nOldPos );
2100  return bRet;
2101 }
2102 
2104 {
2105  const uno::Reference< lang::XMultiServiceFactory > & rServiceFactory =
2106  GetServiceFactory();
2107 
2108  if(!rServiceFactory.is())
2109  return;
2110 
2111  awt::Size aSz;
2112  uno::Reference< form::XFormComponent> xFComp;
2113 
2114  if (rFormula.Import(rServiceFactory, xFComp, aSz))
2115  {
2116  uno::Reference <drawing::XShape> xShapeRef;
2117  if (InsertControl(xFComp, aSz, &xShapeRef, false))
2118  GetShapes()->add(xShapeRef);
2119  }
2120 }
2121 
2123  SvStream *pDataStream)
2124 {
2125  sal_uInt8 nField;
2126 
2127  // The following is a FFData structure as described in
2128  // Microsoft's DOC specification (chapter 2.9.78)
2129  sal_uInt32 nVersion = 0;
2130  pDataStream->ReadUInt32(nVersion);
2131  // An unsigned integer that MUST be 0xFFFFFFFF
2132  if (nVersion != 0xFFFFFFFF)
2133  {
2134  SAL_WARN("sw.ww8", "Parsing error: invalid header for FFData");
2135  return; // bail out
2136  }
2137 
2138  // might be better to read the bits as a 16 bit word
2139  // ( like it is in the spec. )
2140  sal_uInt8 bits1 = 0;
2141  pDataStream->ReadUChar( bits1 );
2142  sal_uInt8 bits2 = 0;
2143  pDataStream->ReadUChar( bits2 );
2144 
2145  sal_uInt8 iType = ( bits1 & 0x3 );
2146 
2147  // we should verify that bits.iType & nWhich concur
2148  OSL_ENSURE( iType == nWhich, "something wrong, expect control type read from stream doesn't match nWhich passed in");
2149  if ( iType != nWhich )
2150  return; // bail out
2151 
2152  sal_uInt8 iRes = (bits1 & 0x7C) >> 2;
2153 
2154  pDataStream->ReadUInt16( mnMaxLen );
2155 
2156  sal_uInt16 hps = 0;
2157  pDataStream->ReadUInt16( hps );
2158 
2159  // xstzName
2160  msTitle = read_uInt16_BeltAndBracesString(*pDataStream);
2161 
2162  if (nWhich == WW8_CT_EDIT)
2163  { // Field is a textbox
2164  // Default text
2165  // xstzTextDef
2167  }
2168  else
2169  {
2170  // CheckBox or ComboBox
2171  sal_uInt16 wDef = 0;
2172  pDataStream->ReadUInt16( wDef );
2173  mnChecked = wDef; // default
2174  if (nWhich == WW8_CT_CHECKBOX)
2175  {
2176  if ( iRes != 25 )
2177  mnChecked = iRes;
2178  msDefault = ( wDef == 0 ) ? OUString( "0" ) : OUString( "1" );
2179  }
2180  }
2181  // xstzTextFormat
2183  // xstzHelpText
2184  msHelp = read_uInt16_BeltAndBracesString(*pDataStream);
2185  // xstzStatText
2187 
2188  // xstzEntryMcr
2190  //xstzExitMcr
2192 
2193  if (nWhich == WW8_CT_DROPDOWN)
2194  {
2195  bool bAllOk = true;
2196  // SSTB (see Spec. 2.2.4)
2197  sal_uInt16 fExtend = 0;
2198  pDataStream->ReadUInt16( fExtend );
2199  sal_uInt16 nStringsCnt = 0;
2200 
2201  // Isn't it that if fExtend isn't 0xFFFF then fExtend actually
2202  // doesn't exist and we really have just read nStringsCnt ( or cData )?
2203  if (fExtend != 0xFFFF)
2204  bAllOk = false;
2205  pDataStream->ReadUInt16( nStringsCnt );
2206 
2207  // I guess this should be zero ( and we should ensure that )
2208  sal_uInt16 cbExtra = 0;
2209  pDataStream->ReadUInt16( cbExtra );
2210 
2211  OSL_ENSURE(bAllOk, "Unknown formfield dropdown list structure");
2212  if (!bAllOk) //Not as expected, don't risk it at all.
2213  nStringsCnt = 0;
2214  const size_t nMinRecordSize = sizeof(sal_uInt16);
2215  const size_t nMaxRecords = pDataStream->remainingSize() / nMinRecordSize;
2216  if (nStringsCnt > nMaxRecords)
2217  {
2218  SAL_WARN("sw.ww8", "Parsing error: " << nMaxRecords <<
2219  " max possible entries, but " << nStringsCnt << " claimed, truncating");
2220  nStringsCnt = nMaxRecords;
2221  }
2222  maListEntries.reserve(nStringsCnt);
2223  for (sal_uInt32 nI = 0; nI < nStringsCnt; ++nI)
2224  {
2225  OUString sEntry = read_uInt16_PascalString(*pDataStream);
2226  maListEntries.push_back(sEntry);
2227  }
2228  }
2229  mfDropdownIndex = iRes;
2230 
2231  mbHelp = bits1 & 0x80;
2232 
2233  nField = bits2;
2234  mfToolTip = nField & 0x01;
2235  mfNoMark = (nField & 0x02)>>1;
2236  mfType = (nField & 0x38)>>3;
2237  mfUnused = (nField & 0xE0)>>5;
2238 }
2239 
2241  : WW8FormulaControl(SL::aListBox, rR)
2242 {
2243 }
2244 
2245 //Miserable hack to get a hardcoded guesstimate of the size of a list dropdown
2246 //box's first entry to set as the lists default size
2247 awt::Size SwWW8ImplReader::MiserableDropDownFormHack(const OUString &rString,
2248  uno::Reference<beans::XPropertySet> const & rPropSet)
2249 {
2250  awt::Size aRet;
2251  struct CtrlFontMapEntry
2252  {
2253  sal_uInt16 nWhichId;
2254  const sal_Char* pPropNm;
2255  };
2256  const CtrlFontMapEntry aMapTable[] =
2257  {
2258  { RES_CHRATR_COLOR, "TextColor" },
2259  { RES_CHRATR_FONT, "FontName" },
2260  { RES_CHRATR_FONTSIZE, "FontHeight" },
2261  { RES_CHRATR_WEIGHT, "FontWeight" },
2262  { RES_CHRATR_UNDERLINE, "FontUnderline" },
2263  { RES_CHRATR_CROSSEDOUT, "FontStrikeout" },
2264  { RES_CHRATR_POSTURE, "FontSlant" },
2265  { 0, nullptr }
2266  };
2267 
2268  vcl::Font aFont;
2269  uno::Reference< beans::XPropertySetInfo > xPropSetInfo =
2270  rPropSet->getPropertySetInfo();
2271 
2272  uno::Any aTmp;
2273  for (const CtrlFontMapEntry* pMap = aMapTable; pMap->nWhichId; ++pMap)
2274  {
2275  bool bSet = true;
2276  const SfxPoolItem* pItem = GetFormatAttr( pMap->nWhichId );
2277  OSL_ENSURE(pItem, "Impossible");
2278  if (!pItem)
2279  continue;
2280 
2281  switch ( pMap->nWhichId )
2282  {
2283  case RES_CHRATR_COLOR:
2284  {
2285  OUString aNm;
2286  if (xPropSetInfo->hasPropertyByName(aNm = "TextColor"))
2287  {
2288  aTmp <<= static_cast<sal_Int32>(static_cast<const SvxColorItem*>(pItem)->GetValue());
2289  rPropSet->setPropertyValue(aNm, aTmp);
2290  }
2291  }
2292  aFont.SetColor(static_cast<const SvxColorItem*>(pItem)->GetValue());
2293  break;
2294  case RES_CHRATR_FONT:
2295  {
2296  const SvxFontItem *pFontItem = static_cast<const SvxFontItem *>(pItem);
2297  OUString aNm;
2298  if (xPropSetInfo->hasPropertyByName(aNm = "FontStyleName"))
2299  {
2300  aTmp <<= pFontItem->GetStyleName();
2301  rPropSet->setPropertyValue( aNm, aTmp );
2302  }
2303  if (xPropSetInfo->hasPropertyByName(aNm = "FontFamily"))
2304  {
2305  aTmp <<= static_cast<sal_Int16>(pFontItem->GetFamily());
2306  rPropSet->setPropertyValue( aNm, aTmp );
2307  }
2308  if (xPropSetInfo->hasPropertyByName(aNm = "FontCharset"))
2309  {
2310  aTmp <<= static_cast<sal_Int16>(pFontItem->GetCharSet());
2311  rPropSet->setPropertyValue( aNm, aTmp );
2312  }
2313  if (xPropSetInfo->hasPropertyByName(aNm = "FontPitch"))
2314  {
2315  aTmp <<= static_cast<sal_Int16>(pFontItem->GetPitch());
2316  rPropSet->setPropertyValue( aNm, aTmp );
2317  }
2318 
2319  aTmp <<= pFontItem->GetFamilyName();
2320  aFont.SetFamilyName( pFontItem->GetFamilyName() );
2321  aFont.SetStyleName( pFontItem->GetStyleName() );
2322  aFont.SetFamily( pFontItem->GetFamily() );
2323  aFont.SetCharSet( pFontItem->GetCharSet() );
2324  aFont.SetPitch( pFontItem->GetPitch() );
2325  }
2326  break;
2327 
2328  case RES_CHRATR_FONTSIZE:
2329  {
2330  Size aSize( aFont.GetFontSize().Width(),
2331  static_cast<const SvxFontHeightItem*>(pItem)->GetHeight() );
2332  aTmp <<= static_cast<float>(aSize.Height()) / 20.0;
2333 
2335  MapMode(MapUnit::MapTwip), MapMode(MapUnit::Map100thMM)));
2336  }
2337  break;
2338 
2339  case RES_CHRATR_WEIGHT:
2341  static_cast<const SvxWeightItem*>(pItem)->GetWeight() );
2342  aFont.SetWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() );
2343  break;
2344 
2345  case RES_CHRATR_UNDERLINE:
2346  aTmp <<= static_cast<sal_Int16>(static_cast<const SvxUnderlineItem*>(pItem)->GetLineStyle());
2347  aFont.SetUnderline(static_cast<const SvxUnderlineItem*>(pItem)->GetLineStyle());
2348  break;
2349 
2350  case RES_CHRATR_CROSSEDOUT:
2351  aTmp <<= static_cast<sal_Int16>( static_cast<const SvxCrossedOutItem*>(pItem)->GetStrikeout() );
2352  aFont.SetStrikeout( static_cast<const SvxCrossedOutItem*>(pItem)->GetStrikeout() );
2353  break;
2354 
2355  case RES_CHRATR_POSTURE:
2356  aTmp <<= static_cast<sal_Int16>( static_cast<const SvxPostureItem*>(pItem)->GetPosture() );
2357  aFont.SetItalic( static_cast<const SvxPostureItem*>(pItem)->GetPosture() );
2358  break;
2359 
2360  default:
2361  bSet = false;
2362  break;
2363  }
2364 
2365  if (bSet && xPropSetInfo->hasPropertyByName(OUString::createFromAscii(pMap->pPropNm)))
2366  rPropSet->setPropertyValue(OUString::createFromAscii(pMap->pPropNm), aTmp);
2367  }
2368  // now calculate the size of the control
2370  OSL_ENSURE(pOut, "Impossible");
2371  if (pOut)
2372  {
2373  pOut->Push( PushFlags::FONT | PushFlags::MAPMODE );
2374  pOut->SetMapMode( MapMode( MapUnit::Map100thMM ));
2375  pOut->SetFont( aFont );
2376  aRet.Width = pOut->GetTextWidth(rString);
2377  aRet.Width += 500; //plus size of button, total hack territory
2378  aRet.Height = pOut->GetTextHeight();
2379  pOut->Pop();
2380  }
2381  return aRet;
2382 }
2383 
2384 bool WW8FormulaListBox::Import(const uno::Reference <
2385  lang::XMultiServiceFactory> &rServiceFactory,
2386  uno::Reference <form::XFormComponent> &rFComp,awt::Size &rSz )
2387 {
2388  uno::Reference<uno::XInterface> xCreate = rServiceFactory->createInstance("com.sun.star.form.component.ComboBox");
2389  if( !xCreate.is() )
2390  return false;
2391 
2392  rFComp.set(xCreate, uno::UNO_QUERY);
2393  if( !rFComp.is() )
2394  return false;
2395 
2396  uno::Reference<beans::XPropertySet> xPropSet(xCreate, uno::UNO_QUERY);
2397 
2398  uno::Any aTmp;
2399  if (!msTitle.isEmpty())
2400  aTmp <<= msTitle;
2401  else
2402  aTmp <<= msName;
2403  xPropSet->setPropertyValue("Name", aTmp );
2404 
2405  if (!msToolTip.isEmpty())
2406  {
2407  aTmp <<= msToolTip;
2408  xPropSet->setPropertyValue("HelpText", aTmp );
2409  }
2410 
2411  xPropSet->setPropertyValue("Dropdown", css::uno::makeAny(true));
2412 
2413  if (!maListEntries.empty())
2414  {
2415  sal_uInt32 nLen = maListEntries.size();
2416  uno::Sequence< OUString > aListSource(nLen);
2417  for (sal_uInt32 nI = 0; nI < nLen; ++nI)
2418  aListSource[nI] = maListEntries[nI];
2419  aTmp <<= aListSource;
2420  xPropSet->setPropertyValue("StringItemList", aTmp );
2421 
2422  if (mfDropdownIndex < nLen)
2423  {
2424  aTmp <<= aListSource[mfDropdownIndex];
2425  }
2426  else
2427  {
2428  aTmp <<= aListSource[0];
2429  }
2430 
2431  xPropSet->setPropertyValue("DefaultText", aTmp );
2432 
2433  rSz = mrRdr.MiserableDropDownFormHack(maListEntries[0], xPropSet);
2434  }
2435  else
2436  {
2437  static const sal_Unicode aBlank[] =
2438  {
2439  0x2002,0x2002,0x2002,0x2002,0x2002
2440  };
2441  rSz = mrRdr.MiserableDropDownFormHack(OUString(aBlank, SAL_N_ELEMENTS(aBlank)), xPropSet);
2442  }
2443 
2444  return true;
2445 }
2446 
2449 {
2450 }
2451 
2452 static void lcl_AddToPropertyContainer
2453 (uno::Reference<beans::XPropertySet> const & xPropSet,
2454  const OUString & rPropertyName, const OUString & rValue)
2455 {
2456  uno::Reference<beans::XPropertySetInfo> xPropSetInfo =
2457  xPropSet->getPropertySetInfo();
2458  if (xPropSetInfo.is() &&
2459  ! xPropSetInfo->hasPropertyByName(rPropertyName))
2460  {
2461  uno::Reference<beans::XPropertyContainer>
2462  xPropContainer(xPropSet, uno::UNO_QUERY);
2463  uno::Any aAny((OUString()));
2464  xPropContainer->addProperty
2465  (rPropertyName,
2466  static_cast<sal_Int16>(beans::PropertyAttribute::BOUND |
2467  beans::PropertyAttribute::REMOVABLE),
2468  aAny);
2469  }
2470 
2471  uno::Any aAnyValue(rValue);
2472  xPropSet->setPropertyValue(rPropertyName, aAnyValue );
2473 }
2474 
2475 bool WW8FormulaCheckBox::Import(const uno::Reference <
2476  lang::XMultiServiceFactory> &rServiceFactory,
2477  uno::Reference <form::XFormComponent> &rFComp,awt::Size &rSz )
2478 {
2479  uno::Reference< uno::XInterface > xCreate = rServiceFactory->createInstance("com.sun.star.form.component.CheckBox");
2480  if( !xCreate.is() )
2481  return false;
2482 
2483  rFComp.set( xCreate, uno::UNO_QUERY );
2484  if( !rFComp.is() )
2485  return false;
2486 
2487  uno::Reference< beans::XPropertySet > xPropSet( xCreate, uno::UNO_QUERY );
2488 
2489  rSz.Width = 16 * mhpsCheckBox;
2490  rSz.Height = 16 * mhpsCheckBox;
2491 
2492  uno::Any aTmp;
2493  if (!msTitle.isEmpty())
2494  aTmp <<= msTitle;
2495  else
2496  aTmp <<= msName;
2497  xPropSet->setPropertyValue("Name", aTmp );
2498 
2499  aTmp <<= static_cast<sal_Int16>(mnChecked);
2500  xPropSet->setPropertyValue("DefaultState", aTmp);
2501 
2502  if (!msToolTip.isEmpty())
2503  lcl_AddToPropertyContainer(xPropSet, "HelpText", msToolTip);
2504 
2505  if (!msHelp.isEmpty())
2506  lcl_AddToPropertyContainer(xPropSet, "HelpF1Text", msHelp);
2507 
2508  return true;
2509 
2510 }
2511 
2514 {
2515 }
2516 
2518  const uno::Reference< form::XFormComponent > & rFComp,
2519  const awt::Size& rSize, uno::Reference< drawing::XShape > *pShape,
2520  bool bFloatingCtrl)
2521 {
2522  const uno::Reference< container::XIndexContainer > &rComps = GetFormComps();
2524  rComps->insertByIndex( rComps->getCount(), aTmp );
2525 
2526  const uno::Reference< lang::XMultiServiceFactory > &rServiceFactory =
2527  GetServiceFactory();
2528  if( !rServiceFactory.is() )
2529  return false;
2530 
2531  uno::Reference< uno::XInterface > xCreate = rServiceFactory->createInstance(
2532  "com.sun.star.drawing.ControlShape");
2533  if( !xCreate.is() )
2534  return false;
2535 
2536  uno::Reference< drawing::XShape > xShape(xCreate, uno::UNO_QUERY);
2537 
2538  OSL_ENSURE(xShape.is(), "Did not get XShape");
2539  xShape->setSize(rSize);
2540 
2541  uno::Reference< beans::XPropertySet > xShapePropSet(
2542  xCreate, uno::UNO_QUERY );
2543 
2544  //I lay a small bet that this will change to
2545  //sal_Int16 nTemp=TextContentAnchorType::AS_CHARACTER;
2546  text::TextContentAnchorType nTemp;
2547  if (bFloatingCtrl)
2548  nTemp = text::TextContentAnchorType_AT_PARAGRAPH;
2549  else
2550  nTemp = text::TextContentAnchorType_AS_CHARACTER;
2551 
2552  xShapePropSet->setPropertyValue("AnchorType", uno::Any(static_cast<sal_Int16>(nTemp)) );
2553 
2554  xShapePropSet->setPropertyValue("VertOrient", uno::Any(sal_Int16(text::VertOrientation::TOP)) );
2555 
2556  uno::Reference< text::XText > xDummyTextRef;
2557  uno::Reference< text::XTextRange > xTextRg =
2558  new SwXTextRange( *pPaM, xDummyTextRef );
2559 
2560  aTmp <<= xTextRg;
2561  xShapePropSet->setPropertyValue("TextRange", aTmp );
2562 
2563  // Set the Control-Model for the Control-Shape
2564  uno::Reference< drawing::XControlShape > xControlShape( xShape,
2565  uno::UNO_QUERY );
2566  uno::Reference< awt::XControlModel > xControlModel( rFComp,
2567  uno::UNO_QUERY );
2568  xControlShape->setControl( xControlModel );
2569 
2570  if (pShape)
2571  *pShape = xShape;
2572 
2573  return true;
2574 }
2575 
2576 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetToolTip(const OUString &rToolTip)
Sets the tool tip of the field.
void SetFamily(FontFamily)
void Read_ListLevel(sal_uInt16 nId, const sal_uInt8 *pData, short nLen)
Definition: ww8par3.cxx:1897
SvxNumType GetNumberingType() const
long Width() const
void AdjustLVL(sal_uInt8 nLevel, SwNumRule &rNumRule, WW8aISet const &rListItemSet, WW8aCFormat &aCharFormat, bool &bNewCharFormatCreated, const OUString &aPrefix=OUString())
Definition: ww8par3.cxx:997
simple Iterator for SPRMs
Definition: ww8scan.hxx:260
WW8aCFormat aCharFormat
Definition: ww8par3.cxx:396
const sal_uInt16 sprmCPbiIBullet
Definition: sprmids.hxx:350
void SetStrikeout(FontStrikeout)
#define RES_CHRATR_WEIGHT
Definition: hintids.hxx:83
void SetListRestart(bool bRestart)
Definition: ndtxt.cxx:4103
void SetStyleIndent(SwWW8StyInf &rStyle, const SwNumFormat &rFormat)
Definition: ww8par3.cxx:1698
Iterator for Booknotes.
Definition: ww8scan.hxx:743
std::unique_ptr< SwWW8FltControlStack > m_xCtrlStck
Definition: ww8par.hxx:1097
SVX_NUM_CHARS_UPPER_LETTER_N
OUString GetUniqueBookmarkName(const OUString &rSuggestedName)
Definition: ww8scan.cxx:4462
void SetLabelFollowedBy(const LabelFollowedBy eLabelFollowedBy)
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:223
std::map< OUString, css::uno::Any > parameter_map_t
Definition: IMark.hxx:94
void SetFontSize(const Size &)
WW8_FC m_fcPlcfLst
Definition: ww8scan.hxx:1454
sal_uInt8 mfNoMark
Definition: ww8par.hxx:665
virtual bool Import(const css::uno::Reference< css::lang::XMultiServiceFactory > &rServiceFactory, css::uno::Reference< css::form::XFormComponent > &rFComp, css::awt::Size &rSz)=0
short nDxaLeft1
Definition: ww8par3.cxx:358
SwWw8ControlType
Definition: ww8par.hxx:639
bool bFormat
Definition: ww8par3.cxx:384
sal_Int32 m_lcbPlfLfo
Definition: ww8scan.hxx:1457
std::unique_ptr< WW8RStyle > m_xStyles
Definition: ww8par.hxx:1229
static bool IsEqualFormatting(const SwNumRule &rOne, const SwNumRule &rTwo)
Definition: ww8par3.cxx:1503
#define RES_CHRATR_FONTSIZE
Definition: hintids.hxx:76
SwCharFormat * MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:867
WW8_CP nSCode
start of instructions code
Definition: ww8scan.hxx:191
const sal_uInt32 cbLSTF
Definition: ww8par3.cxx:340
SwNumRule * m_pOutlineNumrule
Definition: ww8par.hxx:225
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
bool bOverride
Definition: ww8par3.cxx:430
void SetAutoRule(bool bFlag)
Definition: numrule.hxx:228
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:4891
SVX_NUM_FULL_WIDTH_ARABIC
std::string GetValue
void UseListIndent(SwWW8StyInf &rStyle, const SwNumFormat &rFormat)
Definition: ww8par3.cxx:1683
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
bool m_bListReleventIndentSet
Definition: ww8par.hxx:249
static void lcl_AddToPropertyContainer(uno::Reference< beans::XPropertySet > const &xPropSet, const OUString &rPropertyName, const OUString &rValue)
Definition: ww8par3.cxx:2453
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
SVX_NUM_NUMBER_NONE
std::vector< sal_uInt8 > bytes
Definition: types.hxx:29
OUString GetBookmark(long nStart, long nEnd, sal_uInt16 &nIndex)
Definition: ww8scan.cxx:4428
sal_uIntPtr sal_uLong
WW8aIdSty aIdSty
Definition: ww8par3.cxx:331
WW8aIdSty aIdSty
Definition: ww8par3.cxx:395
void SetNCurrentColl(sal_uInt16 nColl)
Definition: ww8par.hxx:1891
bool m_bHasStyNumRule
Definition: ww8par.hxx:247
void SetPrefix(const OUString &rSet)
sal_uInt8 mfType
Definition: ww8par.hxx:666
sal_uInt16 GetCurrentId() const
Definition: ww8scan.hxx:283
void SetGrfBulletCP(sal_Unicode cP)
Definition: numrule.hxx:81
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat IDs.
Definition: numrule.hxx:248
const sal_uInt8 * pMemPos
Definition: ww8scan.hxx:850
sal_Int32 nV6DxaSpace
Definition: ww8par3.cxx:353
const SvxFontItem & GetFont(bool=true) const
Definition: charatr.hxx:125
Provides access to the marks of a document.
#define ODF_FORMCHECKBOX
sal_uInt8 nAlign
Definition: ww8par3.cxx:365
bool operator()(const std::unique_ptr< WW8LSTInfo > &pEntry) const
Definition: ww8par3.cxx:466
void SetContinusNum(bool bFlag)
Definition: numrule.hxx:234
sal_uInt8 nLfoLvl
Definition: ww8par3.cxx:346
void SetWeight(FontWeight)
OUString msEntryMcr
Definition: ww8par.hxx:680
SwCharFormat * WW8aCFormat[nMaxLevel]
Definition: ww8par.hxx:179
sal_uInt64 Seek(sal_uInt64 nPos)
sal_Int32 m_lcbPlcfLst
Definition: ww8scan.hxx:1455
#define RES_CHRATR_FONT
Definition: hintids.hxx:75
void InsertFormula(WW8FormulaControl &rFormula)
Definition: ww8par3.cxx:2103
void SetTextLeft(const long nL, const sal_uInt16 nProp=100)
bool IsAtEnd() const
std::unique_ptr< WW8ListManager, o3tl::default_delete< WW8ListManager > > m_xLstManager
Definition: ww8par.hxx:1221
OUString msDefault
Definition: ww8par.hxx:675
WW8_CP nLen
total length (to skip over text)
Definition: ww8scan.hxx:190
const OUString & GetName() const
Definition: numrule.hxx:222
sal_uInt16 GetPoolHelpId() const
Query and set Help-IDs for document styles.
Definition: numrule.hxx:252
OUString GetUniqueNumRuleName(const OUString *pChkStr=nullptr, bool bAutoNum=true) const
Definition: docnum.cxx:2501
sal_Int32 lcb
Definition: ww8struc.hxx:447
const SfxPoolItem * GetFormatAttr(sal_uInt16 nWhich)
Definition: ww8par6.cxx:2783
static void lcl_CopyGreaterEight(OUString &rDest, OUString const &rSrc, sal_Int32 nStart, sal_Int32 nLen=SAL_MAX_INT32)
Definition: ww8par3.cxx:480
ListWithId(sal_uInt32 nIdLst)
Definition: ww8par3.cxx:465
void SetCharSet(rtl_TextEncoding)
#define ODF_FORMCHECKBOX_HELPTEXT
sal_uInt8 nLevel
Definition: ww8par3.cxx:379
void SetIncludeUpperLevels(sal_uInt8 nSet)
const char aListBox[]
Definition: ww8scan.hxx:49
FontPitch GetPitch() const
SwNumRule * GetNumRule(size_t i)
Definition: ww8par3.cxx:1127
bool bSimpleList
Definition: ww8par3.cxx:347
WW8FormulaCheckBox(const WW8FormulaCheckBox &)=delete
void SetMapMode()
bool bUsedInDoc
Definition: ww8par3.cxx:401
#define ODF_FORMDROPDOWN_RESULT
sal_uInt16 mhpsCheckBox
Definition: ww8par.hxx:669
bool IsRightToLeft()
Definition: ww8par6.cxx:4519
FontFamily GetFamily() const
sal_uInt64 SeekRel(sal_Int64 nPos)
bool ImportFormulaControl(WW8FormulaControl &rBox, WW8_CP nStart, SwWw8ControlType nWhich)
Definition: ww8par3.cxx:2049
SvxNumType
void RegisterNumFormat(sal_uInt16 nCurrentLFO, sal_uInt8 nCurrentLevel)
Definition: ww8par3.cxx:1888
static OutputDevice * GetDefaultDevice()
WW8LSTInfo * GetLSTByListId(sal_uInt32 nIdLst) const
Definition: ww8par3.cxx:471
sal_uInt8 mfDropdownIndex
Definition: ww8par.hxx:663
void Read_LFOPosition(sal_uInt16 nId, const sal_uInt8 *pData, short nLen)
read and interpret the sprmPIlfo used to determine which list contains the paragraph.
Definition: ww8par3.cxx:1941
SwNumRule * pNumRule
Definition: ww8par3.cxx:420
sal_uInt16 sal_Unicode
#define RES_CHRATR_END
Definition: hintids.hxx:114
OUString msExitMcr
Definition: ww8par.hxx:681
const SwCharFormat * GetDfltCharFormat() const
Definition: doc.hxx:747
ErrCode GetError() const
std::vector< WW8LFOLVL > maOverrides
Definition: ww8par3.cxx:419
FUNC_TYPE const nType
sal_uInt16 mnChecked
Definition: ww8par.hxx:670
std::vector< SwWW8StyInf > m_vColl
Definition: ww8par.hxx:1234
bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat, const bool bReset=true, const bool bResetListAttrs=false, SwRootFrame const *pLayout=nullptr)
Add 4th optional parameter .
Definition: docfmt.cxx:1096
rtl_TextEncoding GetCharSet() const
sal_uInt32 nIdLst
Definition: ww8par3.cxx:333
const sal_uInt16 sprmCPbiGrf
Definition: sprmids.hxx:351
char sal_Char
sal_uInt32 mnIdLst
Definition: ww8par3.cxx:463
std::unique_ptr< SfxItemSet > WW8aISet[nMaxLevel]
Definition: ww8par.hxx:177
Ret writer_cast(Param in)
A static_cast style cast for conversion of word types to writer's.
sal_Int32 nStartAt
Definition: ww8par3.cxx:352
SVX_NUM_ARABIC
WW8LSTInfo(SwNumRule *pNumRule_, const WW8LST &aLST)
Definition: ww8par3.cxx:404
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
WW8FormulaListBox(const WW8FormulaListBox &)=delete
SVX_NUM_ROMAN_UPPER
void SetToolTip(const OUString &rStr)
Definition: expfld.cxx:1421
bool IsWW8BuiltInHeadingStyle() const
Definition: ww8par.hxx:327
SVX_NUM_ROMAN_LOWER
virtual parameter_map_t * GetParameters()=0
void SetHelp(const OUString &rStr)
Definition: expfld.cxx:1411
SVX_NUM_IROHA_FULLWIDTH_JA
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
Definition: hints.cxx:153
void SetUnderline(FontLineStyle)
#define RES_PARATR_NUMRULE
Definition: hintids.hxx:170
void SetCountedInList(bool bCounted)
Definition: ndtxt.cxx:4224
const char aCheckBox[]
Definition: ww8scan.hxx:48
void SetSelectedItem(const OUString &rItem)
Sets the selected item.
OUString msFormatting
Definition: ww8par.hxx:676
sal_uInt64 remainingSize()
eF_ResT
Definition: ww8par.hxx:622
sal_uInt8 mfUnused
Definition: ww8par.hxx:667
SVX_NUM_DI_ZI_ZH
sal_uInt8 nNFC
Definition: ww8par3.cxx:360
SvStream & rSt
Definition: ww8par.hxx:164
void SetPitch(FontPitch ePitch)
const OUString & GetStyleName() const
void SetFirstLineIndent(const long nFirstLineIndent)
Definition: ww8scan.hxx:42
#define SAL_N_ELEMENTS(arr)
sal_uInt16 GetCurrentColl() const
Definition: ww8par.hxx:1890
WW8_CP nLCode
length
Definition: ww8scan.hxx:192
bool IsContinusNum() const
Definition: numrule.hxx:233
void SetStylesList(sal_uInt16 nStyle, sal_uInt16 nCurrentLFO, sal_uInt8 nCurrentLevel)
Definition: ww8par3.cxx:1717
sal_uInt8 m_nVersion
Program-Version asked for by us: in Ctor we check if it matches the value of nFib.
Definition: ww8scan.hxx:1113
SwNumRule * pNumRule
Definition: ww8par3.cxx:398
virtual bool Import(const css::uno::Reference< css::lang::XMultiServiceFactory > &rServiceFactory, css::uno::Reference< css::form::XFormComponent > &rFComp, css::awt::Size &rSz) override
Definition: ww8par3.cxx:2475
SVX_NUM_BITMAP
void SetNumAdjust(SvxAdjust eSet)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
SVX_NUM_CHAR_SPECIAL
SwCharFormat * GetCharFormat() const
Definition: numrule.hxx:74
#define RES_CHRATR_COLOR
Definition: hintids.hxx:71
eF_ResT Read_F_FormCheckBox(WW8FieldDesc *pF, OUString &rStr)
Definition: ww8par3.cxx:182
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
std::vector< ww::bytes > maParaSprms
Definition: ww8par3.cxx:394
void SetListtabPos(const long nListtabPos)
short ImportSprm(const sal_uInt8 *pPos, sal_Int32 nMemLen, sal_uInt16 nId=0)
Definition: ww8par6.cxx:6068
OUString msHelp
Definition: ww8par.hxx:678
SVX_NUM_IROHA_HALFWIDTH_JA
SVX_NUM_TIAN_GAN_ZH
bool checkSeek(SvStream &rSt, sal_uInt64 nOffset)
SVX_NUM_NUMBER_UPPER_KO
static SvtFilterOptions & Get()
#define SAL_MAX_INT32
void SetFamilyName(const OUString &rFamilyName)
sal_uInt8 nLenGrpprlPapx
Definition: ww8par3.cxx:364
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
sal_uInt16 m_nCurrentColl
Definition: ww8par.hxx:1287
void SetIndentAt(const long nIndentAt)
SvxAdjust
bool HasWW8OutlineLevel() const
Definition: ww8par.hxx:305
SwDoc & m_rDoc
Definition: ww8par.hxx:1093
sal_uInt8 bV6Prev
Definition: ww8par3.cxx:368
void SetBulletFont(const vcl::Font *pFont)
sal_Int32 GetAbsLSpace() const
const SwPosition * GetPoint() const
Definition: pam.hxx:207
SwNumRuleType GetRuleType() const
Definition: numrule.hxx:209
void SetToggleAttrFlags(sal_uInt16 nFlags)
Definition: ww8par.cxx:583
std::unique_ptr< SfxItemSet > SetCurrentItemSet(std::unique_ptr< SfxItemSet > pItemSet)
Definition: ww8par.cxx:6555
const vcl::Font & GetDefBulletFont()
retrieve font used for the default bullet list characters
Definition: number.cxx:1264
sal_uInt8 mfToolTip
Definition: ww8par.hxx:664
sal_uInt8 bV6PrSp
Definition: ww8par3.cxx:369
SwFormat * m_pFormat
Definition: ww8par.hxx:223
OUString msTitle
Definition: ww8par.hxx:674
sal_uInt8 nLenGrpprlChpx
Definition: ww8par3.cxx:363
sal_uInt16 WW8aIdSty[WW8ListManager::nMaxLevel]
Definition: ww8par3.cxx:325
int i
sal_uInt16 Count() const
void Read_ANLevelNo(sal_uInt16, const sal_uInt8 *pData, short nLen)
Definition: ww8par2.cxx:741
const SfxPoolItem * NextItem()
std::shared_ptr< SvxLRSpaceItem > maWordLR
Definition: ww8par.hxx:242
sal_uInt16 m_nLFOIndex
Definition: ww8par.hxx:229
SwNumRule * pNumRule
Definition: ww8par3.cxx:344
void RegisterNumFormatOnStyle(sal_uInt16 nStyle)
Definition: ww8par3.cxx:1750
std::enable_if< std::is_signed< T >::value, bool >::type checked_add(T a, T b, T &result)
bool ReadLVL(SwNumFormat &rNumFormat, std::unique_ptr< SfxItemSet > &rpItemSet, sal_uInt16 nLevelStyle, bool bSetStartNo, std::deque< bool > &rNotReallyThere, sal_uInt16 nLevel, ww::bytes &rParaSprms)
Definition: ww8par3.cxx:518
virtual bool InsertControl(const css::uno::Reference< css::form::XFormComponent > &rFComp, const css::awt::Size &rSize, css::uno::Reference< css::drawing::XShape > *pShape, bool bFloatingCtrl) override
Definition: ww8par3.cxx:2517
#define RES_CHRATR_BEGIN
Definition: hintids.hxx:68
void SetBulletChar(sal_Unicode cSet)
virtual bool Import(const css::uno::Reference< css::lang::XMultiServiceFactory > &rServiceFactory, css::uno::Reference< css::form::XFormComponent > &rFComp, css::awt::Size &rSz) override
Definition: ww8par3.cxx:2384
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2813
sal_uInt32 nIdLst
Definition: ww8par3.cxx:424
#define RES_CHRATR_UNDERLINE
Definition: hintids.hxx:82
eF_ResT Read_F_FormTextBox(WW8FieldDesc *pF, OUString &rStr)
Definition: ww8par3.cxx:90
void FormulaRead(SwWw8ControlType nWhich, SvStream *pD)
Definition: ww8par3.cxx:2122
const Size & GetFontSize() const
void Restore(SwWW8ImplReader *pRdr)
Definition: ww8par.cxx:2043
const sal_uInt8 * pSprm
Definition: ww8scan.hxx:95
sal_uInt16 nLastLFOPosition
Definition: ww8par.hxx:187
const sal_uInt16 LN_PAnld
Definition: sprmids.hxx:39
sal_uInt8 GetPoolHlpFileId() const
Definition: numrule.hxx:254
sal_uInt8 nLfoLvl
Definition: ww8par3.cxx:425
sal_uInt16 GetToggleAttrFlags() const
Definition: ww8par.cxx:573
wwSprmParser const maSprmParser
Definition: ww8par.hxx:160
SvStream & ReadUChar(unsigned char &rChar)
std::vector< std::unique_ptr< WW8LSTInfo > > maLSTInfos
Definition: ww8par.hxx:165
sal_uInt16 GetStart() const
bool bSimpleList
Definition: ww8par3.cxx:335
sal_uInt32 nIdLst
Definition: ww8par3.cxx:399
void SetCharTextDistance(short nSet)
SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const
eF_ResT Read_F_FormListBox(WW8FieldDesc *pF, OUString &rStr)
Definition: ww8par3.cxx:241
long GetTextHeight() const
sal_uInt16 StyleUsingLFO(sal_uInt16 nLFOIndex) const
Definition: ww8par2.cxx:3568
virtual sw::mark::IFieldmark * makeNoTextFieldBookmark(const SwPaM &rPaM, const OUString &rName, const OUString &rType)=0
SVX_NUM_CHARS_LOWER_LETTER_N
sal_uInt16 mnMaxLen
FFData.cch in the spec: maximum length, in characters, of the value of the textbox.
Definition: ww8par.hxx:673
std::vector< std::unique_ptr< WW8LFOInfo > > m_LFOInfos
Definition: ww8par.hxx:166
SVX_NUM_NUMBER_HANGUL_KO
std::vector< OUString > maListEntries
Definition: ww8par.hxx:682
void RegisterNumFormatOnTextNode(sal_uInt16 nCurrentLFO, sal_uInt8 nCurrentLevel, const bool bSetAttr=true)
Definition: ww8par3.cxx:1796
Dropdown field.
Definition: flddropdown.hxx:58
void SetColor(const Color &)
sal_Int32 WW8_CP
Definition: ww8struc.hxx:153
SvStream & ReadInt32(sal_Int32 &rInt32)
#define RES_LR_SPACE
Definition: hintids.hxx:196
std::size_t ReadBytes(void *pData, std::size_t nSize)
void SetName(const OUString &rName)
Sets the name of the field.
WW8LFOInfo(const WW8LFO &rLFO)
Definition: ww8par3.cxx:439
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:460
sal_Int32 GetRemLen() const
Definition: ww8scan.hxx:284
sal_uInt8 m_nListLevel
Definition: ww8par.hxx:230
SVX_NUM_NUMBER_UPPER_ZH_TW
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:83
void SetToggleBiDiAttrFlags(sal_uInt16 nFlags)
Definition: ww8par.cxx:589
void SetStatus(sal_uInt16 nIndex, eBookStatus eStat)
Definition: ww8scan.cxx:4396
sal_uInt16 nDxaLeft
Definition: ww8par3.cxx:357
const OUString & GetFamilyName() const
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
WW8ListManager(SvStream &rSt_, SwWW8ImplReader &rReader_)
Definition: ww8par3.cxx:1137
void SetAttrListLevel(int nLevel)
Sets the list level of this text node.
Definition: ndtxt.cxx:4066
#define ODF_FORMCHECKBOX_NAME
void Set(sal_uInt16 i, const SwNumFormat *)
Definition: number.cxx:592
sal_uInt32 nIdLst
Definition: ww8par3.cxx:345
void SetStyleName(const OUString &rStyleName)
void SetCharFormat(SwCharFormat *)
Definition: number.cxx:277
SprmResult findSprmData(sal_uInt16 nId, sal_uInt8 *pSprms, sal_uInt16 nLen) const
Returns the offset to data of the first sprm of id nId, 0.
Definition: ww8scan.cxx:8456
void SetTextFirstLineOfst(const short nF, const sal_uInt16 nProp=100)
const WW8Fib & rFib
Definition: ww8par.hxx:163
void SyncIndentWithList(SvxLRSpaceItem &rLR, const SwNumFormat &rFormat, const bool bFirstLineOfstSet, const bool bLeftIndentSet)
Definition: ww8par.cxx:1247
#define ERRCODE_NONE
void advance()
Definition: ww8scan.cxx:885
unsigned char sal_uInt8
#define RES_CHRATR_POSTURE
Definition: hintids.hxx:79
SVX_NUM_NUMBER_TRADITIONAL_JA
SVX_NUM_HANGUL_JAMO_KO
void SetFont(const vcl::Font &rNewFont)
void SetFirstLineOffset(sal_Int32 nSet)
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:261
static void PicRead(SvStream *pDataStream, WW8_PIC *pPic, bool bVer67)
Definition: ww8graf2.cxx:436
long GetListFirstLineIndent(const SwNumFormat &rFormat)
Definition: ww8par.cxx:1212
VCL_DLLPUBLIC float ConvertFontWeight(FontWeight eWeight)
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1055
SVX_NUM_NUMBER_LOWER_ZH
sal_uInt16 nSprmId
Definition: ww8scan.hxx:851
#define ODF_FORMDROPDOWN_LISTENTRY
SVX_NUM_NUMBER_UPPER_ZH
eF_ResT Read_F_OCX(WW8FieldDesc *, OUString &)
Definition: ww8par3.cxx:82
#define ODF_FORMTEXT
sal_Int32 nRemainingData
Definition: ww8scan.hxx:96
sal_Int32 nStartAt
Definition: ww8par3.cxx:377
bool IsInvalidOrToBeMergedTabCell() const
Definition: ww8par2.cxx:3549
sal_uInt64 Tell() const
OUString const msName
Definition: ww8par.hxx:688
sal_uInt16 MakeNumRule(const OUString &rName, const SwNumRule *pCpy=nullptr, bool bBroadcast=false, const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode=SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
Definition: docnum.cxx:2457
~WW8ListManager() COVERITY_NOEXCEPT_FALSE
Definition: ww8par3.cxx:1476
sal_Int32 nV6Indent
Definition: ww8par3.cxx:354
SVX_NUM_HANGUL_SYLLABLE_KO
void SetSuffix(const OUString &rSet)
WW8FormulaEditBox(const WW8FormulaEditBox &)=delete
long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
void SetStart(sal_uInt16 nSet)
SwNumRule * CreateNextRule(bool bSimple)
Definition: ww8par3.cxx:1113
bool good() const
void SetItalic(FontItalic)
std::unique_ptr< wwSprmParser > m_xSprmParser
Definition: ww8par.hxx:1172
void Read_PicLoc(sal_uInt16, const sal_uInt8 *pData, short nLen)
Definition: ww8par6.cxx:2853
const char aTextField[]
Definition: ww8scan.hxx:51
OString const aName
std::shared_ptr< WW8PLCFMan > m_xPlcxMan
Definition: ww8par.hxx:1223
sal_uInt16 GetToggleBiDiAttrFlags() const
Definition: ww8par.cxx:578
bool IsAbsSpaces() const
Definition: numrule.hxx:236
WW8_FC m_fcPlfLfo
Definition: ww8scan.hxx:1456
bool bSimpleList
Definition: ww8par3.cxx:400
#define SAL_WARN(area, stream)
#define RES_CHRATR_CROSSEDOUT
Definition: hintids.hxx:73
void SetHelp(const OUString &rHelp)
Sets the help text of the field.
void SetAbsLSpace(sal_Int32 nSet)
std::vector< ww::bytes > maParaSprms
Definition: ww8par3.cxx:418
sal_uInt8 bV6
Definition: ww8par3.cxx:370
bool m_bValid
Definition: ww8par.hxx:243
SvStream * m_pDataStream
Definition: ww8par.hxx:1090
bool bRestartHdn
Definition: ww8par3.cxx:336
bool bStartAt
Definition: ww8par3.cxx:383
sal_uInt16 nUniqueList
Definition: ww8par.hxx:167
bool DelNumRule(const OUString &rName, bool bBroadCast=false)
Definition: docnum.cxx:1053
SVX_NUM_AIU_HALFWIDTH_JA
static OUString sanitizeString(const OUString &rString)
Definition: ww8par3.cxx:492
bool m_bColl
Definition: ww8par.hxx:245
OUString msToolTip
Definition: ww8par.hxx:679
sal_uInt8 m_nListLevel
Definition: ww8par.hxx:1302
bool bUsedInDoc
Definition: ww8par3.cxx:432
OUString read_uInt16_BeltAndBracesString(SvStream &rStrm)
Definition: ww8scan.cxx:2075
void SetNumberingType(SvxNumType nSet)
sal_uLong m_nPicLocFc
Definition: ww8par.hxx:1277
virtual void SetChecked(bool checked)=0
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
Definition: ndtxt.cxx:5121
SwFormat * m_pCurrentColl
Definition: ww8par.hxx:1230
OUString read_uInt16_PascalString(SvStream &rStrm)
Definition: ww8scan.hxx:160
SwCharFormat * WW8aCFormat[WW8ListManager::nMaxLevel]
Definition: ww8par3.cxx:327
void Push(PushFlags nFlags=PushFlags::ALL)
bool IsUseEnhancedFields() const
sal_Int32 nPos
sal_uInt32 nTplC
Definition: ww8par3.cxx:334
SwPaM * m_pPaM
Definition: ww8par.hxx:1095
SwDoc & rDoc
Definition: ww8par.hxx:162
bool SetTextFormatCollAndListLevel(const SwPaM &rRg, SwWW8StyInf &rStyleInfo)
Definition: ww8par3.cxx:1649
void SetAttrListRestartValue(SwNumberTree::tSwNumTreeNumber nNum)
Definition: ndtxt.cxx:4147
sal_uInt16 Which() const
bool IsOutlineRule() const
Definition: numrule.hxx:239
SVX_NUM_AIU_FULLWIDTH_JA
SwWW8ImplReader & mrRdr
Definition: ww8par.hxx:649
const sal_uInt8 * GetSprms() const
Definition: ww8scan.hxx:280
const SfxPoolItem * GetCurItem() const
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1307
sal_uInt16 m_nLFOPosition
Definition: ww8par.hxx:1289
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:843
#define ODF_FORMDROPDOWN
void SetItems(const std::vector< OUString > &rItems)
Sets the items of the dropdown box.
SwWW8ImplReader & rReader
Definition: ww8par.hxx:161
SwNumRule * GetNumRuleForActivation(sal_uInt16 nLFOPosition, const sal_uInt8 nLevel, std::vector< sal_uInt8 > &rParaSprms, SwTextNode *pNode=nullptr)
Definition: ww8par3.cxx:1532
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1013
sal_uInt8 aOfsNumsXCH[WW8ListManager::nMaxLevel]
Definition: ww8par3.cxx:362
SwPaM *const pPaM
Definition: ww8par.hxx:745
SprmResult GrpprlHasSprm(sal_uInt16 nId, sal_uInt8 &rSprms, sal_uInt8 nLen)
Definition: ww8par3.cxx:454
css::awt::Size MiserableDropDownFormHack(const OUString &rString, css::uno::Reference< css::beans::XPropertySet > const &rPropSet)
Definition: ww8par3.cxx:2247
eF_ResT Read_F_HTMLControl(WW8FieldDesc *pF, OUString &rStr)
Definition: ww8par3.cxx:314
bool bLSTbUIDSet
Definition: ww8par3.cxx:434