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