LibreOffice Module sw (master)  1
docstyle.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 <sal/config.h>
22 #include <sal/log.hxx>
23 #include <osl/diagnose.h>
24 
25 #include <cstdlib>
26 
27 #include <hintids.hxx>
28 #include <rtl/ustrbuf.hxx>
29 #include <svl/itemiter.hxx>
30 #include <svl/eitem.hxx>
31 #include <unotools/syslocale.hxx>
32 #include <editeng/boxitem.hxx>
33 #include <editeng/numitem.hxx>
34 #include <editeng/lrspitem.hxx>
35 #include <drawdoc.hxx>
36 #include <fmtcol.hxx>
37 #include <uitool.hxx>
38 #include <wrtsh.hxx>
39 #include <docsh.hxx>
40 #include <frmfmt.hxx>
41 #include <charfmt.hxx>
42 #include <tblafmt.hxx>
43 #include <poolfmt.hxx>
44 #include <pagedesc.hxx>
45 #include <docstyle.hxx>
46 #include <docary.hxx>
47 #include <ccoll.hxx>
48 #include <doc.hxx>
49 #include <IDocumentUndoRedo.hxx>
53 #include <IDocumentState.hxx>
54 #include <cmdid.h>
55 #include <strings.hrc>
56 #include <paratr.hxx>
57 #include <SwStyleNameMapper.hxx>
58 #include <svl/cjkoptions.hxx>
59 #include <svl/ctloptions.hxx>
60 #include <unotools/intlwrapper.hxx>
61 #include <numrule.hxx>
62 #include <svx/xdef.hxx>
63 #include <SwRewriter.hxx>
64 #include <hints.hxx>
65 #include <frameformats.hxx>
66 #include <svx/xfillit0.hxx>
67 #include <svx/xflftrit.hxx>
68 #include <svx/drawitem.hxx>
69 #include <editeng/eeitem.hxx>
70 
71 // The Format names in the list of all names have the
72 // following family as their first character:
73 
74 #define cCHAR u'c'
75 #define cPARA u'p'
76 #define cFRAME u'f'
77 #define cPAGE u'g'
78 #define cNUMRULE u'n'
79 #define cTABSTYLE u't'
80 #define cCELLSTYLE u'b'
81 
82 using namespace com::sun::star;
83 
84 // At the names' publication, this character is removed again and the
85 // family is newly generated.
86 
87 // In addition now there is the Bit bPhysical. In case this Bit is
88 // TRUE, the Pool-Formatnames are not being submitted.
89 
90 namespace {
91 
92 class SwImplShellAction
93 {
94  SwWrtShell* pSh;
95  std::unique_ptr<CurrShell> pCurrSh;
96 public:
97  explicit SwImplShellAction( SwDoc& rDoc );
98  ~SwImplShellAction() COVERITY_NOEXCEPT_FALSE;
99  SwImplShellAction(const SwImplShellAction&) = delete;
100  SwImplShellAction& operator=(const SwImplShellAction&) = delete;
101 };
102 
103 }
104 
105 SwImplShellAction::SwImplShellAction( SwDoc& rDoc )
106 {
107  if( rDoc.GetDocShell() )
108  pSh = rDoc.GetDocShell()->GetWrtShell();
109  else
110  pSh = nullptr;
111 
112  if( pSh )
113  {
114  pCurrSh.reset( new CurrShell( pSh ) );
115  pSh->StartAllAction();
116  }
117 }
118 
119 SwImplShellAction::~SwImplShellAction() COVERITY_NOEXCEPT_FALSE
120 {
121  if( pCurrSh )
122  {
123  pSh->EndAllAction();
124  pCurrSh.reset();
125  }
126 }
127 
128 // find/create SwCharFormate
129 // possibly fill Style
131  const OUString& rName,
132  SwDocStyleSheet* pStyle = nullptr,
133  bool bCreate = true )
134 {
135  SwCharFormat* pFormat = nullptr;
136  if (!rName.isEmpty())
137  {
138  pFormat = rDoc.FindCharFormatByName( rName );
139  if( !pFormat && rName == SwResId(STR_POOLCHR_STANDARD))
140  {
141  // Standard-Character template
142  pFormat = rDoc.GetDfltCharFormat();
143  }
144 
145  if( !pFormat && bCreate )
146  { // explore Pool
148  if(nId != USHRT_MAX)
150  }
151  }
152  if(pStyle)
153  {
154  if(pFormat)
155  {
156  pStyle->SetPhysical(true);
157  SwFormat* p = pFormat->DerivedFrom();
158  if( p && !p->IsDefault() )
159  pStyle->PresetParent( p->GetName() );
160  else
161  pStyle->PresetParent( OUString() );
162  }
163  else
164  pStyle->SetPhysical(false);
165  }
166  return pFormat;
167 }
168 
169 // find/create ParaFormats
170 // fill Style
172  const OUString& rName,
173  SwDocStyleSheet* pStyle = nullptr,
174  bool bCreate = true )
175 {
176  SwTextFormatColl* pColl = nullptr;
177 
178  if (!rName.isEmpty())
179  {
180  pColl = rDoc.FindTextFormatCollByName( rName );
181  if( !pColl && bCreate )
182  { // explore Pool
184  if(nId != USHRT_MAX)
186  }
187  }
188 
189  if(pStyle)
190  {
191  if(pColl)
192  {
193  pStyle->SetPhysical(true);
194  if( pColl->DerivedFrom() && !pColl->DerivedFrom()->IsDefault() )
195  pStyle->PresetParent( pColl->DerivedFrom()->GetName() );
196  else
197  pStyle->PresetParent( OUString() );
198 
199  SwTextFormatColl& rNext = pColl->GetNextTextFormatColl();
200  pStyle->PresetFollow(rNext.GetName());
201  }
202  else
203  pStyle->SetPhysical(false);
204  }
205  return pColl;
206 }
207 
208 // Border formats
210  const OUString& rName,
211  SwDocStyleSheet* pStyle = nullptr,
212  bool bCreate = true )
213 {
214  SwFrameFormat* pFormat = nullptr;
215  if( !rName.isEmpty() )
216  {
217  pFormat = rDoc.FindFrameFormatByName( rName );
218  if( !pFormat && bCreate )
219  { // explore Pool
221  if(nId != USHRT_MAX)
223  }
224  }
225 
226  if(pStyle)
227  {
228  if(pFormat)
229  {
230  pStyle->SetPhysical(true);
231  if( pFormat->DerivedFrom() && !pFormat->DerivedFrom()->IsDefault() )
232  pStyle->PresetParent( pFormat->DerivedFrom()->GetName() );
233  else
234  pStyle->PresetParent( OUString() );
235  }
236  else
237  pStyle->SetPhysical(false);
238  }
239  return pFormat;
240 }
241 
242 // Page descriptors
243 static const SwPageDesc* lcl_FindPageDesc( SwDoc& rDoc,
244  const OUString& rName,
245  SwDocStyleSheet* pStyle = nullptr,
246  bool bCreate = true )
247 {
248  const SwPageDesc* pDesc = nullptr;
249 
250  if (!rName.isEmpty())
251  {
252  pDesc = rDoc.FindPageDesc(rName);
253  if( !pDesc && bCreate )
254  {
256  if(nId != USHRT_MAX)
258  }
259  }
260 
261  if(pStyle)
262  {
263  if(pDesc)
264  {
265  pStyle->SetPhysical(true);
266  if(pDesc->GetFollow())
267  pStyle->PresetFollow(pDesc->GetFollow()->GetName());
268  else
269  pStyle->PresetParent( OUString() );
270  }
271  else
272  pStyle->SetPhysical(false);
273  }
274  return pDesc;
275 }
276 
277 static const SwNumRule* lcl_FindNumRule( SwDoc& rDoc,
278  const OUString& rName,
279  SwDocStyleSheet* pStyle = nullptr,
280  bool bCreate = true )
281 {
282  const SwNumRule* pRule = nullptr;
283 
284  if (!rName.isEmpty())
285  {
286  pRule = rDoc.FindNumRulePtr( rName );
287  if( !pRule && bCreate )
288  {
290  if(nId != USHRT_MAX)
292  }
293  }
294 
295  if(pStyle)
296  {
297  if(pRule)
298  {
299  pStyle->SetPhysical(true);
300  pStyle->PresetParent( OUString() );
301  }
302  else
303  pStyle->SetPhysical(false);
304  }
305  return pRule;
306 }
307 
308 static SwTableAutoFormat* lcl_FindTableStyle(SwDoc& rDoc, const OUString& rName, SwDocStyleSheet *pStyle = nullptr, bool bCreate = true)
309 {
310  SwTableAutoFormat* pFormat = nullptr;
311 
312  if (!rName.isEmpty())
313  {
314  pFormat = rDoc.GetTableStyles().FindAutoFormat(rName);
315  if (!pFormat && bCreate)
316  {
317  SwTableAutoFormat aNew(rName);
318  rDoc.GetTableStyles().AddAutoFormat(aNew);
319  }
320  }
321 
322  if(pStyle)
323  {
324  if(pFormat)
325  {
326  pStyle->SetPhysical(true);
327  pStyle->PresetParent(OUString());
328  }
329  else
330  pStyle->SetPhysical(false);
331  }
332  return pFormat;
333 }
334 
335 static const SwBoxAutoFormat* lcl_FindCellStyle(SwDoc& rDoc, std::u16string_view rName, SwDocStyleSheet *pStyle)
336 {
337  const SwBoxAutoFormat* pFormat = rDoc.GetCellStyles().GetBoxFormat(rName);
338 
339  if (!pFormat)
340  {
341  const auto& aTableTemplateMap = SwTableAutoFormat::GetTableTemplateMap();
342  SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
343  for (size_t i=0; i < rTableStyles.size() && !pFormat; ++i)
344  {
345  const SwTableAutoFormat& rTableStyle = rTableStyles[i];
346  for (size_t nBoxFormat=0; nBoxFormat < aTableTemplateMap.size() && !pFormat; ++nBoxFormat)
347  {
348  const sal_uInt32 nBoxIndex = aTableTemplateMap[nBoxFormat];
349  const SwBoxAutoFormat& rBoxFormat = rTableStyle.GetBoxFormat(nBoxIndex);
350  OUString sBoxFormatName;
352  sBoxFormatName += rTableStyle.GetTableTemplateCellSubName(rBoxFormat);
353  if (rName == sBoxFormatName)
354  pFormat = &rBoxFormat;
355  }
356  }
357  }
358 
359  if(pStyle)
360  {
361  if(pFormat)
362  {
363  pStyle->SetPhysical(true);
364  pStyle->PresetParent(OUString());
365  }
366  else
367  pStyle->SetPhysical(false);
368  }
369  return pFormat;
370 }
371 
373  std::u16string_view rName)
374 {
375  if(!maImpl.empty())
376  {
377  sal_Unicode cStyle(0);
378  switch( eFam )
379  {
380  case SfxStyleFamily::Char:
381  cStyle = cCHAR;
382  break;
383  case SfxStyleFamily::Para:
384  cStyle = cPARA;
385  break;
386  case SfxStyleFamily::Frame:
387  cStyle = cFRAME;
388  break;
389  case SfxStyleFamily::Page:
390  cStyle = cPAGE;
391  break;
392  case SfxStyleFamily::Pseudo:
393  cStyle = cNUMRULE;
394  break;
395  case SfxStyleFamily::Table:
396  cStyle = cTABSTYLE;
397  break;
398  case SfxStyleFamily::Cell:
399  cStyle = cCELLSTYLE;
400  break;
401  default:
402  cStyle = ' ';
403  break;
404  }
405  const OUString sSrch = OUStringChar(cStyle) + rName;
406 
407  UniqueHash::const_iterator it = maUnique.find(sSrch);
408  if (it != maUnique.end())
409  {
410  sal_uInt32 nIdx = it->second;
411  assert (nIdx < maImpl.size());
412  assert (maImpl.size() == maUnique.size());
413  return nIdx;
414  }
415  }
416  return SAL_MAX_UINT32;
417 }
418 
420 {
421  maUnique.clear();
422  for (size_t i = 0; i < maImpl.size(); i++)
423  maUnique[maImpl[i]] = i;
424  assert (maImpl.size() == maUnique.size());
425 }
426 
428  std::u16string_view rName)
429 {
430  sal_uInt32 nTmpPos = FindName( eFam, rName );
431  if( nTmpPos < maImpl.size() )
432  maImpl.erase(maImpl.begin() + nTmpPos);
433 
434  // assumption: this seldom occurs, the iterator is built, then emptied.
435  rehash();
436  assert (maImpl.size() == maUnique.size());
437 }
438 
439 // Add Strings to the list of templates
440 void SwStyleSheetIterator::SwPoolFormatList::Append( char cChar, std::u16string_view rStr )
441 {
442  const OUString aStr = OUStringChar(cChar) + rStr;
443 
444  UniqueHash::const_iterator it = maUnique.find(aStr);
445  if (it != maUnique.end())
446  return;
447 
448  maUnique[aStr] = static_cast<sal_uInt32>(maImpl.size());
449  maImpl.push_back(aStr);
450 }
451 
452 // UI-sided implementation of StyleSheets
453 // uses the Core-Engine
455  SwDocStyleSheetPool& rPool) :
456 
457  SfxStyleSheetBase( OUString(), &rPool, SfxStyleFamily::Char, SfxStyleSearchBits::Auto ),
458  pCharFormat(nullptr),
459  pColl(nullptr),
460  pFrameFormat(nullptr),
461  pDesc(nullptr),
462  pNumRule(nullptr),
463  pTableFormat(nullptr),
464  pBoxFormat(nullptr),
465  rDoc(rDocument),
466  aCoreSet(
467  rPool.GetPool(),
468  svl::Items<
472  // FillAttribute support:
474  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
475  SID_ATTR_PAGE, SID_ATTR_PAGE_EXT1,
476  SID_ATTR_PAGE_HEADERSET, SID_ATTR_PAGE_FOOTERSET,
477  SID_ATTR_PARA_MODEL, SID_ATTR_PARA_MODEL,
478  // Items to hand over XPropertyList things like XColorList,
479  // XHatchList, XGradientList, and XBitmapList to the Area TabPage:
480  SID_COLOR_TABLE, SID_PATTERN_LIST,
481  SID_SWREGISTER_COLLECTION, SID_SWREGISTER_COLLECTION,
482  SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM,
483  SID_SWREGISTER_MODE, SID_SWREGISTER_MODE,
484  SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR,
485  SID_ATTR_NUMBERING_RULE, SID_ATTR_NUMBERING_RULE,
486  SID_ATTR_CHAR_GRABBAG, SID_ATTR_CHAR_GRABBAG,
487  SID_ATTR_AUTO_STYLE_UPDATE, SID_ATTR_AUTO_STYLE_UPDATE,
490  bPhysical(false)
491 {
492  nHelpId = UCHAR_MAX;
493 }
494 
496 
498 
500 {
501  aName.clear();
502  aFollow.clear();
503  aParent.clear();
504  SetPhysical(false);
505 }
506 
508 {
509  bool bChg = false;
510  if (!bPhysical)
512 
513  SwFormat* pFormat = nullptr;
514  switch (nFamily)
515  {
516  case SfxStyleFamily::Char:
517  pFormat = rDoc.FindCharFormatByName(aName);
518  if (pFormat)
519  {
520  pFormat->SetGrabBagItem(rVal);
521  bChg = true;
522  }
523  break;
524  case SfxStyleFamily::Para:
525  pFormat = rDoc.FindTextFormatCollByName(aName);
526  if (pFormat)
527  {
528  pFormat->SetGrabBagItem(rVal);
529  bChg = true;
530  }
531  break;
532  case SfxStyleFamily::Pseudo:
533  {
534  SwNumRule* pRule = rDoc.FindNumRulePtr(aName);
535  if (pRule)
536  {
537  pRule->SetGrabBagItem(rVal);
538  bChg = true;
539  }
540  }
541  break;
542  default:
543  break;
544  }
545 
546  if (bChg)
547  {
548  dynamic_cast<SwDocStyleSheetPool&>(*m_pPool).InvalidateIterator();
549  m_pPool->Broadcast(SfxStyleSheetHint(SfxHintId::StyleSheetModified, *this));
550  SwEditShell* pSh = rDoc.GetEditShell();
551  if (pSh)
552  pSh->CallChgLnk();
553  }
554 }
555 
557 {
558  SwFormat* pFormat = nullptr;
559  switch (nFamily)
560  {
561  case SfxStyleFamily::Char:
562  pFormat = rDoc.FindCharFormatByName(aName);
563  if (pFormat)
564  pFormat->GetGrabBagItem(rVal);
565  break;
566  case SfxStyleFamily::Para:
567  pFormat = rDoc.FindTextFormatCollByName(aName);
568  if (pFormat)
569  pFormat->GetGrabBagItem(rVal);
570  break;
571  case SfxStyleFamily::Pseudo:
572  {
573  SwNumRule* pRule = rDoc.FindNumRulePtr(aName);
574  if (pRule)
575  pRule->GetGrabBagItem(rVal);
576  }
577  break;
578  default:
579  break;
580  }
581 }
582 // virtual methods
583 void SwDocStyleSheet::SetHidden( bool bValue )
584 {
585  bool bChg = false;
586  if(!bPhysical)
588 
589  SwFormat* pFormat = nullptr;
590  switch(nFamily)
591  {
592  case SfxStyleFamily::Char:
593  pFormat = rDoc.FindCharFormatByName( aName );
594  if ( pFormat )
595  {
596  pFormat->SetHidden( bValue );
597  bChg = true;
598  }
599  break;
600 
601  case SfxStyleFamily::Para:
602  pFormat = rDoc.FindTextFormatCollByName( aName );
603  if ( pFormat )
604  {
605  pFormat->SetHidden( bValue );
606  bChg = true;
607  }
608  break;
609 
610  case SfxStyleFamily::Frame:
611  pFormat = rDoc.FindFrameFormatByName( aName );
612  if ( pFormat )
613  {
614  pFormat->SetHidden( bValue );
615  bChg = true;
616  }
617  break;
618 
619  case SfxStyleFamily::Page:
620  {
621  SwPageDesc* pPgDesc = rDoc.FindPageDesc(aName);
622  if ( pPgDesc )
623  {
624  pPgDesc->SetHidden( bValue );
625  bChg = true;
626  }
627  }
628  break;
629 
630  case SfxStyleFamily::Pseudo:
631  {
632  SwNumRule* pRule = rDoc.FindNumRulePtr( aName );
633  if ( pRule )
634  {
635  pRule->SetHidden( bValue );
636  bChg = true;
637  }
638  }
639  break;
640 
641  case SfxStyleFamily::Table:
642  {
643  SwTableAutoFormat* pTableAutoFormat = rDoc.GetTableStyles().FindAutoFormat( aName );
644  if ( pTableAutoFormat )
645  {
646  pTableAutoFormat->SetHidden( bValue );
647  bChg = true;
648  }
649  }
650  break;
651 
652  default:
653  break;
654  }
655 
656  if( bChg )
657  {
658  // calling pPool->First() here would be quite slow...
659  dynamic_cast<SwDocStyleSheetPool&>(*m_pPool).InvalidateIterator(); // internal list has to be updated
660  m_pPool->Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified, *this ) );
661  SwEditShell* pSh = rDoc.GetEditShell();
662  if( pSh )
663  pSh->CallChgLnk();
664  }
665 }
666 
668 {
669  bool bRet = false;
670 
671  SwFormat* pFormat = nullptr;
672  switch(nFamily)
673  {
674  case SfxStyleFamily::Char:
675  pFormat = rDoc.FindCharFormatByName( aName );
676  bRet = pFormat && pFormat->IsHidden( );
677  break;
678 
679  case SfxStyleFamily::Para:
680  pFormat = rDoc.FindTextFormatCollByName( aName );
681  bRet = pFormat && pFormat->IsHidden( );
682  break;
683 
684  case SfxStyleFamily::Frame:
685  pFormat = rDoc.FindFrameFormatByName( aName );
686  bRet = pFormat && pFormat->IsHidden( );
687  break;
688 
689  case SfxStyleFamily::Page:
690  {
691  SwPageDesc* pPgDesc = rDoc.FindPageDesc(aName);
692  bRet = pPgDesc && pPgDesc->IsHidden( );
693  }
694  break;
695  case SfxStyleFamily::Pseudo:
696  {
697  SwNumRule* pRule = rDoc.FindNumRulePtr( aName );
698  bRet = pRule && pRule->IsHidden( );
699  }
700  break;
701  case SfxStyleFamily::Table:
702  {
703  SwTableAutoFormat* pTableAutoFormat = rDoc.GetTableStyles().FindAutoFormat( aName );
704  bRet = pTableAutoFormat && pTableAutoFormat->IsHidden( );
705  }
706  break;
707  default:
708  break;
709  }
710 
711  return bRet;
712 }
713 
714 const OUString& SwDocStyleSheet::GetParent() const
715 {
716  if( !bPhysical )
717  {
718  // check if it's already in document
719  SwFormat* pFormat = nullptr;
720  SwGetPoolIdFromName eGetType;
721  switch(nFamily)
722  {
723  case SfxStyleFamily::Char:
724  pFormat = rDoc.FindCharFormatByName( aName );
725  eGetType = SwGetPoolIdFromName::ChrFmt;
726  break;
727 
728  case SfxStyleFamily::Para:
729  pFormat = rDoc.FindTextFormatCollByName( aName );
730  eGetType = SwGetPoolIdFromName::TxtColl;
731  break;
732 
733  case SfxStyleFamily::Frame:
734  pFormat = rDoc.FindFrameFormatByName( aName );
735  eGetType = SwGetPoolIdFromName::FrmFmt;
736  break;
737 
738  case SfxStyleFamily::Page:
739  case SfxStyleFamily::Pseudo:
740  default:
741  {
742  static const OUString sEmpty;
743  return sEmpty; // there's no parent
744  }
745  }
746 
747  OUString sTmp;
748  if( !pFormat ) // not yet there, so default Parent
749  {
750  sal_uInt16 i = SwStyleNameMapper::GetPoolIdFromUIName( aName, eGetType );
751  i = ::GetPoolParent( i );
752  if( i && USHRT_MAX != i )
754  }
755  else
756  {
757  SwFormat* p = pFormat->DerivedFrom();
758  if( p && !p->IsDefault() )
759  sTmp = p->GetName();
760  }
761  SwDocStyleSheet* pThis = const_cast<SwDocStyleSheet*>(this);
762  pThis->aParent = sTmp;
763  }
764  return aParent;
765 }
766 
767 // Follower
768 const OUString& SwDocStyleSheet::GetFollow() const
769 {
770  if( !bPhysical )
771  {
772  SwDocStyleSheet* pThis = const_cast<SwDocStyleSheet*>(this);
773  pThis->FillStyleSheet( FillAllInfo );
774  }
775  return aFollow;
776 }
777 
778 // What Linkage is possible
780 {
781  switch(nFamily)
782  {
783  case SfxStyleFamily::Para :
784  case SfxStyleFamily::Page : return true;
785  case SfxStyleFamily::Frame:
786  case SfxStyleFamily::Char :
787  case SfxStyleFamily::Pseudo: return false;
788  default:
789  OSL_ENSURE(false, "unknown style family");
790  }
791  return false;
792 }
793 
794 // Parent ?
796 {
797  bool bRet = false;
798  switch(nFamily)
799  {
800  case SfxStyleFamily::Char :
801  case SfxStyleFamily::Para :
802  case SfxStyleFamily::Frame: bRet = true;
803  break;
804  default:; //prevent warning
805  }
806  return bRet;
807 }
808 
810 {
811  bool bRet = false;
812  switch(nFamily)
813  {
814  case SfxStyleFamily::Para :
815  case SfxStyleFamily::Char :
816  case SfxStyleFamily::Frame: bRet = true;
817  break;
818  default:; //prevent warning
819  }
820  return bRet;
821 }
822 
823 // determine textual description
825 {
826  IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
827 
828  static const OUStringLiteral sPlus(u" + ");
829  if ( SfxStyleFamily::Page == nFamily )
830  {
831  if( !pSet )
832  GetItemSet();
833 
834  SfxItemIter aIter( *pSet );
835  OUStringBuffer aDesc;
836 
837  for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
838  {
839  if(!IsInvalidItem(pItem))
840  {
841  switch ( pItem->Which() )
842  {
843  case RES_LR_SPACE:
844  case SID_ATTR_PAGE_SIZE:
845  case SID_ATTR_PAGE_MAXSIZE:
846  case SID_ATTR_PAGE_PAPERBIN:
847  case SID_ATTR_BORDER_INNER:
848  break;
849  default:
850  {
851  OUString aItemPresentation;
852  if ( !IsInvalidItem( pItem ) &&
854  *pItem, eUnit, aItemPresentation, aIntlWrapper ) )
855  {
856  if ( !aDesc.isEmpty() && !aItemPresentation.isEmpty() )
857  aDesc.append(sPlus);
858  aDesc.append(aItemPresentation);
859  }
860  }
861  }
862  }
863  }
864  return aDesc.makeStringAndClear();
865  }
866 
867  if ( SfxStyleFamily::Frame == nFamily || SfxStyleFamily::Para == nFamily || SfxStyleFamily::Char == nFamily )
868  {
869  if( !pSet )
870  GetItemSet();
871 
872  SfxItemIter aIter( *pSet );
873  OUStringBuffer aDesc;
874  OUString sPageNum;
875  OUString sModel;
876  OUString sBreak;
877  bool bHasWesternFontPrefix = false;
878  bool bHasCJKFontPrefix = false;
879  bool bHasCTLFontPrefix = false;
880  SvtCJKOptions aCJKOptions;
881  SvtCTLOptions aCTLOptions;
882 
883  // Get currently used FillStyle and remember, also need the XFillFloatTransparenceItem
884  // to decide if gradient transparence is used
885  const drawing::FillStyle eFillStyle(pSet->Get(XATTR_FILLSTYLE).GetValue());
886  const bool bUseFloatTransparence(pSet->Get(XATTR_FILLFLOATTRANSPARENCE).IsEnabled());
887 
888  for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
889  {
890  if(!IsInvalidItem(pItem))
891  {
892  switch ( pItem->Which() )
893  {
894  case SID_ATTR_AUTO_STYLE_UPDATE:
895  case RES_PAGEDESC:
896  break;
897  default:
898  {
899  OUString aItemPresentation;
900  if ( !IsInvalidItem( pItem ) &&
902  *pItem, eUnit, aItemPresentation, aIntlWrapper ) )
903  {
904  bool bIsDefault = false;
905  switch ( pItem->Which() )
906  {
907  case XATTR_FILLCOLOR:
908  {
909  // only use active FillStyle information
910  bIsDefault = (drawing::FillStyle_SOLID == eFillStyle);
911  break;
912  }
913  case XATTR_FILLGRADIENT:
914  {
915  // only use active FillStyle information
916  bIsDefault = (drawing::FillStyle_GRADIENT == eFillStyle);
917  break;
918  }
919  case XATTR_FILLHATCH:
920  {
921  // only use active FillStyle information
922  bIsDefault = (drawing::FillStyle_HATCH == eFillStyle);
923  break;
924  }
925  case XATTR_FILLBITMAP:
926  {
927  // only use active FillStyle information
928  bIsDefault = (drawing::FillStyle_BITMAP == eFillStyle);
929  break;
930  }
932  {
933  // only active when not FloatTransparence
934  bIsDefault = !bUseFloatTransparence;
935  break;
936  }
938  {
939  // only active when FloatTransparence
940  bIsDefault = bUseFloatTransparence;
941  break;
942  }
943 
944  case SID_ATTR_PARA_PAGENUM:
945  sPageNum = aItemPresentation;
946  break;
947  case SID_ATTR_PARA_MODEL:
948  sModel = aItemPresentation;
949  break;
950  case RES_BREAK:
951  sBreak = aItemPresentation;
952  break;
953  case RES_CHRATR_CJK_FONT:
958  if(aCJKOptions.IsCJKFontEnabled())
959  bIsDefault = true;
960  if(!bHasCJKFontPrefix)
961  {
962  aItemPresentation = SwResId(STR_CJK_FONT) + aItemPresentation;
963  bHasCJKFontPrefix = true;
964  }
965  break;
966  case RES_CHRATR_CTL_FONT:
971  if(aCTLOptions.IsCTLFontEnabled())
972  bIsDefault = true;
973  if(!bHasCTLFontPrefix)
974  {
975  aItemPresentation = SwResId(STR_CTL_FONT) + aItemPresentation;
976  bHasCTLFontPrefix = true;
977  }
978  break;
979  case RES_CHRATR_FONT:
980  case RES_CHRATR_FONTSIZE:
981  case RES_CHRATR_LANGUAGE:
982  case RES_CHRATR_POSTURE:
983  case RES_CHRATR_WEIGHT:
984  if(!bHasWesternFontPrefix)
985  {
986  aItemPresentation = SwResId(STR_WESTERN_FONT) + aItemPresentation;
987  bHasWesternFontPrefix = true;
988  }
989  [[fallthrough]];
990  default:
991  bIsDefault = true;
992  }
993  if(bIsDefault)
994  {
995  if ( !aDesc.isEmpty() && !aItemPresentation.isEmpty() )
996  aDesc.append(sPlus);
997  aDesc.append(aItemPresentation);
998  }
999  }
1000  }
1001  }
1002  }
1003  }
1004  // Special treatment for Break, Page template and Site offset
1005  if (!sModel.isEmpty())
1006  {
1007  if (!aDesc.isEmpty())
1008  aDesc.append(sPlus);
1009  aDesc.append(SwResId(STR_PAGEBREAK)).append(sPlus).append(sModel);
1010  if (sPageNum != "0")
1011  {
1012  aDesc.append(sPlus).append(SwResId(STR_PAGEOFFSET)).append(sPageNum);
1013  }
1014  }
1015  else if (!sBreak.isEmpty()) // Break can be valid only when NO Model
1016  {
1017  if (!aDesc.isEmpty())
1018  aDesc.append(sPlus);
1019  aDesc.append(sBreak);
1020  }
1021  return aDesc.makeStringAndClear();
1022  }
1023 
1024  if( SfxStyleFamily::Pseudo == nFamily )
1025  {
1026  return OUString();
1027  }
1028 
1029  return SfxStyleSheetBase::GetDescription(eUnit);
1030 }
1031 
1032 // Set names
1033 bool SwDocStyleSheet::SetName(const OUString& rStr, bool bReindexNow)
1034 {
1035  if( rStr.isEmpty() )
1036  return false;
1037 
1038  if( aName != rStr )
1039  {
1040  if( !SfxStyleSheetBase::SetName(rStr, bReindexNow))
1041  return false;
1042  }
1043  else if(!bPhysical)
1045 
1046  bool bChg = false;
1047  switch(nFamily)
1048  {
1049  case SfxStyleFamily::Char :
1050  {
1051  OSL_ENSURE(pCharFormat, "SwCharFormat missing!");
1052  if( pCharFormat && pCharFormat->GetName() != rStr )
1053  {
1054  if (!pCharFormat->GetName().isEmpty())
1055  rDoc.RenameFormat(*pCharFormat, rStr);
1056  else
1057  pCharFormat->SetName(rStr);
1058 
1059  bChg = true;
1060  }
1061  break;
1062  }
1063  case SfxStyleFamily::Para :
1064  {
1065  OSL_ENSURE(pColl, "Collection missing!");
1066  if( pColl && pColl->GetName() != rStr )
1067  {
1068  if (!pColl->GetName().isEmpty())
1069  rDoc.RenameFormat(*pColl, rStr);
1070  else
1071  pColl->SetName(rStr);
1072 
1073  bChg = true;
1074  }
1075  break;
1076  }
1077  case SfxStyleFamily::Frame:
1078  {
1079  OSL_ENSURE(pFrameFormat, "FrameFormat missing!");
1080  if( pFrameFormat && pFrameFormat->GetName() != rStr )
1081  {
1082  if (!pFrameFormat->GetName().isEmpty())
1083  rDoc.RenameFormat(*pFrameFormat, rStr);
1084  else
1085  pFrameFormat->SetName( rStr );
1086 
1087  bChg = true;
1088  }
1089  break;
1090  }
1091  case SfxStyleFamily::Page :
1092  OSL_ENSURE(pDesc, "PageDesc missing!");
1093  if( pDesc && pDesc->GetName() != rStr )
1094  {
1095  // Set PageDesc - copy with earlier one - probably not
1096  // necessary for setting the name. So here we allow a
1097  // cast.
1098  SwPageDesc aPageDesc(*const_cast<SwPageDesc*>(pDesc));
1099  const OUString aOldName(aPageDesc.GetName());
1100 
1101  aPageDesc.SetName( rStr );
1102  bool const bDoesUndo = rDoc.GetIDocumentUndoRedo().DoesUndo();
1103 
1104  rDoc.GetIDocumentUndoRedo().DoUndo(!aOldName.isEmpty());
1105  rDoc.ChgPageDesc(aOldName, aPageDesc);
1106  rDoc.GetIDocumentUndoRedo().DoUndo(bDoesUndo);
1107 
1108  rDoc.getIDocumentState().SetModified();
1109  bChg = true;
1110  }
1111  break;
1112  case SfxStyleFamily::Pseudo:
1113  OSL_ENSURE(pNumRule, "NumRule missing!");
1114 
1115  if (pNumRule)
1116  {
1117  OUString aOldName = pNumRule->GetName();
1118 
1119  if (!aOldName.isEmpty())
1120  {
1121  if ( aOldName != rStr &&
1122  rDoc.RenameNumRule(aOldName, rStr))
1123  {
1124  pNumRule = rDoc.FindNumRulePtr(rStr);
1125  rDoc.getIDocumentState().SetModified();
1126 
1127  bChg = true;
1128  }
1129  }
1130  else
1131  {
1132  // #i91400#
1133  const_cast<SwNumRule*>(pNumRule)->SetName( rStr, rDoc.getIDocumentListsAccess() );
1134  rDoc.getIDocumentState().SetModified();
1135 
1136  bChg = true;
1137  }
1138  }
1139 
1140  break;
1141 
1142  default:
1143  OSL_ENSURE(false, "unknown style family");
1144  }
1145 
1146  if( bChg )
1147  {
1148  m_pPool->First(nFamily); // internal list has to be updated
1149  m_pPool->Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified, *this ) );
1150  SwEditShell* pSh = rDoc.GetEditShell();
1151  if( pSh )
1152  pSh->CallChgLnk();
1153  }
1154  return true;
1155 }
1156 
1157 // hierarchy of deduction
1158 bool SwDocStyleSheet::SetParent( const OUString& rStr)
1159 {
1160  SwFormat* pFormat = nullptr, *pParent = nullptr;
1161  switch(nFamily)
1162  {
1163  case SfxStyleFamily::Char :
1164  OSL_ENSURE( pCharFormat, "SwCharFormat missing!" );
1165  if( nullptr != ( pFormat = pCharFormat ) && !rStr.isEmpty() )
1166  pParent = lcl_FindCharFormat(rDoc, rStr);
1167  break;
1168 
1169  case SfxStyleFamily::Para :
1170  OSL_ENSURE( pColl, "Collection missing!");
1171  if( nullptr != ( pFormat = pColl ) && !rStr.isEmpty() )
1172  pParent = lcl_FindParaFormat( rDoc, rStr );
1173  break;
1174 
1175  case SfxStyleFamily::Frame:
1176  OSL_ENSURE(pFrameFormat, "FrameFormat missing!");
1177  if( nullptr != ( pFormat = pFrameFormat ) && !rStr.isEmpty() )
1178  pParent = lcl_FindFrameFormat( rDoc, rStr );
1179  break;
1180 
1181  case SfxStyleFamily::Page:
1182  case SfxStyleFamily::Pseudo:
1183  break;
1184  default:
1185  OSL_ENSURE(false, "unknown style family");
1186  }
1187 
1188  bool bRet = false;
1189  if( pFormat && pFormat->DerivedFrom() &&
1190  pFormat->DerivedFrom()->GetName() != rStr )
1191  {
1192  {
1193  SwImplShellAction aTmp( rDoc );
1194  bRet = pFormat->SetDerivedFrom( pParent );
1195  }
1196 
1197  if( bRet )
1198  {
1199  aParent = rStr;
1200  m_pPool->Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified,
1201  *this ) );
1202  }
1203  }
1204 
1205  return bRet;
1206 }
1207 
1208 // Set Follower
1209 bool SwDocStyleSheet::SetFollow( const OUString& rStr)
1210 {
1211  if( !rStr.isEmpty() && !SfxStyleSheetBase::SetFollow( rStr ))
1212  return false;
1213 
1214  SwImplShellAction aTmpSh( rDoc );
1215  switch(nFamily)
1216  {
1217  case SfxStyleFamily::Para :
1218  {
1219  OSL_ENSURE(pColl, "Collection missing!");
1220  if( pColl )
1221  {
1222  SwTextFormatColl* pFollow = pColl;
1223  if( !rStr.isEmpty() && nullptr == (pFollow = lcl_FindParaFormat(rDoc, rStr) ))
1224  pFollow = pColl;
1225 
1226  pColl->SetNextTextFormatColl(*pFollow);
1227  }
1228  break;
1229  }
1230  case SfxStyleFamily::Page :
1231  {
1232  OSL_ENSURE(pDesc, "PageDesc missing!");
1233  if( pDesc )
1234  {
1235  const SwPageDesc* pFollowDesc = !rStr.isEmpty()
1236  ? lcl_FindPageDesc(rDoc, rStr)
1237  : nullptr;
1238  size_t nId = 0;
1239  if (pFollowDesc != pDesc->GetFollow() && rDoc.FindPageDesc(pDesc->GetName(), &nId))
1240  {
1241  SwPageDesc aDesc( *pDesc );
1242  aDesc.SetFollow( pFollowDesc );
1243  rDoc.ChgPageDesc( nId, aDesc );
1244  pDesc = &rDoc.GetPageDesc( nId );
1245  }
1246  }
1247  break;
1248  }
1249  case SfxStyleFamily::Char:
1250  case SfxStyleFamily::Frame:
1251  case SfxStyleFamily::Pseudo:
1252  break;
1253  default:
1254  OSL_ENSURE(false, "unknown style family");
1255  }
1256 
1257  return true;
1258 }
1259 
1260 static
1261 std::unique_ptr<SfxItemSet> lcl_SwFormatToFlatItemSet(SwFormat const *const pFormat)
1262 {
1263  // note: we don't add the odd items that GetItemSet() would add
1264  // because they don't seem relevant for preview
1265  std::vector<SfxItemSet const*> sets;
1266  sets.push_back(&pFormat->GetAttrSet());
1267  while (SfxItemSet const*const pParent = sets.back()->GetParent())
1268  {
1269  sets.push_back(pParent);
1270  }
1271  // start by copying top-level parent set
1272  std::unique_ptr<SfxItemSet> pRet(new SfxItemSet(*sets.back()));
1273  sets.pop_back();
1274  for (auto iter = sets.rbegin(); iter != sets.rend(); ++iter)
1275  { // in reverse so child overrides parent
1276  pRet->Put(**iter);
1277  }
1278  return pRet;
1279 }
1280 
1281 std::unique_ptr<SfxItemSet> SwDocStyleSheet::GetItemSetForPreview()
1282 {
1283  if (SfxStyleFamily::Page == nFamily || SfxStyleFamily::Pseudo == nFamily || SfxStyleFamily::Table == nFamily)
1284  {
1285  SAL_WARN("sw.ui", "GetItemSetForPreview not implemented for page or number or table style");
1286  return std::unique_ptr<SfxItemSet>();
1287  }
1288  if (!bPhysical)
1289  {
1290  // because not only this style, but also any number of its parents
1291  // (or follow style) may not actually exist in the document at this
1292  // time, return one "flattened" item set that contains all items from
1293  // all parents.
1294  std::unique_ptr<SfxItemSet> pRet;
1295 
1296  bool bModifiedEnabled = rDoc.getIDocumentState().IsEnableSetModified();
1298 
1299  FillStyleSheet(FillPreview, &pRet);
1300 
1301  rDoc.getIDocumentState().SetEnableSetModified(bModifiedEnabled);
1302 
1303  assert(pRet);
1304  return pRet;
1305  }
1306  else
1307  {
1308  switch (nFamily)
1309  {
1310  case SfxStyleFamily::Char:
1312  case SfxStyleFamily::Para:
1314  case SfxStyleFamily::Frame:
1316  default:
1317  std::abort();
1318  }
1319  }
1320 }
1321 
1322 // extract ItemSet to Name and Family, Mask
1323 
1325 {
1326  if(!bPhysical)
1328 
1329  switch(nFamily)
1330  {
1331  case SfxStyleFamily::Char:
1332  case SfxStyleFamily::Para:
1333  case SfxStyleFamily::Frame:
1334  {
1335  SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1336  aBoxInfo.SetTable( false );
1337  aBoxInfo.SetDist( true ); // always show gap field
1338  aBoxInfo.SetMinDist( true );// set minimum size in tables and paragraphs
1339  aBoxInfo.SetDefDist( MIN_BORDER_DIST );// always set Default-Gap
1340  // Single lines can only have DontCare-Status in tables
1341  aBoxInfo.SetValid( SvxBoxInfoItemValidFlags::DISABLE );
1342 
1343  if( nFamily == SfxStyleFamily::Char )
1344  {
1345  SAL_WARN_IF(!pCharFormat, "sw.ui", "Where's SwCharFormat");
1347  aCoreSet.Put( aBoxInfo );
1348 
1349  if(pCharFormat->DerivedFrom())
1351  }
1352  else if ( nFamily == SfxStyleFamily::Para )
1353  {
1354  OSL_ENSURE(pColl, "Where's Collection");
1356  aCoreSet.Put( aBoxInfo );
1357  aCoreSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, pColl->IsAutoUpdateFormat()));
1358 
1359  if(pColl->DerivedFrom())
1361  }
1362  else
1363  {
1364  OSL_ENSURE(pFrameFormat, "Where's FrameFormat");
1366  aCoreSet.Put( aBoxInfo );
1367  aCoreSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, pFrameFormat->IsAutoUpdateFormat()));
1368 
1369  if(pFrameFormat->DerivedFrom())
1371 
1372  // create needed items for XPropertyList entries from the DrawModel so that
1373  // the Area TabPage can access them
1374  const SwDrawModel* pDrawModel = rDoc.getIDocumentDrawModelAccess().GetDrawModel();
1375 
1376  aCoreSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE));
1377  aCoreSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST));
1378  aCoreSet.Put(SvxHatchListItem(pDrawModel->GetHatchList(), SID_HATCH_LIST));
1379  aCoreSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), SID_BITMAP_LIST));
1380  aCoreSet.Put(SvxPatternListItem(pDrawModel->GetPatternList(), SID_PATTERN_LIST));
1381  }
1382  }
1383  break;
1384 
1385  case SfxStyleFamily::Page :
1386  {
1387  // set correct parent to get the drawing::FillStyle_NONE FillStyle as needed
1388  if(!aCoreSet.GetParent())
1389  {
1391  }
1392 
1393  OSL_ENSURE(pDesc, "No PageDescriptor");
1394  ::PageDescToItemSet(*const_cast<SwPageDesc*>(pDesc), aCoreSet);
1395  }
1396  break;
1397 
1398  case SfxStyleFamily::Pseudo:
1399  {
1400  OSL_ENSURE(pNumRule, "No NumRule");
1401  SvxNumRule aRule = pNumRule->MakeSvxNumRule();
1402  aCoreSet.Put(SvxNumBulletItem(aRule));
1403  }
1404  break;
1405 
1406  default:
1407  OSL_ENSURE(false, "unknown style family");
1408  }
1409  // Member of Baseclass
1410  pSet = &aCoreSet;
1411 
1412  return aCoreSet;
1413 }
1414 
1416 {
1417  if ( nFamily != SfxStyleFamily::Para )
1418  {
1419  return;
1420  }
1421 
1422  OSL_ENSURE( pColl, "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - missing paragraph style");
1424  return;
1425 
1426  OSL_ENSURE( pColl->GetItemState( RES_PARATR_NUMRULE ) == SfxItemState::SET,
1427  "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - list level indents are applicable at paragraph style, but no list style found. Serious defect." );
1428  const OUString sNumRule = pColl->GetNumRule().GetValue();
1429  if (sNumRule.isEmpty())
1430  return;
1431 
1432  const SwNumRule* pRule = rDoc.FindNumRulePtr( sNumRule );
1433  if( pRule )
1434  {
1435  const SwNumFormat& rFormat = pRule->Get( 0 );
1437  {
1439  aLR.SetTextLeft( rFormat.GetIndentAt() );
1440  aLR.SetTextFirstLineOffset( static_cast<short>(rFormat.GetFirstLineIndent()) );
1441  rSet.Put( aLR );
1442  }
1443  }
1444 }
1445 
1446 // handling of parameter <bResetIndentAttrsAtParagraphStyle>
1448  const bool bResetIndentAttrsAtParagraphStyle )
1449 {
1450  // if applicable determine format first
1451  if(!bPhysical)
1453 
1454  SwImplShellAction aTmpSh( rDoc );
1455 
1456  OSL_ENSURE( &rSet != &aCoreSet, "SetItemSet with own Set is not allowed" );
1457 
1458  if (rDoc.GetIDocumentUndoRedo().DoesUndo())
1459  {
1460  SwRewriter aRewriter;
1461  aRewriter.AddRule( UndoArg1, GetName() );
1462  rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::INSFMTATTR, &aRewriter );
1463  }
1464 
1465  SwFormat* pFormat = nullptr;
1466  std::unique_ptr<SwPageDesc> pNewDsc;
1467  size_t nPgDscPos = 0;
1468 
1469  switch(nFamily)
1470  {
1471  case SfxStyleFamily::Char :
1472  {
1473  OSL_ENSURE(pCharFormat, "Where's CharFormat");
1474  pFormat = pCharFormat;
1475  }
1476  break;
1477 
1478  case SfxStyleFamily::Para :
1479  {
1480  OSL_ENSURE(pColl, "Where's Collection");
1481  const SfxPoolItem* pAutoUpdate;
1482  if(SfxItemState::SET == rSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE,false, &pAutoUpdate ))
1483  {
1484  pColl->SetAutoUpdateFormat(static_cast<const SfxBoolItem*>(pAutoUpdate)->GetValue());
1485  }
1486 
1487  const SwCondCollItem* pCondItem;
1488  if( SfxItemState::SET != rSet.GetItemState( FN_COND_COLL, false,
1489  reinterpret_cast<const SfxPoolItem**>(&pCondItem) ))
1490  pCondItem = nullptr;
1491 
1492  if( RES_CONDTXTFMTCOLL == pColl->Which() && pCondItem )
1493  {
1494  const CommandStruct* pCmds = SwCondCollItem::GetCmds();
1495  for(sal_uInt16 i = 0; i < COND_COMMAND_COUNT; i++)
1496  {
1497  SwCollCondition aCond( nullptr, pCmds[ i ].nCnd, pCmds[ i ].nSubCond );
1498  static_cast<SwConditionTextFormatColl*>(pColl)->RemoveCondition( aCond );
1499  const OUString sStyle = pCondItem->GetStyle( i );
1500  if (sStyle.isEmpty())
1501  continue;
1502  SwFormat *const pFindFormat = lcl_FindParaFormat( rDoc, sStyle );
1503  if (pFindFormat)
1504  {
1505  aCond.RegisterToFormat( *pFindFormat );
1506  static_cast<SwConditionTextFormatColl*>(pColl)->InsertCondition( aCond );
1507  }
1508  }
1509 
1511  }
1512  else if( pCondItem && !pColl->HasWriterListeners() )
1513  {
1514  // no conditional template, then first create and adopt
1515  // all important values
1517  pColl->GetName(), static_cast<SwTextFormatColl*>(pColl->DerivedFrom()) );
1518  if( pColl != &pColl->GetNextTextFormatColl() )
1520 
1523  else
1525 
1526  const CommandStruct* pCmds = SwCondCollItem::GetCmds();
1527  for( sal_uInt16 i = 0; i < COND_COMMAND_COUNT; ++i )
1528  {
1529  const OUString sStyle = pCondItem->GetStyle( i );
1530  if (sStyle.isEmpty())
1531  continue;
1532  SwTextFormatColl *const pFindFormat = lcl_FindParaFormat( rDoc, sStyle );
1533  if (pFindFormat)
1534  {
1535  pCColl->InsertCondition( SwCollCondition( pFindFormat,
1536  pCmds[ i ].nCnd, pCmds[ i ].nSubCond ) );
1537  }
1538  }
1539 
1540  rDoc.DelTextFormatColl( pColl );
1541  pColl = pCColl;
1542  }
1543  if ( bResetIndentAttrsAtParagraphStyle &&
1544  rSet.GetItemState( RES_PARATR_NUMRULE, false ) == SfxItemState::SET &&
1545  rSet.GetItemState( RES_LR_SPACE, false ) != SfxItemState::SET &&
1546  pColl->GetItemState( RES_LR_SPACE, false ) == SfxItemState::SET )
1547  {
1549  }
1550 
1551  // #i56252: If a standard numbering style is assigned to a standard paragraph style
1552  // we have to create a physical instance of the numbering style. If we do not and
1553  // neither the paragraph style nor the numbering style is used in the document
1554  // the numbering style will not be saved with the document and the assignment got lost.
1555  const SfxPoolItem* pNumRuleItem = nullptr;
1556  if( SfxItemState::SET == rSet.GetItemState( RES_PARATR_NUMRULE, false, &pNumRuleItem ) )
1557  { // Setting a numbering rule?
1558  const OUString sNumRule = static_cast<const SwNumRuleItem*>(pNumRuleItem)->GetValue();
1559  if (!sNumRule.isEmpty())
1560  {
1561  SwNumRule* pRule = rDoc.FindNumRulePtr( sNumRule );
1562  if( !pRule )
1563  { // Numbering rule not in use yet.
1564  sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( sNumRule, SwGetPoolIdFromName::NumRule );
1565  if( USHRT_MAX != nPoolId ) // It's a standard numbering rule
1566  {
1567  rDoc.getIDocumentStylePoolAccess().GetNumRuleFromPool( nPoolId ); // Create numbering rule (physical)
1568  }
1569  }
1570  }
1571  }
1572 
1573  pFormat = pColl;
1574 
1575  sal_uInt16 nId = pColl->GetPoolFormatId() &
1577  switch( GetMask() & ( static_cast<SfxStyleSearchBits>(0x0fff) & ~SfxStyleSearchBits::SwCondColl ) )
1578  {
1579  case SfxStyleSearchBits::SwText:
1580  nId |= COLL_TEXT_BITS;
1581  break;
1582  case SfxStyleSearchBits::SwChapter:
1583  nId |= COLL_DOC_BITS;
1584  break;
1585  case SfxStyleSearchBits::SwList:
1586  nId |= COLL_LISTS_BITS;
1587  break;
1588  case SfxStyleSearchBits::SwIndex:
1589  nId |= COLL_REGISTER_BITS;
1590  break;
1591  case SfxStyleSearchBits::SwExtra:
1592  nId |= COLL_EXTRA_BITS;
1593  break;
1594  case SfxStyleSearchBits::SwHtml:
1595  nId |= COLL_HTML_BITS;
1596  break;
1597  default: break;
1598  }
1599  pColl->SetPoolFormatId( nId );
1600  break;
1601  }
1602  case SfxStyleFamily::Frame:
1603  {
1604  OSL_ENSURE(pFrameFormat, "Where's FrameFormat");
1605  const SfxPoolItem* pAutoUpdate;
1606  if(SfxItemState::SET == rSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE,false, &pAutoUpdate ))
1607  {
1608  pFrameFormat->SetAutoUpdateFormat(static_cast<const SfxBoolItem*>(pAutoUpdate)->GetValue());
1609  }
1610  pFormat = pFrameFormat;
1611  }
1612  break;
1613 
1614  case SfxStyleFamily::Page :
1615  {
1616  OSL_ENSURE(pDesc, "Where's PageDescriptor");
1617 
1618  if (rDoc.FindPageDesc(pDesc->GetName(), &nPgDscPos))
1619  {
1620  pNewDsc.reset( new SwPageDesc( *pDesc ) );
1621  // #i48949# - no undo actions for the
1622  // copy of the page style
1623  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1624  rDoc.CopyPageDesc(*pDesc, *pNewDsc); // #i7983#
1625 
1626  pFormat = &pNewDsc->GetMaster();
1627  }
1628  }
1629  break;
1630 
1631  case SfxStyleFamily::Pseudo:
1632  {
1633  OSL_ENSURE(pNumRule, "Where's NumRule");
1634 
1635  if (!pNumRule)
1636  break;
1637 
1638  const SfxPoolItem* pItem;
1639  switch( rSet.GetItemState( SID_ATTR_NUMBERING_RULE, false, &pItem ))
1640  {
1641  case SfxItemState::SET:
1642  {
1643  SvxNumRule* pSetRule = static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule();
1644  pSetRule->UnLinkGraphics();
1645  SwNumRule aSetRule(*pNumRule);
1646  aSetRule.SetSvxRule(*pSetRule, &rDoc);
1647  rDoc.ChgNumRuleFormats( aSetRule );
1648  }
1649  break;
1650  case SfxItemState::DONTCARE:
1651  // set NumRule to default values
1652  // what are the default values?
1653  {
1654  SwNumRule aRule( pNumRule->GetName(),
1655  // #i89178#
1657  rDoc.ChgNumRuleFormats( aRule );
1658  }
1659  break;
1660  default: break;
1661  }
1662  }
1663  break;
1664 
1665  default:
1666  OSL_ENSURE(false, "unknown style family");
1667  }
1668 
1669  if( pFormat && rSet.Count())
1670  {
1671  SfxItemIter aIter( rSet );
1672  const SfxPoolItem* pItem = aIter.GetCurItem();
1673  do
1674  {
1675  if( IsInvalidItem( pItem ) ) // Clear
1676  {
1677  // use method <SwDoc::ResetAttrAtFormat(..)> in order to
1678  // create an Undo object for the attribute reset.
1679  rDoc.ResetAttrAtFormat( rSet.GetWhichByPos(aIter.GetCurPos()),
1680  *pFormat );
1681  }
1682 
1683  pItem = aIter.NextItem();
1684  } while (pItem);
1685  SfxItemSet aSet(rSet);
1686  aSet.ClearInvalidItems();
1687 
1688  if(SfxStyleFamily::Frame == nFamily)
1689  {
1690  // Need to check for unique item for DrawingLayer items of type NameOrIndex
1691  // and evtl. correct that item to ensure unique names for that type. This call may
1692  // modify/correct entries inside of the given SfxItemSet
1694  }
1695 
1696  aCoreSet.ClearItem();
1697 
1698  if( pNewDsc )
1699  {
1700  ::ItemSetToPageDesc( aSet, *pNewDsc );
1701  rDoc.ChgPageDesc( nPgDscPos, *pNewDsc );
1702  pDesc = &rDoc.GetPageDesc( nPgDscPos );
1703  rDoc.PreDelPageDesc(pNewDsc.get()); // #i7983#
1704  pNewDsc.reset();
1705  }
1706  else
1707  rDoc.ChgFormat(*pFormat, aSet); // put all that is set
1708  }
1709  else
1710  {
1711  aCoreSet.ClearItem();
1712  if( pNewDsc ) // we still need to delete it
1713  {
1714  rDoc.PreDelPageDesc(pNewDsc.get()); // #i7983#
1715  pNewDsc.reset();
1716  }
1717  }
1718 
1719  if (rDoc.GetIDocumentUndoRedo().DoesUndo())
1720  {
1721  rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::END, nullptr);
1722  }
1723 }
1724 
1725 static void lcl_SaveStyles( SfxStyleFamily nFamily, std::vector<void*>& rArr, SwDoc& rDoc )
1726 {
1727  switch( nFamily )
1728  {
1729  case SfxStyleFamily::Char:
1730  {
1731  const SwCharFormats& rTable = *rDoc.GetCharFormats();
1732  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1733  {
1734  rArr.push_back( rTable[ n ] );
1735  }
1736  }
1737  break;
1738  case SfxStyleFamily::Para:
1739  {
1740  const SwTextFormatColls& rTable = *rDoc.GetTextFormatColls();
1741  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1742  {
1743  rArr.push_back( rTable[ n ] );
1744  }
1745  }
1746  break;
1747  case SfxStyleFamily::Frame:
1748  {
1749  const SwFrameFormats& rTable = *rDoc.GetFrameFormats();
1750  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1751  {
1752  rArr.push_back( rTable[ n ] );
1753  }
1754  }
1755  break;
1756 
1757  case SfxStyleFamily::Page:
1758  {
1759  for( size_t n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n )
1760  {
1761  rArr.push_back( &rDoc.GetPageDesc( n ) );
1762  }
1763  }
1764  break;
1765 
1766  case SfxStyleFamily::Pseudo:
1767  {
1768  const SwNumRuleTable& rTable = rDoc.GetNumRuleTable();
1769  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1770  {
1771  rArr.push_back( rTable[ n ] );
1772  }
1773  }
1774  break;
1775  default: break;
1776  }
1777 }
1778 
1779 static bool lcl_Contains(const std::vector<void*>& rArr, const void* p)
1780 {
1781  return std::find( rArr.begin(), rArr.end(), p ) != rArr.end();
1782 }
1783 
1784 static void lcl_DeleteInfoStyles( SfxStyleFamily nFamily, std::vector<void*> const & rArr, SwDoc& rDoc )
1785 {
1786  size_t n, nCnt;
1787  switch( nFamily )
1788  {
1789  case SfxStyleFamily::Char:
1790  {
1791  std::deque<sal_uInt16> aDelArr;
1792  const SwCharFormats& rTable = *rDoc.GetCharFormats();
1793  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1794  {
1795  if( !lcl_Contains( rArr, rTable[ n ] ))
1796  aDelArr.push_front( n );
1797  }
1798  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1799  rDoc.DelCharFormat( aDelArr[ n ] );
1800  }
1801  break;
1802 
1803  case SfxStyleFamily::Para :
1804  {
1805  std::deque<sal_uInt16> aDelArr;
1806  const SwTextFormatColls& rTable = *rDoc.GetTextFormatColls();
1807  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1808  {
1809  if( !lcl_Contains( rArr, rTable[ n ] ))
1810  aDelArr.push_front( n );
1811  }
1812  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1813  rDoc.DelTextFormatColl( aDelArr[ n ] );
1814  }
1815  break;
1816 
1817  case SfxStyleFamily::Frame:
1818  {
1819  std::deque<SwFrameFormat*> aDelArr;
1820  const SwFrameFormats& rTable = *rDoc.GetFrameFormats();
1821  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1822  {
1823  if( !lcl_Contains( rArr, rTable[ n ] ))
1824  aDelArr.push_front( rTable[ n ] );
1825  }
1826  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1827  rDoc.DelFrameFormat( aDelArr[ n ] );
1828  }
1829  break;
1830 
1831  case SfxStyleFamily::Page:
1832  {
1833  std::deque<size_t> aDelArr;
1834  for( n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n )
1835  {
1836  if( !lcl_Contains( rArr, &rDoc.GetPageDesc( n ) ))
1837  aDelArr.push_front( n );
1838  }
1839  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1840  rDoc.DelPageDesc( aDelArr[ n ] );
1841  }
1842  break;
1843 
1844  case SfxStyleFamily::Pseudo:
1845  {
1846  std::deque<SwNumRule*> aDelArr;
1847  const SwNumRuleTable& rTable = rDoc.GetNumRuleTable();
1848  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1849  {
1850  if( !lcl_Contains( rArr, rTable[ n ] ))
1851  aDelArr.push_front( rTable[ n ] );
1852  }
1853  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1854  rDoc.DelNumRule( aDelArr[ n ]->GetName() );
1855  }
1856  break;
1857  default: break;
1858  }
1859 }
1860 
1861 // determine the format
1863  FillStyleType const eFType, std::unique_ptr<SfxItemSet> *const o_ppFlatSet)
1864 {
1865  bool bRet = false;
1866  sal_uInt16 nPoolId = USHRT_MAX;
1867  SwFormat* pFormat = nullptr;
1868 
1869  bool bCreate = FillPhysical == eFType;
1870  bool bDeleteInfo = false;
1871  bool bFillOnlyInfo = FillAllInfo == eFType || FillPreview == eFType;
1872  std::vector<void*> aDelArr;
1873  bool const isModified(rDoc.getIDocumentState().IsModified());
1874 
1875  switch(nFamily)
1876  {
1877  case SfxStyleFamily::Char:
1878  pCharFormat = lcl_FindCharFormat(rDoc, aName, this, bCreate );
1879  bPhysical = nullptr != pCharFormat;
1880  if( bFillOnlyInfo && !bPhysical )
1881  {
1882  // create style (plus all needed parents) and clean it up
1883  // later - without affecting the undo/redo stack
1884  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1885  bDeleteInfo = true;
1886  ::lcl_SaveStyles( nFamily, aDelArr, rDoc );
1887  pCharFormat = lcl_FindCharFormat(rDoc, aName, this );
1888  }
1889 
1890  pFormat = pCharFormat;
1891  if( !bCreate && !pFormat )
1892  {
1893  if( aName == SwResId(STR_POOLCHR_STANDARD))
1894  nPoolId = 0;
1895  else
1897  }
1898 
1899  bRet = nullptr != pCharFormat || USHRT_MAX != nPoolId;
1900 
1901  if( bDeleteInfo )
1902  pCharFormat = nullptr;
1903  break;
1904 
1905  case SfxStyleFamily::Para:
1906  {
1907  pColl = lcl_FindParaFormat(rDoc, aName, this, bCreate);
1908  bPhysical = nullptr != pColl;
1909  if( bFillOnlyInfo && !bPhysical )
1910  {
1911  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1912  bDeleteInfo = true;
1913  ::lcl_SaveStyles( nFamily, aDelArr, rDoc );
1914  pColl = lcl_FindParaFormat(rDoc, aName, this );
1915  }
1916 
1917  pFormat = pColl;
1918  if( pColl )
1920  else if( !bCreate )
1922 
1923  bRet = nullptr != pColl || USHRT_MAX != nPoolId;
1924 
1925  if( bDeleteInfo )
1926  pColl = nullptr;
1927  }
1928  break;
1929 
1930  case SfxStyleFamily::Frame:
1931  pFrameFormat = lcl_FindFrameFormat(rDoc, aName, this, bCreate);
1932  bPhysical = nullptr != pFrameFormat;
1933  if (bFillOnlyInfo && !bPhysical)
1934  {
1935  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1936  bDeleteInfo = true;
1937  ::lcl_SaveStyles( nFamily, aDelArr, rDoc );
1938  pFrameFormat = lcl_FindFrameFormat(rDoc, aName, this );
1939  }
1940  pFormat = pFrameFormat;
1941  if( !bCreate && !pFormat )
1943 
1944  bRet = nullptr != pFrameFormat || USHRT_MAX != nPoolId;
1945 
1946  if( bDeleteInfo )
1947  pFrameFormat = nullptr;
1948  break;
1949 
1950  case SfxStyleFamily::Page:
1951  pDesc = lcl_FindPageDesc(rDoc, aName, this, bCreate);
1952  bPhysical = nullptr != pDesc;
1953  if( bFillOnlyInfo && !pDesc )
1954  {
1955  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1956  bDeleteInfo = true;
1957  ::lcl_SaveStyles( nFamily, aDelArr, rDoc );
1958  pDesc = lcl_FindPageDesc( rDoc, aName, this );
1959  }
1960 
1961  if( pDesc )
1962  {
1963  nPoolId = pDesc->GetPoolFormatId();
1964  nHelpId = pDesc->GetPoolHelpId();
1965  if( pDesc->GetPoolHlpFileId() != UCHAR_MAX )
1966  aHelpFile = *rDoc.GetDocPattern( pDesc->GetPoolHlpFileId() );
1967  else
1968  aHelpFile.clear();
1969  }
1970  else if( !bCreate )
1972  SetMask( (USER_FMT & nPoolId) ? SfxStyleSearchBits::UserDefined : SfxStyleSearchBits::Auto );
1973 
1974  bRet = nullptr != pDesc || USHRT_MAX != nPoolId;
1975  if( bDeleteInfo )
1976  pDesc = nullptr;
1977  break;
1978 
1979  case SfxStyleFamily::Pseudo:
1980  pNumRule = lcl_FindNumRule(rDoc, aName, this, bCreate);
1981  bPhysical = nullptr != pNumRule;
1982  if( bFillOnlyInfo && !pNumRule )
1983  {
1984  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1985  bDeleteInfo = true;
1986  ::lcl_SaveStyles( nFamily, aDelArr, rDoc );
1987  pNumRule = lcl_FindNumRule( rDoc, aName, this );
1988  }
1989 
1990  if( pNumRule )
1991  {
1992  nPoolId = pNumRule->GetPoolFormatId();
1994  if( pNumRule->GetPoolHlpFileId() != UCHAR_MAX )
1996  else
1997  aHelpFile.clear();
1998  }
1999  else if( !bCreate )
2001  SetMask( (USER_FMT & nPoolId) ? SfxStyleSearchBits::UserDefined : SfxStyleSearchBits::Auto );
2002 
2003  bRet = nullptr != pNumRule || USHRT_MAX != nPoolId;
2004 
2005  if( bDeleteInfo )
2006  pNumRule = nullptr;
2007  break;
2008 
2009  case SfxStyleFamily::Table:
2010  pTableFormat = lcl_FindTableStyle(rDoc, aName, this, bCreate);
2011  SetMask((pTableFormat && pTableFormat->IsUserDefined()) ? SfxStyleSearchBits::UserDefined : SfxStyleSearchBits::Auto);
2012  bRet = bPhysical = (nullptr != pTableFormat);
2013  break;
2014 
2015  case SfxStyleFamily::Cell:
2016  pBoxFormat = lcl_FindCellStyle(rDoc, aName, this);
2017  bRet = bPhysical = (nullptr != pBoxFormat);
2018  break;
2019  default:; //prevent warning
2020  }
2021 
2022  if( SfxStyleFamily::Char == nFamily ||
2023  SfxStyleFamily::Para == nFamily ||
2024  SfxStyleFamily::Frame == nFamily )
2025  {
2026  if( pFormat )
2027  nPoolId = pFormat->GetPoolFormatId();
2028 
2029  SfxStyleSearchBits _nMask = SfxStyleSearchBits::Auto;
2030  if( pFormat == rDoc.GetDfltCharFormat() )
2031  _nMask |= SfxStyleSearchBits::ReadOnly;
2032  else if( USER_FMT & nPoolId )
2033  _nMask |= SfxStyleSearchBits::UserDefined;
2034 
2035  switch ( COLL_GET_RANGE_BITS & nPoolId )
2036  {
2037  case COLL_TEXT_BITS: _nMask |= SfxStyleSearchBits::SwText; break;
2038  case COLL_DOC_BITS : _nMask |= SfxStyleSearchBits::SwChapter; break;
2039  case COLL_LISTS_BITS: _nMask |= SfxStyleSearchBits::SwList; break;
2040  case COLL_REGISTER_BITS: _nMask |= SfxStyleSearchBits::SwIndex; break;
2041  case COLL_EXTRA_BITS: _nMask |= SfxStyleSearchBits::SwExtra; break;
2042  case COLL_HTML_BITS: _nMask |= SfxStyleSearchBits::SwHtml; break;
2043  }
2044 
2045  if( pFormat )
2046  {
2047  OSL_ENSURE( bPhysical, "Format not found" );
2048 
2049  nHelpId = pFormat->GetPoolHelpId();
2050  if( pFormat->GetPoolHlpFileId() != UCHAR_MAX )
2051  aHelpFile = *rDoc.GetDocPattern( pFormat->GetPoolHlpFileId() );
2052  else
2053  aHelpFile.clear();
2054 
2055  if( RES_CONDTXTFMTCOLL == pFormat->Which() )
2056  _nMask |= SfxStyleSearchBits::SwCondColl;
2057 
2058  if (FillPreview == eFType)
2059  {
2060  assert(o_ppFlatSet);
2061  *o_ppFlatSet = lcl_SwFormatToFlatItemSet(pFormat);
2062  }
2063  }
2064 
2065  SetMask( _nMask );
2066  }
2067  if( bDeleteInfo && bFillOnlyInfo )
2068  {
2069  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
2070  ::lcl_DeleteInfoStyles( nFamily, aDelArr, rDoc );
2071  if (!isModified)
2072  {
2074  }
2075  }
2076  return bRet;
2077 }
2078 
2079 // Create new format in Core
2081 {
2082  switch(nFamily)
2083  {
2084  case SfxStyleFamily::Char :
2086  if( !pCharFormat )
2088  rDoc.GetDfltCharFormat());
2089  pCharFormat->SetAuto(false);
2090  break;
2091 
2092  case SfxStyleFamily::Para :
2093  pColl = lcl_FindParaFormat( rDoc, aName );
2094  if( !pColl )
2095  {
2096  SwTextFormatColl *pPar = (*rDoc.GetTextFormatColls())[0];
2097  if( nMask & SfxStyleSearchBits::SwCondColl )
2098  pColl = rDoc.MakeCondTextFormatColl( aName, pPar );
2099  else
2100  pColl = rDoc.MakeTextFormatColl( aName, pPar );
2101  }
2102  break;
2103 
2104  case SfxStyleFamily::Frame:
2106  if( !pFrameFormat )
2107  pFrameFormat = rDoc.MakeFrameFormat(aName, rDoc.GetDfltFrameFormat(), false, false);
2108 
2109  break;
2110 
2111  case SfxStyleFamily::Page :
2112  pDesc = lcl_FindPageDesc( rDoc, aName );
2113  if( !pDesc )
2114  {
2115  pDesc = rDoc.MakePageDesc(aName);
2116  }
2117  break;
2118 
2119  case SfxStyleFamily::Pseudo:
2120  pNumRule = lcl_FindNumRule( rDoc, aName );
2121  if( !pNumRule )
2122  {
2123  const OUString sTmpNm( aName.isEmpty() ? rDoc.GetUniqueNumRuleName() : aName );
2124  SwNumRule* pRule = rDoc.GetNumRuleTable()[
2125  rDoc.MakeNumRule( sTmpNm, nullptr, false,
2126  // #i89178#
2128  pRule->SetAutoRule( false );
2129  if( aName.isEmpty() )
2130  {
2131  // #i91400#
2132  pRule->SetName( aName, rDoc.getIDocumentListsAccess() );
2133  }
2134  pNumRule = pRule;
2135  }
2136  break;
2137 
2138  case SfxStyleFamily::Table:
2139  if (aName.isEmpty())
2140  return;
2142  if (!pTableFormat)
2143  {
2144  rDoc.MakeTableStyle(aName);
2146  SAL_WARN_IF(!pTableFormat, "sw.ui", "Recently added auto format not found");
2147  }
2148  break;
2149  default:; //prevent warning
2150  }
2151  bPhysical = true;
2152  aCoreSet.ClearItem();
2153 }
2154 
2156 {
2157  if(!bPhysical)
2159  return pCharFormat;
2160 }
2161 
2163 {
2164  if(!bPhysical)
2166  return pColl;
2167 }
2168 
2170 {
2171  if(!bPhysical)
2173  return pDesc;
2174 }
2175 
2177 {
2178  if(!bPhysical)
2180  return pNumRule;
2181 }
2182 
2183 
2185 {
2186  OSL_ENSURE(pNumRule, "Where is the NumRule");
2187  rDoc.ChgNumRuleFormats( rRule );
2188 }
2189 
2191 {
2192  if(!bPhysical)
2194  assert(pTableFormat && "SwDocStyleSheet table style, SwTableAutoFormat not found");
2195  return pTableFormat;
2196 }
2197 
2198 // re-generate Name AND Family from String
2199 // First() and Next() (see below) insert an identification letter at Pos.1
2200 
2201 void SwDocStyleSheet::PresetNameAndFamily(const OUString& rName)
2202 {
2203  switch( rName[0] )
2204  {
2205  case cPARA: nFamily = SfxStyleFamily::Para; break;
2206  case cFRAME: nFamily = SfxStyleFamily::Frame; break;
2207  case cPAGE: nFamily = SfxStyleFamily::Page; break;
2208  case cNUMRULE: nFamily = SfxStyleFamily::Pseudo; break;
2209  case cTABSTYLE: nFamily = SfxStyleFamily::Table; break;
2210  default: nFamily = SfxStyleFamily::Char; break;
2211  }
2212  aName = rName.copy(1);
2213 }
2214 
2215 // Is the format physically present yet
2217 {
2218  bPhysical = bPhys;
2219 
2220  if(!bPhys)
2221  {
2222  pCharFormat = nullptr;
2223  pColl = nullptr;
2224  pFrameFormat = nullptr;
2225  pDesc = nullptr;
2226  }
2227 }
2228 
2230 {
2231  if(!bPhysical)
2233  return pFrameFormat;
2234 }
2235 
2237 {
2238  if( !bPhysical )
2239  {
2240  SwDocStyleSheet* pThis = const_cast<SwDocStyleSheet*>(this);
2241  pThis->FillStyleSheet( FillOnlyName );
2242  }
2243 
2244  if( !bPhysical )
2245  return false;
2246 
2247  const sw::BroadcastingModify* pMod;
2248  switch( nFamily )
2249  {
2250  case SfxStyleFamily::Char : pMod = pCharFormat; break;
2251  case SfxStyleFamily::Para : pMod = pColl; break;
2252  case SfxStyleFamily::Frame: pMod = pFrameFormat; break;
2253  case SfxStyleFamily::Page : pMod = pDesc; break;
2254 
2255  case SfxStyleFamily::Pseudo:
2256  return pNumRule && rDoc.IsUsed(*pNumRule);
2257 
2258  case SfxStyleFamily::Table:
2259  return pTableFormat && rDoc.IsUsed( *pTableFormat );
2260 
2261  default:
2262  OSL_ENSURE(false, "unknown style family");
2263  return false;
2264  }
2265  return rDoc.IsUsed( *pMod );
2266 }
2267 
2269 {
2270  return pNumRule ? pNumRule->MakeParagraphStyleListString() : OUString();
2271 }
2272 
2274 {
2275  sal_uInt16 nId = 0;
2276  sal_uInt16 nPoolId = 0;
2277  unsigned char nFileId = UCHAR_MAX;
2278 
2279  rFile = "swrhlppi.hlp";
2280 
2281  const SwFormat* pTmpFormat = nullptr;
2282  switch( nFamily )
2283  {
2284  case SfxStyleFamily::Char :
2285  if( !pCharFormat &&
2286  nullptr == (pCharFormat = lcl_FindCharFormat( rDoc, aName, nullptr, false )) )
2287  {
2289  return USHRT_MAX == nId ? 0 : nId;
2290  }
2291  pTmpFormat = pCharFormat;
2292  break;
2293 
2294  case SfxStyleFamily::Para:
2295  if( !pColl &&
2296  nullptr == ( pColl = lcl_FindParaFormat( rDoc, aName, nullptr, false )) )
2297  {
2299  return USHRT_MAX == nId ? 0 : nId;
2300  }
2301  pTmpFormat = pColl;
2302  break;
2303 
2304  case SfxStyleFamily::Frame:
2305  if( !pFrameFormat &&
2306  nullptr == ( pFrameFormat = lcl_FindFrameFormat( rDoc, aName, nullptr, false ) ) )
2307  {
2309  return USHRT_MAX == nId ? 0 : nId;
2310  }
2311  pTmpFormat = pFrameFormat;
2312  break;
2313 
2314  case SfxStyleFamily::Page:
2315  if( !pDesc &&
2316  nullptr == ( pDesc = lcl_FindPageDesc( rDoc, aName, nullptr, false ) ) )
2317  {
2319  return USHRT_MAX == nId ? 0 : nId;
2320  }
2321 
2322  nId = pDesc->GetPoolHelpId();
2323  nFileId = pDesc->GetPoolHlpFileId();
2324  nPoolId = pDesc->GetPoolFormatId();
2325  break;
2326 
2327  case SfxStyleFamily::Pseudo:
2328  if( !pNumRule &&
2329  nullptr == ( pNumRule = lcl_FindNumRule( rDoc, aName, nullptr, false ) ) )
2330  {
2332  return USHRT_MAX == nId ? 0 : nId;
2333  }
2334 
2335  nId = pNumRule->GetPoolHelpId();
2336  nFileId = pNumRule->GetPoolHlpFileId();
2337  nPoolId = pNumRule->GetPoolFormatId();
2338  break;
2339 
2340  default:
2341  OSL_ENSURE(false, "unknown style family");
2342  return 0;
2343  }
2344 
2345  if( pTmpFormat )
2346  {
2347  nId = pTmpFormat->GetPoolHelpId();
2348  nFileId = pTmpFormat->GetPoolHlpFileId();
2349  nPoolId = pTmpFormat->GetPoolFormatId();
2350  }
2351 
2352  if( UCHAR_MAX != nFileId )
2353  {
2354  const OUString *pTemplate = rDoc.GetDocPattern( nFileId );
2355  if( pTemplate )
2356  {
2357  rFile = *pTemplate;
2358  }
2359  }
2360  else if( !IsPoolUserFormat( nPoolId ) )
2361  {
2362  nId = nPoolId;
2363  }
2364 
2365  // because SFX acts like that, with HelpId:
2366  if( USHRT_MAX == nId )
2367  nId = 0; // don't show Help accordingly
2368 
2369  return nId;
2370 }
2371 
2372 void SwDocStyleSheet::SetHelpId( const OUString& r, sal_uLong nId )
2373 {
2374  sal_uInt8 nFileId = static_cast< sal_uInt8 >(rDoc.SetDocPattern( r ));
2375  sal_uInt16 nHId = static_cast< sal_uInt16 >(nId);
2376 
2377  SwFormat* pTmpFormat = nullptr;
2378  switch( nFamily )
2379  {
2380  case SfxStyleFamily::Char : pTmpFormat = pCharFormat; break;
2381  case SfxStyleFamily::Para : pTmpFormat = pColl; break;
2382  case SfxStyleFamily::Frame: pTmpFormat = pFrameFormat; break;
2383  case SfxStyleFamily::Page :
2384  const_cast<SwPageDesc*>(pDesc)->SetPoolHelpId( nHId );
2385  const_cast<SwPageDesc*>(pDesc)->SetPoolHlpFileId( nFileId );
2386  break;
2387 
2388  case SfxStyleFamily::Pseudo:
2389  const_cast<SwNumRule*>(pNumRule)->SetPoolHelpId( nHId );
2390  const_cast<SwNumRule*>(pNumRule)->SetPoolHlpFileId( nFileId );
2391  break;
2392 
2393  default:
2394  OSL_ENSURE(false, "unknown style family");
2395  return ;
2396  }
2397  if( pTmpFormat )
2398  {
2399  pTmpFormat->SetPoolHelpId( nHId );
2400  pTmpFormat->SetPoolHlpFileId( nFileId );
2401  }
2402 }
2403 
2404 // methods for DocStyleSheetPool
2406  : SfxStyleSheetBasePool(rDocument.GetAttrPool())
2407  , mxStyleSheet(new SwDocStyleSheet(rDocument, *this))
2408  , rDoc(rDocument)
2409 {
2410  bOrganizer = bOrg;
2411 }
2412 
2414 {
2415 }
2416 
2418  SfxStyleFamily eFam,
2419  SfxStyleSearchBits _nMask)
2420 {
2421  mxStyleSheet->PresetName(rName);
2422  mxStyleSheet->PresetParent(OUString());
2423  mxStyleSheet->PresetFollow(OUString());
2424  mxStyleSheet->SetMask(_nMask) ;
2425  mxStyleSheet->SetFamily(eFam);
2426  mxStyleSheet->SetPhysical(true);
2427  mxStyleSheet->Create();
2428 
2429  return *mxStyleSheet;
2430 }
2431 
2433 {
2434  OSL_ENSURE(false , "Create in SW-Stylesheet-Pool not possible" );
2435  return nullptr;
2436 }
2437 
2440 {
2441  OSL_ENSURE( false, "Create in SW-Stylesheet-Pool not possible" );
2442  return nullptr;
2443 }
2444 
2445 std::unique_ptr<SfxStyleSheetIterator> SwDocStyleSheetPool::CreateIterator( SfxStyleFamily eFam, SfxStyleSearchBits _nMask )
2446 {
2447  return std::make_unique<SwStyleSheetIterator>(*this, eFam, _nMask);
2448 }
2449 
2451 {
2452  mxStyleSheet.clear();
2453 }
2454 
2456 {
2457  if( !pStyle )
2458  return;
2459 
2460  bool bBroadcast = true;
2461  SwImplShellAction aTmpSh( rDoc );
2462  const OUString sName = pStyle->GetName();
2463  switch( pStyle->GetFamily() )
2464  {
2465  case SfxStyleFamily::Char:
2466  {
2467  SwCharFormat* pFormat = lcl_FindCharFormat(rDoc, sName, nullptr, false );
2468  if(pFormat)
2469  rDoc.DelCharFormat(pFormat);
2470  }
2471  break;
2472  case SfxStyleFamily::Para:
2473  {
2474  SwTextFormatColl* pColl = lcl_FindParaFormat(rDoc, sName, nullptr, false );
2475  if(pColl)
2476  rDoc.DelTextFormatColl(pColl);
2477  }
2478  break;
2479  case SfxStyleFamily::Frame:
2480  {
2481  SwFrameFormat* pFormat = lcl_FindFrameFormat(rDoc, sName, nullptr, false );
2482  if(pFormat)
2483  rDoc.DelFrameFormat(pFormat);
2484  }
2485  break;
2486  case SfxStyleFamily::Page :
2487  {
2488  rDoc.DelPageDesc(sName);
2489  }
2490  break;
2491 
2492  case SfxStyleFamily::Pseudo:
2493  {
2494  if( !rDoc.DelNumRule( sName ) )
2495  // Only send Broadcast, when something was deleted
2496  bBroadcast = false;
2497  }
2498  break;
2499 
2500  case SfxStyleFamily::Table:
2501  {
2502  rDoc.DelTableStyle(sName);
2503  }
2504  break;
2505 
2506  default:
2507  OSL_ENSURE(false, "unknown style family");
2508  bBroadcast = false;
2509  }
2510 
2511  if( bBroadcast )
2512  Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetErased, *pStyle ) );
2513 }
2514 
2516  const OUString &rStyle, const OUString &rParent )
2517 {
2518  SwFormat* pFormat = nullptr, *pParent = nullptr;
2519  switch( eFam )
2520  {
2521  case SfxStyleFamily::Char :
2522  if( nullptr != ( pFormat = lcl_FindCharFormat( rDoc, rStyle ) ) && !rParent.isEmpty() )
2523  pParent = lcl_FindCharFormat(rDoc, rParent );
2524  break;
2525 
2526  case SfxStyleFamily::Para :
2527  if( nullptr != ( pFormat = lcl_FindParaFormat( rDoc, rStyle ) ) && !rParent.isEmpty() )
2528  pParent = lcl_FindParaFormat( rDoc, rParent );
2529  break;
2530 
2531  case SfxStyleFamily::Frame:
2532  if( nullptr != ( pFormat = lcl_FindFrameFormat( rDoc, rStyle ) ) && !rParent.isEmpty() )
2533  pParent = lcl_FindFrameFormat( rDoc, rParent );
2534  break;
2535 
2536  case SfxStyleFamily::Page:
2537  case SfxStyleFamily::Pseudo:
2538  break;
2539 
2540  default:
2541  OSL_ENSURE(false, "unknown style family");
2542  }
2543 
2544  bool bRet = false;
2545  if( pFormat && pFormat->DerivedFrom() &&
2546  pFormat->DerivedFrom()->GetName() != rParent )
2547  {
2548  {
2549  SwImplShellAction aTmpSh( rDoc );
2550  bRet = pFormat->SetDerivedFrom( pParent );
2551  }
2552 
2553  if( bRet )
2554  {
2555  // only for Broadcasting
2556  mxStyleSheet->PresetName( rStyle );
2557  mxStyleSheet->PresetParent( rParent );
2558  if( SfxStyleFamily::Para == eFam )
2559  mxStyleSheet->PresetFollow( static_cast<SwTextFormatColl*>(pFormat)->
2560  GetNextTextFormatColl().GetName() );
2561  else
2562  mxStyleSheet->PresetFollow( OUString() );
2563 
2564  Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified, *mxStyleSheet ) );
2565  }
2566  }
2567 
2568  return bRet;
2569 }
2570 
2573 {
2574  SfxStyleSearchBits nSMask = n;
2575  if( SfxStyleFamily::Para == eFam && rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) )
2576  {
2577  // then only HTML-Templates are of interest
2578  if( SfxStyleSearchBits::All == nSMask )
2579  nSMask = SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined | SfxStyleSearchBits::Used;
2580  else
2581  nSMask &= SfxStyleSearchBits::Used | SfxStyleSearchBits::UserDefined |
2582  SfxStyleSearchBits::SwCondColl | SfxStyleSearchBits::SwHtml;
2583  if( nSMask == SfxStyleSearchBits::Auto )
2584  nSMask = SfxStyleSearchBits::SwHtml;
2585  }
2586 
2587  const bool bSearchUsed = ( n != SfxStyleSearchBits::All && n & SfxStyleSearchBits::Used );
2588  const sw::BroadcastingModify* pMod = nullptr;
2589 
2590  mxStyleSheet->SetPhysical( false );
2591  mxStyleSheet->PresetName( rName );
2592  mxStyleSheet->SetFamily( eFam );
2593  bool bFnd = mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
2594 
2595  if( mxStyleSheet->IsPhysical() )
2596  {
2597  switch( eFam )
2598  {
2599  case SfxStyleFamily::Char:
2600  pMod = mxStyleSheet->GetCharFormat();
2601  break;
2602 
2603  case SfxStyleFamily::Para:
2604  pMod = mxStyleSheet->GetCollection();
2605  break;
2606 
2607  case SfxStyleFamily::Frame:
2608  pMod = mxStyleSheet->GetFrameFormat();
2609  break;
2610 
2611  case SfxStyleFamily::Page:
2612  pMod = mxStyleSheet->GetPageDesc();
2613  break;
2614 
2615  case SfxStyleFamily::Pseudo:
2616  {
2617  const SwNumRule* pRule = mxStyleSheet->GetNumRule();
2618  if( pRule &&
2619  !bSearchUsed &&
2620  (( nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2621  ? !(pRule->GetPoolFormatId() & USER_FMT)
2622  // searched for used and found none
2623  : bSearchUsed ))
2624  bFnd = false;
2625  }
2626  break;
2627 
2628  case SfxStyleFamily::Table:
2629  case SfxStyleFamily::Cell:
2630  break;
2631  default:
2632  OSL_ENSURE(false, "unknown style family");
2633  }
2634  }
2635 
2636  // then evaluate the mask:
2637  if( pMod && !bSearchUsed )
2638  {
2639  const sal_uInt16 nId = SfxStyleFamily::Page == eFam
2640  ? static_cast<const SwPageDesc*>(pMod)->GetPoolFormatId()
2641  : static_cast<const SwFormat*>(pMod)->GetPoolFormatId();
2642 
2643  if( ( nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2644  ? !(nId & USER_FMT)
2645  // searched for used and found none
2646  : bSearchUsed )
2647  bFnd = false;
2648  }
2649  return bFnd ? mxStyleSheet.get() : nullptr;
2650 }
2651 
2654  : SfxStyleSheetIterator(&rBase, eFam, n)
2655  , mxIterSheet(new SwDocStyleSheet(rBase.GetDoc(), rBase))
2656  , mxStyleSheet(new SwDocStyleSheet(rBase.GetDoc(), rBase))
2657 {
2658  bFirstCalled = false;
2659  nLastPos = 0;
2660  StartListening(rBase);
2661 }
2662 
2664 {
2665  EndListening( *mxIterSheet->GetPool() );
2666 }
2667 
2669 {
2670  // let the list fill correctly!!
2671  if( !bFirstCalled )
2672  First();
2673  return aLst.size();
2674 }
2675 
2677 {
2678  // found
2679  if( !bFirstCalled )
2680  First();
2681  mxStyleSheet->PresetNameAndFamily( aLst[ nIdx ] );
2682  mxStyleSheet->SetPhysical( false );
2683  mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
2684 
2685  return mxStyleSheet.get();
2686 }
2687 
2689 {
2690  // Delete old list
2691  bFirstCalled = true;
2692  nLastPos = 0;
2693  aLst.clear();
2694 
2695  // Delete current
2696  mxIterSheet->Reset();
2697 
2698  SwDoc& rDoc = static_cast<SwDocStyleSheetPool*>(pBasePool)->GetDoc();
2699  const SfxStyleSearchBits nSrchMask = nMask;
2700  const bool bIsSearchUsed = SearchUsed();
2701 
2702  bool bSearchHidden( nMask & SfxStyleSearchBits::Hidden );
2703  bool bOnlyHidden = nMask == SfxStyleSearchBits::Hidden;
2704 
2705  const bool bOrganizer = static_cast<SwDocStyleSheetPool*>(pBasePool)->IsOrganizerMode();
2706  bool bAll = ( nSrchMask & SfxStyleSearchBits::AllVisible ) == SfxStyleSearchBits::AllVisible;
2707 
2708  if( nSearchFamily == SfxStyleFamily::Char
2709  || nSearchFamily == SfxStyleFamily::All )
2710  {
2711  const size_t nArrLen = rDoc.GetCharFormats()->size();
2712  for( size_t i = 0; i < nArrLen; i++ )
2713  {
2714  SwCharFormat* pFormat = (*rDoc.GetCharFormats())[ i ];
2715 
2716  const bool bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(*pFormat));
2717  if( ( !bSearchHidden && pFormat->IsHidden() && !bUsed ) || ( pFormat->IsDefault() && pFormat != rDoc.GetDfltCharFormat() ) )
2718  continue;
2719 
2720  if ( nSrchMask == SfxStyleSearchBits::Hidden && !pFormat->IsHidden( ) )
2721  continue;
2722 
2723  if( !bUsed )
2724  {
2725  // Standard is no User template
2726  const sal_uInt16 nId = rDoc.GetDfltCharFormat() == pFormat ?
2727  sal_uInt16( RES_POOLCHR_INET_NORMAL ):
2728  pFormat->GetPoolFormatId();
2729  if( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2730  ? !(nId & USER_FMT)
2731  // searched for used and found none
2732  : bIsSearchUsed )
2733  {
2734  continue;
2735  }
2736 
2738  ( RES_POOLCHR_HTML_BEGIN > nId || nId >= RES_POOLCHR_HTML_END ) &&
2739  RES_POOLCHR_INET_NORMAL != nId &&
2740  RES_POOLCHR_INET_VISIT != nId &&
2741  RES_POOLCHR_FOOTNOTE != nId &&
2742  RES_POOLCHR_ENDNOTE != nId )
2743  continue;
2744  }
2745 
2746  aLst.Append( cCHAR, pFormat == rDoc.GetDfltCharFormat()
2747  ? SwResId(STR_POOLCHR_STANDARD)
2748  : pFormat->GetName() );
2749  }
2750 
2751  // PoolFormat
2752  if( bAll )
2753  {
2756  bIsSearchUsed, bSearchHidden, bOnlyHidden,
2758  else
2759  {
2768  }
2770  bIsSearchUsed, bSearchHidden, bOnlyHidden,
2771  SwGetPoolIdFromName::ChrFmt, cCHAR);
2772  }
2773  }
2774 
2775  if( nSearchFamily == SfxStyleFamily::Para ||
2776  nSearchFamily == SfxStyleFamily::All )
2777  {
2778  SfxStyleSearchBits nSMask = nSrchMask;
2780  {
2781  // then only HTML-Template are of interest
2782  if( SfxStyleSearchBits::AllVisible == ( nSMask & SfxStyleSearchBits::AllVisible ) )
2783  nSMask = SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined |
2784  SfxStyleSearchBits::Used;
2785  else
2786  nSMask &= SfxStyleSearchBits::Used | SfxStyleSearchBits::UserDefined |
2787  SfxStyleSearchBits::SwCondColl | SfxStyleSearchBits::SwHtml;
2788  if( nSMask == SfxStyleSearchBits::Auto )
2789  nSMask = SfxStyleSearchBits::SwHtml;
2790  }
2791 
2792  const size_t nArrLen = rDoc.GetTextFormatColls()->size();
2793  for( size_t i = 0; i < nArrLen; i++ )
2794  {
2795  SwTextFormatColl* pColl = (*rDoc.GetTextFormatColls())[ i ];
2796 
2797  const bool bUsed = bOrganizer || rDoc.IsUsed(*pColl);
2798  if ( ( !bSearchHidden && pColl->IsHidden( ) && !bUsed ) || pColl->IsDefault() )
2799  continue;
2800 
2801  if ( nSMask == SfxStyleSearchBits::Hidden && !pColl->IsHidden( ) )
2802  continue;
2803 
2804  if( !(bIsSearchUsed && bUsed ))
2805  {
2806  const sal_uInt16 nId = pColl->GetPoolFormatId();
2807  auto tmpMask = nSMask & ~SfxStyleSearchBits::Used;
2808  if (tmpMask == SfxStyleSearchBits::UserDefined)
2809  {
2810  if(!IsPoolUserFormat(nId)) continue;
2811  }
2812  else if (tmpMask == SfxStyleSearchBits::SwText)
2813  {
2814  if((nId & COLL_GET_RANGE_BITS) != COLL_TEXT_BITS) continue;
2815  }
2816  else if (tmpMask == SfxStyleSearchBits::SwChapter)
2817  {
2818  if((nId & COLL_GET_RANGE_BITS) != COLL_DOC_BITS) continue;
2819  }
2820  else if (tmpMask == SfxStyleSearchBits::SwList)
2821  {
2822  if((nId & COLL_GET_RANGE_BITS) != COLL_LISTS_BITS) continue;
2823  }
2824  else if (tmpMask == SfxStyleSearchBits::SwIndex)
2825  {
2826  if((nId & COLL_GET_RANGE_BITS) != COLL_REGISTER_BITS) continue;
2827  }
2828  else if (tmpMask == SfxStyleSearchBits::SwExtra)
2829  {
2830  if((nId & COLL_GET_RANGE_BITS) != COLL_EXTRA_BITS) continue;
2831  }
2832  else if (tmpMask == (SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined)
2833  || tmpMask == SfxStyleSearchBits::SwHtml)
2834  {
2835  if((tmpMask & SfxStyleSearchBits::UserDefined) && IsPoolUserFormat(nId))
2836  ; // do nothing
2837  else if( (nId & COLL_GET_RANGE_BITS) != COLL_HTML_BITS)
2838  {
2839  // but some we also want to see in this section
2840  bool bContinue = true;
2841  switch( nId )
2842  {
2843  case RES_POOLCOLL_SEND_ADDRESS: // --> ADDRESS
2844  case RES_POOLCOLL_TABLE_HDLN: // --> TH
2845  case RES_POOLCOLL_TABLE: // --> TD
2846  case RES_POOLCOLL_TEXT: // --> P
2847  case RES_POOLCOLL_HEADLINE_BASE:// --> H
2848  case RES_POOLCOLL_HEADLINE1: // --> H1
2849  case RES_POOLCOLL_HEADLINE2: // --> H2
2850  case RES_POOLCOLL_HEADLINE3: // --> H3
2851  case RES_POOLCOLL_HEADLINE4: // --> H4
2852  case RES_POOLCOLL_HEADLINE5: // --> H5
2853  case RES_POOLCOLL_HEADLINE6: // --> H6
2854  case RES_POOLCOLL_STANDARD: // --> P
2855  case RES_POOLCOLL_FOOTNOTE:
2856  case RES_POOLCOLL_ENDNOTE:
2857  bContinue = false;
2858  break;
2859  }
2860  if( bContinue )
2861  continue;
2862  }
2863  }
2864  else if (tmpMask == SfxStyleSearchBits::SwCondColl)
2865  {
2866  if( RES_CONDTXTFMTCOLL != pColl->Which() ) continue;
2867  }
2868  else
2869  {
2870  // searched for used and found none
2871  if( bIsSearchUsed )
2872  continue;
2873  }
2874  }
2875  aLst.Append( cPARA, pColl->GetName() );
2876  }
2877 
2878  bAll = ( nSMask & SfxStyleSearchBits::AllVisible ) == SfxStyleSearchBits::AllVisible;
2879  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwText )
2881  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA );
2882  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwChapter )
2884  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2885  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwList )
2887  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2888  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwIndex )
2890  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2891  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwExtra )
2893  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2894  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwCondColl )
2895  {
2896  if( !bIsSearchUsed ||
2900  }
2901  if ( bAll ||
2902  (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwHtml ||
2903  (nSMask & ~SfxStyleSearchBits::Used) ==
2904  (SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined) )
2905  {
2907  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2908  if( !bAll )
2909  {
2910  // then also the ones, that we are mapping:
2911  static sal_uInt16 aPoolIds[] = {
2912  RES_POOLCOLL_SEND_ADDRESS, // --> ADDRESS
2913  RES_POOLCOLL_TABLE_HDLN, // --> TH
2914  RES_POOLCOLL_TABLE, // --> TD
2915  RES_POOLCOLL_STANDARD, // --> P
2916  RES_POOLCOLL_TEXT, // --> P
2917  RES_POOLCOLL_HEADLINE_BASE, // --> H
2918  RES_POOLCOLL_HEADLINE1, // --> H1
2919  RES_POOLCOLL_HEADLINE2, // --> H2
2920  RES_POOLCOLL_HEADLINE3, // --> H3
2921  RES_POOLCOLL_HEADLINE4, // --> H4
2922  RES_POOLCOLL_HEADLINE5, // --> H5
2923  RES_POOLCOLL_HEADLINE6, // --> H6
2926  0
2927  };
2928 
2929  sal_uInt16* pPoolIds = aPoolIds;
2930  OUString s;
2931  while( *pPoolIds )
2932  {
2933  if( !bIsSearchUsed || rDoc.getIDocumentStylePoolAccess().IsPoolTextCollUsed( *pPoolIds ) )
2934  {
2935  s = SwStyleNameMapper::GetUIName( *pPoolIds, s );
2936  aLst.Append( cPARA, s);
2937  }
2938  ++pPoolIds;
2939  }
2940  }
2941  }
2942  }
2943 
2944  if( nSearchFamily == SfxStyleFamily::Frame ||
2945  nSearchFamily == SfxStyleFamily::All )
2946  {
2947  const size_t nArrLen = rDoc.GetFrameFormats()->size();
2948  for( size_t i = 0; i < nArrLen; i++ )
2949  {
2950  const SwFrameFormat* pFormat = (*rDoc.GetFrameFormats())[ i ];
2951 
2952  bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(*pFormat));
2953  if( ( !bSearchHidden && pFormat->IsHidden( ) && !bUsed ) || pFormat->IsDefault() || pFormat->IsAuto() )
2954  continue;
2955 
2956  if ( nSrchMask == SfxStyleSearchBits::Hidden && !pFormat->IsHidden( ) )
2957  continue;
2958 
2959  const sal_uInt16 nId = pFormat->GetPoolFormatId();
2960  if( !bUsed )
2961  {
2962  if( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2963  ? !(nId & USER_FMT)
2964  // searched for used and found none
2965  : bIsSearchUsed )
2966  {
2967  continue;
2968  }
2969  }
2970 
2971  aLst.Append( cFRAME, pFormat->GetName() );
2972  }
2973 
2974  // PoolFormat
2975  if ( bAll )
2977  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::FrmFmt, cFRAME);
2978  }
2979 
2980  if( nSearchFamily == SfxStyleFamily::Page ||
2981  nSearchFamily == SfxStyleFamily::All )
2982  {
2983  const size_t nCount = rDoc.GetPageDescCnt();
2984  for(size_t i = 0; i < nCount; ++i)
2985  {
2986  const SwPageDesc& rDesc = rDoc.GetPageDesc(i);
2987  const sal_uInt16 nId = rDesc.GetPoolFormatId();
2988  bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rDesc));
2989  if( !bUsed )
2990  {
2991  if ( ( !bSearchHidden && rDesc.IsHidden() ) ||
2992  ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2993  ? !(nId & USER_FMT)
2994  // searched for used and found none
2995  : bIsSearchUsed ) )
2996  continue;
2997  }
2998 
2999  if ( nSrchMask == SfxStyleSearchBits::Hidden && !rDesc.IsHidden( ) )
3000  continue;
3001 
3002  aLst.Append( cPAGE, rDesc.GetName() );
3003  }
3004  if ( bAll )
3006  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::PageDesc, cPAGE);
3007  }
3008 
3009  if( nSearchFamily == SfxStyleFamily::Pseudo ||
3010  nSearchFamily == SfxStyleFamily::All )
3011  {
3012  const SwNumRuleTable& rNumTable = rDoc.GetNumRuleTable();
3013  for(size_t i = 0; i < rNumTable.size(); ++i)
3014  {
3015  const SwNumRule& rRule = *rNumTable[ i ];
3016  if( !rRule.IsAutoRule() )
3017  {
3018  if ( nSrchMask == SfxStyleSearchBits::Hidden && !rRule.IsHidden( ) )
3019  continue;
3020 
3021  bool bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(rRule));
3022  if( !bUsed )
3023  {
3024  if( ( !bSearchHidden && rRule.IsHidden() ) ||
3025  ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
3026  ? !(rRule.GetPoolFormatId() & USER_FMT)
3027  // searched for used and found none
3028  : bIsSearchUsed ) )
3029  continue;
3030  }
3031 
3032  aLst.Append( cNUMRULE, rRule.GetName() );
3033  }
3034  }
3035  if ( bAll )
3037  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::NumRule, cNUMRULE);
3038  }
3039 
3040  if( nSearchFamily == SfxStyleFamily::Table ||
3041  nSearchFamily == SfxStyleFamily::All )
3042  {
3043  const SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
3044  for(size_t i = 0; i < rTableStyles.size(); ++i)
3045  {
3046  const SwTableAutoFormat& rTableStyle = rTableStyles[i];
3047 
3048  bool bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(rTableStyle));
3049  if(!bUsed)
3050  {
3051  if(nSrchMask == SfxStyleSearchBits::Hidden && !rTableStyle.IsHidden())
3052  continue;
3053 
3054  if( (!bSearchHidden && rTableStyle.IsHidden() ) ||
3055  ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
3056  ? !rTableStyle.IsUserDefined()
3057  // searched for used and found none
3058  : bIsSearchUsed ) )
3059  continue;
3060  }
3061 
3062  aLst.Append( cTABSTYLE, rTableStyle.GetName() );
3063  }
3064  }
3065 
3066  if( nSearchFamily == SfxStyleFamily::Cell ||
3067  nSearchFamily == SfxStyleFamily::All )
3068  {
3069  const auto& aTableTemplateMap = SwTableAutoFormat::GetTableTemplateMap();
3070  if (rDoc.HasTableStyles())
3071  {
3072  const SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
3073  for(size_t i = 0; i < rTableStyles.size(); ++i)
3074  {
3075  const SwTableAutoFormat& rTableStyle = rTableStyles[i];
3076  for(size_t nBoxFormat = 0; nBoxFormat < aTableTemplateMap.size(); ++nBoxFormat)
3077  {
3078  const sal_uInt32 nBoxIndex = aTableTemplateMap[nBoxFormat];
3079  const SwBoxAutoFormat& rBoxFormat = rTableStyle.GetBoxFormat(nBoxIndex);
3080  OUString sBoxFormatName;
3082  sBoxFormatName += rTableStyle.GetTableTemplateCellSubName(rBoxFormat);
3083  aLst.Append( cCELLSTYLE, sBoxFormatName );
3084  }
3085  }
3086  }
3087  const SwCellStyleTable& rCellStyles = rDoc.GetCellStyles();
3088  for(size_t i = 0; i < rCellStyles.size(); ++i)
3089  aLst.Append( cCELLSTYLE, rCellStyles[i].GetName() );
3090  }
3091 
3092  if(!aLst.empty())
3093  {
3095  return Next();
3096  }
3097  return nullptr;
3098 }
3099 
3101 {
3103  ++nLastPos;
3104  if(nLastPos < aLst.size())
3105  {
3106  mxIterSheet->PresetNameAndFamily(aLst[nLastPos]);
3107  mxIterSheet->SetPhysical( false );
3108  mxIterSheet->SetMask( nMask );
3109  if(mxIterSheet->pSet)
3110  {
3111  mxIterSheet->pSet->ClearItem();
3112  mxIterSheet->pSet= nullptr;
3113  }
3114  return mxIterSheet.get();
3115  }
3116  return nullptr;
3117 }
3118 
3120 {
3121  // searching
3122  if( !bFirstCalled )
3123  First();
3124 
3125  nLastPos = aLst.FindName( nSearchFamily, rName );
3126  if( SAL_MAX_UINT32 != nLastPos )
3127  {
3128  // found
3129  mxStyleSheet->PresetNameAndFamily(aLst[nLastPos]);
3130  // new name is set, so determine its Data
3131  mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
3132  if( !mxStyleSheet->IsPhysical() )
3133  mxStyleSheet->SetPhysical( false );
3134 
3135  return mxStyleSheet.get();
3136  }
3137  return nullptr;
3138 }
3139 
3140 void SwStyleSheetIterator::AppendStyleList(const std::vector<OUString>& rList,
3141  bool bTestUsed, bool bTestHidden, bool bOnlyHidden,
3142  SwGetPoolIdFromName nSection, char cType )
3143 {
3144  SwDoc& rDoc = static_cast<SwDocStyleSheetPool*>(pBasePool)->GetDoc();
3145  bool bUsed = false;
3146  for (const auto & i : rList)
3147  {
3148  bool bHidden = false;
3149  sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(i, nSection);
3150  switch ( nSection )
3151  {
3153  {
3154  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolTextCollUsed( nId );
3155  SwFormat* pFormat = rDoc.FindTextFormatCollByName( i );
3156  bHidden = pFormat && pFormat->IsHidden( );
3157  }
3158  break;
3160  {
3161  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolFormatUsed( nId );
3162  SwFormat* pFormat = rDoc.FindCharFormatByName( i );
3163  bHidden = pFormat && pFormat->IsHidden( );
3164  }
3165  break;
3167  {
3168  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolFormatUsed( nId );
3169  SwFormat* pFormat = rDoc.FindFrameFormatByName( i );
3170  bHidden = pFormat && pFormat->IsHidden( );
3171  }
3172  break;
3174  {
3175  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolPageDescUsed( nId );
3176  SwPageDesc* pPgDesc = rDoc.FindPageDesc(i);
3177  bHidden = pPgDesc && pPgDesc->IsHidden( );
3178  }
3179  break;
3181  {
3182  SwNumRule* pRule = rDoc.FindNumRulePtr( i );
3183  bUsed = pRule && rDoc.IsUsed(*pRule);
3184  bHidden = pRule && pRule->IsHidden( );
3185  }
3186  break;
3187  default:
3188  OSL_ENSURE( false, "unknown PoolFormat-Id" );
3189  }
3190 
3191  bool bMatchHidden = ( bTestHidden && ( bHidden || !bOnlyHidden ) ) || ( !bTestHidden && ( !bHidden || bUsed ) );
3192  if ( ( !bTestUsed && bMatchHidden ) || ( bTestUsed && bUsed ) )
3193  aLst.Append( cType, i );
3194  }
3195 }
3196 
3198 {
3200  dynamic_cast<SwStyleSheetIterator&>(*pIter).InvalidateIterator();
3201 }
3202 
3204 {
3205  // potentially we could send an SfxHint to Notify but currently it's
3206  // iterating over the vector anyway so would still be slow - why does
3207  // this iterator not use a map?
3208  bFirstCalled = false;
3209  nLastPos = 0;
3210  aLst.clear();
3211 }
3212 
3214 {
3215  // search and remove from View-List!!
3216  const SfxStyleSheetHint* pStyleSheetHint = dynamic_cast<const SfxStyleSheetHint*>(&rHint);
3217  if( pStyleSheetHint &&
3218  SfxHintId::StyleSheetErased == pStyleSheetHint->GetId() )
3219  {
3220  SfxStyleSheetBase* pStyle = pStyleSheetHint->GetStyleSheet();
3221 
3222  if (pStyle)
3223  aLst.RemoveName(pStyle->GetFamily(), pStyle->GetName());
3224  }
3225 }
3226 
3227 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)=0
void UnLinkGraphics()
SwTextFormatColl * MakeTextFormatColl(const OUString &rFormatName, SwTextFormatColl *pDerivedFrom, bool bBroadcast=false)
Create the FormatCollections.
Definition: docfmt.cxx:877
virtual std::unique_ptr< SfxStyleSheetIterator > CreateIterator(SfxStyleFamily, SfxStyleSearchBits nMask=SfxStyleSearchBits::All) override
Definition: docstyle.cxx:2445
SfxStyleSheetBase * First(SfxStyleFamily eFamily, SfxStyleSearchBits eMask=SfxStyleSearchBits::All)
virtual OUString GetDescription(MapUnit eUnit) override
Definition: docstyle.cxx:824
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
tools::Long GetFirstLineIndent() const
virtual bool IsUsed() const override
Definition: docstyle.cxx:2236
bool IsUsed(const sw::BroadcastingModify &) const
Definition: poolfmt.cxx:86
const sal_uInt16 COLL_LISTS_BITS
Definition: poolfmt.hxx:66
SwStyleSheetIterator(SwDocStyleSheetPool &rBase, SfxStyleFamily eFam, SfxStyleSearchBits n)
Definition: docstyle.cxx:2652
int GetAssignedOutlineStyleLevel() const
Definition: fmtcol.cxx:599
const sal_uInt16 COLL_DOC_BITS
Definition: poolfmt.hxx:69
void PresetNameAndFamily(const OUString &rName)
Definition: docstyle.cxx:2201
virtual SfxItemSet & GetItemSet() override
Definition: docstyle.cxx:1324
Represents the style of a paragraph.
Definition: fmtcol.hxx:56
virtual bool GetPresentation(const SfxPoolItem &rItem, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
void ItemSetToPageDesc(const SfxItemSet &rSet, SwPageDesc &rPageDesc)
Definition: uitool.cxx:269
static const std::vector< OUString > & GetListsUINameArray()
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CTL_FONT(27)
static SwTextFormatColl * lcl_FindParaFormat(SwDoc &rDoc, const OUString &rName, SwDocStyleSheet *pStyle=nullptr, bool bCreate=true)
Definition: docstyle.cxx:171
virtual bool IsPoolFormatUsed(sal_uInt16 nId) const =0
SfxItemPool & GetPool()
SwCharFormat * FindCharFormatByName(std::u16string_view rName) const
Definition: doc.hxx:772
bool IsDefault() const
Definition: format.hxx:113
void SetDefDist(sal_uInt16 nNew)
SwTableAutoFormat * GetTableFormat()
Definition: docstyle.cxx:2190
virtual void SetHelpId(const OUString &r, sal_uLong nId) override
Definition: docstyle.cxx:2372
void SetPoolHelpId(sal_uInt16 nId)
Definition: format.hxx:152
SAL_DLLPRIVATE bool FillStyleSheet(FillStyleType eFType, std::unique_ptr< SfxItemSet > *o_ppFlatSet=nullptr)
Definition: docstyle.cxx:1862
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: docfmt.cxx:2113
void SetNumRule(const SwNumRule &rRule)
Definition: docstyle.cxx:2184
SwCharFormat * MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:843
SwDocShell * GetDocShell()
Definition: doc.hxx:1353
bool IsHidden() const
Definition: numrule.hxx:161
static bool lcl_Contains(const std::vector< void * > &rArr, const void *p)
Definition: docstyle.cxx:1779
std::string GetValue
virtual SfxStyleSheetBase * First() override
Definition: docstyle.cxx:2688
static const std::vector< OUString > & GetFrameFormatUINameArray()
const sal_uInt16 COLL_GET_RANGE_BITS
Definition: poolfmt.hxx:71
static void FillUIName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
bool IsHidden() const
Definition: format.hxx:165
void DelPageDesc(const OUString &rName, bool bBroadcast=false)
Definition: docdesc.cxx:883
void SetMinDist(bool bNew)
#define cCHAR
Definition: docstyle.cxx:74
sal_uInt16 char char * pDesc
static const std::vector< OUString > & GetHTMLUINameArray()
virtual void SetModified()=0
Must be called manually at changes of format.
sal_uIntPtr sal_uLong
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
void SetTable(bool bNew)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
virtual rtl::Reference< SfxStyleSheetBase > Create(const OUString &, SfxStyleFamily, SfxStyleSearchBits nMask) override
Definition: docstyle.cxx:2438
SwFrameFormat * MakeFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom, bool bBroadcast=false, bool bAuto=true)
Definition: docfmt.cxx:809
virtual bool HasParentSupport() const override
Definition: docstyle.cxx:795
OUString MakeParagraphStyleListString() const
Definition: number.cxx:858
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat IDs.
Definition: numrule.hxx:251
bool IsAutoRule() const
Definition: numrule.hxx:230
sal_Int64 n
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
const sal_uInt16 COLL_HTML_BITS
Definition: poolfmt.hxx:70
void GetGrabBagItem(css::uno::Any &rVal) const
Definition: number.cxx:1106
Definition: doc.hxx:187
constexpr sal_uInt16 RES_FRMATR_END(133)
void GetGrabBagItem(css::uno::Any &rVal) const
Definition: docstyle.cxx:556
virtual bool SetFollow(const OUString &rStr) override
Definition: docstyle.cxx:1209
SwPoolFormatList aLst
Definition: docstyle.hxx:167
virtual bool SetName(const OUString &rNewName, bool bReindexNow=true)
#define FN_COND_COLL
Definition: cmdid.h:797
sal_Int16 nId
sal_uInt16 GetPoolParent(sal_uInt16 nId)
Query defined parent of a POOL-ID Returns 0 if standard USHRT_MAX if no parent the parent in all othe...
Definition: poolfmt.cxx:150
bool IsPoolUserFormat(sal_uInt16 nId)
Definition: poolfmt.hxx:86
void RemoveName(SfxStyleFamily eFam, std::u16string_view rName)
Definition: docstyle.cxx:427
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
virtual bool HasFollowSupport() const override
Definition: docstyle.cxx:779
virtual const OUString & GetFollow() const override
Definition: docstyle.cxx:768
const OUString & GetName() const
Definition: numrule.hxx:225
virtual void SetHidden(bool bHidden) override
Definition: docstyle.cxx:583
void RenameFormat(SwFormat &rFormat, const OUString &sNewName, bool bBroadcast=false)
Definition: docfmt.cxx:1911
sal_uInt16 GetPoolHelpId() const
Query and set Help-IDs for document styles.
Definition: numrule.hxx:255
OUString GetUniqueNumRuleName(const OUString *pChkStr=nullptr, bool bAutoNum=true) const
Definition: docnum.cxx:2493
bool IsCJKFontEnabled() const
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(160)
void SetHidden(bool bValue)
Definition: numrule.hxx:162
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
static void lcl_SaveStyles(SfxStyleFamily nFamily, std::vector< void * > &rArr, SwDoc &rDoc)
Definition: docstyle.cxx:1725
static SwCharFormat * lcl_FindCharFormat(SwDoc &rDoc, const OUString &rName, SwDocStyleSheet *pStyle=nullptr, bool bCreate=true)
Definition: docstyle.cxx:130
constexpr TypedWhichId< XFillHatchItem > XATTR_FILLHATCH(XATTR_FILL_FIRST+3)
bool IsCTLFontEnabled() const
void AddAutoFormat(const SwTableAutoFormat &rFormat)
Append table style to the existing styles.
Definition: tblafmt.cxx:943
SfxStyleFamily GetFamily() const
virtual SwFrameFormat * GetFrameFormatFromPool(sal_uInt16 nId)=0
Return required automatic format.
const SwCellStyleTable & GetCellStyles() const
Definition: doc.hxx:1252
bool HasWriterListeners() const
Definition: calbck.hxx:197
SwFrameFormat * FindFrameFormatByName(std::u16string_view rName) const
Definition: docfmt.cxx:734
#define MIN_BORDER_DIST
Definition: swtypes.hxx:74
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CJK_POSTURE(25)
SfxStyleSearchBits GetMask() const
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
SfxHintId GetId() const
static const std::vector< OUString > & GetPageDescUINameArray()
static const CommandStruct * GetCmds()
Definition: ccoll.hxx:58
static std::unique_ptr< SfxItemSet > lcl_SwFormatToFlatItemSet(SwFormat const *const pFormat)
Definition: docstyle.cxx:1261
void SetFollow(const SwPageDesc *pNew)
Definition: pagedesc.hxx:315
XPatternListRef GetPatternList() const
const OUString & GetName() const
Definition: pagedesc.hxx:197
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:155
SwDocStyleSheetPool(SwDoc &, bool bOrganizer)
Definition: docstyle.cxx:2405
void DelCharFormat(size_t nFormat, bool bBroadcast=false)
Delete the formats.
Definition: docfmt.cxx:659
Used by the UI to modify the document model.
Definition: wrtsh.hxx:91
#define SAL_MAX_UINT32
static const std::vector< OUString > & GetDocUINameArray()
SfxStyleFamily nSearchFamily
SfxStyleSearchBits nMask
SfxStyleSheetBase * GetStyleSheet() const
virtual SfxStyleSheetBase * operator[](sal_Int32 nIdx) override
Definition: docstyle.cxx:2676
sal_uInt16 sal_Unicode
void SetGrabBagItem(const css::uno::Any &rVal)
Definition: number.cxx:1114
const SfxPoolItem * NextItem()
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:114
void SetMask(SfxStyleSearchBits mask)
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
const SwCharFormat * GetDfltCharFormat() const
Definition: doc.hxx:752
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
const OUString & GetName() const
virtual ~SwDocStyleSheetPool() override
Definition: docstyle.cxx:2413
static const std::vector< sal_Int32 > & GetTableTemplateMap()
Returns a vector of indexes in aBoxAutoFormat array. Returned indexes points to cells which are mappe...
Definition: tblafmt.cxx:890
void SetPoolFormatId(sal_uInt16 nId)
Definition: format.hxx:148
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat-Id.
Definition: pagedesc.hxx:276
rtl::Reference< SwDocStyleSheet > mxIterSheet
Definition: docstyle.hxx:165
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
const OUString sEmpty
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:426
void SetNextTextFormatColl(SwTextFormatColl &rNext)
Inline implementations.
Definition: fmtcol.hxx:257
const OUString & GetName() const
Definition: format.hxx:115
virtual SfxStyleSheetBase * Next() override
Definition: docstyle.cxx:3100
int nCount
void SetPoolHlpFileId(sal_uInt8 nId)
Definition: format.hxx:154
virtual void SetName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2471
SwFrameFormat * GetFrameFormat()
Definition: docstyle.cxx:2229
#define FN_PARAM_FTN_INFO
Definition: cmdid.h:769
virtual bool SetFollow(const OUString &)
virtual void DoUndo(bool const bDoUndo)=0
Enable/Disable Undo.
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
virtual const OUString & GetParent() const override
Definition: docstyle.cxx:714
SfxStyleSearchBits nMask
const SwPageDesc * GetPageDesc()
Definition: docstyle.cxx:2169
SfxStyleFamily
const sal_uInt16 COLL_REGISTER_BITS
Definition: poolfmt.hxx:68
bool RenameNumRule(const OUString &aOldName, const OUString &aNewName, bool bBroadcast=false)
Definition: docnum.cxx:1108
virtual bool IsEnableSetModified() const =0
SwCharFormat * GetCharFormat()
Definition: docstyle.cxx:2155
const sal_uInt16 POOLGRP_NOCOLLID
POOLCOLL-IDs: +-—+—+—+—+—+—+—+—+—+—+—+—+—+—+—+—+ !User! Range ! 0 ! Offset ! +-—+—+...
Definition: poolfmt.hxx:59
virtual bool DoesUndo() const =0
Is Undo enabled?
virtual bool SetParent(SfxStyleFamily eFam, const OUString &rStyle, const OUString &rParent) override
Definition: docstyle.cxx:2515
const char * sName
bool SetDerivedFrom(SwFormat *pDerivedFrom=nullptr)
0 is Default.
Definition: format.cxx:321
void PresetParent(const OUString &rName)
Definition: docstyle.hxx:119
static void lcl_DeleteInfoStyles(SfxStyleFamily nFamily, std::vector< void * > const &rArr, SwDoc &rDoc)
Definition: docstyle.cxx:1784
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:147
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
Specific frame formats (frames, DrawObjects).
SvxNumRule MakeSvxNumRule() const
Definition: number.cxx:911
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
Definition: docdesc.cxx:860
SwTableAutoFormat * pTableFormat
Definition: docstyle.hxx:56
Base class for various Writer styles.
Definition: format.hxx:46
void DelTextFormatColl(size_t nFormat, bool bBroadcast=false)
Definition: docfmt.cxx:948
static SwTableAutoFormat * lcl_FindTableStyle(SwDoc &rDoc, const OUString &rName, SwDocStyleSheet *pStyle=nullptr, bool bCreate=true)
Definition: docstyle.cxx:308
Table of Contents - heading.
Definition: poolfmt.hxx:342
virtual SfxStyleSheetBase * Find(const OUString &rStr) override
Definition: docstyle.cxx:3119
#define cCELLSTYLE
Definition: docstyle.cxx:80
SwNumRule * FindNumRulePtr(const OUString &rName) const
Definition: docnum.cxx:2415
virtual sal_uLong GetHelpId(OUString &rFile) override
Definition: docstyle.cxx:2273
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SwBoxAutoFormat * GetBoxFormat(std::u16string_view sName) const
If found returns a ptr to a BoxFormat. If not found returns nullptr.
Definition: tblafmt.cxx:1221
Style of a layout element.
Definition: frmfmt.hxx:58
constexpr OUStringLiteral sModel
const SwPageDesc * pDesc
Definition: docstyle.hxx:54
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
const SfxItemSet * GetParent() const
HTML-styles.
Definition: poolfmt.hxx:134
void InsertCondition(const SwCollCondition &rCond)
Definition: fmtcol.cxx:543
OUString GetTableTemplateCellSubName(const SwBoxAutoFormat &rBoxFormat) const
Returns the cell's name postfix. eg. ".1".
Definition: tblafmt.cxx:850
void Broadcast(const SfxHint &rHint)
constexpr TypedWhichId< XFillTransparenceItem > XATTR_FILLTRANSPARENCE(XATTR_FILL_FIRST+5)
constexpr TypedWhichId< XFillGradientItem > XATTR_FILLGRADIENT(XATTR_FILL_FIRST+2)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Internet visited.
Definition: poolfmt.hxx:121
int i
virtual bool IsPoolPageDescUsed(sal_uInt16 nId) const =0
static SwFrameFormat * lcl_FindFrameFormat(SwDoc &rDoc, const OUString &rName, SwDocStyleSheet *pStyle=nullptr, bool bCreate=true)
Definition: docstyle.cxx:209
size_t SetDocPattern(const OUString &rPatternName)
Definition: poolfmt.cxx:132
const SwBoxAutoFormat & GetBoxFormat(sal_uInt8 nPos) const
Definition: tblafmt.cxx:456
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
Subgroup headings.
Definition: poolfmt.hxx:261
virtual bool IsModified() const =0
Changes of document?
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:882
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:328
size_t size() const
Definition: tblafmt.cxx:1177
static const SwNumRule * lcl_FindNumRule(SwDoc &rDoc, const OUString &rName, SwDocStyleSheet *pStyle=nullptr, bool bCreate=true)
Definition: docstyle.cxx:277
virtual bool IsPoolTextCollUsed(sal_uInt16 nId) const =0
Check whether this "auto-collection" is used in document.
void SetAuto(bool bNew)
Definition: format.hxx:163
bool IsUserDefined() const
Check if style is defined by user.
Definition: tblafmt.hxx:228
void SetGrabBagItem(const css::uno::Any &rVal)
Definition: docstyle.cxx:507
Text body.
Definition: poolfmt.hxx:251
void AppendStyleList(const std::vector< OUString > &rLst, bool bUsed, bool bTestHidden, bool bOnlyHidden, SwGetPoolIdFromName nSection, char cType)
Definition: docstyle.cxx:3140
SfxStyleSheetBasePool * m_pPool
void SetHidden(bool bValue)
Definition: format.hxx:166
SwPageDesc * MakePageDesc(const OUString &rName, const SwPageDesc *pCpy=nullptr, bool bRegardLanguage=true, bool bBroadcast=false)
Definition: docdesc.cxx:678
virtual void Notify(SfxBroadcaster &, const SfxHint &) override
Definition: docstyle.cxx:3213
const OUString & GetValue() const
sal_uInt16 Count() const
size_t size() const
Definition: tblafmt.cxx:929
SwCharFormat * pCharFormat
Definition: docstyle.hxx:51
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
virtual void SetName(const OUString &rNewName, bool bBroadcast=false)
Definition: format.cxx:146
sal_uInt8 GetPoolHlpFileId() const
Definition: format.hxx:153
size_t GetPageDescCnt() const
Definition: doc.hxx:881
XGradientListRef GetGradientList() const
Internet normal.
Definition: poolfmt.hxx:120
float u
size_t size() const
Definition: docary.hxx:84
void MergeIndentAttrsOfListStyle(SfxItemSet &rSet)
new method for paragraph styles to merge indent attributes of applied list style into the given item ...
Definition: docstyle.cxx:1415
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:27
virtual bool SetParent(const OUString &rStr) override
Definition: docstyle.cxx:1158
const SwNumRule * pNumRule
Definition: docstyle.hxx:55
virtual std::unique_ptr< SfxItemSet > GetItemSetForPreview() override
Definition: docstyle.cxx:1281
#define COND_COMMAND_COUNT
Definition: ccoll.hxx:29
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:394
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:224
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
Definition: docdesc.cxx:891
const SwNumRule * GetNumRule()
Definition: docstyle.cxx:2176
void PresetFollow(const OUString &rName)
Definition: docstyle.hxx:120
sal_uInt8 GetPoolHlpFileId() const
Definition: numrule.hxx:257
const OUString * GetDocPattern(size_t nPos) const
Definition: poolfmt.cxx:123
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:388
void SetItemSet(const SfxItemSet &rSet, const bool bResetIndentAttrsAtParagraphStyle=false)
add optional parameter , default value false, which indicates that...
Definition: docstyle.cxx:1447
SwDocStyleSheet(SwDoc &rDoc, SwDocStyleSheetPool &rPool)
Definition: docstyle.cxx:454
void DeleteAssignmentToListLevelOfOutlineStyle()
Definition: fmtcol.cxx:633
constexpr sal_uInt16 RES_UNKNOWNATR_END(154)
bool IsHidden() const
Definition: pagedesc.hxx:217
void SetHidden(bool const bValue)
Definition: pagedesc.hxx:218
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
OUString SwResId(const char *pId)
Definition: swmodule.cxx:166
sal_uInt16 GetWhichByPos(sal_uInt16 nPos) const
bool IsAutoUpdateFormat() const
Query / set bAutoUpdateFormat-flag.
Definition: format.hxx:172
void SetPhysical(bool bPhys)
Definition: docstyle.cxx:2216
void Append(char cChar, std::u16string_view rStr)
Definition: docstyle.cxx:440
SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const
SAL_DLLPRIVATE void Create()
Make empty shell a real StyleSheet (Core).
Definition: docstyle.cxx:2080
sal_uInt32 FindName(SfxStyleFamily eFam, std::u16string_view rName)
Definition: docstyle.cxx:372
SfxStyleFamily nFamily
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily, SfxStyleSearchBits nMask=SfxStyleSearchBits::All) override
Definition: docstyle.cxx:2417
std::unique_ptr< SwTableAutoFormat > DelTableStyle(const OUString &rName, bool bBroadcast=false)
Definition: ndtbl.cxx:4601
const SwNumRuleItem & GetNumRule(bool=true) const
Definition: paratr.hxx:233
void SetHidden(bool bHidden)
Set if style is hidden.
Definition: tblafmt.hxx:238
void ResetAttrAtFormat(const sal_uInt16 nWhichId, SwFormat &rChangedFormat)
Definition: docfmt.cxx:482
void push_back(Value const &rVal)
Definition: docary.hxx:98
SwFrameFormat * pFrameFormat
Definition: docstyle.hxx:53
void SetGrabBagItem(const css::uno::Any &rVal)
Definition: format.cxx:734
void ClearInvalidItems()
const SwPageDesc * GetFollow() const
Definition: pagedesc.hxx:268
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:746
void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel)
Definition: fmtcol.cxx:606
FillStyleType
Fill StyleSheet with data.
Definition: docstyle.hxx:67
void SetParent(const SfxItemSet *pNew)
virtual SwNumRule * GetNumRuleFromPool(sal_uInt16 nId)=0
constexpr sal_uInt16 RES_UNKNOWNATR_BEGIN(RES_BOXATR_END)
sal_uInt16 GetCurPos() const
SvtBroadcaster & GetNotifier()
Definition: calbck.hxx:99
static const std::vector< OUString > & GetNumRuleUINameArray()
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
virtual ~SwStyleSheetIterator() override
Definition: docstyle.cxx:2663
const OUString & GetName() const
Definition: tblafmt.hxx:208
SwTableAutoFormatTable & GetTableStyles()
Return the available table styles.
Definition: ndtbl.cxx:3892
void CallChgLnk()
Definition: crsrsh.cxx:2524
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:79
const sal_uInt16 USER_FMT
POLLCOLL-groups:
Definition: poolfmt.hxx:63
SwFormat * DerivedFrom() const
Definition: format.hxx:112
SwTextFormatColl * FindTextFormatCollByName(std::u16string_view rName) const
Definition: doc.hxx:800
static const SwPageDesc * lcl_FindPageDesc(SwDoc &rDoc, const OUString &rName, SwDocStyleSheet *pStyle=nullptr, bool bCreate=true)
Definition: docstyle.cxx:243
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
sal_uInt32 nLastPos
Definition: docstyle.hxx:168
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
static const std::vector< OUString > & GetHTMLChrFormatUINameArray()
void CopyPageDesc(const SwPageDesc &rSrcDesc, SwPageDesc &rDstDesc, bool bCopyPoolIds=true)
Copy the complete PageDesc - beyond document and "deep"! Optionally copying of PoolFormatId, -HlpId can be prevented.
Definition: docfmt.cxx:1416
void Broadcast(const SfxHint &rHint)
static const std::vector< OUString > & GetChrFormatUINameArray()
constexpr TypedWhichId< XFillFloatTransparenceItem > XATTR_FILLFLOATTRANSPARENCE(XATTR_FILL_FIRST+11)
static const std::vector< OUString > & GetExtraUINameArray()
XHatchListRef GetHatchList() const
SwTextFormatColl * GetCollection()
Definition: docstyle.cxx:2162
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:739
bool IsHidden() const
Check if style is hidden.
Definition: tblafmt.hxx:226
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
bool AreListLevelIndentsApplicable() const
Definition: fmtcol.cxx:419
SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
Definition: number.cxx:1505
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CJK_WEIGHT(26)
static const SwBoxAutoFormat * lcl_FindCellStyle(SwDoc &rDoc, std::u16string_view rName, SwDocStyleSheet *pStyle)
Definition: docstyle.cxx:335
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetPoolHelpId() const
Get and set Help-IDs for document templates.
Definition: format.hxx:151
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All) override
Definition: docstyle.cxx:2571
#define SAL_WARN_IF(condition, area, stream)
virtual bool IsHidden() const override
Definition: docstyle.cxx:667
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:779
unsigned char sal_uInt8
void PageDescToItemSet(const SwPageDesc &rPageDesc, SfxItemSet &rSet)
Definition: uitool.cxx:428
virtual ~SwDocStyleSheet() override
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CTL_WEIGHT(31)
SwConditionTextFormatColl * MakeCondTextFormatColl(const OUString &rFormatName, SwTextFormatColl *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:911
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:254
rtl::Reference< SwDocStyleSheet > mxStyleSheet
Definition: docstyle.hxx:166
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1067
#define cTABSTYLE
Definition: docstyle.cxx:79
void GetGrabBagItem(css::uno::Any &rVal) const
Definition: format.cxx:726
SfxStyleSheetIterator * GetCachedIterator()
static void FillProgName(const OUString &rName, OUString &rFillName, SwGetPoolIdFromName)
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:176
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_CTL_POSTURE(30)
static const std::vector< OUString > & GetRegisterUINameArray()
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
bool bOrganizer
Organizer.
Definition: docstyle.hxx:198
void SetSvxRule(const SvxNumRule &, SwDoc *pDoc)
Definition: number.cxx:899
static const OUString & GetUIName(const OUString &rName, SwGetPoolIdFromName)
#define cFRAME
Definition: docstyle.cxx:76
virtual bool HasClearParentSupport() const override
Definition: docstyle.cxx:809
void * p
bool SetName(const OUString &rNewName)
Definition: pagedesc.cxx:148
sal_uInt16 MakeNumRule(const OUString &rName, const SwNumRule *pCpy=nullptr, bool bBroadcast=false, const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode=SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
Definition: docnum.cxx:2449
SwGetPoolIdFromName
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
OUString GetStyle(sal_uInt16 nPos) const
Definition: ccoll.cxx:148
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
#define cNUMRULE
Definition: docstyle.cxx:78
constexpr sal_uInt16 RES_CHRATR_END(46)
void ChgFormat(SwFormat &rFormat, const SfxItemSet &rSet)
Definition: docfmt.cxx:1879
XBitmapListRef GetBitmapList() const
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
Definition: docfmt.cxx:686
virtual sal_Int32 Count() override
Definition: docstyle.cxx:2668
void SetValid(SvxBoxInfoItemValidFlags nValid, bool bValid=true)
virtual void SetEnableSetModified(bool bEnableSetModified)=0
void CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet &rSet)
Definition: docfly.cxx:501
MapUnit
#define SAL_WARN(area, stream)
bool HasTableStyles() const
Counts table styles without triggering lazy-load of them.
Definition: doc.hxx:1244
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLBACKGROUND)
size_t size() const
#define cPAGE
Definition: docstyle.cxx:77
const sal_uInt16 COLL_TEXT_BITS
Definition: poolfmt.hxx:65
XColorListRef GetColorList() const
bool DelNumRule(const OUString &rName, bool bBroadCast=false)
Definition: docnum.cxx:1046
virtual bool SetName(const OUString &rNewName, bool bReindexNow=true) override
Definition: docstyle.cxx:1033
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:120
#define cPARA
Definition: docstyle.cxx:75
SwTextFormatColl * pColl
Definition: docstyle.hxx:52
SwTableAutoFormat * FindAutoFormat(std::u16string_view rName) const
Find table style with the provided name, return nullptr when not found.
Definition: tblafmt.cxx:995
const SwFrameFormats * GetFrameFormats() const
Definition: doc.hxx:737
SfxItemSet * pSet
bool IsInvalidItem(const SfxPoolItem *pItem)
Subgroup table.
Definition: poolfmt.hxx:341
void PreDelPageDesc(SwPageDesc const *pDel)
All descriptors whose Follow point to the to-be-deleted have to be adapted.
Definition: docdesc.cxx:593
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
bool SearchUsed() const
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CTL_FONTSIZE(28)
IDocumentListsAccess const & getIDocumentListsAccess() const
Definition: doc.cxx:293
tools::Long GetIndentAt() const
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
virtual OUString GetUsedBy() override
Definition: docstyle.cxx:2268
static const std::vector< OUString > & GetTextUINameArray()
bool IsAuto() const
Query / set AutoFormat-flag.
Definition: format.hxx:162
aStr
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
SfxStyleSheetBasePool * pBasePool
void RegisterToFormat(SwFormat &)
Definition: fmtcol.cxx:510
SfxStyleSearchBits
SwTableAutoFormat * MakeTableStyle(const OUString &rName, bool bBroadcast=false)
Definition: ndtbl.cxx:4581
rtl::Reference< SwDocStyleSheet > mxStyleSheet
Definition: docstyle.hxx:196
const SfxPoolItem * GetCurItem() const
SwTextFormatColl & GetNextTextFormatColl() const
Definition: fmtcol.hxx:102
const sal_uInt16 COLL_EXTRA_BITS
Definition: poolfmt.hxx:67
virtual OUString GetDescription(MapUnit eMetric)
void SetDist(bool bNew)
void ChgNumRuleFormats(const SwNumRule &rRule)
Definition: docnum.cxx:1086
SfxItemSet aCoreSet
Definition: docstyle.hxx:59
const SwBoxAutoFormat * pBoxFormat
Definition: docstyle.hxx:57
virtual void ResetModified()=0
virtual void Remove(SfxStyleSheetBase *pStyle) override
Definition: docstyle.cxx:2455
void SetAutoUpdateFormat(bool bNew=true)
Definition: format.hxx:173