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