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