LibreOffice Module sw (master)  1
number.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 <hintids.hxx>
22 
23 #include <vcl/font.hxx>
24 #include <editeng/brushitem.hxx>
25 #include <editeng/numitem.hxx>
26 #include <svl/grabbagitem.hxx>
27 #include <fmtornt.hxx>
28 #include <doc.hxx>
29 #include <charfmt.hxx>
30 #include <ndtxt.hxx>
31 #include <docary.hxx>
32 #include <SwStyleNameMapper.hxx>
33 
34 // Needed to load default bullet list configuration
35 #include <unotools/configmgr.hxx>
36 #include <unotools/configitem.hxx>
37 
38 #include <numrule.hxx>
39 #include <SwNodeNum.hxx>
40 
41 #include <list.hxx>
42 
43 #include <algorithm>
44 #include <unordered_map>
45 #include <libxml/xmlwriter.h>
46 
48 #include <unotools/saveopt.hxx>
49 #include <osl/diagnose.h>
50 
51 #include <IDocumentListsAccess.hxx>
53 #include <IDocumentState.hxx>
54 
55 #include <com/sun/star/beans/PropertyValue.hpp>
56 
57 using namespace ::com::sun::star;
58 
59 sal_uInt16 SwNumRule::mnRefCount = 0;
61  {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr } };
62 
64  {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr } };
65 
66 const sal_uInt16 SwNumRule::maDefNumIndents[ MAXLEVEL ] = {
67 //inch: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0
68  1440/4, 1440/2, 1440*3/4, 1440, 1440*5/4, 1440*3/2, 1440*7/4, 1440*2,
69  1440*9/4, 1440*5/2
70 };
71 
73 {
74  return "Outline";
75 }
76 
77 const SwNumFormat& SwNumRule::Get( sal_uInt16 i ) const
78 {
79  assert( i < MAXLEVEL && meRuleType < RULE_END );
80  return maFormats[ i ]
81  ? *maFormats[ i ]
83  ? *maBaseFormats[ meRuleType ][ i ]
85 }
86 
87 const SwNumFormat* SwNumRule::GetNumFormat( sal_uInt16 i ) const
88 {
89  const SwNumFormat * pResult = nullptr;
90 
91  assert( i < MAXLEVEL && meRuleType < RULE_END );
92  if ( i < MAXLEVEL && meRuleType < RULE_END)
93  {
94  pResult = maFormats[ i ].get();
95  }
96 
97  return pResult;
98 }
99 
100 // #i91400#
101 void SwNumRule::SetName( const OUString & rName,
102  IDocumentListsAccess& rDocListAccess)
103 {
104  if ( msName != rName )
105  {
106  if (mpNumRuleMap)
107  {
108  mpNumRuleMap->erase(msName);
109  (*mpNumRuleMap)[rName] = this;
110 
111  if ( !GetDefaultListId().isEmpty() )
112  {
113  rDocListAccess.trackChangeOfListStyleName( msName, rName );
114  }
115  }
116 
117  msName = rName;
118  }
119 }
120 
122 {
123  rTextNodeList = maTextNodeList;
124 }
125 
126 SwNumRule::tTextNodeList::size_type SwNumRule::GetTextNodeListSize() const
127 {
128  return maTextNodeList.size();
129 }
130 
132 {
133  tTextNodeList::iterator aIter =
134  std::find( maTextNodeList.begin(), maTextNodeList.end(), &rTextNode );
135 
136  if ( aIter == maTextNodeList.end() )
137  {
138  maTextNodeList.push_back( &rTextNode );
139  }
140 }
141 
143 {
144  tTextNodeList::iterator aIter =
145  std::find( maTextNodeList.begin(), maTextNodeList.end(), &rTextNode );
146 
147  if ( aIter != maTextNodeList.end() )
148  {
149  maTextNodeList.erase( aIter );
150  }
151 }
152 
153 void SwNumRule::SetNumRuleMap(std::unordered_map<OUString, SwNumRule *> *
154  pNumRuleMap)
155 {
156  mpNumRuleMap = pNumRuleMap;
157 }
158 
160 {
161  OSL_ENSURE( MAXLEVEL > nLvl, "NumLevel is out of range" );
162  return maDefNumIndents[ nLvl ];
163 }
164 
166 {
167  OSL_ENSURE( MAXLEVEL > nLvl, "NumLevel is out of range" );
168  return maDefNumIndents[ nLvl ];
169 }
170 
171 static void lcl_SetRuleChgd( SwTextNode& rNd, sal_uInt8 nLevel )
172 {
173  if( rNd.GetActualListLevel() == nLevel )
174  rNd.NumRuleChgd();
175 }
176 
179  SwClient( nullptr ),
180  m_pVertOrient(new SwFormatVertOrient( 0, text::VertOrientation::NONE))
181  ,m_cGrfBulletCP(USHRT_MAX)//For i120928,record the cp info of graphic within bullet
182 {
183 }
184 
186  SvxNumberFormat(rFormat),
187  SwClient( rFormat.GetRegisteredInNonConst() ),
188  m_pVertOrient(new SwFormatVertOrient( 0, rFormat.GetVertOrient()))
189  ,m_cGrfBulletCP(rFormat.m_cGrfBulletCP)//For i120928,record the cp info of graphic within bullet
190 {
191  sal_Int16 eMyVertOrient = rFormat.GetVertOrient();
192  SetGraphicBrush( rFormat.GetBrush(), &rFormat.GetGraphicSize(),
193  &eMyVertOrient);
194 }
195 
197  : SvxNumberFormat(rNumFormat)
198  , m_pVertOrient(new SwFormatVertOrient( 0, rNumFormat.GetVertOrient()))
199  , m_cGrfBulletCP(USHRT_MAX)
200 {
201  sal_Int16 eMyVertOrient = rNumFormat.GetVertOrient();
202  SetGraphicBrush( rNumFormat.GetBrush(), &rNumFormat.GetGraphicSize(),
203  &eMyVertOrient);
204  const OUString rCharStyleName = rNumFormat.SvxNumberFormat::GetCharFormatName();
205  if( !rCharStyleName.isEmpty() )
206  {
207  SwCharFormat* pCFormat = pDoc->FindCharFormatByName( rCharStyleName );
208  if( !pCFormat )
209  {
210  sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( rCharStyleName,
212  pCFormat = nId != USHRT_MAX
214  : pDoc->MakeCharFormat( rCharStyleName, nullptr );
215  }
216  pCFormat->Add( this );
217  }
218  else
219  EndListeningAll();
220 }
221 
223 {
224 }
225 
226 // #i22362#
228 {
229  // #i30655# native numbering did not work any longer
230  // using this code. Therefore HBRINKM and I agreed upon defining
231  // IsEnumeration() as !IsItemize()
232  return !IsItemize();
233 }
234 
236 {
237  bool bResult;
238 
239  switch(GetNumberingType())
240  {
242  case SVX_NUM_BITMAP:
243  bResult = true;
244 
245  break;
246 
247  default:
248  bResult = false;
249  }
250 
251  return bResult;
252 
253 }
254 
256 {
257  SvxNumberFormat::operator=(rNumFormat);
258  StartListeningToSameModifyAs(rNumFormat);
259  //For i120928,record the cp info of graphic within bullet
260  m_cGrfBulletCP = rNumFormat.m_cGrfBulletCP;
261  return *this;
262 }
263 
264 bool SwNumFormat::operator==( const SwNumFormat& rNumFormat) const
265 {
266  bool bRet = SvxNumberFormat::operator==(rNumFormat) &&
267  GetRegisteredIn() == rNumFormat.GetRegisteredIn();
268  return bRet;
269 }
270 
272 {
273  if( pChFormat )
274  pChFormat->Add( this );
275  else
276  EndListeningAll();
277 }
278 
279 void SwNumFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
280 {
281  // Look for the NumRules object in the Doc where this NumFormat is set.
282  // The format does not need to exist!
283  const SwCharFormat* pFormat = nullptr;
284  sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
285  switch( nWhich )
286  {
287  case RES_ATTRSET_CHG:
288  case RES_FMT_CHG:
289  pFormat = GetCharFormat();
290  break;
291  }
292 
293  if( pFormat && !pFormat->GetDoc()->IsInDtor() )
294  UpdateNumNodes( const_cast<SwDoc*>(pFormat->GetDoc()) );
295  else
296  CheckRegistration( pOld );
297 }
298 
300 {
301  if(static_cast<const SwCharFormat*>(GetRegisteredIn()))
302  return static_cast<const SwCharFormat*>(GetRegisteredIn())->GetName();
303 
304  return OUString();
305 }
306 
307 void SwNumFormat::SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize,
308  const sal_Int16* pOrient)
309 {
310  if(pOrient)
311  m_pVertOrient->SetVertOrient( *pOrient );
312  SvxNumberFormat::SetGraphicBrush( pBrushItem, pSize, pOrient);
313 }
314 
316 {
317  bool bDocIsModified = pDoc->getIDocumentState().IsModified();
318  bool bFnd = false;
319  for( SwNumRuleTable::size_type n = pDoc->GetNumRuleTable().size(); !bFnd && n; )
320  {
321  const SwNumRule* pRule = pDoc->GetNumRuleTable()[ --n ];
322  for( sal_uInt8 i = 0; i < MAXLEVEL; ++i )
323  if( pRule->GetNumFormat( i ) == this )
324  {
325  SwNumRule::tTextNodeList aTextNodeList;
326  pRule->GetTextNodeList( aTextNodeList );
327  for ( auto& rpTextNode : aTextNodeList )
328  {
329  lcl_SetRuleChgd( *rpTextNode, i );
330  }
331  bFnd = true;
332  break;
333  }
334  }
335 
336  if( bFnd && !bDocIsModified )
338 }
339 
341 {
342  sal_Int16 eOrient = SvxNumberFormat::GetVertOrient();
343  if(text::VertOrientation::NONE == eOrient)
344  return nullptr;
345  else
346  {
347  m_pVertOrient->SetVertOrient(eOrient);
348  return m_pVertOrient.get();
349  }
350 }
351 
352 SwNumRule::SwNumRule( const OUString& rNm,
353  const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode,
354  SwNumRuleType eType )
355  : maTextNodeList(),
356  maParagraphStyleList(),
357  mpNumRuleMap(nullptr),
358  msName( rNm ),
359  meRuleType( eType ),
360  mnPoolFormatId( USHRT_MAX ),
361  mnPoolHelpId( USHRT_MAX ),
362  mnPoolHlpFileId( UCHAR_MAX ),
363  mbAutoRuleFlag( true ),
364  mbInvalidRuleFlag( true ),
365  mbContinusNum( false ),
366  mbAbsSpaces( false ),
367  mbHidden( false ),
368  mbCountPhantoms( true ),
369  mbUsedByRedline( false ),
370  meDefaultNumberFormatPositionAndSpaceMode( eDefaultNumberFormatPositionAndSpaceMode ),
371  msDefaultListId()
372 {
373  if( !mnRefCount++ ) // for the first time, initialize
374  {
375  SwNumFormat* pFormat;
376  sal_uInt8 n;
377 
378  // numbering:
379  // position-and-space mode LABEL_WIDTH_AND_POSITION:
380  for( n = 0; n < MAXLEVEL; ++n )
381  {
382  pFormat = new SwNumFormat;
383  pFormat->SetIncludeUpperLevels( 1 );
384  pFormat->SetStart( 1 );
387  pFormat->SetSuffix( "." );
389  SwNumRule::maBaseFormats[ NUM_RULE ][ n ] = pFormat;
390  }
391  // position-and-space mode LABEL_ALIGNMENT
392  // first line indent of general numbering in inch: -0,25 inch
393  const long cFirstLineIndent = -1440/4;
394  // indent values of general numbering in inch:
395  // 0,5 0,75 1,0 1,25 1,5
396  // 1,75 2,0 2,25 2,5 2,75
397  const long cIndentAt[ MAXLEVEL ] = {
398  1440/2, 1440*3/4, 1440, 1440*5/4, 1440*3/2,
399  1440*7/4, 1440*2, 1440*9/4, 1440*5/2, 1440*11/4 };
400  for( n = 0; n < MAXLEVEL; ++n )
401  {
402  pFormat = new SwNumFormat;
403  pFormat->SetIncludeUpperLevels( 1 );
404  pFormat->SetStart( 1 );
407  pFormat->SetListtabPos( cIndentAt[ n ] );
408  pFormat->SetFirstLineIndent( cFirstLineIndent );
409  pFormat->SetIndentAt( cIndentAt[ n ] );
410  pFormat->SetSuffix( "." );
412  SwNumRule::maLabelAlignmentBaseFormats[ NUM_RULE ][ n ] = pFormat;
413  }
414 
415  // outline:
416  // position-and-space mode LABEL_WIDTH_AND_POSITION:
417  for( n = 0; n < MAXLEVEL; ++n )
418  {
419  pFormat = new SwNumFormat;
421  pFormat->SetIncludeUpperLevels( MAXLEVEL );
422  pFormat->SetStart( 1 );
425  SwNumRule::maBaseFormats[ OUTLINE_RULE ][ n ] = pFormat;
426  }
427  // position-and-space mode LABEL_ALIGNMENT:
428  for( n = 0; n < MAXLEVEL; ++n )
429  {
430  pFormat = new SwNumFormat;
432  pFormat->SetIncludeUpperLevels( MAXLEVEL );
433  pFormat->SetStart( 1 );
436  SwNumRule::maLabelAlignmentBaseFormats[ OUTLINE_RULE ][ n ] = pFormat;
437  }
438  }
439  OSL_ENSURE( !msName.isEmpty(), "NumRule without a name!" );
440 }
441 
442 SwNumRule::SwNumRule( const SwNumRule& rNumRule )
443  : maTextNodeList(),
444  maParagraphStyleList(),
445  mpNumRuleMap(nullptr),
446  msName( rNumRule.msName ),
447  meRuleType( rNumRule.meRuleType ),
448  mnPoolFormatId( rNumRule.GetPoolFormatId() ),
449  mnPoolHelpId( rNumRule.GetPoolHelpId() ),
450  mnPoolHlpFileId( rNumRule.GetPoolHlpFileId() ),
451  mbAutoRuleFlag( rNumRule.mbAutoRuleFlag ),
452  mbInvalidRuleFlag( true ),
453  mbContinusNum( rNumRule.mbContinusNum ),
454  mbAbsSpaces( rNumRule.mbAbsSpaces ),
455  mbHidden( rNumRule.mbHidden ),
456  mbCountPhantoms( true ),
457  mbUsedByRedline( false ),
458  meDefaultNumberFormatPositionAndSpaceMode( rNumRule.meDefaultNumberFormatPositionAndSpaceMode ),
459  msDefaultListId( rNumRule.msDefaultListId )
460 {
461  ++mnRefCount;
462  for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
463  if( rNumRule.maFormats[ n ] )
464  Set( n, *rNumRule.maFormats[ n ] );
465 }
466 
468 {
469  for (auto & i : maFormats)
470  i.reset();
471 
472  if (mpNumRuleMap)
473  {
474  mpNumRuleMap->erase(GetName());
475  }
476 
477  if( !--mnRefCount ) // the last one closes the door (?)
478  {
479  // Numbering:
480  SwNumFormat** ppFormats = &SwNumRule::maBaseFormats[0][0];
481  int n;
482 
483  for( n = 0; n < MAXLEVEL; ++n, ++ppFormats )
484  {
485  delete *ppFormats;
486  *ppFormats = nullptr;
487  }
488 
489  // Outline:
490  for( n = 0; n < MAXLEVEL; ++n, ++ppFormats )
491  {
492  delete *ppFormats;
493  *ppFormats = nullptr;
494  }
495 
496  ppFormats = &SwNumRule::maLabelAlignmentBaseFormats[0][0];
497  for( n = 0; n < MAXLEVEL; ++n, ++ppFormats )
498  {
499  delete *ppFormats;
500  *ppFormats = nullptr;
501  }
502  for( n = 0; n < MAXLEVEL; ++n, ++ppFormats )
503  {
504  delete *ppFormats;
505  *ppFormats = nullptr;
506  }
507  }
508 
509  maTextNodeList.clear();
510  maParagraphStyleList.clear();
511 }
512 
514 {
515  for(auto& rpNumFormat : maFormats)
516  {
517  SwCharFormat* pFormat;
518  if( rpNumFormat && nullptr != ( pFormat = rpNumFormat->GetCharFormat() ) &&
519  pFormat->GetDoc() != pDoc )
520  {
521  // copy
522  SwNumFormat* pNew = new SwNumFormat( *rpNumFormat );
523  pNew->SetCharFormat( pDoc->CopyCharFormat( *pFormat ) );
524  rpNumFormat.reset(pNew);
525  }
526  }
527 }
528 
530 {
531  if( this != &rNumRule )
532  {
533  for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
534  Set( n, rNumRule.maFormats[ n ].get() );
535 
536  meRuleType = rNumRule.meRuleType;
537  msName = rNumRule.msName;
538  mbAutoRuleFlag = rNumRule.mbAutoRuleFlag;
539  mbInvalidRuleFlag = true;
540  mbContinusNum = rNumRule.mbContinusNum;
541  mbAbsSpaces = rNumRule.mbAbsSpaces;
542  mbHidden = rNumRule.mbHidden;
543  mnPoolFormatId = rNumRule.GetPoolFormatId();
544  mnPoolHelpId = rNumRule.GetPoolHelpId();
545  mnPoolHlpFileId = rNumRule.GetPoolHlpFileId();
546  }
547  return *this;
548 }
549 
550 bool SwNumRule::operator==( const SwNumRule& rRule ) const
551 {
552  bool bRet = meRuleType == rRule.meRuleType &&
553  msName == rRule.msName &&
554  mbAutoRuleFlag == rRule.mbAutoRuleFlag &&
555  mbContinusNum == rRule.mbContinusNum &&
556  mbAbsSpaces == rRule.mbAbsSpaces &&
557  mnPoolFormatId == rRule.GetPoolFormatId() &&
558  mnPoolHelpId == rRule.GetPoolHelpId() &&
560  if( bRet )
561  {
562  for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
563  if( rRule.Get( n ) != Get( n ) )
564  {
565  bRet = false;
566  break;
567  }
568  }
569  return bRet;
570 }
571 
572 void SwNumRule::Set( sal_uInt16 i, const SwNumFormat& rNumFormat )
573 {
574  OSL_ENSURE( i < MAXLEVEL, "Serious defect" );
575  if( i < MAXLEVEL )
576  {
577  if( !maFormats[ i ] || (rNumFormat != Get( i )) )
578  {
579  maFormats[ i ].reset(new SwNumFormat( rNumFormat ));
580  mbInvalidRuleFlag = true;
581  }
582  }
583 }
584 
585 void SwNumRule::Set( sal_uInt16 i, const SwNumFormat* pNumFormat )
586 {
587  OSL_ENSURE( i < MAXLEVEL, "Serious defect" );
588  if( i >= MAXLEVEL )
589  return;
590  if( !maFormats[ i ] )
591  {
592  if( pNumFormat )
593  {
594  maFormats[ i ].reset(new SwNumFormat( *pNumFormat ));
595  mbInvalidRuleFlag = true;
596  }
597  }
598  else if( !pNumFormat )
599  {
600  maFormats[ i ].reset();
601  mbInvalidRuleFlag = true;
602  }
603  else if( *maFormats[i] != *pNumFormat )
604  {
605  *maFormats[ i ] = *pNumFormat;
606  mbInvalidRuleFlag = true;
607  }
608 }
609 
610 OUString SwNumRule::MakeNumString( const SwNodeNum& rNum, bool bInclStrings ) const
611 {
612  if (rNum.IsCounted())
613  return MakeNumString(rNum.GetNumberVector(), bInclStrings);
614 
615  return OUString();
616 }
617 
619  const bool bInclStrings,
620  const bool bOnlyArabic,
621  const unsigned int _nRestrictToThisLevel,
622  SwNumRule::Extremities* pExtremities,
623  LanguageType nLang ) const
624 {
625  OUStringBuffer aStr;
626 
627  SwNumberTree::tNumberVector::size_type nLevel = rNumVector.size() - 1;
628 
629  if ( pExtremities )
630  pExtremities->nPrefixChars = pExtremities->nSuffixChars = 0;
631 
632  if ( nLevel > _nRestrictToThisLevel )
633  {
634  nLevel = _nRestrictToThisLevel;
635  }
636 
637  if (nLevel < MAXLEVEL)
638  {
639  const SwNumFormat& rMyNFormat = Get( static_cast<sal_uInt16>(nLevel) );
640 
641  {
642  SwNumberTree::tNumberVector::size_type i = nLevel;
643 
644  if( !IsContinusNum() &&
645  // - do not include upper levels, if level isn't numbered.
646  rMyNFormat.GetNumberingType() != SVX_NUM_NUMBER_NONE &&
647  rMyNFormat.GetIncludeUpperLevels() ) // Just the own level?
648  {
649  sal_uInt8 n = rMyNFormat.GetIncludeUpperLevels();
650  if( 1 < n )
651  {
652  if( i+1 >= n )
653  i -= n - 1;
654  else
655  i = 0;
656  }
657  }
658 
659  css::lang::Locale aLocale( LanguageTag::convertToLocale(nLang));
660 
661  for( ; i <= nLevel; ++i )
662  {
663  const SwNumFormat& rNFormat = Get( i );
664  if( SVX_NUM_NUMBER_NONE == rNFormat.GetNumberingType() )
665  {
666  // Should 1.1.1 --> 2. NoNum --> 1..1 or 1.1 ??
667  // if( i != rNum.nMyLevel )
668  // aStr += ".";
669  continue;
670  }
671 
672  if( rNumVector[ i ] )
673  {
674  if( bOnlyArabic )
675  aStr.append(OUString::number( rNumVector[ i ] ));
676  else
677  aStr.append(rNFormat.GetNumStr( rNumVector[ i ], aLocale ));
678  }
679  else
680  aStr.append("0"); // all 0 level are a 0
681  if( i != nLevel && !aStr.isEmpty() )
682  aStr.append(".");
683  }
684 
685  // The type doesn't have any number, so don't append
686  // the post-/prefix string
687  if( bInclStrings && !bOnlyArabic &&
688  SVX_NUM_CHAR_SPECIAL != rMyNFormat.GetNumberingType() &&
689  SVX_NUM_BITMAP != rMyNFormat.GetNumberingType() )
690  {
691  const OUString& sPrefix = rMyNFormat.GetPrefix();
692  const OUString& sSuffix = rMyNFormat.GetSuffix();
693 
694  aStr.insert(0, sPrefix);
695  aStr.append(sSuffix);
696  if ( pExtremities )
697  {
698  pExtremities->nPrefixChars = sPrefix.getLength();
699  pExtremities->nSuffixChars = sSuffix.getLength();
700  }
701  }
702  }
703  }
704 
705  return aStr.makeStringAndClear();
706 }
707 
708 OUString SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum,
709  const bool bInclSuperiorNumLabels,
710  const int nRestrictInclToThisLevel ) const
711 {
712  OUString aRefNumStr;
713 
714  if ( rNodeNum.GetLevelInListTree() >= 0 )
715  {
716  bool bOldHadPrefix = true;
717 
718  const SwNodeNum* pWorkingNodeNum( &rNodeNum );
719  do
720  {
721  bool bMakeNumStringForPhantom( false );
722  if ( pWorkingNodeNum->IsPhantom() )
723  {
724  int nListLevel = pWorkingNodeNum->GetLevelInListTree();
725 
726  if (nListLevel < 0)
727  nListLevel = 0;
728 
729  if (nListLevel >= MAXLEVEL)
730  nListLevel = MAXLEVEL - 1;
731 
732  SwNumFormat aFormat( Get( static_cast<sal_uInt16>(nListLevel) ) );
733  bMakeNumStringForPhantom = aFormat.IsEnumeration() &&
735 
736  }
737  if ( bMakeNumStringForPhantom ||
738  ( !pWorkingNodeNum->IsPhantom() &&
739  pWorkingNodeNum->GetTextNode() &&
740  pWorkingNodeNum->GetTextNode()->HasNumber() ) )
741  {
742  Extremities aExtremities;
743  OUString aPrevStr = MakeNumString( pWorkingNodeNum->GetNumberVector(),
744  true, false, MAXLEVEL,
745  &aExtremities);
746  sal_Int32 nStrip = 0;
747  while ( nStrip < aExtremities.nPrefixChars )
748  {
749  const sal_Unicode c = aPrevStr[nStrip];
750  if ( c!='\t' && c!=' ')
751  break;
752  ++nStrip;
753  }
754 
755  if (nStrip)
756  {
757  aPrevStr = aPrevStr.copy( nStrip );
758  aExtremities.nPrefixChars -= nStrip;
759  }
760 
761  if (bOldHadPrefix &&
762  aExtremities.nSuffixChars &&
763  !aExtremities.nPrefixChars
764  )
765  {
766  aPrevStr = aPrevStr.copy(0,
767  aPrevStr.getLength() - aExtremities.nSuffixChars);
768  }
769 
770  bOldHadPrefix = ( aExtremities.nPrefixChars > 0);
771 
772  aRefNumStr = aPrevStr + aRefNumStr;
773  }
774 
775  if ( bInclSuperiorNumLabels && pWorkingNodeNum->GetLevelInListTree() > 0 )
776  {
777  sal_uInt8 n = Get( static_cast<sal_uInt16>(pWorkingNodeNum->GetLevelInListTree()) ).GetIncludeUpperLevels();
778  pWorkingNodeNum = dynamic_cast<SwNodeNum*>(pWorkingNodeNum->GetParent());
779  // skip parents, whose list label is already contained in the actual list label.
780  while ( pWorkingNodeNum && n > 1 )
781  {
782  pWorkingNodeNum = dynamic_cast<SwNodeNum*>(pWorkingNodeNum->GetParent());
783  --n;
784  }
785  }
786  else
787  {
788  break;
789  }
790  } while ( pWorkingNodeNum &&
791  pWorkingNodeNum->GetLevelInListTree() >= 0 &&
792  pWorkingNodeNum->GetLevelInListTree() >= nRestrictInclToThisLevel );
793  }
794 
795  return aRefNumStr;
796 }
797 
804 {
805  for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
806  {
807  Set( n, rNumRule.maFormats[ n ].get() );
808  if( maFormats[ n ] && maFormats[ n ]->GetCharFormat() &&
809  !pDoc->GetCharFormats()->IsAlive(maFormats[n]->GetCharFormat()))
810  {
811  // If we copy across different Documents, then copy the
812  // corresponding CharFormat into the new Document.
813  maFormats[n]->SetCharFormat( pDoc->CopyCharFormat( *maFormats[n]->
814  GetCharFormat() ) );
815  }
816  }
817  meRuleType = rNumRule.meRuleType;
818  msName = rNumRule.msName;
819  mbAutoRuleFlag = rNumRule.mbAutoRuleFlag;
820  mnPoolFormatId = rNumRule.GetPoolFormatId();
821  mnPoolHelpId = rNumRule.GetPoolHelpId();
822  mnPoolHlpFileId = rNumRule.GetPoolHlpFileId();
823  mbInvalidRuleFlag = true;
824  return *this;
825 }
826 
827 void SwNumRule::SetSvxRule(const SvxNumRule& rNumRule, SwDoc* pDoc)
828 {
829  for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
830  {
831  const SvxNumberFormat* pSvxFormat = rNumRule.Get(n);
832  maFormats[n].reset( pSvxFormat ? new SwNumFormat(*pSvxFormat, pDoc) : nullptr );
833  }
834 
835  mbInvalidRuleFlag = true;
837 }
838 
840 {
841  SvxNumRule aRule(SvxNumRuleFlags::CONTINUOUS | SvxNumRuleFlags::CHAR_STYLE |
842  SvxNumRuleFlags::ENABLE_LINKED_BMP | SvxNumRuleFlags::ENABLE_EMBEDDED_BMP,
844  meRuleType == NUM_RULE ? SvxNumRuleType::NUMBERING : SvxNumRuleType::OUTLINE_NUMBERING );
845  for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
846  {
847  SwNumFormat aNumFormat = Get(n);
848  if(aNumFormat.GetCharFormat())
849  aNumFormat.SetCharFormatName(aNumFormat.GetCharFormat()->GetName());
850  aRule.SetLevel(n, aNumFormat, maFormats[n] != nullptr);
851  }
852  return aRule;
853 }
854 
856 {
857  if (bFlag)
858  {
859  std::set< SwList* > aLists;
860  for ( const SwTextNode* pTextNode : maTextNodeList )
861  {
862  // #i111681# - applying patch from cmc
863  SwList* pList = pTextNode->GetDoc()->getIDocumentListsAccess().getListByName( pTextNode->GetListId() );
864  OSL_ENSURE( pList, "<SwNumRule::SetInvalidRule(..)> - list at which the text node is registered at does not exist. This is a serious issue.");
865  if ( pList )
866  {
867  aLists.insert( pList );
868  }
869  }
870  for ( auto aList : aLists )
871  aList->InvalidateListTree();
872  }
873 
874  mbInvalidRuleFlag = bFlag;
875 }
876 
878 void SwNumRule::ChangeIndent( const sal_Int32 nDiff )
879 {
880  for ( sal_uInt16 i = 0; i < MAXLEVEL; ++i )
881  {
882  SwNumFormat aTmpNumFormat( Get(i) );
883 
884  const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
885  aTmpNumFormat.GetPositionAndSpaceMode() );
886  if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
887  {
888  auto nNewIndent = nDiff +
889  aTmpNumFormat.GetAbsLSpace();
890  if ( nNewIndent < 0 )
891  {
892  nNewIndent = 0;
893  }
894  aTmpNumFormat.SetAbsLSpace( nNewIndent );
895  }
896  else if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
897  {
898  // adjust also the list tab position, if a list tab stop is applied
899  if ( aTmpNumFormat.GetLabelFollowedBy() == SvxNumberFormat::LISTTAB )
900  {
901  const long nNewListTab = aTmpNumFormat.GetListtabPos() + nDiff;
902  aTmpNumFormat.SetListtabPos( nNewListTab );
903  }
904 
905  const long nNewIndent = nDiff +
906  aTmpNumFormat.GetIndentAt();
907  aTmpNumFormat.SetIndentAt( nNewIndent );
908  }
909 
910  Set( i, aTmpNumFormat );
911  }
912 
913  SetInvalidRule( true );
914 }
915 
917 void SwNumRule::SetIndent( const short nNewIndent,
918  const sal_uInt16 nListLevel )
919 {
920  SwNumFormat aTmpNumFormat( Get(nListLevel) );
921 
922  const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
923  aTmpNumFormat.GetPositionAndSpaceMode() );
924  if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
925  {
926  aTmpNumFormat.SetAbsLSpace( nNewIndent );
927  }
928  else if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
929  {
930  // adjust also the list tab position, if a list tab stop is applied
931  if ( aTmpNumFormat.GetLabelFollowedBy() == SvxNumberFormat::LISTTAB )
932  {
933  const long nNewListTab = aTmpNumFormat.GetListtabPos() +
934  ( nNewIndent - aTmpNumFormat.GetIndentAt() );
935  aTmpNumFormat.SetListtabPos( nNewListTab );
936  }
937 
938  aTmpNumFormat.SetIndentAt( nNewIndent );
939  }
940 
941  SetInvalidRule( true );
942 }
943 
947 {
948  SwNumFormat aTmpNumFormat( Get(0) );
949 
950  sal_Int32 nDiff( 0 );
951  const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
952  aTmpNumFormat.GetPositionAndSpaceMode() );
953  if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
954  {
955  nDiff = nNewIndent
956  - aTmpNumFormat.GetFirstLineOffset()
957  - aTmpNumFormat.GetAbsLSpace();
958  }
959  else if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
960  {
961  nDiff = nNewIndent - aTmpNumFormat.GetIndentAt();
962  }
963  if ( nDiff != 0 )
964  {
965  ChangeIndent( nDiff );
966  }
967 }
968 
970 {
971  std::set< SwList* > aLists;
972  for ( const SwTextNode* pTextNode : maTextNodeList )
973  {
974  aLists.insert( pTextNode->GetDoc()->getIDocumentListsAccess().getListByName( pTextNode->GetListId() ) );
975  }
976  for ( auto aList : aLists )
977  aList->ValidateListTree();
978 
979  SetInvalidRule(false);
980 }
981 
982 void SwNumRule::SetCountPhantoms(bool bCountPhantoms)
983 {
984  mbCountPhantoms = bCountPhantoms;
985 }
986 
987 SwNumRule::tParagraphStyleList::size_type SwNumRule::GetParagraphStyleListSize() const
988 {
989  return maParagraphStyleList.size();
990 }
991 
993 {
994  tParagraphStyleList::iterator aIter =
995  std::find( maParagraphStyleList.begin(), maParagraphStyleList.end(), &rTextFormatColl );
996 
997  if ( aIter == maParagraphStyleList.end() )
998  {
999  maParagraphStyleList.push_back( &rTextFormatColl );
1000  }
1001 }
1002 
1004 {
1005  tParagraphStyleList::iterator aIter =
1006  std::find( maParagraphStyleList.begin(), maParagraphStyleList.end(), &rTextFormatColl );
1007 
1008  if ( aIter != maParagraphStyleList.end() )
1009  {
1010  maParagraphStyleList.erase( aIter );
1011  }
1012 }
1013 
1015 {
1016  xmlTextWriterStartElement(pWriter, BAD_CAST("SwNumRule"));
1017  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("msName"), BAD_CAST(msName.toUtf8().getStr()));
1018  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("mnPoolFormatId"), BAD_CAST(OString::number(mnPoolFormatId).getStr()));
1019  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("mbAutoRuleFlag"), BAD_CAST(OString::boolean(mbAutoRuleFlag).getStr()));
1020  xmlTextWriterEndElement(pWriter);
1021 }
1022 
1024 {
1025  if (mpGrabBagItem.get())
1026  mpGrabBagItem->QueryValue(rVal);
1027  else
1028  rVal <<= uno::Sequence<beans::PropertyValue>();
1029 }
1030 
1032 {
1033  if (!mpGrabBagItem.get())
1034  mpGrabBagItem.reset(new SfxGrabBagItem);
1035 
1036  mpGrabBagItem->PutValue(rVal, 0);
1037 }
1038 
1039 namespace numfunc
1040 {
1043  {
1044  public:
1045  static SwDefBulletConfig& getInstance();
1046 
1047  const OUString& GetFontname() const
1048  {
1049  return msFontname;
1050  }
1051 
1053  {
1054  return mbUserDefinedFontname;
1055  }
1056 
1057  const vcl::Font& GetFont() const
1058  {
1059  return *mpFont;
1060  }
1061 
1062  sal_Unicode GetChar( sal_uInt8 p_nListLevel ) const
1063  {
1064  if (p_nListLevel >= MAXLEVEL)
1065  {
1066  p_nListLevel = MAXLEVEL - 1;
1067  }
1068 
1069  return mnLevelChars[p_nListLevel];
1070  }
1071 
1073 
1074  private:
1076  void SetToDefault();
1077 
1079  static uno::Sequence<OUString> GetPropNames();
1080 
1083  void LoadConfig();
1084 
1086  void InitFont();
1087 
1089  virtual void Notify( const uno::Sequence<OUString>& aPropertyNames ) override;
1090  virtual void ImplCommit() override;
1091 
1092  // default bullet list configuration data
1093  OUString msFontname;
1098 
1099  // default bullet list font instance
1100  std::unique_ptr<vcl::Font> mpFont;
1101  };
1102 
1103  namespace
1104  {
1105  class theSwDefBulletConfig
1106  : public rtl::Static<SwDefBulletConfig, theSwDefBulletConfig>{};
1107  }
1108 
1110  {
1111  return theSwDefBulletConfig::get();
1112  }
1113 
1115  : ConfigItem( "Office.Writer/Numbering/DefaultBulletList" ),
1116  // default bullet font is now OpenSymbol
1117  msFontname( OUString("OpenSymbol") ),
1118  mbUserDefinedFontname( false ),
1119  meFontWeight( WEIGHT_DONTKNOW ),
1120  meFontItalic( ITALIC_NONE )
1121  {
1122  SetToDefault();
1123  LoadConfig();
1124  InitFont();
1125 
1126  // enable notification for changes on default bullet configuration change
1128  }
1129 
1131  {
1132  msFontname = "OpenSymbol";
1133  mbUserDefinedFontname = false;
1136 
1137  mnLevelChars[0] = 0x2022;
1138  mnLevelChars[1] = 0x25e6;
1139  mnLevelChars[2] = 0x25aa;
1140  mnLevelChars[3] = 0x2022;
1141  mnLevelChars[4] = 0x25e6;
1142  mnLevelChars[5] = 0x25aa;
1143  mnLevelChars[6] = 0x2022;
1144  mnLevelChars[7] = 0x25e6;
1145  mnLevelChars[8] = 0x25aa;
1146  mnLevelChars[9] = 0x2022;
1147  }
1148 
1149  uno::Sequence<OUString> SwDefBulletConfig::GetPropNames()
1150  {
1151  uno::Sequence<OUString> aPropNames(13);
1152  OUString* pNames = aPropNames.getArray();
1153  pNames[0] = "BulletFont/FontFamilyname";
1154  pNames[1] = "BulletFont/FontWeight";
1155  pNames[2] = "BulletFont/FontItalic";
1156  pNames[3] = "BulletCharLvl1";
1157  pNames[4] = "BulletCharLvl2";
1158  pNames[5] = "BulletCharLvl3";
1159  pNames[6] = "BulletCharLvl4";
1160  pNames[7] = "BulletCharLvl5";
1161  pNames[8] = "BulletCharLvl6";
1162  pNames[9] = "BulletCharLvl7";
1163  pNames[10] = "BulletCharLvl8";
1164  pNames[11] = "BulletCharLvl9";
1165  pNames[12] = "BulletCharLvl10";
1166 
1167  return aPropNames;
1168  }
1169 
1171  {
1172  uno::Sequence<OUString> aPropNames = GetPropNames();
1173  uno::Sequence<uno::Any> aValues =
1174  GetProperties( aPropNames );
1175  const uno::Any* pValues = aValues.getConstArray();
1176  OSL_ENSURE( aValues.getLength() == aPropNames.getLength(),
1177  "<SwDefBulletConfig::SwDefBulletConfig()> - GetProperties failed");
1178  if ( aValues.getLength() == aPropNames.getLength() )
1179  {
1180  for ( int nProp = 0; nProp < aPropNames.getLength(); ++nProp )
1181  {
1182  if ( pValues[nProp].hasValue() )
1183  {
1184  switch ( nProp )
1185  {
1186  case 0:
1187  {
1188  OUString aStr;
1189  pValues[nProp] >>= aStr;
1190  msFontname = aStr;
1191  mbUserDefinedFontname = true;
1192  }
1193  break;
1194  case 1:
1195  case 2:
1196  {
1197  sal_Int16 nTmp = 0;
1198  pValues[nProp] >>= nTmp;
1199  if ( nProp == 1 )
1200  meFontWeight = static_cast<FontWeight>(nTmp);
1201  else if ( nProp == 2 )
1202  meFontItalic = static_cast<FontItalic>(nTmp);
1203  }
1204  break;
1205  case 3:
1206  case 4:
1207  case 5:
1208  case 6:
1209  case 7:
1210  case 8:
1211  case 9:
1212  case 10:
1213  case 11:
1214  case 12:
1215  {
1216  sal_Unicode cChar = sal_Unicode();
1217  pValues[nProp] >>= cChar;
1218  mnLevelChars[nProp-3] = cChar;
1219  }
1220  break;
1221  }
1222  }
1223  }
1224  }
1225 
1226  }
1227 
1229  {
1230  mpFont.reset( new vcl::Font( msFontname, OUString(), Size( 0, 14 ) ) );
1231  mpFont->SetWeight( meFontWeight );
1232  mpFont->SetItalic( meFontItalic );
1233  mpFont->SetCharSet( RTL_TEXTENCODING_SYMBOL );
1234  }
1235 
1236  void SwDefBulletConfig::Notify( const uno::Sequence<OUString>& )
1237  {
1238  SetToDefault();
1239  LoadConfig();
1240  InitFont();
1241  }
1242 
1244  {
1245  }
1246 
1247  OUString const & GetDefBulletFontname()
1248  {
1250  }
1251 
1253  {
1255  }
1256 
1258  {
1260  }
1261 
1263  {
1264  return SwDefBulletConfig::getInstance().GetChar( nLevel );
1265  }
1266 
1273  {
1274  public:
1276 
1278  {
1280  }
1281 
1283 
1284  private:
1285 
1287  void SetToDefault();
1288 
1290  static css::uno::Sequence<OUString> GetPropNames();
1291 
1293  void LoadConfig();
1294 
1296  virtual void Notify( const css::uno::Sequence<OUString>& aPropertyNames ) override;
1297  virtual void ImplCommit() override;
1298 
1299  // configuration data
1301  };
1302 
1303  namespace
1304  {
1305  class theSwNumberingUIBehaviorConfig : public rtl::Static<SwNumberingUIBehaviorConfig, theSwNumberingUIBehaviorConfig>{};
1306  }
1307 
1309  {
1311  }
1312 
1314  : ConfigItem( "Office.Writer/Numbering/UserInterfaceBehavior" ),
1315  mbChangeIndentOnTabAtFirstPosOfFirstListItem( true )
1316  {
1317  SetToDefault();
1318  LoadConfig();
1319 
1320  // enable notification for changes on configuration change
1322  }
1323 
1325  {
1327  }
1328 
1329  css::uno::Sequence<OUString> SwNumberingUIBehaviorConfig::GetPropNames()
1330  {
1331  css::uno::Sequence<OUString> aPropNames { "ChangeIndentOnTabAtFirstPosOfFirstListItem" };
1332 
1333  return aPropNames;
1334  }
1335 
1337 
1339  {
1340  css::uno::Sequence<OUString> aPropNames = GetPropNames();
1341  css::uno::Sequence<css::uno::Any> aValues = GetProperties( aPropNames );
1342  const css::uno::Any* pValues = aValues.getConstArray();
1343  OSL_ENSURE( aValues.getLength() == aPropNames.getLength(),
1344  "<SwNumberingUIBehaviorConfig::LoadConfig()> - GetProperties failed");
1345  if ( aValues.getLength() == aPropNames.getLength() )
1346  {
1347  for ( int nProp = 0; nProp < aPropNames.getLength(); ++nProp )
1348  {
1349  if ( pValues[nProp].hasValue() )
1350  {
1351  switch ( nProp )
1352  {
1353  case 0:
1354  {
1356  }
1357  break;
1358  default:
1359  {
1360  OSL_FAIL( "<SwNumberingUIBehaviorConfig::LoadConfig()> - unknown configuration property");
1361  }
1362  }
1363  }
1364  }
1365  }
1366  }
1367 
1368  void SwNumberingUIBehaviorConfig::Notify( const css::uno::Sequence<OUString>& )
1369  {
1370  SetToDefault();
1371  LoadConfig();
1372  }
1373 
1375  {
1377  }
1378 
1380  {
1383 
1385  SvtSaveOptions aSaveOptions;
1386  switch ( aSaveOptions.GetODFDefaultVersion() )
1387  {
1390  {
1391  ePosAndSpaceMode = SvxNumberFormat::LABEL_WIDTH_AND_POSITION;
1392  }
1393  break;
1394  default: // ODFVER_UNKNOWN or ODFVER_012
1395  {
1396  ePosAndSpaceMode = SvxNumberFormat::LABEL_ALIGNMENT;
1397  }
1398  }
1399 
1400  return ePosAndSpaceMode;
1401  }
1402 }
1403 
1405 {
1406  xmlTextWriterStartElement(pWriter, BAD_CAST("SwNumRuleTable"));
1407  for (SwNumRule* pNumRule : *this)
1408  pNumRule->dumpAsXml(pWriter);
1409  xmlTextWriterEndElement(pWriter);
1410 }
1411 
1412 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
virtual SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)=0
SvxNumberFormat & operator=(const SvxNumberFormat &)
OUString GetNumStr(sal_Int32 nNo) const
SvxNumType GetNumberingType() const
sal_Unicode mnLevelChars[MAXLEVEL]
Definition: number.cxx:1097
void AddParagraphStyle(SwTextFormatColl &rTextFormatColl)
Definition: number.cxx:992
virtual void Notify(const uno::Sequence< OUString > &aPropertyNames) override
catches notification about changed default bullet configuration data
Definition: number.cxx:1236
sal_uInt16 mnPoolHelpId
HelpId for this Pool-style.
Definition: numrule.hxx:128
void SetLabelFollowedBy(const LabelFollowedBy eLabelFollowedBy)
bool mbHidden
Is the numbering rule to be hidden in the UI?
Definition: numrule.hxx:134
void Add(SwClient *pDepend)
Definition: calbck.cxx:217
Represents the style of a paragraph.
Definition: fmtcol.hxx:55
SwNumFormat & operator=(const SwNumFormat &)
Definition: number.cxx:255
static sal_uInt16 GetBullIndent(sal_uInt8 nLvl)
Definition: number.cxx:165
static void lcl_SetRuleChgd(SwTextNode &rNd, sal_uInt8 nLevel)
Definition: number.cxx:171
virtual void trackChangeOfListStyleName(const OUString &rListStyleName, const OUString &rNewListStyleName)=0
OUString MakeRefNumString(const SwNodeNum &rNodeNum, const bool bInclSuperiorNumLabels, const int nRestrictInclToThisLevel) const
Definition: number.cxx:708
bool ChangeIndentOnTabAtFirstPosOfFirstListItem() const
Definition: number.cxx:1277
#define RES_ATTRSET_CHG
Definition: hintids.hxx:287
OUString MakeNumString(const SwNodeNum &, bool bInclStrings=true) const
Definition: number.cxx:610
SwCharFormat * MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:835
const SwNumFormat * GetNumFormat(sal_uInt16 i) const
Definition: number.cxx:87
void SetPositionAndSpaceMode(SvxNumPositionAndSpaceMode ePositionAndSpaceMode)
const SvxBrushItem * GetBrush() const
SVX_NUM_NUMBER_NONE
static SwDefBulletConfig & getInstance()
Definition: number.cxx:1109
void AddTextNode(SwTextNode &rTextNode)
Definition: number.cxx:131
static SwNumberingUIBehaviorConfig & getInstance()
Definition: number.cxx:1308
SwNumberTreeNode * GetParent() const
Returns the parent of this node.
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat IDs.
Definition: numrule.hxx:247
const OUString & GetDefaultListId() const
Definition: numrule.hxx:191
Definition: list.hxx:35
void GetGrabBagItem(css::uno::Any &rVal) const
Definition: number.cxx:1023
Definition: doc.hxx:185
const SvxNumberFormat * Get(sal_uInt16 nLevel) const
void RemoveParagraphStyle(SwTextFormatColl &rTextFormatColl)
Definition: number.cxx:1003
sal_uInt8 mnPoolHlpFileId
FilePos at Doc on style helps.
Definition: numrule.hxx:129
sal_Int16 nId
sal_uInt8 GetIncludeUpperLevels() const
SwNumRuleType
Definition: numrule.hxx:91
virtual bool IsCounted() const override
Return if this node is counted.
Definition: SwNodeNum.cxx:169
const OUString & GetName() const
Definition: numrule.hxx:221
sal_uInt16 GetPoolHelpId() const
Query and set Help-IDs for document styles.
Definition: numrule.hxx:251
SwNumberTree::tNumberVector GetNumberVector() const
Returns level numbers of this node.
class containing configuration data about user interface behavior regarding lists and list items...
Definition: number.cxx:1272
bool operator==(const SwNumRule &) const
Definition: number.cxx:550
void SetIncludeUpperLevels(sal_uInt8 nSet)
bool HasNumber() const
Returns if this text node has a number.
Definition: ndtxt.cxx:3092
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: number.cxx:1404
bool mbInvalidRuleFlag
Definition: numrule.hxx:131
SwTextNode * GetTextNode() const
Definition: SwNodeNum.hxx:41
bool operator==(const SwNumFormat &) const
Definition: number.cxx:264
int GetActualListLevel() const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4094
int GetLevelInListTree() const
Return level of this node.
static LanguageType nLang
Definition: srtdlg.cxx:60
const sal_uInt16 lNumIndent
Definition: swtypes.hxx:113
void StartListeningToSameModifyAs(const SwClient &)
Definition: calbck.cxx:116
sal_uInt16 sal_Unicode
void SetGrabBagItem(const css::uno::Any &rVal)
Definition: number.cxx:1031
bool operator==(const SvxNumberFormat &) const
const vcl::Font & GetFont() const
Definition: number.cxx:1057
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:425
sal_Unicode GetBulletChar(sal_uInt8 nLevel)
retrieve unicode of character used for the default bullet list for the given list level ...
Definition: number.cxx:1262
const OUString & GetName() const
Definition: format.hxx:111
static bool IsFuzzing()
void SetCharFormatName(const OUString &rSet)
SVX_NUM_ARABIC
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
bool EnableNotification(const css::uno::Sequence< OUString > &rNames, bool bEnableInternalNotification=false)
void InitFont()
initialize font instance for default bullet list
Definition: number.cxx:1228
bool mbAutoRuleFlag
Definition: numrule.hxx:130
const OUString & GetPrefix() const
void SetNumRuleMap(std::unordered_map< OUString, SwNumRule * > *pNumRuleMap)
Register this rule in a "name->numrule" map.
Definition: number.cxx:153
void LoadConfig()
loads default bullet configuration properties and applies values to internal data ...
Definition: number.cxx:1170
const OUString & GetSuffix() const
SvxNumRule MakeSvxNumRule() const
Definition: number.cxx:839
void SetFirstLineIndent(const long nFirstLineIndent)
bool IsAlive(typename std::remove_pointer< Value >::type const *const p) const
check that given format is still alive (i.e. contained here)
Definition: docary.hxx:144
void EndListeningAll()
Definition: calbck.cxx:124
void CheckCharFormats(SwDoc *pDoc)
Tests whether the CharFormats are from the given doc and copies them if appropriate.
Definition: number.cxx:513
bool IsContinusNum() const
Definition: numrule.hxx:232
const short lNumFirstLineOffset
Definition: swtypes.hxx:114
SVX_NUM_BITMAP
SVX_NUM_CHAR_SPECIAL
WEIGHT_DONTKNOW
SwCharFormat * GetCharFormat() const
Definition: numrule.hxx:73
virtual void ImplCommit() override
Definition: number.cxx:1336
SwNumRule & CopyNumRule(SwDoc *, const SwNumRule &)
A kind of copy-constructor to make sure the num formats are attached to the correctCharFormats of a d...
Definition: number.cxx:803
SwNumRule(const OUString &rNm, const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode, SwNumRuleType=NUM_RULE)
add parameter
Definition: number.cxx:352
struct _xmlTextWriter * xmlTextWriterPtr
const SwFormatVertOrient * GetGraphicOrientation() const
Definition: number.cxx:340
void SetListtabPos(const long nListtabPos)
std::unique_ptr< SwFormatVertOrient > m_pVertOrient
Definition: numrule.hxx:51
std::unique_ptr< sw::ModifyChangedHint > CheckRegistration(const SfxPoolItem *pOldValue)
Definition: calbck.cxx:78
void SetIndentAt(const long nIndentAt)
bool IsFontnameUserDefined() const
Definition: number.cxx:1052
LabelFollowedBy GetLabelFollowedBy() const
sal_Int32 GetAbsLSpace() const
void LoadConfig()
loads configuration properties and applies values to internal data
Definition: number.cxx:1338
std::vector< SwNumRule * >::size_type size_type
Definition: docary.hxx:70
virtual bool IsModified() const =0
Changes of document?
const vcl::Font & GetDefBulletFont()
retrieve font used for the default bullet list characters
Definition: number.cxx:1257
bool IsPhantom() const
Return if this node is a phantom.
int i
bool mbAbsSpaces
Levels represent absolute indents.
Definition: numrule.hxx:133
bool IsEnumeration() const
Definition: number.cxx:227
void RemoveTextNode(SwTextNode &rTextNode)
Definition: number.cxx:142
size_t size() const
Definition: docary.hxx:91
virtual ~SwNumFormat() override
Definition: number.cxx:222
SwNumRuleType meRuleType
Definition: numrule.hxx:126
void SetBulletChar(sal_Unicode cSet)
static OUString GetOutlineRuleName()
Definition: number.cxx:72
css::uno::Sequence< css::uno::Any > GetProperties(const css::uno::Sequence< OUString > &rNames)
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:393
sal_Unicode GetChar(sal_uInt8 p_nListLevel) const
Definition: number.cxx:1062
sal_Unicode m_cGrfBulletCP
Definition: numrule.hxx:53
bool IsItemize() const
Definition: number.cxx:235
sal_uInt8 GetPoolHlpFileId() const
Definition: numrule.hxx:253
void SetToDefault()
sets internal default bullet configuration data to default values
Definition: number.cxx:1130
void GetTextNodeList(SwNumRule::tTextNodeList &rTextNodeList) const
Definition: number.cxx:121
static sal_uInt16 GetNumIndent(sal_uInt8 nLvl)
Definition: number.cxx:159
const short lOutlineMinTextDistance
Definition: swtypes.hxx:115
void SetCountPhantoms(bool bCountPhantoms)
Definition: number.cxx:982
std::unordered_map< OUString, SwNumRule * > * mpNumRuleMap
unordered_map containing "name->rule" relation
Definition: numrule.hxx:123
ITALIC_NONE
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:119
void SetIndent(const short nNewIndent, const sal_uInt16 nListLevel)
set indent of certain list level to given value
Definition: number.cxx:917
virtual void ImplCommit() override
Definition: number.cxx:1243
ODFDefaultVersion GetODFDefaultVersion() const
void SetCharTextDistance(short nSet)
void SetToDefault()
sets internal configuration data to default values
Definition: number.cxx:1324
SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const
void dumpAsXml(xmlTextWriterPtr w) const
Definition: number.cxx:1014
#define RES_FMT_CHG
Definition: hintids.hxx:286
SAL_DLLPRIVATE void UpdateNumNodes(SwDoc *pDoc)
Definition: number.cxx:315
SwNumRule::tParagraphStyleList::size_type GetParagraphStyleListSize() const
Definition: number.cxx:987
Provides access to the lists of a document.
void ChangeIndent(const sal_Int32 nDiff)
change indent of all list levels by given difference
Definition: number.cxx:878
std::vector< tSwNumTreeNumber > tNumberVector
long GetIndentAt() const
bool mbContinusNum
Continuous numbering without levels.
Definition: numrule.hxx:132
const SvxNumberFormat::SvxNumPositionAndSpaceMode meDefaultNumberFormatPositionAndSpaceMode
it needs to export as part of tracked numbering change
Definition: numrule.hxx:138
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:77
SwCharFormat * FindCharFormatByName(const OUString &rName) const
Definition: doc.hxx:767
sal_uInt16 nPrefixChars
Definition: numrule.hxx:101
std::unique_ptr< SwNumFormat > maFormats[MAXLEVEL]
Definition: numrule.hxx:114
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
bool IsContinuousNumbering() const
static SwNumFormat * maBaseFormats[RULE_END][MAXLEVEL]
Definition: numrule.hxx:108
FontWeight
void Set(sal_uInt16 i, const SwNumFormat *)
Definition: number.cxx:585
SwNumRule::tTextNodeList::size_type GetTextNodeListSize() const
Definition: number.cxx:126
void Validate()
Definition: number.cxx:969
void SetCharFormat(SwCharFormat *)
Definition: number.cxx:271
const Size & GetGraphicSize() const
void SetInvalidRule(bool bFlag)
Definition: number.cxx:855
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:733
SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
Definition: number.cxx:1379
const OUString & GetFontname() const
Definition: number.cxx:1047
static uno::Sequence< OUString > GetPropNames()
returns sequence of default bullet configuration property names
Definition: number.cxx:1149
bool IsDefBulletFontUserDefined()
determine if default bullet font is user defined
Definition: number.cxx:1252
unsigned char sal_uInt8
OUString const & GetDefBulletFontname()
retrieve font family name used for the default bullet list characters
Definition: number.cxx:1247
SwCharFormat * CopyCharFormat(const SwCharFormat &)
copy the char format
Definition: docfmt.cxx:1148
void SetFirstLineOffset(sal_Int32 nSet)
sal_uInt16 nSuffixChars
Definition: numrule.hxx:102
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:261
tTextNodeList maTextNodeList
container for associated text nodes
Definition: numrule.hxx:117
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1057
static sal_uInt16 mnRefCount
Definition: numrule.hxx:112
static SwNumFormat * maLabelAlignmentBaseFormats[RULE_END][MAXLEVEL]
default list level properties for position-and-space mode LABEL_ALIGNMENT
Definition: numrule.hxx:111
void SetSvxRule(const SvxNumRule &, SwDoc *pDoc)
Definition: number.cxx:827
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:157
~SwNumRule()
Definition: number.cxx:467
SwNumRule & operator=(const SwNumRule &)
Definition: number.cxx:529
static css::uno::Sequence< OUString > GetPropNames()
returns sequence of configuration property names
Definition: number.cxx:1329
void SetSuffix(const OUString &rSet)
long GetListtabPos() const
sal_Int32 GetFirstLineOffset() const
std::vector< SwTextNode * > tTextNodeList
Definition: numrule.hxx:96
void SetStart(sal_uInt16 nSet)
virtual void SetGraphicBrush(const SvxBrushItem *pBrushItem, const Size *pSize=nullptr, const sal_Int16 *pOrient=nullptr)
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames) override
catches notification about changed configuration data
Definition: number.cxx:1368
virtual void SetGraphicBrush(const SvxBrushItem *pBrushItem, const Size *pSize=nullptr, const sal_Int16 *pOrient=nullptr) override
Definition: number.cxx:307
def text(shape, st)
std::shared_ptr< SfxGrabBagItem > mpGrabBagItem
Style InteropGrabBag.
Definition: numrule.hxx:140
bool IsInDtor() const
Definition: doc.hxx:397
tParagraphStyleList maParagraphStyleList
container for associated paragraph styles
Definition: numrule.hxx:120
void NumRuleChgd()
Notify this textnode that its numbering rule has changed.
Definition: ndtxt.cxx:2850
static const sal_uInt16 maDefNumIndents[MAXLEVEL]
Definition: numrule.hxx:109
void SetAbsLSpace(sal_Int32 nSet)
void SetNumberingType(SvxNumType nSet)
void SetName(const OUString &rNm, IDocumentListsAccess &rDocListAccess)
Definition: number.cxx:101
class containing default bullet list configuration data
Definition: number.cxx:1042
void SetIndentOfFirstListLevelAndChangeOthers(const short nNewIndent)
set indent of first list level to given value and change other list level's indents accordingly ...
Definition: number.cxx:946
virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew) override
Definition: number.cxx:279
void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat &rFmt, bool bIsValid=true)
aStr
virtual OUString GetCharFormatName() const override
Definition: number.cxx:299
sal_uInt16 mnPoolFormatId
Id-for NumRules created "automatically".
Definition: numrule.hxx:127
sal_Int16 GetVertOrient() const
sal_uInt16 Which() const
bool ChangeIndentOnTabAtFirstPosOfFirstListItem()
configuration, if at first position of the first list item the -key increased the indent of the ...
Definition: number.cxx:1374
OUString msName
Definition: numrule.hxx:125
FontItalic
std::unique_ptr< vcl::Font > mpFont
Definition: number.cxx:1100
bool mbCountPhantoms
Definition: numrule.hxx:135
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
virtual void ResetModified()=0
namespace for static functions and methods for numbering and bullets
Definition: number.cxx:1039