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