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  m_rSt.ReadInt32( aLVL.nStartAt );
688  m_rSt.ReadUChar( aLVL.nNFC );
689  m_rSt.ReadUChar( aBits1 );
690  if( ERRCODE_NONE != m_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  m_rSt.ReadUChar( aLVL.aOfsNumsXCH[ nLevelB ] );
699  if( ERRCODE_NONE != m_rSt.GetError() )
700  {
701  bLVLOkB = false;
702  break;
703  }
704  }
705 
706  if( !bLVLOkB )
707  return false;
708 
709  sal_uInt8 ixchFollow(0);
710  m_rSt.ReadUChar( ixchFollow );
711  m_rSt.ReadInt32( aLVL.nV6DxaSpace );
712  m_rSt.ReadInt32( aLVL.nV6Indent );
713  m_rSt.ReadUChar( aLVL.nLenGrpprlChpx );
714  m_rSt.ReadUChar( aLVL.nLenGrpprlPapx );
715  m_rSt.SeekRel( 2 );
716  if( ERRCODE_NONE != m_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 != m_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 != m_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  m_rReader.SetCurrentItemSet(std::move(rpItemSet));
845  // Set Reader-Style to Style of this Level
846  sal_uInt16 nOldColl = m_rReader.GetCurrentColl();
847  sal_uInt16 nNewColl = nLevelStyle;
848  if (ww::stiNil == nNewColl)
849  nNewColl = 0;
850  m_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 = m_rReader.GetToggleAttrFlags();
857  sal_uInt16 nOldFlags2 = m_rReader.GetToggleBiDiAttrFlags();
858 
859  WW8SprmIter aSprmIter(&aGrpprlChpx[0], aLVL.nLenGrpprlChpx,
860  maSprmParser);
861  while (const sal_uInt8* pSprm = aSprmIter.GetSprms())
862  {
863  m_rReader.ImportSprm(pSprm, aSprmIter.GetRemLen(), aSprmIter.GetCurrentId());
864  aSprmIter.advance();
865  }
866 
867  // Reset Reader-ItemSet-Pointer and Reader-Style
868  rpItemSet = m_rReader.SetCurrentItemSet(nullptr);
869  m_rReader.SetNCurrentColl( nOldColl );
870  m_rReader.SetToggleAttrFlags(nOldFlags1);
871  m_rReader.SetToggleBiDiAttrFlags(nOldFlags2);
872  }
873 
874  // 4. Read numbering String. Results in prefix and postfix
875 
876  OUString sNumString(sanitizeString(read_uInt16_PascalString(m_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(m_nUniqueList++));
1130  // #i86652#
1131  sal_uInt16 nRul =
1132  m_rDoc.MakeNumRule( m_rDoc.GetUniqueNumRuleName(&sPrefix), nullptr, false,
1134  SwNumRule* pMyNumRule = m_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()), m_rReader(rReader_)
1152  , m_rDoc(m_rReader.GetDoc())
1153  , m_rFib(m_rReader.GetFib()), m_rSt(rSt_)
1154  , m_nUniqueList(1)
1155  , m_nLastLFOPosition(USHRT_MAX)
1156 {
1157 
1158  // LST and LFO only since WW8
1159  if( ( 8 > m_rFib.m_nVersion )
1161  || ( m_rFib.m_lcbPlcfLst < 2 )
1162  || ( m_rFib.m_lcbPlfLfo < 2) ) return; // no public lists
1163 
1164  // create Arrays
1165  bool bLVLOk = true;
1166 
1167  sal_uInt64 nOriginalPos = m_rSt.Tell();
1168 
1169  // 1. read PLCF LST and create list templates in Writer
1170 
1171  bool bOk = checkSeek(m_rSt, m_rFib.m_fcPlcfLst);
1172 
1173  if (!bOk)
1174  return;
1175 
1176  sal_uInt32 nRemainingPlcfLst = m_rFib.m_lcbPlcfLst;
1177 
1178  sal_uInt16 nListCount(0);
1179  m_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 = m_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  m_rSt.ReadUInt32( aLST.nIdLst );
1205  m_rSt.ReadUInt32( aLST.nTplC );
1206  for (sal_uInt16 & nLevel : aLST.aIdSty)
1207  m_rSt.ReadUInt16( nLevel );
1208 
1209  sal_uInt8 aBits1(0);
1210  m_rSt.ReadUChar( aBits1 );
1211 
1212  m_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(m_rSt, m_rFib.m_fcPlfLfo);
1288 
1289  if (!bOk)
1290  return;
1291 
1292  sal_Int32 nLfoCount(0);
1293  m_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  m_rSt.ReadUInt32( aLFO.nIdLst );
1308  m_rSt.SeekRel( 8 );
1309  m_rSt.ReadUChar( aLFO.nLfoLvl );
1310  if (!m_rSt.good())
1311  break;
1312  m_rSt.SeekRel( 3 );
1313  // as many Overrides as there are
1314  if ((nMaxLevel < aLFO.nLfoLvl) || m_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 > m_rReader.StyleUsingLFO( nLfo ) )
1372  {
1373  sal_uInt16 nRul = m_rDoc.MakeNumRule(
1374  m_rDoc.GetUniqueNumRuleName( &sPrefix ), pParentNumRule);
1375  rLFOInfo.pNumRule = m_rDoc.GetNumRuleTable()[ nRul ];
1376  rLFOInfo.pNumRule->SetAutoRule(false);
1377  }
1378  else
1379  {
1380  sal_uInt16 nRul = m_rDoc.MakeNumRule(
1381  m_rDoc.GetUniqueNumRuleName(), pParentNumRule);
1382  rLFOInfo.pNumRule = m_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  m_rSt.ReadUInt32( nTest );
1399  do
1400  {
1401  nTest = 0;
1402  m_rSt.ReadUInt32( nTest );
1403  }
1404  while (nTest == 0xFFFFFFFF);
1405  m_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  m_rSt.ReadInt32( aLFOLVL.nStartAt );
1415  sal_uInt8 aBits1(0);
1416  m_rSt.ReadUChar( aBits1 );
1417  m_rSt.SeekRel( 3 );
1418  if (m_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  m_rSt.Seek( nOriginalPos );
1481 }
1482 
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  m_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  m_rDoc.DelNumRule( (*aIter)->pNumRule->GetName() );
1506  }
1507  }
1508 }
1509 
1511 {
1513 }
1514 
1515 static bool IsEqualFormatting(const SwNumRule &rOne, const SwNumRule &rTwo)
1516 {
1517  bool bRet =
1518  (
1519  rOne.GetRuleType() == rTwo.GetRuleType() &&
1520  rOne.IsContinusNum() == rTwo.IsContinusNum() &&
1521  rOne.IsAbsSpaces() == rTwo.IsAbsSpaces() &&
1522  rOne.GetPoolFormatId() == rTwo.GetPoolFormatId() &&
1523  rOne.GetPoolHelpId() == rTwo.GetPoolHelpId() &&
1524  rOne.GetPoolHlpFileId() == rTwo.GetPoolHlpFileId()
1525  );
1526 
1527  if (bRet)
1528  {
1529  for (sal_uInt8 n = 0; n < MAXLEVEL; ++n )
1530  {
1531  //The SvxNumberFormat compare, not the SwNumFormat compare
1532  const SvxNumberFormat &rO = rOne.Get(n);
1533  const SvxNumberFormat &rT = rTwo.Get(n);
1534  if (rO != rT)
1535  {
1536  bRet = false;
1537  break;
1538  }
1539  }
1540  }
1541  return bRet;
1542 }
1543 
1545  const sal_uInt8 nLevel, std::vector<sal_uInt8> &rParaSprms, SwTextNode *pNode)
1546 {
1547  if (m_LFOInfos.size() <= nLFOPosition)
1548  return nullptr;
1549 
1550  WW8LFOInfo& rLFOInfo = *m_LFOInfos[nLFOPosition];
1551 
1552  bool bFirstUse = !rLFOInfo.bUsedInDoc;
1553  rLFOInfo.bUsedInDoc = true;
1554 
1555  if( !rLFOInfo.pNumRule )
1556  return nullptr;
1557 
1558  // #i25545#
1559  // #i100132# - a number format does not have to exist on given list level
1560  SwNumFormat aFormat(rLFOInfo.pNumRule->Get(nLevel));
1561 
1562  if (m_rReader.IsRightToLeft() && m_nLastLFOPosition != nLFOPosition) {
1563  if ( aFormat.GetNumAdjust() == SvxAdjust::Right)
1564  aFormat.SetNumAdjust(SvxAdjust::Left);
1565  else if ( aFormat.GetNumAdjust() == SvxAdjust::Left)
1566  aFormat.SetNumAdjust(SvxAdjust::Right);
1567  rLFOInfo.pNumRule->Set(nLevel, aFormat);
1568  }
1569  m_nLastLFOPosition = nLFOPosition;
1570  /*
1571  #i1869#
1572  If this list has had its bits set in word 2000 to pretend that it is a
1573  simple list from the point of view of the user, then it is almost
1574  certainly a simple continuous list, and we will try to keep it like that.
1575  Otherwise when we save again it will be shown as the true outline list
1576  that it is, confusing the user that just wanted what they thought was a
1577  simple list. On the other hand it is possible that some of the other levels
1578  were used by the user, in which case we will not pretend anymore that it
1579  is a simple list. Something that word 2000 does anyway, that 97 didn't, to
1580  my bewilderment.
1581  */
1582  if (nLevel && rLFOInfo.pNumRule->IsContinusNum())
1583  rLFOInfo.pNumRule->SetContinusNum(false);
1584 
1585  if( (!rLFOInfo.bOverride) && (!rLFOInfo.bLSTbUIDSet) )
1586  {
1587  WW8LSTInfo* pParentListInfo = GetLSTByListId( rLFOInfo.nIdLst );
1588  if( pParentListInfo )
1589  pParentListInfo->bUsedInDoc = true;
1590  rLFOInfo.bLSTbUIDSet = true;
1591  }
1592 
1593  if (rLFOInfo.maParaSprms.size() > nLevel)
1594  rParaSprms = rLFOInfo.maParaSprms[nLevel];
1595 
1596  SwNumRule *pRet = rLFOInfo.pNumRule;
1597 
1598  bool bRestart(false);
1599  sal_uInt16 nStart(0);
1600  bool bNewstart(false);
1601  /*
1602  Note: If you fiddle with this then you have to make sure that #i18322#
1603  #i13833#, #i20095# and #112466# continue to work
1604 
1605  Check if there were overrides for this level
1606  */
1607  if (rLFOInfo.bOverride && nLevel < rLFOInfo.nLfoLvl)
1608  {
1609  WW8LSTInfo* pParentListInfo = GetLSTByListId(rLFOInfo.nIdLst);
1610  OSL_ENSURE(pParentListInfo, "ww: Impossible lists, please report");
1611  if (pParentListInfo && pParentListInfo->pNumRule)
1612  {
1613  const WW8LFOLVL &rOverride = rLFOInfo.maOverrides[nLevel];
1614  bool bNoChangeFromParent =
1615  IsEqualFormatting(*pRet, *(pParentListInfo->pNumRule));
1616 
1617  //If so then I think word still uses the parent (maybe)
1618  if (bNoChangeFromParent)
1619  {
1620  pRet = pParentListInfo->pNumRule;
1621 
1622  //did it not affect start at value ?
1623  if (bFirstUse && rOverride.bStartAt)
1624  {
1625  const SwNumFormat &rFormat =
1626  pParentListInfo->pNumRule->Get(nLevel);
1627  if (
1628  rFormat.GetStart() ==
1629  rLFOInfo.maOverrides[nLevel].nStartAt
1630  )
1631  {
1632  bRestart = true;
1633  }
1634  else
1635  {
1636  bNewstart = true;
1637  nStart = writer_cast<sal_uInt16>
1638  (rLFOInfo.maOverrides[nLevel].nStartAt);
1639  }
1640  }
1641 
1642  pParentListInfo->bUsedInDoc = true;
1643  }
1644  }
1645  }
1646 
1647  if (pNode)
1648  {
1649  pNode->SetAttrListLevel(nLevel);
1650 
1651  if (bRestart || bNewstart)
1652  pNode->SetListRestart(true);
1653  if (bNewstart)
1654  pNode->SetAttrListRestartValue(nStart);
1655  }
1656  return pRet;
1657 }
1658 
1659 // SwWW8ImplReader: append a List to a Style or Paragraph
1660 
1662  SwWW8StyInf& rStyleInfo)
1663 {
1664  bool bRes = true;
1665  if( rStyleInfo.m_pFormat && rStyleInfo.m_bColl )
1666  {
1667  bRes = m_rDoc.SetTextFormatColl(rRg, static_cast<SwTextFormatColl*>(rStyleInfo.m_pFormat));
1668  SwTextNode* pTextNode = m_pPaM->GetNode().GetTextNode();
1669  OSL_ENSURE( pTextNode, "No Text-Node at PaM-Position" );
1670  if ( !pTextNode )
1671  {
1672  // make code robust
1673  return bRes;
1674  }
1675 
1676  const SwNumRule * pNumRule = pTextNode->GetNumRule(); // #i27610#
1677 
1679  ! (pNumRule && pNumRule->IsOutlineRule()) ) // #i27610#
1680  {
1681  pTextNode->ResetAttr( RES_PARATR_NUMRULE );
1682  }
1683 
1684  if (USHRT_MAX > rStyleInfo.m_nLFOIndex && WW8ListManager::nMaxLevel
1685  > rStyleInfo.m_nListLevel)
1686  {
1687  const bool bApplyListStyle = false;
1688  RegisterNumFormatOnTextNode(rStyleInfo.m_nLFOIndex, rStyleInfo.m_nListLevel,
1689  bApplyListStyle);
1690  }
1691  }
1692  return bRes;
1693 }
1694 
1695 void UseListIndent(SwWW8StyInf &rStyle, const SwNumFormat &rFormat)
1696 {
1697  // #i86652#
1699  {
1700  const auto nAbsLSpace = rFormat.GetAbsLSpace();
1701  const tools::Long nListFirstLineIndent = GetListFirstLineIndent(rFormat);
1703  aLR.SetTextLeft(nAbsLSpace);
1704  aLR.SetTextFirstLineOffset(writer_cast<short>(nListFirstLineIndent));
1705  rStyle.m_pFormat->SetFormatAttr(aLR);
1706  rStyle.m_bListRelevantIndentSet = true;
1707  }
1708 }
1709 
1710 void SetStyleIndent(SwWW8StyInf &rStyle, const SwNumFormat &rFormat)
1711 {
1713  return;
1714 
1716  if (rStyle.m_bListRelevantIndentSet)
1717  {
1718 
1719  SyncIndentWithList( aLR, rFormat, false, false ); // #i103711#, #i105414#
1720  }
1721  else
1722  {
1723  aLR.SetTextLeft(0);
1724  aLR.SetTextFirstLineOffset(0);
1725  }
1726  rStyle.m_pFormat->SetFormatAttr(aLR);
1727 }
1728 
1729 void SwWW8ImplReader::SetStylesList(sal_uInt16 nStyle, sal_uInt16 nCurrentLFO,
1730  sal_uInt8 nCurrentLevel)
1731 {
1732  if (nStyle >= m_vColl.size())
1733  return;
1734 
1735  SwWW8StyInf &rStyleInf = m_vColl[nStyle];
1736  if (!rStyleInf.m_bValid)
1737  return;
1738 
1739  OSL_ENSURE(m_pCurrentColl, "Cannot be called outside of style import");
1740  // Phase 1: Numbering attributes when reading a StyleDef
1741  if( !m_pCurrentColl )
1742  return;
1743 
1744  if (nCurrentLFO < USHRT_MAX)
1745  rStyleInf.m_nLFOIndex = nCurrentLFO;
1746  if (nCurrentLevel < MAXLEVEL)
1747  rStyleInf.m_nListLevel = nCurrentLevel;
1748 
1749  // only save the Parameters for now. The actual List will be appended
1750  // at a later point, when the Listdefinitions is read...
1751  if (rStyleInf.m_nLFOIndex < USHRT_MAX && rStyleInf.m_nListLevel < WW8ListManager::nMaxLevel)
1752  {
1753  std::vector<sal_uInt8> aParaSprms;
1754  SwNumRule* pNmRule = m_xLstManager->GetNumRuleForActivation(
1755  rStyleInf.m_nLFOIndex, rStyleInf.m_nListLevel, aParaSprms);
1756  if (pNmRule)
1757  UseListIndent(rStyleInf, pNmRule->Get(rStyleInf.m_nListLevel));
1758  }
1759 }
1760 
1762 {
1763 
1764  if (nStyle >= m_vColl.size())
1765  return;
1766 
1767  SwWW8StyInf &rStyleInf = m_vColl[nStyle];
1768  if (!(rStyleInf.m_bValid && rStyleInf.m_pFormat))
1769  return;
1770 
1771  //Save old pre-list modified indent, which are the word indent values
1772  rStyleInf.maWordLR.reset(rStyleInf.m_pFormat->GetFormatAttr(RES_LR_SPACE).Clone());
1773 
1774  // Phase 2: refresh StyleDef after reading all Lists
1775  if (rStyleInf.m_nLFOIndex >= USHRT_MAX || rStyleInf.m_nListLevel >= WW8ListManager::nMaxLevel)
1776  return;
1777 
1778  std::vector<sal_uInt8> aParaSprms;
1779  SwNumRule* pNmRule = m_xLstManager->GetNumRuleForActivation(
1780  rStyleInf.m_nLFOIndex, rStyleInf.m_nListLevel, aParaSprms);
1781 
1782  if (pNmRule != nullptr)
1783  {
1784  if (rStyleInf.IsWW8BuiltInHeadingStyle()
1785  && rStyleInf.HasWW8OutlineLevel())
1786  {
1787  rStyleInf.m_pOutlineNumrule = pNmRule;
1788  }
1789  else
1790  {
1791  rStyleInf.m_pFormat->SetFormatAttr(
1792  SwNumRuleItem(pNmRule->GetName()));
1793  rStyleInf.m_bHasStyNumRule = true;
1794  }
1795 
1796  SetStyleIndent(rStyleInf, pNmRule->Get(rStyleInf.m_nListLevel));
1797  }
1798 }
1799 
1801  sal_uInt8 nCurrentLevel,
1802  const bool bSetAttr)
1803 {
1804  // Note: the method appends NumRule to the Text Node if
1805  // bSetAttr (of course the lists have to be read before)
1806  // and only sets the Level. It does not check if there is a NumRule
1807  // attached to the STYLE !!!
1808 
1809  if (!m_xLstManager) // are all list declarations read?
1810  return;
1811 
1812  SwTextNode* pTextNd = m_pPaM->GetNode().GetTextNode();
1813  OSL_ENSURE(pTextNd, "No Text-Node at PaM-Position");
1814  if (!pTextNd)
1815  return;
1816 
1817  // WW8ListManager::nMaxLevel indicates body text, cancelling an inherited numbering.
1818  if (nCurrentLFO < USHRT_MAX && nCurrentLevel == WW8ListManager::nMaxLevel)
1819  {
1820  pTextNd->SetAttr(SwNumRuleItem(OUString()));
1821  return;
1822  }
1823 
1824  // Undefined listLevel is treated as the first level with valid numbering rule.
1825  // TODO:This doesn't allow for inheriting from a style(HOW?), but it matches previous behaviour.
1826  if (nCurrentLFO < USHRT_MAX && nCurrentLevel == MAXLEVEL)
1827  nCurrentLevel = 0;
1828 
1829  std::vector<sal_uInt8> aParaSprms;
1830  const SwNumRule* pRule = bSetAttr ?
1831  m_xLstManager->GetNumRuleForActivation( nCurrentLFO, nCurrentLevel,
1832  aParaSprms, pTextNd) : nullptr;
1833 
1834  if (pRule == nullptr && bSetAttr)
1835  return;
1836 
1837  if (bSetAttr && pTextNd->GetNumRule() != pRule
1838  && (pTextNd->GetNumRule() != m_rDoc.GetOutlineNumRule()
1839  || pRule != m_pChosenWW8OutlineStyle))
1840  {
1841  // Now this is either not a part of Chapter Numbering,
1842  // or else it is using a different numRule than the one copied to Chapter Numbering.
1844  : pRule->GetName();
1845  pTextNd->SetAttr(SwNumRuleItem(sName));
1846  }
1847  pTextNd->SetAttrListLevel(nCurrentLevel);
1848 
1849  // <IsCounted()> state of text node has to be adjusted accordingly.
1850  if ( /*nCurrentLevel >= 0 &&*/ nCurrentLevel < MAXLEVEL )
1851  {
1852  pTextNd->SetCountedInList( true );
1853  }
1854 
1855  // #i99822#
1856  // Direct application of the list level formatting no longer
1857  // needed for list levels of mode LABEL_ALIGNMENT
1858  bool bApplyListLevelIndentDirectlyAtPara(true);
1859  {
1860  if (pTextNd->GetNumRule() && nCurrentLevel < MAXLEVEL)
1861  {
1862  const SwNumFormat& rFormat = pTextNd->GetNumRule()->Get(nCurrentLevel);
1863  if (rFormat.GetPositionAndSpaceMode()
1865  {
1866  bApplyListLevelIndentDirectlyAtPara = false;
1867  }
1868  }
1869  }
1870 
1871  if (!bApplyListLevelIndentDirectlyAtPara)
1872  return;
1873 
1874  auto xListIndent = std::make_unique<SfxItemSet>(m_rDoc.GetAttrPool(), svl::Items<RES_LR_SPACE, RES_LR_SPACE>);
1875  const SvxLRSpaceItem *pItem = static_cast<const SvxLRSpaceItem*>(
1877  OSL_ENSURE(pItem, "impossible");
1878  if (pItem)
1879  xListIndent->Put(*pItem);
1880 
1881  /*
1882  Take the original paragraph sprms attached to this list level
1883  formatting and apply them to the paragraph. I'm convinced that
1884  this is exactly what word does.
1885  */
1886  if (short nLen = static_cast< short >(aParaSprms.size()))
1887  {
1888  std::unique_ptr<SfxItemSet> xOldCurrentItemSet(SetCurrentItemSet(std::move(xListIndent)));
1889 
1890  sal_uInt8* pSprms1 = aParaSprms.data();
1891  while (0 < nLen)
1892  {
1893  sal_uInt16 nL1 = ImportSprm(pSprms1, nLen);
1894  nLen = nLen - nL1;
1895  pSprms1 += nL1;
1896  }
1897 
1898  xListIndent = SetCurrentItemSet(std::move(xOldCurrentItemSet));
1899  }
1900 
1901  if (const SvxLRSpaceItem *pLR = xListIndent->GetItem<SvxLRSpaceItem>(RES_LR_SPACE))
1902  {
1903  m_xCtrlStck->NewAttr(*m_pPaM->GetPoint(), *pLR);
1904  m_xCtrlStck->SetAttr(*m_pPaM->GetPoint(), RES_LR_SPACE);
1905  }
1906 }
1907 
1908 void SwWW8ImplReader::RegisterNumFormat(sal_uInt16 nCurrentLFO, sal_uInt8 nCurrentLevel)
1909 {
1910  // Are we reading the StyleDef ?
1911  if (m_pCurrentColl)
1912  SetStylesList( m_nCurrentColl , nCurrentLFO, nCurrentLevel);
1913  else
1914  RegisterNumFormatOnTextNode(nCurrentLFO, nCurrentLevel);
1915 }
1916 
1917 void SwWW8ImplReader::Read_ListLevel(sal_uInt16, const sal_uInt8* pData,
1918  short nLen)
1919 {
1920  if (m_xPlcxMan && m_xPlcxMan->GetDoingDrawTextBox())
1921  return;
1922 
1923  if( nLen < 0 )
1924  {
1925  // the current level is finished, what should we do ?
1927  if (m_xStyles && !m_bVer67)
1928  m_xStyles->mnWwNumLevel = 0;
1929  }
1930  else
1931  {
1932  // security check
1933  if( !pData )
1934  return;
1935 
1936  // the Streamdata is zero based
1937  m_nListLevel = *pData;
1938 
1939  if (m_xStyles && !m_bVer67)
1940  {
1941  /*
1942  if this is the case, then if the numbering is actually stored in
1943  winword 6 format, and its likely that sprmPIlvl has been abused
1944  to set the ww6 list level information which we will need when we
1945  reach the true ww6 list def. So set it now
1946  */
1947  m_xStyles->mnWwNumLevel = m_nListLevel;
1948  }
1949 
1950  // Treat an invalid level as body-level
1953 
1955  if (USHRT_MAX > m_nLFOPosition)
1956  {
1957  assert(false && "m_nLFOPosition is usually reset immediately, so we rarely ever get here.");
1958  m_nLFOPosition = USHRT_MAX;
1960  }
1961  }
1962 }
1963 
1964 void SwWW8ImplReader::Read_LFOPosition(sal_uInt16, const sal_uInt8* pData,
1965  short nLen)
1966 {
1967  if (m_xPlcxMan && m_xPlcxMan->GetDoingDrawTextBox())
1968  return;
1969 
1970  if( nLen < 0 )
1971  {
1972  // the current level is finished, what should we do ?
1973  m_nLFOPosition = USHRT_MAX;
1975  }
1976  else
1977  {
1978  // security check
1979  if( !pData )
1980  return;
1981 
1982  short nData = SVBT16ToUInt16( pData );
1983  if( 0 >= nData )
1984  {
1985  // disable the numbering/list style apply to the paragraph or the style
1986 
1987  /*
1988  If you have a paragraph in word with left and/or hanging indent
1989  and remove its numbering, then the indentation appears to get
1990  reset, but not back to the base style, instead it goes to a blank
1991  setting.
1992  Unless it's a broken ww6 list in 97 in which case more hackery is
1993  required, some more details about broken ww6 list in
1994  ww8par6.cxx#SwWW8ImplReader::Read_LR
1995  */
1996 
1997  if (m_pCurrentColl)
1998  {
1999  // here a "named" style is being configured
2000 
2001  // disable the numbering/list in the style currently configured
2003 
2004  // reset/blank the indent
2006 
2007  // These sprmPIlfos are supposed to indicate "cancel" numbering.
2008  // Since m_nLFOPosition is "data - 1", then zero becomes USHRT_MAX
2009  // which is no good since that indicates "unspecified, available for inheritance".
2010  // So instead use USHRT_MAX-1 for indicating an explicit "cancel numbering".
2011  RegisterNumFormat(USHRT_MAX-1, MAXLEVEL);
2012  }
2013  else if (SwTextNode* pTextNode = m_pPaM->GetNode().GetTextNode())
2014  {
2015  // here a paragraph is being directly formatted
2016 
2017  // empty the numbering/list style applied to the current paragraph
2018  SwNumRuleItem aEmptyRule;
2019  pTextNode->SetAttr( aEmptyRule );
2020 
2021  // create an empty SvxLRSpaceItem
2022  std::shared_ptr<SvxLRSpaceItem> aLR(std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE));
2023 
2024  // replace it with the one of the current node if it exist
2025  const SfxPoolItem* pLR = GetFormatAttr(RES_LR_SPACE);
2026  if( pLR )
2027  aLR.reset(static_cast<SvxLRSpaceItem*>(pLR->Clone()));
2028 
2029  // reset/blank the left indent (and only the left)
2030  aLR->SetTextLeft(0);
2031  aLR->SetTextFirstLineOffset(0);
2032 
2033  // apply the modified SvxLRSpaceItem to the current paragraph
2034  pTextNode->SetAttr( *aLR );
2035  }
2036 
2037  m_nLFOPosition = USHRT_MAX;
2038  }
2039  else // nData in (0..0x7FFF]
2040  {
2041  m_nLFOPosition = o3tl::narrowing<sal_uInt16>(nData)-1; // m_nLFOPosition in [0..0x7FFF)
2042  /*
2043  If we are a ww8+ style with ww7- style lists then there is a
2044  bizarre broken word bug where when the list is removed from a para
2045  the ww6 list first line indent still affects the first line
2046  indentation. Setting this flag will allow us to recover from this
2047  braindeadness
2048  */
2049  if (m_pCurrentColl && (m_nLFOPosition == 2047-1) && m_nCurrentColl < m_vColl.size())
2050  m_vColl[m_nCurrentColl].m_bHasBrokenWW6List = true;
2051 
2052  // here the stream data is 1-based, we subtract ONE
2053  if (m_nLFOPosition != 2047-1) //Normal ww8+ list behaviour
2054  {
2056  m_nLFOPosition = USHRT_MAX;
2058  }
2059  else if (m_xPlcxMan && m_xPlcxMan->HasParaSprm(NS_sprm::LN_PAnld).pSprm)
2060  {
2061  /*
2062  #i8114# Horrific backwards compatible ww7- lists in ww8+
2063  docs
2064  */
2065  m_nListLevel = std::min<sal_uInt8>(WW8ListManager::nMaxLevel, m_nListLevel);
2066  Read_ANLevelNo(13 /*equiv ww7- sprm no*/, &m_nListLevel, 1);
2067  }
2068  }
2069  }
2070 }
2071 
2072 // Reading Controls
2073 
2075  WW8_CP nStart, SwWw8ControlType nWhich )
2076 {
2077  bool bRet=false;
2078  /*
2079  * Save the reader state and process the sprms for this anchor cp.
2080  * Doing so will set the nPicLocFc to the offset to find the hypertext
2081  * data in the data stream.
2082  */
2083  WW8_CP nEndCp = nStart+1; //Only interested in the single 0x01 character
2084 
2085  WW8ReaderSave aSave(this,nStart);
2086 
2087  WW8PLCFManResult aRes;
2088  nStart = m_xPlcxMan->Where();
2089  while(nStart <= nEndCp)
2090  {
2091  if ( m_xPlcxMan->Get(&aRes)
2092  && aRes.pMemPos && aRes.nSprmId )
2093  {
2094  //only interested in sprms which would set nPicLocFc
2095  if ( (68 == aRes.nSprmId) || (0x6A03 == aRes.nSprmId) )
2096  {
2097  Read_PicLoc( aRes.nSprmId, aRes.pMemPos +
2098  m_xSprmParser->DistanceToData(aRes.nSprmId), 4);
2099  break;
2100  }
2101  }
2102  m_xPlcxMan->advance();
2103  nStart = m_xPlcxMan->Where();
2104  }
2105  sal_uLong nOffset = m_nPicLocFc;
2106  aSave.Restore(this);
2107 
2108  sal_uInt64 nOldPos = m_pDataStream->Tell();
2109  WW8_PIC aPic;
2110  bool bValid = checkSeek(*m_pDataStream, nOffset) &&
2111  PicRead(m_pDataStream, &aPic, m_bVer67);
2112 
2113  if (bValid && aPic.lcb > 0x3A)
2114  {
2115  aFormula.FormulaRead(nWhich,m_pDataStream);
2116  bRet = true;
2117  }
2118 
2119  /*
2120  There is a problem with aPic, the WW8_PIC is always used even though it
2121  is too big for the WW95 files, it needs to be modified to check the
2122  version C.
2123  */
2124  m_pDataStream->Seek( nOldPos );
2125  return bRet;
2126 }
2127 
2129 {
2130  const uno::Reference< lang::XMultiServiceFactory > & rServiceFactory =
2131  GetServiceFactory();
2132 
2133  if(!rServiceFactory.is())
2134  return;
2135 
2136  awt::Size aSz;
2137  uno::Reference< form::XFormComponent> xFComp;
2138 
2139  if (rFormula.Import(rServiceFactory, xFComp, aSz))
2140  {
2141  uno::Reference <drawing::XShape> xShapeRef;
2142  if (InsertControl(xFComp, aSz, &xShapeRef, false))
2143  GetShapes()->add(xShapeRef);
2144  }
2145 }
2146 
2148  SvStream *pDataStream)
2149 {
2150  sal_uInt8 nField;
2151 
2152  // The following is a FFData structure as described in
2153  // Microsoft's DOC specification (chapter 2.9.78)
2154  sal_uInt32 nVersion = 0;
2155  pDataStream->ReadUInt32(nVersion);
2156  // An unsigned integer that MUST be 0xFFFFFFFF
2157  if (nVersion != 0xFFFFFFFF)
2158  {
2159  SAL_WARN("sw.ww8", "Parsing error: invalid header for FFData");
2160  return; // bail out
2161  }
2162 
2163  // might be better to read the bits as a 16 bit word
2164  // ( like it is in the spec. )
2165  sal_uInt8 bits1 = 0;
2166  pDataStream->ReadUChar( bits1 );
2167  sal_uInt8 bits2 = 0;
2168  pDataStream->ReadUChar( bits2 );
2169 
2170  sal_uInt8 iType = ( bits1 & 0x3 );
2171 
2172  // we should verify that bits.iType & nWhich concur
2173  OSL_ENSURE( iType == nWhich, "something wrong, expect control type read from stream doesn't match nWhich passed in");
2174  if ( iType != nWhich )
2175  return; // bail out
2176 
2177  sal_uInt8 iRes = (bits1 & 0x7C) >> 2;
2178 
2179  pDataStream->ReadUInt16( mnMaxLen );
2180 
2181  sal_uInt16 hps = 0;
2182  pDataStream->ReadUInt16( hps );
2183 
2184  // xstzName
2185  msTitle = read_uInt16_BeltAndBracesString(*pDataStream);
2186 
2187  if (nWhich == WW8_CT_EDIT)
2188  { // Field is a textbox
2189  // Default text
2190  // xstzTextDef
2192  }
2193  else
2194  {
2195  // CheckBox or ComboBox
2196  sal_uInt16 wDef = 0;
2197  pDataStream->ReadUInt16( wDef );
2198  mnChecked = wDef; // default
2199  if (nWhich == WW8_CT_CHECKBOX)
2200  {
2201  if ( iRes != 25 )
2202  mnChecked = iRes;
2203  msDefault = ( wDef == 0 ) ? std::u16string_view( u"0" ) : std::u16string_view( u"1" );
2204  }
2205  }
2206  // xstzTextFormat
2208  // xstzHelpText
2209  msHelp = read_uInt16_BeltAndBracesString(*pDataStream);
2210  // xstzStatText
2212 
2213  // xstzEntryMcr
2215  //xstzExitMcr
2217 
2218  if (nWhich == WW8_CT_DROPDOWN)
2219  {
2220  bool bAllOk = true;
2221  // SSTB (see Spec. 2.2.4)
2222  sal_uInt16 fExtend = 0;
2223  pDataStream->ReadUInt16( fExtend );
2224  sal_uInt16 nStringsCnt = 0;
2225 
2226  // Isn't it that if fExtend isn't 0xFFFF then fExtend actually
2227  // doesn't exist and we really have just read nStringsCnt ( or cData )?
2228  if (fExtend != 0xFFFF)
2229  bAllOk = false;
2230  pDataStream->ReadUInt16( nStringsCnt );
2231 
2232  // I guess this should be zero ( and we should ensure that )
2233  sal_uInt16 cbExtra = 0;
2234  pDataStream->ReadUInt16( cbExtra );
2235 
2236  OSL_ENSURE(bAllOk, "Unknown formfield dropdown list structure");
2237  if (!bAllOk) //Not as expected, don't risk it at all.
2238  nStringsCnt = 0;
2239  const size_t nMinRecordSize = sizeof(sal_uInt16);
2240  const size_t nMaxRecords = pDataStream->remainingSize() / nMinRecordSize;
2241  if (nStringsCnt > nMaxRecords)
2242  {
2243  SAL_WARN("sw.ww8", "Parsing error: " << nMaxRecords <<
2244  " max possible entries, but " << nStringsCnt << " claimed, truncating");
2245  nStringsCnt = nMaxRecords;
2246  }
2247  maListEntries.reserve(nStringsCnt);
2248  for (sal_uInt32 nI = 0; nI < nStringsCnt; ++nI)
2249  {
2250  OUString sEntry = read_uInt16_PascalString(*pDataStream);
2251  maListEntries.push_back(sEntry);
2252  }
2253  }
2254  mfDropdownIndex = iRes;
2255 
2256  mbHelp = bits1 & 0x80;
2257 
2258  nField = bits2;
2259  mfToolTip = nField & 0x01;
2260  mfNoMark = (nField & 0x02)>>1;
2261  mfType = (nField & 0x38)>>3;
2262  mfUnused = (nField & 0xE0)>>5;
2263 }
2264 
2266  : WW8FormulaControl(SL::aListBox, rR)
2267 {
2268 }
2269 
2270 //Miserable hack to get a hardcoded guesstimate of the size of a list dropdown
2271 //box's first entry to set as the lists default size
2272 awt::Size SwWW8ImplReader::MiserableDropDownFormHack(const OUString &rString,
2273  uno::Reference<beans::XPropertySet> const & rPropSet)
2274 {
2275  awt::Size aRet;
2276  struct CtrlFontMapEntry
2277  {
2278  sal_uInt16 nWhichId;
2279  const char* pPropNm;
2280  };
2281  const CtrlFontMapEntry aMapTable[] =
2282  {
2283  { RES_CHRATR_COLOR, "TextColor" },
2284  { RES_CHRATR_FONT, "FontName" },
2285  { RES_CHRATR_FONTSIZE, "FontHeight" },
2286  { RES_CHRATR_WEIGHT, "FontWeight" },
2287  { RES_CHRATR_UNDERLINE, "FontUnderline" },
2288  { RES_CHRATR_CROSSEDOUT, "FontStrikeout" },
2289  { RES_CHRATR_POSTURE, "FontSlant" },
2290  { 0, nullptr }
2291  };
2292 
2293  vcl::Font aFont;
2294  uno::Reference< beans::XPropertySetInfo > xPropSetInfo =
2295  rPropSet->getPropertySetInfo();
2296 
2297  uno::Any aTmp;
2298  for (const CtrlFontMapEntry* pMap = aMapTable; pMap->nWhichId; ++pMap)
2299  {
2300  bool bSet = true;
2301  const SfxPoolItem* pItem = GetFormatAttr( pMap->nWhichId );
2302  OSL_ENSURE(pItem, "Impossible");
2303  if (!pItem)
2304  continue;
2305 
2306  switch ( pMap->nWhichId )
2307  {
2308  case RES_CHRATR_COLOR:
2309  {
2310  OUString aNm;
2311  if (xPropSetInfo->hasPropertyByName(aNm = "TextColor"))
2312  {
2313  aTmp <<= static_cast<sal_Int32>(static_cast<const SvxColorItem*>(pItem)->GetValue());
2314  rPropSet->setPropertyValue(aNm, aTmp);
2315  }
2316  }
2317  aFont.SetColor(static_cast<const SvxColorItem*>(pItem)->GetValue());
2318  break;
2319  case RES_CHRATR_FONT:
2320  {
2321  const SvxFontItem *pFontItem = static_cast<const SvxFontItem *>(pItem);
2322  OUString aNm;
2323  if (xPropSetInfo->hasPropertyByName(aNm = "FontStyleName"))
2324  {
2325  aTmp <<= pFontItem->GetStyleName();
2326  rPropSet->setPropertyValue( aNm, aTmp );
2327  }
2328  if (xPropSetInfo->hasPropertyByName(aNm = "FontFamily"))
2329  {
2330  aTmp <<= static_cast<sal_Int16>(pFontItem->GetFamily());
2331  rPropSet->setPropertyValue( aNm, aTmp );
2332  }
2333  if (xPropSetInfo->hasPropertyByName(aNm = "FontCharset"))
2334  {
2335  aTmp <<= static_cast<sal_Int16>(pFontItem->GetCharSet());
2336  rPropSet->setPropertyValue( aNm, aTmp );
2337  }
2338  if (xPropSetInfo->hasPropertyByName(aNm = "FontPitch"))
2339  {
2340  aTmp <<= static_cast<sal_Int16>(pFontItem->GetPitch());
2341  rPropSet->setPropertyValue( aNm, aTmp );
2342  }
2343 
2344  aTmp <<= pFontItem->GetFamilyName();
2345  aFont.SetFamilyName( pFontItem->GetFamilyName() );
2346  aFont.SetStyleName( pFontItem->GetStyleName() );
2347  aFont.SetFamily( pFontItem->GetFamily() );
2348  aFont.SetCharSet( pFontItem->GetCharSet() );
2349  aFont.SetPitch( pFontItem->GetPitch() );
2350  }
2351  break;
2352 
2353  case RES_CHRATR_FONTSIZE:
2354  {
2355  Size aSize( aFont.GetFontSize().Width(),
2356  static_cast<const SvxFontHeightItem*>(pItem)->GetHeight() );
2357  aTmp <<= static_cast<float>(aSize.Height()) / 20.0;
2358 
2360  }
2361  break;
2362 
2363  case RES_CHRATR_WEIGHT:
2365  static_cast<const SvxWeightItem*>(pItem)->GetWeight() );
2366  aFont.SetWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() );
2367  break;
2368 
2369  case RES_CHRATR_UNDERLINE:
2370  aTmp <<= static_cast<sal_Int16>(static_cast<const SvxUnderlineItem*>(pItem)->GetLineStyle());
2371  aFont.SetUnderline(static_cast<const SvxUnderlineItem*>(pItem)->GetLineStyle());
2372  break;
2373 
2374  case RES_CHRATR_CROSSEDOUT:
2375  aTmp <<= static_cast<sal_Int16>( static_cast<const SvxCrossedOutItem*>(pItem)->GetStrikeout() );
2376  aFont.SetStrikeout( static_cast<const SvxCrossedOutItem*>(pItem)->GetStrikeout() );
2377  break;
2378 
2379  case RES_CHRATR_POSTURE:
2380  aTmp <<= static_cast<sal_Int16>( static_cast<const SvxPostureItem*>(pItem)->GetPosture() );
2381  aFont.SetItalic( static_cast<const SvxPostureItem*>(pItem)->GetPosture() );
2382  break;
2383 
2384  default:
2385  bSet = false;
2386  break;
2387  }
2388 
2389  if (bSet && xPropSetInfo->hasPropertyByName(OUString::createFromAscii(pMap->pPropNm)))
2390  rPropSet->setPropertyValue(OUString::createFromAscii(pMap->pPropNm), aTmp);
2391  }
2392  // now calculate the size of the control
2394  OSL_ENSURE(pOut, "Impossible");
2395  if (pOut)
2396  {
2398  pOut->SetMapMode( MapMode( MapUnit::Map100thMM ));
2399  pOut->SetFont( aFont );
2400  aRet.Width = pOut->GetTextWidth(rString);
2401  aRet.Width += 500; //plus size of button, total hack territory
2402  aRet.Height = pOut->GetTextHeight();
2403  pOut->Pop();
2404  }
2405  return aRet;
2406 }
2407 
2408 bool WW8FormulaListBox::Import(const uno::Reference <
2409  lang::XMultiServiceFactory> &rServiceFactory,
2410  uno::Reference <form::XFormComponent> &rFComp,awt::Size &rSz )
2411 {
2412  uno::Reference<uno::XInterface> xCreate = rServiceFactory->createInstance("com.sun.star.form.component.ComboBox");
2413  if( !xCreate.is() )
2414  return false;
2415 
2416  rFComp.set(xCreate, uno::UNO_QUERY);
2417  if( !rFComp.is() )
2418  return false;
2419 
2420  uno::Reference<beans::XPropertySet> xPropSet(xCreate, uno::UNO_QUERY);
2421 
2422  uno::Any aTmp;
2423  if (!msTitle.isEmpty())
2424  aTmp <<= msTitle;
2425  else
2426  aTmp <<= msName;
2427  xPropSet->setPropertyValue("Name", aTmp );
2428 
2429  if (!msToolTip.isEmpty())
2430  {
2431  aTmp <<= msToolTip;
2432  xPropSet->setPropertyValue("HelpText", aTmp );
2433  }
2434 
2435  xPropSet->setPropertyValue("Dropdown", css::uno::Any(true));
2436 
2437  if (!maListEntries.empty())
2438  {
2439  sal_uInt32 nLen = maListEntries.size();
2440  uno::Sequence< OUString > aListSource(nLen);
2441  auto aListSourceRange = asNonConstRange(aListSource);
2442  for (sal_uInt32 nI = 0; nI < nLen; ++nI)
2443  aListSourceRange[nI] = maListEntries[nI];
2444  aTmp <<= aListSource;
2445  xPropSet->setPropertyValue("StringItemList", aTmp );
2446 
2447  if (mfDropdownIndex < nLen)
2448  {
2449  aTmp <<= aListSource[mfDropdownIndex];
2450  }
2451  else
2452  {
2453  aTmp <<= aListSource[0];
2454  }
2455 
2456  xPropSet->setPropertyValue("DefaultText", aTmp );
2457 
2458  rSz = mrRdr.MiserableDropDownFormHack(maListEntries[0], xPropSet);
2459  }
2460  else
2461  {
2462  static constexpr OUStringLiteral aBlank =
2463  u"\u2002\u2002\u2002\u2002\u2002";
2464  rSz = mrRdr.MiserableDropDownFormHack(aBlank, xPropSet);
2465  }
2466 
2467  return true;
2468 }
2469 
2472 {
2473 }
2474 
2475 static void lcl_AddToPropertyContainer
2476 (uno::Reference<beans::XPropertySet> const & xPropSet,
2477  const OUString & rPropertyName, const OUString & rValue)
2478 {
2479  uno::Reference<beans::XPropertySetInfo> xPropSetInfo =
2480  xPropSet->getPropertySetInfo();
2481  if (xPropSetInfo.is() &&
2482  ! xPropSetInfo->hasPropertyByName(rPropertyName))
2483  {
2484  uno::Reference<beans::XPropertyContainer>
2485  xPropContainer(xPropSet, uno::UNO_QUERY);
2486  uno::Any aAny((OUString()));
2487  xPropContainer->addProperty
2488  (rPropertyName,
2489  static_cast<sal_Int16>(beans::PropertyAttribute::BOUND |
2490  beans::PropertyAttribute::REMOVABLE),
2491  aAny);
2492  }
2493 
2494  uno::Any aAnyValue(rValue);
2495  xPropSet->setPropertyValue(rPropertyName, aAnyValue );
2496 }
2497 
2498 bool WW8FormulaCheckBox::Import(const uno::Reference <
2499  lang::XMultiServiceFactory> &rServiceFactory,
2500  uno::Reference <form::XFormComponent> &rFComp,awt::Size &rSz )
2501 {
2502  uno::Reference< uno::XInterface > xCreate = rServiceFactory->createInstance("com.sun.star.form.component.CheckBox");
2503  if( !xCreate.is() )
2504  return false;
2505 
2506  rFComp.set( xCreate, uno::UNO_QUERY );
2507  if( !rFComp.is() )
2508  return false;
2509 
2510  uno::Reference< beans::XPropertySet > xPropSet( xCreate, uno::UNO_QUERY );
2511 
2512  rSz.Width = 16 * mhpsCheckBox;
2513  rSz.Height = 16 * mhpsCheckBox;
2514 
2515  uno::Any aTmp;
2516  if (!msTitle.isEmpty())
2517  aTmp <<= msTitle;
2518  else
2519  aTmp <<= msName;
2520  xPropSet->setPropertyValue("Name", aTmp );
2521 
2522  aTmp <<= static_cast<sal_Int16>(mnChecked);
2523  xPropSet->setPropertyValue("DefaultState", aTmp);
2524 
2525  if (!msToolTip.isEmpty())
2526  lcl_AddToPropertyContainer(xPropSet, "HelpText", msToolTip);
2527 
2528  if (!msHelp.isEmpty())
2529  lcl_AddToPropertyContainer(xPropSet, "HelpF1Text", msHelp);
2530 
2531  return true;
2532 
2533 }
2534 
2537 {
2538 }
2539 
2541  const uno::Reference< form::XFormComponent > & rFComp,
2542  const awt::Size& rSize, uno::Reference< drawing::XShape > *pShape,
2543  bool bFloatingCtrl)
2544 {
2545  const uno::Reference< container::XIndexContainer > &rComps = GetFormComps();
2547  rComps->insertByIndex( rComps->getCount(), aTmp );
2548 
2549  const uno::Reference< lang::XMultiServiceFactory > &rServiceFactory =
2550  GetServiceFactory();
2551  if( !rServiceFactory.is() )
2552  return false;
2553 
2554  uno::Reference< uno::XInterface > xCreate = rServiceFactory->createInstance(
2555  "com.sun.star.drawing.ControlShape");
2556  if( !xCreate.is() )
2557  return false;
2558 
2559  uno::Reference< drawing::XShape > xShape(xCreate, uno::UNO_QUERY);
2560 
2561  OSL_ENSURE(xShape.is(), "Did not get XShape");
2562  xShape->setSize(rSize);
2563 
2564  uno::Reference< beans::XPropertySet > xShapePropSet(
2565  xCreate, uno::UNO_QUERY );
2566 
2567  //I lay a small bet that this will change to
2568  //sal_Int16 nTemp=TextContentAnchorType::AS_CHARACTER;
2569  text::TextContentAnchorType nTemp;
2570  if (bFloatingCtrl)
2571  nTemp = text::TextContentAnchorType_AT_PARAGRAPH;
2572  else
2573  nTemp = text::TextContentAnchorType_AS_CHARACTER;
2574 
2575  xShapePropSet->setPropertyValue("AnchorType", uno::Any(static_cast<sal_Int16>(nTemp)) );
2576 
2577  xShapePropSet->setPropertyValue("VertOrient", uno::Any(sal_Int16(text::VertOrientation::TOP)) );
2578 
2579  uno::Reference< text::XText > xDummyTextRef;
2580  uno::Reference< text::XTextRange > xTextRg =
2581  new SwXTextRange( *m_pPaM, xDummyTextRef );
2582 
2583  aTmp <<= xTextRg;
2584  xShapePropSet->setPropertyValue("TextRange", aTmp );
2585 
2586  // Set the Control-Model for the Control-Shape
2587  uno::Reference< drawing::XControlShape > xControlShape( xShape,
2588  uno::UNO_QUERY );
2589  uno::Reference< awt::XControlModel > xControlModel( rFComp,
2590  uno::UNO_QUERY );
2591  xControlShape->setControl( xControlModel );
2592 
2593  if (pShape)
2594  *pShape = xShape;
2595 
2596  return true;
2597 }
2598 
2599 /* 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:1917
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:4147
void SetStyleIndent(SwWW8StyInf &rStyle, const SwNumFormat &rFormat)
Definition: ww8par3.cxx:1710
Iterator for Booknotes.
Definition: ww8scan.hxx:750
std::unique_ptr< SwWW8FltControlStack > m_xCtrlStck
Definition: ww8par.hxx:1130
SVX_NUM_CHARS_UPPER_LETTER_N
OUString GetUniqueBookmarkName(const OUString &rSuggestedName)
Definition: ww8scan.cxx:4496
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:661
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:635
sal_Int32 m_lcbPlfLfo
Definition: ww8scan.hxx:1464
std::unique_ptr< WW8RStyle > m_xStyles
Definition: ww8par.hxx:1263
OUString msName
Definition: ww8par.hxx:684
SVX_NUM_CHARS_NEPALI
static bool IsEqualFormatting(const SwNumRule &rOne, const SwNumRule &rTwo)
Definition: ww8par3.cxx:1515
sal_uInt32 sal_UCS4
SwCharFormat * MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:854
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:234
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
bool bOverride
Definition: ww8par3.cxx:438
void SetAutoRule(bool bFlag)
Definition: numrule.hxx:230
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:4886
SVX_NUM_FULL_WIDTH_ARABIC
std::string GetValue
void UseListIndent(SwWW8StyInf &rStyle, const SwNumFormat &rFormat)
Definition: ww8par3.cxx:1695
static void lcl_AddToPropertyContainer(uno::Reference< beans::XPropertySet > const &xPropSet, const OUString &rPropertyName, const OUString &rValue)
Definition: ww8par3.cxx:2476
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:8497
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:1921
bool m_bHasStyNumRule
Definition: ww8par.hxx:256
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
sal_uInt8 mfType
Definition: ww8par.hxx:662
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:250
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
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.
SVX_NUM_CIRCLE_NUMBER
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
void SetContinusNum(bool bFlag)
Definition: numrule.hxx:236
sal_uInt16 m_nUniqueList
Definition: ww8par.hxx:175
void SetWeight(FontWeight)
OUString msEntryMcr
Definition: ww8par.hxx:676
SwCharFormat * WW8aCFormat[nMaxLevel]
Definition: ww8par.hxx:186
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:2128
OUString msDefault
Definition: ww8par.hxx:671
WW8_CP nLen
total length (to skip over text)
Definition: ww8scan.hxx:192
const OUString & GetName() const
Definition: numrule.hxx:224
SwWW8ImplReader & m_rReader
Definition: ww8par.hxx:169
sal_uInt16 GetPoolHelpId() const
Query and set Help-IDs for document styles.
Definition: numrule.hxx:254
OUString GetUniqueNumRuleName(const OUString *pChkStr=nullptr, bool bAutoNum=true) const
Definition: docnum.cxx:2551
sal_Int32 lcb
Definition: ww8struc.hxx:446
const SfxPoolItem * GetFormatAttr(sal_uInt16 nWhich)
Definition: ww8par6.cxx:2843
void SetCharSet(rtl_TextEncoding)
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1792
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
static constexpr sal_uInt16 val
Definition: sprmids.hxx:278
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:258
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
sal_uInt16 mhpsCheckBox
Definition: ww8par.hxx:665
bool IsRightToLeft()
Definition: ww8par6.cxx:4637
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:2074
void SetIndentAt(const tools::Long nIndentAt)
SvxNumType
void RegisterNumFormat(sal_uInt16 nCurrentLFO, sal_uInt8 nCurrentLevel)
Definition: ww8par3.cxx:1908
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:659
constexpr OUStringLiteral aListBox
Definition: ww8scan.hxx:50
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
SwDoc & m_rDoc
Definition: docbm.cxx:1201
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:1964
wwSprmParser maSprmParser
Definition: ww8par.hxx:168
SwNumRule * pNumRule
Definition: ww8par3.cxx:428
constexpr OUStringLiteral ODF_FORMDROPDOWN_RESULT
sal_uInt16 sal_Unicode
const SfxPoolItem * NextItem()
OUString msExitMcr
Definition: ww8par.hxx:677
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
const SwCharFormat * GetDfltCharFormat() const
Definition: doc.hxx:752
ErrCode GetError() const
std::vector< WW8LFOLVL > maOverrides
Definition: ww8par3.cxx:427
sal_uInt16 mnChecked
Definition: ww8par.hxx:666
std::vector< SwWW8StyInf > m_vColl
Definition: ww8par.hxx:1268
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:1083
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:442
std::unique_ptr< SfxItemSet > WW8aISet[nMaxLevel]
Definition: ww8par.hxx:184
sal_uInt16 m_nLastLFOPosition
Definition: ww8par.hxx:196
Ret writer_cast(Param in)
A static_cast style cast for conversion of word types to writer's.
SvStream & m_rSt
Definition: ww8par.hxx:172
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:1210
SVX_NUM_ROMAN_UPPER
void SetToolTip(const OUString &rStr)
Definition: expfld.cxx:1426
bool IsWW8BuiltInHeadingStyle() const
Definition: ww8par.hxx:336
SVX_NUM_ROMAN_LOWER
virtual parameter_map_t * GetParameters()=0
void SetHelp(const OUString &rStr)
Definition: expfld.cxx:1416
#define suppress_fun_call_w_exception(expr)
SVX_NUM_IROHA_FULLWIDTH_JA
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
Definition: hints.cxx:156
void SetUnderline(FontLineStyle)
void SetCountedInList(bool bCounted)
Definition: ndtxt.cxx:4262
void SetSelectedItem(const OUString &rItem)
Sets the selected item.
OUString msFormatting
Definition: ww8par.hxx:672
sal_uInt64 remainingSize()
eF_ResT
Definition: ww8par.hxx:618
sal_uInt8 mfUnused
Definition: ww8par.hxx:663
const char * sName
SVX_NUM_DI_ZI_ZH
sal_Int32 getTokenCount(std::string_view rIn, char cTok)
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:1920
WW8_CP nLCode
length
Definition: ww8scan.hxx:194
bool IsContinusNum() const
Definition: numrule.hxx:235
void SetStylesList(sal_uInt16 nStyle, sal_uInt16 nCurrentLFO, sal_uInt8 nCurrentLevel)
Definition: ww8par3.cxx:1729
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:2498
SVX_NUM_BITMAP
void SetNumAdjust(SvxAdjust eSet)
constexpr OUStringLiteral ODF_FORMDROPDOWN_LISTENTRY
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:6190
OUString msHelp
Definition: ww8par.hxx:674
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:1322
SvxAdjust
bool HasWW8OutlineLevel() const
Definition: ww8par.hxx:314
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:1126
void SetBulletFont(const vcl::Font *pFont)
sal_Int32 GetAbsLSpace() const
const SwPosition * GetPoint() const
Definition: pam.hxx:208
SwNumRuleType GetRuleType() const
Definition: numrule.hxx:211
void SetToggleAttrFlags(sal_uInt16 nFlags)
Definition: ww8par.cxx:585
std::unique_ptr< SfxItemSet > SetCurrentItemSet(std::unique_ptr< SfxItemSet > pItemSet)
Definition: ww8par.cxx:6743
SVX_NUM_CHARS_ARABIC_ABJAD
const vcl::Font & GetDefBulletFont()
retrieve font used for the default bullet list characters
Definition: number.cxx:1391
SVX_NUM_TEXT_NUMBER
sal_uInt8 mfToolTip
Definition: ww8par.hxx:660
SwFormat * m_pFormat
Definition: ww8par.hxx:232
OUString msTitle
Definition: ww8par.hxx:670
sal_uInt16 WW8aIdSty[WW8ListManager::nMaxLevel]
Definition: ww8par3.cxx:329
constexpr OUStringLiteral ODF_FORMTEXT
sal_uInt16 Count() const
void Read_ANLevelNo(sal_uInt16, const sal_uInt8 *pData, short nLen)
Definition: ww8par2.cxx:754
std::shared_ptr< SvxLRSpaceItem > maWordLR
Definition: ww8par.hxx:251
sal_uInt16 m_nLFOIndex
Definition: ww8par.hxx:238
void RegisterNumFormatOnStyle(sal_uInt16 nStyle)
Definition: ww8par3.cxx:1761
std::enable_if< std::is_signed< T >::value, bool >::type checked_add(T a, T b, T &result)
void ImplDestroy()
Definition: ww8par3.cxx:1483
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:2540
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:2408
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2834
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:2147
const Size & GetFontSize() const
void Restore(SwWW8ImplReader *pRdr)
Definition: ww8par.cxx:2037
const sal_uInt8 * pSprm
Definition: ww8scan.hxx:95
const sal_uInt16 LN_PAnld
Definition: sprmids.hxx:39
sal_uInt8 GetPoolHlpFileId() const
Definition: numrule.hxx:256
sal_uInt8 nLfoLvl
Definition: ww8par3.cxx:433
sal_uInt16 GetToggleAttrFlags() const
Definition: ww8par.cxx:575
SvStream & ReadUChar(unsigned char &rChar)
std::vector< std::unique_ptr< WW8LSTInfo > > maLSTInfos
Definition: ww8par.hxx:173
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:3575
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:669
std::vector< std::unique_ptr< WW8LFOInfo > > m_LFOInfos
Definition: ww8par.hxx:174
SVX_NUM_NUMBER_HANGUL_KO
std::vector< OUString > maListEntries
Definition: ww8par.hxx:678
void RegisterNumFormatOnTextNode(sal_uInt16 nCurrentLFO, sal_uInt8 nCurrentLevel, const bool bSetAttr=true)
Definition: ww8par3.cxx:1800
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:448
sal_Int32 GetRemLen() const
Definition: ww8scan.hxx:286
sal_uInt8 m_nListLevel
Definition: ww8par.hxx:239
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
SVX_NUM_NUMBER_UPPER_ZH_TW
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:86
constexpr OUStringLiteral ODF_FORMCHECKBOX_HELPTEXT
void SetToggleBiDiAttrFlags(sal_uInt16 nFlags)
Definition: ww8par.cxx:591
void SetStatus(sal_uInt16 nIndex, eBookStatus eStat)
Definition: ww8scan.cxx:4430
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:4110
void Set(sal_uInt16 i, const SwNumFormat *)
Definition: number.cxx:617
void SetStyleName(const OUString &rStyleName)
void SetCharFormat(SwCharFormat *)
Definition: number.cxx:280
void SyncIndentWithList(SvxLRSpaceItem &rLR, const SwNumFormat &rFormat, const bool bFirstLineOfstSet, const bool bLeftIndentSet)
Definition: ww8par.cxx:1245
#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:1065
SVX_NUM_NUMBER_LOWER_ZH
SwDoc & m_rDoc
Definition: ww8par.hxx:170
tools::Long GetTextHeight() const
sal_uInt16 nSprmId
Definition: ww8scan.hxx:858
OUString aName
SVX_NUM_NUMBER_UPPER_ZH
eF_ResT Read_F_OCX(WW8FieldDesc *, OUString &)
Definition: ww8par3.cxx:85
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:3556
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:2507
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:367
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
std::unique_ptr< WW8ListManager > m_xLstManager
Definition: ww8par.hxx:1255
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:1206
void Read_PicLoc(sal_uInt16, const sal_uInt8 *pData, short nLen)
Definition: ww8par6.cxx:2913
std::shared_ptr< WW8PLCFMan > m_xPlcxMan
Definition: ww8par.hxx:1257
sal_uInt16 GetToggleBiDiAttrFlags() const
Definition: ww8par.cxx:580
bool IsAbsSpaces() const
Definition: numrule.hxx:238
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
constexpr OUStringLiteral ODF_FORMCHECKBOX
std::vector< ww::bytes > maParaSprms
Definition: ww8par3.cxx:426
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
bool m_bValid
Definition: ww8par.hxx:252
SvStream * m_pDataStream
Definition: ww8par.hxx:1123
bool DelNumRule(const OUString &rName, bool bBroadCast=false)
Definition: docnum.cxx:1060
SVX_NUM_AIU_HALFWIDTH_JA
static OUString sanitizeString(const OUString &rString)
Definition: ww8par3.cxx:492
bool m_bColl
Definition: ww8par.hxx:254
OUString msToolTip
Definition: ww8par.hxx:675
constexpr OUStringLiteral aTextField
Definition: ww8scan.hxx:51
sal_uInt8 m_nListLevel
Definition: ww8par.hxx:1338
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:1312
virtual void SetChecked(bool checked)=0
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
Definition: ndtxt.cxx:5120
SwFormat * m_pCurrentColl
Definition: ww8par.hxx:1264
OUString read_uInt16_PascalString(SvStream &rStrm)
Definition: ww8scan.hxx:162
OUString GetBookmark(tools::Long nStart, tools::Long nEnd, sal_uInt16 &nIndex)
Definition: ww8scan.cxx:4462
SwCharFormat * WW8aCFormat[WW8ListManager::nMaxLevel]
Definition: ww8par3.cxx:331
void SetFirstLineIndent(const tools::Long nFirstLineIndent)
constexpr OUStringLiteral ODF_FORMCHECKBOX_NAME
const WW8Fib & m_rFib
Definition: ww8par.hxx:171
bool IsUseEnhancedFields() const
constexpr OUStringLiteral ODF_FORMDROPDOWN
SwPaM * m_pPaM
Definition: ww8par.hxx:1128
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
bool SetTextFormatCollAndListLevel(const SwPaM &rRg, SwWW8StyInf &rStyleInfo)
Definition: ww8par3.cxx:1661
void SetAttrListRestartValue(SwNumberTree::tSwNumTreeNumber nNum)
Definition: ndtxt.cxx:4190
sal_uInt16 Which() const
void SetListFormat(const OUString &rPrefix, const OUString &rSuffix, int nLevel)
bool IsOutlineRule() const
Definition: numrule.hxx:241
SVX_NUM_AIU_FULLWIDTH_JA
const SwNumRule * m_pChosenWW8OutlineStyle
Definition: ww8par.hxx:1337
SwWW8ImplReader & mrRdr
Definition: ww8par.hxx:645
sal_uInt16 nPos
const sal_uInt8 * GetSprms() const
Definition: ww8scan.hxx:282
const SfxPoolItem * GetCurItem() const
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1318
void SetListtabPos(const tools::Long nListtabPos)
sal_uInt16 m_nLFOPosition
Definition: ww8par.hxx:1324
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:864
SwNumRule * GetNumRuleForActivation(sal_uInt16 nLFOPosition, const sal_uInt8 nLevel, std::vector< sal_uInt8 > &rParaSprms, SwTextNode *pNode=nullptr)
Definition: ww8par3.cxx:1544
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1023
SprmResult GrpprlHasSprm(sal_uInt16 nId, sal_uInt8 &rSprms, sal_uInt8 nLen)
Definition: ww8par3.cxx:462
bool m_bDetectedRangeSegmentation false
css::awt::Size MiserableDropDownFormHack(const OUString &rString, css::uno::Reference< css::beans::XPropertySet > const &rPropSet)
Definition: ww8par3.cxx:2272
eF_ResT Read_F_HTMLControl(WW8FieldDesc *pF, OUString &rStr)
Definition: ww8par3.cxx:318
bool bLSTbUIDSet
Definition: ww8par3.cxx:442