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