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