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* m_pSh;
84  std::unique_ptr<CurrShell> m_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  m_pSh = rDoc.GetDocShell()->GetWrtShell();
98  else
99  m_pSh = nullptr;
100 
101  if( m_pSh )
102  {
103  m_pCurrSh.reset( new CurrShell( m_pSh ) );
104  m_pSh->StartAllAction();
105  }
106 }
107 
108 SwImplShellAction::~SwImplShellAction() COVERITY_NOEXCEPT_FALSE
109 {
110  if( m_pCurrSh )
111  {
112  m_pSh->EndAllAction();
113  m_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 void SwDocStyleSheet::SetLink(const OUString& rStr)
737 {
738  SwImplShellAction aTmpSh(m_rDoc);
739  switch (nFamily)
740  {
741  case SfxStyleFamily::Para:
742  {
743  if (m_pColl)
744  {
746  if (pLink)
747  {
748  m_pColl->SetLinkedCharFormat(*pLink);
749  }
750  }
751  break;
752  }
753  case SfxStyleFamily::Char:
754  {
755  if (m_pCharFormat)
756  {
758  if (pLink)
759  {
761  }
762  }
763  break;
764  }
765  default:
766  break;
767  }
768 }
769 
770 const OUString& SwDocStyleSheet::GetLink() const
771 {
772  if (!m_bPhysical)
773  {
774  SwDocStyleSheet* pThis = const_cast<SwDocStyleSheet*>(this);
775  pThis->FillStyleSheet(FillAllInfo);
776  }
777 
778  return m_aLink;
779 }
780 
781 // What Linkage is possible
783 {
784  switch(nFamily)
785  {
786  case SfxStyleFamily::Para :
787  case SfxStyleFamily::Page : return true;
788  case SfxStyleFamily::Frame:
789  case SfxStyleFamily::Char :
790  case SfxStyleFamily::Pseudo: return false;
791  default:
792  OSL_ENSURE(false, "unknown style family");
793  }
794  return false;
795 }
796 
797 // Parent ?
799 {
800  bool bRet = false;
801  switch(nFamily)
802  {
803  case SfxStyleFamily::Char :
804  case SfxStyleFamily::Para :
805  case SfxStyleFamily::Frame: bRet = true;
806  break;
807  default:; //prevent warning
808  }
809  return bRet;
810 }
811 
813 {
814  bool bRet = false;
815  switch(nFamily)
816  {
817  case SfxStyleFamily::Para :
818  case SfxStyleFamily::Char :
819  case SfxStyleFamily::Frame: bRet = true;
820  break;
821  default:; //prevent warning
822  }
823  return bRet;
824 }
825 
826 // determine textual description
828 {
829  IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
830 
831  static const OUStringLiteral sPlus(u" + ");
832  if ( SfxStyleFamily::Page == nFamily )
833  {
834  if( !pSet )
835  GetItemSet();
836 
837  SfxItemIter aIter( *pSet );
838  OUStringBuffer aDesc;
839 
840  for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
841  {
842  if(!IsInvalidItem(pItem))
843  {
844  switch ( pItem->Which() )
845  {
846  case RES_LR_SPACE:
847  case SID_ATTR_PAGE_SIZE:
848  case SID_ATTR_PAGE_MAXSIZE:
849  case SID_ATTR_PAGE_PAPERBIN:
850  case SID_ATTR_BORDER_INNER:
851  break;
852  default:
853  {
854  OUString aItemPresentation;
855  if ( !IsInvalidItem( pItem ) &&
857  *pItem, eUnit, aItemPresentation, aIntlWrapper ) )
858  {
859  if ( !aDesc.isEmpty() && !aItemPresentation.isEmpty() )
860  aDesc.append(sPlus);
861  aDesc.append(aItemPresentation);
862  }
863  }
864  }
865  }
866  }
867  return aDesc.makeStringAndClear();
868  }
869 
870  if ( SfxStyleFamily::Frame == nFamily || SfxStyleFamily::Para == nFamily || SfxStyleFamily::Char == nFamily )
871  {
872  if( !pSet )
873  GetItemSet();
874 
875  SfxItemIter aIter( *pSet );
876  OUStringBuffer aDesc;
877  OUString sPageNum;
878  OUString sModel;
879  OUString sBreak;
880  bool bHasWesternFontPrefix = false;
881  bool bHasCJKFontPrefix = false;
882  bool bHasCTLFontPrefix = false;
883  SvtCTLOptions aCTLOptions;
884 
885  // Get currently used FillStyle and remember, also need the XFillFloatTransparenceItem
886  // to decide if gradient transparence is used
887  const drawing::FillStyle eFillStyle(pSet->Get(XATTR_FILLSTYLE).GetValue());
888  const bool bUseFloatTransparence(pSet->Get(XATTR_FILLFLOATTRANSPARENCE).IsEnabled());
889 
890  for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
891  {
892  if(!IsInvalidItem(pItem))
893  {
894  switch ( pItem->Which() )
895  {
896  case SID_ATTR_AUTO_STYLE_UPDATE:
897  case RES_PAGEDESC:
898  break;
899  default:
900  {
901  OUString aItemPresentation;
902  if ( !IsInvalidItem( pItem ) &&
904  *pItem, eUnit, aItemPresentation, aIntlWrapper ) )
905  {
906  bool bIsDefault = false;
907  switch ( pItem->Which() )
908  {
909  case XATTR_FILLCOLOR:
910  {
911  // only use active FillStyle information
912  bIsDefault = (drawing::FillStyle_SOLID == eFillStyle);
913  break;
914  }
915  case XATTR_FILLGRADIENT:
916  {
917  // only use active FillStyle information
918  bIsDefault = (drawing::FillStyle_GRADIENT == eFillStyle);
919  break;
920  }
921  case XATTR_FILLHATCH:
922  {
923  // only use active FillStyle information
924  bIsDefault = (drawing::FillStyle_HATCH == eFillStyle);
925  break;
926  }
927  case XATTR_FILLBITMAP:
928  {
929  // only use active FillStyle information
930  bIsDefault = (drawing::FillStyle_BITMAP == eFillStyle);
931  break;
932  }
934  {
935  // only active when not FloatTransparence
936  bIsDefault = !bUseFloatTransparence;
937  break;
938  }
940  {
941  // only active when FloatTransparence
942  bIsDefault = bUseFloatTransparence;
943  break;
944  }
945 
946  case SID_ATTR_PARA_PAGENUM:
947  sPageNum = aItemPresentation;
948  break;
949  case SID_ATTR_PARA_MODEL:
950  sModel = aItemPresentation;
951  break;
952  case RES_BREAK:
953  sBreak = aItemPresentation;
954  break;
955  case RES_CHRATR_CJK_FONT:
961  bIsDefault = true;
962  if(!bHasCJKFontPrefix)
963  {
964  aItemPresentation = SwResId(STR_CJK_FONT) + aItemPresentation;
965  bHasCJKFontPrefix = true;
966  }
967  break;
968  case RES_CHRATR_CTL_FONT:
973  if(aCTLOptions.IsCTLFontEnabled())
974  bIsDefault = true;
975  if(!bHasCTLFontPrefix)
976  {
977  aItemPresentation = SwResId(STR_CTL_FONT) + aItemPresentation;
978  bHasCTLFontPrefix = true;
979  }
980  break;
981  case RES_CHRATR_FONT:
982  case RES_CHRATR_FONTSIZE:
983  case RES_CHRATR_LANGUAGE:
984  case RES_CHRATR_POSTURE:
985  case RES_CHRATR_WEIGHT:
986  if(!bHasWesternFontPrefix)
987  {
988  aItemPresentation = SwResId(STR_WESTERN_FONT) + aItemPresentation;
989  bHasWesternFontPrefix = true;
990  }
991  [[fallthrough]];
992  default:
993  bIsDefault = true;
994  }
995  if(bIsDefault)
996  {
997  if ( !aDesc.isEmpty() && !aItemPresentation.isEmpty() )
998  aDesc.append(sPlus);
999  aDesc.append(aItemPresentation);
1000  }
1001  }
1002  }
1003  }
1004  }
1005  }
1006  // Special treatment for Break, Page template and Site offset
1007  if (!sModel.isEmpty())
1008  {
1009  if (!aDesc.isEmpty())
1010  aDesc.append(sPlus);
1011  aDesc.append(SwResId(STR_PAGEBREAK) + sPlus + sModel);
1012  if (sPageNum != "0")
1013  {
1014  aDesc.append(sPlus + SwResId(STR_PAGEOFFSET) + sPageNum);
1015  }
1016  }
1017  else if (!sBreak.isEmpty()) // Break can be valid only when NO Model
1018  {
1019  if (!aDesc.isEmpty())
1020  aDesc.append(sPlus);
1021  aDesc.append(sBreak);
1022  }
1023  return aDesc.makeStringAndClear();
1024  }
1025 
1026  if( SfxStyleFamily::Pseudo == nFamily )
1027  {
1028  return OUString();
1029  }
1030 
1031  return SfxStyleSheetBase::GetDescription(eUnit);
1032 }
1033 
1034 // Set names
1035 bool SwDocStyleSheet::SetName(const OUString& rStr, bool bReindexNow)
1036 {
1037  if( rStr.isEmpty() )
1038  return false;
1039 
1040  if( aName != rStr )
1041  {
1042  if( !SfxStyleSheetBase::SetName(rStr, bReindexNow))
1043  return false;
1044  }
1045  else if(!m_bPhysical)
1047 
1048  bool bChg = false;
1049  switch(nFamily)
1050  {
1051  case SfxStyleFamily::Char :
1052  {
1053  OSL_ENSURE(m_pCharFormat, "SwCharFormat missing!");
1054  if( m_pCharFormat && m_pCharFormat->GetName() != rStr )
1055  {
1056  if (!m_pCharFormat->GetName().isEmpty())
1058  else
1059  m_pCharFormat->SetName(rStr);
1060 
1061  bChg = true;
1062  }
1063  break;
1064  }
1065  case SfxStyleFamily::Para :
1066  {
1067  OSL_ENSURE(m_pColl, "Collection missing!");
1068  if( m_pColl && m_pColl->GetName() != rStr )
1069  {
1070  if (!m_pColl->GetName().isEmpty())
1071  m_rDoc.RenameFormat(*m_pColl, rStr);
1072  else
1073  m_pColl->SetName(rStr);
1074 
1075  bChg = true;
1076  }
1077  break;
1078  }
1079  case SfxStyleFamily::Frame:
1080  {
1081  OSL_ENSURE(m_pFrameFormat, "FrameFormat missing!");
1082  if( m_pFrameFormat && m_pFrameFormat->GetName() != rStr )
1083  {
1084  if (!m_pFrameFormat->GetName().isEmpty())
1086  else
1087  m_pFrameFormat->SetName( rStr );
1088 
1089  bChg = true;
1090  }
1091  break;
1092  }
1093  case SfxStyleFamily::Page :
1094  OSL_ENSURE(m_pDesc, "PageDesc missing!");
1095  if( m_pDesc && m_pDesc->GetName() != rStr )
1096  {
1097  // Set PageDesc - copy with earlier one - probably not
1098  // necessary for setting the name. So here we allow a
1099  // cast.
1100  SwPageDesc aPageDesc(*const_cast<SwPageDesc*>(m_pDesc));
1101  const OUString aOldName(aPageDesc.GetName());
1102 
1103  aPageDesc.SetName( rStr );
1104  bool const bDoesUndo = m_rDoc.GetIDocumentUndoRedo().DoesUndo();
1105 
1106  m_rDoc.GetIDocumentUndoRedo().DoUndo(!aOldName.isEmpty());
1107  m_rDoc.ChgPageDesc(aOldName, aPageDesc);
1108  m_rDoc.GetIDocumentUndoRedo().DoUndo(bDoesUndo);
1109 
1111  bChg = true;
1112  }
1113  break;
1114  case SfxStyleFamily::Pseudo:
1115  OSL_ENSURE(m_pNumRule, "NumRule missing!");
1116 
1117  if (m_pNumRule)
1118  {
1119  OUString aOldName = m_pNumRule->GetName();
1120 
1121  if (!aOldName.isEmpty())
1122  {
1123  if ( aOldName != rStr &&
1124  m_rDoc.RenameNumRule(aOldName, rStr))
1125  {
1128 
1129  bChg = true;
1130  }
1131  }
1132  else
1133  {
1134  // #i91400#
1135  const_cast<SwNumRule*>(m_pNumRule)->SetName( rStr, m_rDoc.getIDocumentListsAccess() );
1137 
1138  bChg = true;
1139  }
1140  }
1141 
1142  break;
1143 
1144  default:
1145  OSL_ENSURE(false, "unknown style family");
1146  }
1147 
1148  if( bChg )
1149  {
1150  m_pPool->First(nFamily); // internal list has to be updated
1151  m_pPool->Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified, *this ) );
1152  SwEditShell* pSh = m_rDoc.GetEditShell();
1153  if( pSh )
1154  pSh->CallChgLnk();
1155  }
1156  return true;
1157 }
1158 
1159 // hierarchy of deduction
1160 bool SwDocStyleSheet::SetParent( const OUString& rStr)
1161 {
1162  SwFormat* pFormat = nullptr, *pParent = nullptr;
1163  switch(nFamily)
1164  {
1165  case SfxStyleFamily::Char :
1166  OSL_ENSURE( m_pCharFormat, "SwCharFormat missing!" );
1167  if( nullptr != ( pFormat = m_pCharFormat ) && !rStr.isEmpty() )
1168  pParent = lcl_FindCharFormat(m_rDoc, rStr);
1169  break;
1170 
1171  case SfxStyleFamily::Para :
1172  OSL_ENSURE( m_pColl, "Collection missing!");
1173  if( nullptr != ( pFormat = m_pColl ) && !rStr.isEmpty() )
1174  pParent = lcl_FindParaFormat( m_rDoc, rStr );
1175  break;
1176 
1177  case SfxStyleFamily::Frame:
1178  OSL_ENSURE(m_pFrameFormat, "FrameFormat missing!");
1179  if( nullptr != ( pFormat = m_pFrameFormat ) && !rStr.isEmpty() )
1180  pParent = lcl_FindFrameFormat( m_rDoc, rStr );
1181  break;
1182 
1183  case SfxStyleFamily::Page:
1184  case SfxStyleFamily::Pseudo:
1185  break;
1186  default:
1187  OSL_ENSURE(false, "unknown style family");
1188  }
1189 
1190  bool bRet = false;
1191  if( pFormat && pFormat->DerivedFrom() &&
1192  pFormat->DerivedFrom()->GetName() != rStr )
1193  {
1194  {
1195  SwImplShellAction aTmp( m_rDoc );
1196  bRet = pFormat->SetDerivedFrom( pParent );
1197  }
1198 
1199  if( bRet )
1200  {
1201  aParent = rStr;
1202  m_pPool->Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified,
1203  *this ) );
1204  }
1205  }
1206 
1207  return bRet;
1208 }
1209 
1210 // Set Follower
1211 bool SwDocStyleSheet::SetFollow( const OUString& rStr)
1212 {
1213  if( !rStr.isEmpty() && !SfxStyleSheetBase::SetFollow( rStr ))
1214  return false;
1215 
1216  SwImplShellAction aTmpSh( m_rDoc );
1217  switch(nFamily)
1218  {
1219  case SfxStyleFamily::Para :
1220  {
1221  OSL_ENSURE(m_pColl, "Collection missing!");
1222  if( m_pColl )
1223  {
1224  SwTextFormatColl* pFollow = m_pColl;
1225  if( !rStr.isEmpty() && nullptr == (pFollow = lcl_FindParaFormat(m_rDoc, rStr) ))
1226  pFollow = m_pColl;
1227 
1228  m_pColl->SetNextTextFormatColl(*pFollow);
1229  }
1230  break;
1231  }
1232  case SfxStyleFamily::Page :
1233  {
1234  OSL_ENSURE(m_pDesc, "PageDesc missing!");
1235  if( m_pDesc )
1236  {
1237  const SwPageDesc* pFollowDesc = !rStr.isEmpty()
1238  ? lcl_FindPageDesc(m_rDoc, rStr)
1239  : nullptr;
1240  size_t nId = 0;
1241  if (pFollowDesc != m_pDesc->GetFollow() && m_rDoc.FindPageDesc(m_pDesc->GetName(), &nId))
1242  {
1243  SwPageDesc aDesc( *m_pDesc );
1244  aDesc.SetFollow( pFollowDesc );
1245  m_rDoc.ChgPageDesc( nId, aDesc );
1246  m_pDesc = &m_rDoc.GetPageDesc( nId );
1247  }
1248  }
1249  break;
1250  }
1251  case SfxStyleFamily::Char:
1252  case SfxStyleFamily::Frame:
1253  case SfxStyleFamily::Pseudo:
1254  break;
1255  default:
1256  OSL_ENSURE(false, "unknown style family");
1257  }
1258 
1259  return true;
1260 }
1261 
1262 static
1263 void lcl_SwFormatToFlatItemSet(SwFormat const *const pFormat, std::optional<SfxItemSet>& pRet)
1264 {
1265  // note: we don't add the odd items that GetItemSet() would add
1266  // because they don't seem relevant for preview
1267  std::vector<SfxItemSet const*> sets;
1268  sets.push_back(&pFormat->GetAttrSet());
1269  while (SfxItemSet const*const pParent = sets.back()->GetParent())
1270  {
1271  sets.push_back(pParent);
1272  }
1273  // start by copying top-level parent set
1274  pRet.emplace(*sets.back());
1275  sets.pop_back();
1276  for (auto iter = sets.rbegin(); iter != sets.rend(); ++iter)
1277  { // in reverse so child overrides parent
1278  pRet->Put(**iter);
1279  }
1280 }
1281 
1282 std::optional<SfxItemSet> SwDocStyleSheet::GetItemSetForPreview()
1283 {
1284  if (SfxStyleFamily::Page == nFamily || SfxStyleFamily::Pseudo == nFamily || SfxStyleFamily::Table == nFamily)
1285  {
1286  SAL_WARN("sw.ui", "GetItemSetForPreview not implemented for page or number or table style");
1287  return std::optional<SfxItemSet>();
1288  }
1289  if (!m_bPhysical)
1290  {
1291  // because not only this style, but also any number of its parents
1292  // (or follow style) may not actually exist in the document at this
1293  // time, return one "flattened" item set that contains all items from
1294  // all parents.
1295  std::optional<SfxItemSet> pRet;
1296 
1297  bool bModifiedEnabled = m_rDoc.getIDocumentState().IsEnableSetModified();
1299 
1300  FillStyleSheet(FillPreview, &pRet);
1301 
1302  m_rDoc.getIDocumentState().SetEnableSetModified(bModifiedEnabled);
1303 
1304  assert(pRet);
1305  return pRet;
1306  }
1307  else
1308  {
1309  std::optional<SfxItemSet> pRet;
1310  switch (nFamily)
1311  {
1312  case SfxStyleFamily::Char:
1314  break;
1315  case SfxStyleFamily::Para:
1317  break;
1318  case SfxStyleFamily::Frame:
1320  break;
1321  default:
1322  std::abort();
1323  }
1324  return pRet;
1325  }
1326 }
1327 
1328 // extract ItemSet to Name and Family, Mask
1329 
1331 {
1332  if(!m_bPhysical)
1334 
1335  switch(nFamily)
1336  {
1337  case SfxStyleFamily::Char:
1338  case SfxStyleFamily::Para:
1339  case SfxStyleFamily::Frame:
1340  {
1341  SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1342  aBoxInfo.SetTable( false );
1343  aBoxInfo.SetDist( true ); // always show gap field
1344  aBoxInfo.SetMinDist( true );// set minimum size in tables and paragraphs
1345  aBoxInfo.SetDefDist( MIN_BORDER_DIST );// always set Default-Gap
1346  // Single lines can only have DontCare-Status in tables
1347  aBoxInfo.SetValid( SvxBoxInfoItemValidFlags::DISABLE );
1348 
1349  if( nFamily == SfxStyleFamily::Char )
1350  {
1351  SAL_WARN_IF(!m_pCharFormat, "sw.ui", "Where's SwCharFormat");
1353  m_aCoreSet.Put( aBoxInfo );
1354 
1355  if(m_pCharFormat->DerivedFrom())
1357  }
1358  else if ( nFamily == SfxStyleFamily::Para )
1359  {
1360  OSL_ENSURE(m_pColl, "Where's Collection");
1362  m_aCoreSet.Put( aBoxInfo );
1363  m_aCoreSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, m_pColl->IsAutoUpdateFormat()));
1364 
1365  if(m_pColl->DerivedFrom())
1367  }
1368  else
1369  {
1370  OSL_ENSURE(m_pFrameFormat, "Where's FrameFormat");
1372  m_aCoreSet.Put( aBoxInfo );
1373  m_aCoreSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, m_pFrameFormat->IsAutoUpdateFormat()));
1374 
1377 
1378  // create needed items for XPropertyList entries from the DrawModel so that
1379  // the Area TabPage can access them
1381 
1382  m_aCoreSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE));
1383  m_aCoreSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST));
1384  m_aCoreSet.Put(SvxHatchListItem(pDrawModel->GetHatchList(), SID_HATCH_LIST));
1385  m_aCoreSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), SID_BITMAP_LIST));
1386  m_aCoreSet.Put(SvxPatternListItem(pDrawModel->GetPatternList(), SID_PATTERN_LIST));
1387  }
1388  }
1389  break;
1390 
1391  case SfxStyleFamily::Page :
1392  {
1393  // set correct parent to get the drawing::FillStyle_NONE FillStyle as needed
1394  if(!m_aCoreSet.GetParent())
1395  {
1397  }
1398 
1399  OSL_ENSURE(m_pDesc, "No PageDescriptor");
1400  ::PageDescToItemSet(*const_cast<SwPageDesc*>(m_pDesc), m_aCoreSet);
1401  }
1402  break;
1403 
1404  case SfxStyleFamily::Pseudo:
1405  {
1406  OSL_ENSURE(m_pNumRule, "No NumRule");
1408  m_aCoreSet.Put(SvxNumBulletItem(std::move(aRule)));
1409  }
1410  break;
1411 
1412  default:
1413  OSL_ENSURE(false, "unknown style family");
1414  }
1415  // Member of Baseclass
1416  pSet = &m_aCoreSet;
1417 
1418  return m_aCoreSet;
1419 }
1420 
1422 {
1423  if ( nFamily != SfxStyleFamily::Para )
1424  {
1425  return;
1426  }
1427 
1428  OSL_ENSURE( m_pColl, "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - missing paragraph style");
1430  return;
1431 
1432  OSL_ENSURE( m_pColl->GetItemState( RES_PARATR_NUMRULE ) == SfxItemState::SET,
1433  "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - list level indents are applicable at paragraph style, but no list style found. Serious defect." );
1434  const OUString sNumRule = m_pColl->GetNumRule().GetValue();
1435  if (sNumRule.isEmpty())
1436  return;
1437 
1438  const SwNumRule* pRule = m_rDoc.FindNumRulePtr( sNumRule );
1439  if( pRule )
1440  {
1441  const SwNumFormat& rFormat = pRule->Get( 0 );
1443  {
1445  aLR.SetTextLeft( rFormat.GetIndentAt() );
1446  aLR.SetTextFirstLineOffset( static_cast<short>(rFormat.GetFirstLineIndent()) );
1447  rSet.Put( aLR );
1448  }
1449  }
1450 }
1451 
1452 // handling of parameter <bResetIndentAttrsAtParagraphStyle>
1454  const bool bResetIndentAttrsAtParagraphStyle )
1455 {
1456  // if applicable determine format first
1457  if(!m_bPhysical)
1459 
1460  SwImplShellAction aTmpSh( m_rDoc );
1461 
1462  OSL_ENSURE( &rSet != &m_aCoreSet, "SetItemSet with own Set is not allowed" );
1463 
1465  {
1466  SwRewriter aRewriter;
1467  aRewriter.AddRule( UndoArg1, GetName() );
1469  }
1470 
1471  SwFormat* pFormat = nullptr;
1472  std::unique_ptr<SwPageDesc> pNewDsc;
1473  size_t nPgDscPos = 0;
1474 
1475  switch(nFamily)
1476  {
1477  case SfxStyleFamily::Char :
1478  {
1479  OSL_ENSURE(m_pCharFormat, "Where's CharFormat");
1480  pFormat = m_pCharFormat;
1481  }
1482  break;
1483 
1484  case SfxStyleFamily::Para :
1485  {
1486  OSL_ENSURE(m_pColl, "Where's Collection");
1487  const SfxPoolItem* pAutoUpdate;
1488  if(SfxItemState::SET == rSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE,false, &pAutoUpdate ))
1489  {
1490  m_pColl->SetAutoUpdateFormat(static_cast<const SfxBoolItem*>(pAutoUpdate)->GetValue());
1491  }
1492 
1493  const SwCondCollItem* pCondItem;
1494  if( SfxItemState::SET != rSet.GetItemState( FN_COND_COLL, false,
1495  reinterpret_cast<const SfxPoolItem**>(&pCondItem) ))
1496  pCondItem = nullptr;
1497 
1498  if( RES_CONDTXTFMTCOLL == m_pColl->Which() && pCondItem )
1499  {
1500  const CommandStruct* pCmds = SwCondCollItem::GetCmds();
1501  for(sal_uInt16 i = 0; i < COND_COMMAND_COUNT; i++)
1502  {
1503  SwCollCondition aCond( nullptr, pCmds[ i ].nCnd, pCmds[ i ].nSubCond );
1504  static_cast<SwConditionTextFormatColl*>(m_pColl)->RemoveCondition( aCond );
1505  const OUString sStyle = pCondItem->GetStyle( i );
1506  if (sStyle.isEmpty())
1507  continue;
1508  SwFormat *const pFindFormat = lcl_FindParaFormat( m_rDoc, sStyle );
1509  if (pFindFormat)
1510  {
1511  aCond.RegisterToFormat( *pFindFormat );
1512  static_cast<SwConditionTextFormatColl*>(m_pColl)->InsertCondition( aCond );
1513  }
1514  }
1515 
1517  }
1518  else if( pCondItem && !m_pColl->HasWriterListeners() )
1519  {
1520  // no conditional template, then first create and adopt
1521  // all important values
1523  m_pColl->GetName(), static_cast<SwTextFormatColl*>(m_pColl->DerivedFrom()) );
1526 
1529  else
1531 
1532  const CommandStruct* pCmds = SwCondCollItem::GetCmds();
1533  for( sal_uInt16 i = 0; i < COND_COMMAND_COUNT; ++i )
1534  {
1535  const OUString sStyle = pCondItem->GetStyle( i );
1536  if (sStyle.isEmpty())
1537  continue;
1538  SwTextFormatColl *const pFindFormat = lcl_FindParaFormat( m_rDoc, sStyle );
1539  if (pFindFormat)
1540  {
1541  pCColl->InsertCondition( SwCollCondition( pFindFormat,
1542  pCmds[ i ].nCnd, pCmds[ i ].nSubCond ) );
1543  }
1544  }
1545 
1547  m_pColl = pCColl;
1548  }
1549  if ( bResetIndentAttrsAtParagraphStyle &&
1550  rSet.GetItemState( RES_PARATR_NUMRULE, false ) == SfxItemState::SET &&
1551  rSet.GetItemState( RES_LR_SPACE, false ) != SfxItemState::SET &&
1552  m_pColl->GetItemState( RES_LR_SPACE, false ) == SfxItemState::SET )
1553  {
1555  }
1556 
1557  // #i56252: If a standard numbering style is assigned to a standard paragraph style
1558  // we have to create a physical instance of the numbering style. If we do not and
1559  // neither the paragraph style nor the numbering style is used in the document
1560  // the numbering style will not be saved with the document and the assignment got lost.
1561  const SfxPoolItem* pNumRuleItem = nullptr;
1562  if( SfxItemState::SET == rSet.GetItemState( RES_PARATR_NUMRULE, false, &pNumRuleItem ) )
1563  { // Setting a numbering rule?
1564  const OUString sNumRule = static_cast<const SwNumRuleItem*>(pNumRuleItem)->GetValue();
1565  if (!sNumRule.isEmpty())
1566  {
1567  SwNumRule* pRule = m_rDoc.FindNumRulePtr( sNumRule );
1568  if( !pRule )
1569  { // Numbering rule not in use yet.
1570  sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( sNumRule, SwGetPoolIdFromName::NumRule );
1571  if( USHRT_MAX != nPoolId ) // It's a standard numbering rule
1572  {
1573  m_rDoc.getIDocumentStylePoolAccess().GetNumRuleFromPool( nPoolId ); // Create numbering rule (physical)
1574  }
1575  }
1576  }
1577  }
1578 
1579  pFormat = m_pColl;
1580 
1581  sal_uInt16 nId = m_pColl->GetPoolFormatId() &
1583  switch( GetMask() & ( static_cast<SfxStyleSearchBits>(0x0fff) & ~SfxStyleSearchBits::SwCondColl ) )
1584  {
1585  case SfxStyleSearchBits::SwText:
1586  nId |= COLL_TEXT_BITS;
1587  break;
1588  case SfxStyleSearchBits::SwChapter:
1589  nId |= COLL_DOC_BITS;
1590  break;
1591  case SfxStyleSearchBits::SwList:
1592  nId |= COLL_LISTS_BITS;
1593  break;
1594  case SfxStyleSearchBits::SwIndex:
1595  nId |= COLL_REGISTER_BITS;
1596  break;
1597  case SfxStyleSearchBits::SwExtra:
1598  nId |= COLL_EXTRA_BITS;
1599  break;
1600  case SfxStyleSearchBits::SwHtml:
1601  nId |= COLL_HTML_BITS;
1602  break;
1603  default: break;
1604  }
1605  m_pColl->SetPoolFormatId( nId );
1606  break;
1607  }
1608  case SfxStyleFamily::Frame:
1609  {
1610  OSL_ENSURE(m_pFrameFormat, "Where's FrameFormat");
1611  const SfxPoolItem* pAutoUpdate;
1612  if(SfxItemState::SET == rSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE,false, &pAutoUpdate ))
1613  {
1614  m_pFrameFormat->SetAutoUpdateFormat(static_cast<const SfxBoolItem*>(pAutoUpdate)->GetValue());
1615  }
1616  pFormat = m_pFrameFormat;
1617  }
1618  break;
1619 
1620  case SfxStyleFamily::Page :
1621  {
1622  OSL_ENSURE(m_pDesc, "Where's PageDescriptor");
1623 
1624  if (m_rDoc.FindPageDesc(m_pDesc->GetName(), &nPgDscPos))
1625  {
1626  pNewDsc.reset( new SwPageDesc( *m_pDesc ) );
1627  // #i48949# - no undo actions for the
1628  // copy of the page style
1630  m_rDoc.CopyPageDesc(*m_pDesc, *pNewDsc); // #i7983#
1631 
1632  pFormat = &pNewDsc->GetMaster();
1633  }
1634  }
1635  break;
1636 
1637  case SfxStyleFamily::Pseudo:
1638  {
1639  OSL_ENSURE(m_pNumRule, "Where's NumRule");
1640 
1641  if (!m_pNumRule)
1642  break;
1643 
1644  const SfxPoolItem* pItem;
1645  switch( rSet.GetItemState( SID_ATTR_NUMBERING_RULE, false, &pItem ))
1646  {
1647  case SfxItemState::SET:
1648  {
1649  SvxNumRule& rSetRule = const_cast<SvxNumRule&>(static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule());
1650  rSetRule.UnLinkGraphics();
1651  SwNumRule aSetRule(*m_pNumRule);
1652  aSetRule.SetSvxRule(rSetRule, &m_rDoc);
1653  m_rDoc.ChgNumRuleFormats( aSetRule );
1654  }
1655  break;
1656  case SfxItemState::DONTCARE:
1657  // set NumRule to default values
1658  // what are the default values?
1659  {
1660  SwNumRule aRule( m_pNumRule->GetName(),
1661  // #i89178#
1663  m_rDoc.ChgNumRuleFormats( aRule );
1664  }
1665  break;
1666  default: break;
1667  }
1668  }
1669  break;
1670 
1671  default:
1672  OSL_ENSURE(false, "unknown style family");
1673  }
1674 
1675  if( pFormat && rSet.Count())
1676  {
1677  SfxItemIter aIter( rSet );
1678  const SfxPoolItem* pItem = aIter.GetCurItem();
1679  do
1680  {
1681  if( IsInvalidItem( pItem ) ) // Clear
1682  {
1683  // use method <SwDoc::ResetAttrAtFormat(..)> in order to
1684  // create an Undo object for the attribute reset.
1686  *pFormat );
1687  }
1688 
1689  pItem = aIter.NextItem();
1690  } while (pItem);
1691  SfxItemSet aSet(rSet);
1692  aSet.ClearInvalidItems();
1693 
1694  if(SfxStyleFamily::Frame == nFamily)
1695  {
1696  // Need to check for unique item for DrawingLayer items of type NameOrIndex
1697  // and evtl. correct that item to ensure unique names for that type. This call may
1698  // modify/correct entries inside of the given SfxItemSet
1700  }
1701 
1703 
1704  if( pNewDsc )
1705  {
1706  ::ItemSetToPageDesc( aSet, *pNewDsc );
1707  m_rDoc.ChgPageDesc( nPgDscPos, *pNewDsc );
1708  m_pDesc = &m_rDoc.GetPageDesc( nPgDscPos );
1709  m_rDoc.PreDelPageDesc(pNewDsc.get()); // #i7983#
1710  pNewDsc.reset();
1711  }
1712  else
1713  m_rDoc.ChgFormat(*pFormat, aSet); // put all that is set
1714  }
1715  else
1716  {
1718  if( pNewDsc ) // we still need to delete it
1719  {
1720  m_rDoc.PreDelPageDesc(pNewDsc.get()); // #i7983#
1721  pNewDsc.reset();
1722  }
1723  }
1724 
1726  {
1728  }
1729 }
1730 
1731 static void lcl_SaveStyles( SfxStyleFamily nFamily, std::vector<void*>& rArr, SwDoc& rDoc )
1732 {
1733  switch( nFamily )
1734  {
1735  case SfxStyleFamily::Char:
1736  {
1737  const SwCharFormats& rTable = *rDoc.GetCharFormats();
1738  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1739  {
1740  rArr.push_back( rTable[ n ] );
1741  }
1742  }
1743  break;
1744  case SfxStyleFamily::Para:
1745  {
1746  const SwTextFormatColls& rTable = *rDoc.GetTextFormatColls();
1747  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1748  {
1749  rArr.push_back( rTable[ n ] );
1750  }
1751  }
1752  break;
1753  case SfxStyleFamily::Frame:
1754  {
1755  const SwFrameFormats& rTable = *rDoc.GetFrameFormats();
1756  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1757  {
1758  rArr.push_back( rTable[ n ] );
1759  }
1760  }
1761  break;
1762 
1763  case SfxStyleFamily::Page:
1764  {
1765  for( size_t n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n )
1766  {
1767  rArr.push_back( &rDoc.GetPageDesc( n ) );
1768  }
1769  }
1770  break;
1771 
1772  case SfxStyleFamily::Pseudo:
1773  {
1774  const SwNumRuleTable& rTable = rDoc.GetNumRuleTable();
1775  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1776  {
1777  rArr.push_back( rTable[ n ] );
1778  }
1779  }
1780  break;
1781  default: break;
1782  }
1783 }
1784 
1785 static bool lcl_Contains(const std::vector<void*>& rArr, const void* p)
1786 {
1787  return std::find( rArr.begin(), rArr.end(), p ) != rArr.end();
1788 }
1789 
1790 static void lcl_DeleteInfoStyles( SfxStyleFamily nFamily, std::vector<void*> const & rArr, SwDoc& rDoc )
1791 {
1792  size_t n, nCnt;
1793  switch( nFamily )
1794  {
1795  case SfxStyleFamily::Char:
1796  {
1797  std::deque<sal_uInt16> aDelArr;
1798  const SwCharFormats& rTable = *rDoc.GetCharFormats();
1799  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1800  {
1801  if( !lcl_Contains( rArr, rTable[ n ] ))
1802  aDelArr.push_front( n );
1803  }
1804  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1805  rDoc.DelCharFormat( aDelArr[ n ] );
1806  }
1807  break;
1808 
1809  case SfxStyleFamily::Para :
1810  {
1811  std::deque<sal_uInt16> aDelArr;
1812  const SwTextFormatColls& rTable = *rDoc.GetTextFormatColls();
1813  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1814  {
1815  if( !lcl_Contains( rArr, rTable[ n ] ))
1816  aDelArr.push_front( n );
1817  }
1818  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1819  rDoc.DelTextFormatColl( aDelArr[ n ] );
1820  }
1821  break;
1822 
1823  case SfxStyleFamily::Frame:
1824  {
1825  std::deque<SwFrameFormat*> aDelArr;
1826  const SwFrameFormats& rTable = *rDoc.GetFrameFormats();
1827  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1828  {
1829  if( !lcl_Contains( rArr, rTable[ n ] ))
1830  aDelArr.push_front( rTable[ n ] );
1831  }
1832  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1833  rDoc.DelFrameFormat( aDelArr[ n ] );
1834  }
1835  break;
1836 
1837  case SfxStyleFamily::Page:
1838  {
1839  std::deque<size_t> aDelArr;
1840  for( n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n )
1841  {
1842  if( !lcl_Contains( rArr, &rDoc.GetPageDesc( n ) ))
1843  aDelArr.push_front( n );
1844  }
1845  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1846  rDoc.DelPageDesc( aDelArr[ n ] );
1847  }
1848  break;
1849 
1850  case SfxStyleFamily::Pseudo:
1851  {
1852  std::deque<SwNumRule*> aDelArr;
1853  const SwNumRuleTable& rTable = rDoc.GetNumRuleTable();
1854  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1855  {
1856  if( !lcl_Contains( rArr, rTable[ n ] ))
1857  aDelArr.push_front( rTable[ n ] );
1858  }
1859  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1860  rDoc.DelNumRule( aDelArr[ n ]->GetName() );
1861  }
1862  break;
1863  default: break;
1864  }
1865 }
1866 
1867 // determine the format
1869  FillStyleType const eFType, std::optional<SfxItemSet> *const o_ppFlatSet)
1870 {
1871  bool bRet = false;
1872  sal_uInt16 nPoolId = USHRT_MAX;
1873  SwFormat* pFormat = nullptr;
1874 
1875  bool bCreate = FillPhysical == eFType;
1876  bool bDeleteInfo = false;
1877  bool bFillOnlyInfo = FillAllInfo == eFType || FillPreview == eFType;
1878  std::vector<void*> aDelArr;
1879  bool const isModified(m_rDoc.getIDocumentState().IsModified());
1880 
1881  switch(nFamily)
1882  {
1883  case SfxStyleFamily::Char:
1884  m_pCharFormat = lcl_FindCharFormat(m_rDoc, aName, this, bCreate );
1885  m_bPhysical = nullptr != m_pCharFormat;
1886  if( bFillOnlyInfo && !m_bPhysical )
1887  {
1888  // create style (plus all needed parents) and clean it up
1889  // later - without affecting the undo/redo stack
1891  bDeleteInfo = true;
1892  ::lcl_SaveStyles( nFamily, aDelArr, m_rDoc );
1894  }
1895 
1896  pFormat = m_pCharFormat;
1897  m_aLink.clear();
1898  if( !bCreate && !pFormat )
1899  {
1900  if( aName == SwResId(STR_POOLCHR_STANDARD))
1901  nPoolId = 0;
1902  else
1904  }
1905 
1906  if (m_pCharFormat)
1907  {
1908  const SwTextFormatColl* pParaFormat = m_pCharFormat->GetLinkedParaFormat();
1909  if (pParaFormat)
1910  {
1911  m_aLink = pParaFormat->GetName();
1912  }
1913  }
1914 
1915  bRet = nullptr != m_pCharFormat || USHRT_MAX != nPoolId;
1916 
1917  if( bDeleteInfo )
1918  m_pCharFormat = nullptr;
1919  break;
1920 
1921  case SfxStyleFamily::Para:
1922  {
1923  m_pColl = lcl_FindParaFormat(m_rDoc, aName, this, bCreate);
1924  m_bPhysical = nullptr != m_pColl;
1925  if( bFillOnlyInfo && !m_bPhysical )
1926  {
1928  bDeleteInfo = true;
1929  ::lcl_SaveStyles( nFamily, aDelArr, m_rDoc );
1931  }
1932 
1933  pFormat = m_pColl;
1934  m_aLink.clear();
1935  if( m_pColl )
1936  {
1938  const SwCharFormat* pCharFormat = m_pColl->GetLinkedCharFormat();
1939  if (pCharFormat)
1940  {
1941  m_aLink = pCharFormat->GetName();
1942  }
1943  }
1944  else if( !bCreate )
1946 
1947  bRet = nullptr != m_pColl || USHRT_MAX != nPoolId;
1948 
1949  if( bDeleteInfo )
1950  m_pColl = nullptr;
1951  }
1952  break;
1953 
1954  case SfxStyleFamily::Frame:
1955  m_pFrameFormat = lcl_FindFrameFormat(m_rDoc, aName, this, bCreate);
1956  m_bPhysical = nullptr != m_pFrameFormat;
1957  if (bFillOnlyInfo && !m_bPhysical)
1958  {
1960  bDeleteInfo = true;
1961  ::lcl_SaveStyles( nFamily, aDelArr, m_rDoc );
1963  }
1964  pFormat = m_pFrameFormat;
1965  if( !bCreate && !pFormat )
1967 
1968  bRet = nullptr != m_pFrameFormat || USHRT_MAX != nPoolId;
1969 
1970  if( bDeleteInfo )
1971  m_pFrameFormat = nullptr;
1972  break;
1973 
1974  case SfxStyleFamily::Page:
1975  m_pDesc = lcl_FindPageDesc(m_rDoc, aName, this, bCreate);
1976  m_bPhysical = nullptr != m_pDesc;
1977  if( bFillOnlyInfo && !m_pDesc )
1978  {
1980  bDeleteInfo = true;
1981  ::lcl_SaveStyles( nFamily, aDelArr, m_rDoc );
1982  m_pDesc = lcl_FindPageDesc( m_rDoc, aName, this );
1983  }
1984 
1985  if( m_pDesc )
1986  {
1987  nPoolId = m_pDesc->GetPoolFormatId();
1989  if( m_pDesc->GetPoolHlpFileId() != UCHAR_MAX )
1991  else
1992  aHelpFile.clear();
1993  }
1994  else if( !bCreate )
1996  SetMask( (USER_FMT & nPoolId) ? SfxStyleSearchBits::UserDefined : SfxStyleSearchBits::Auto );
1997 
1998  bRet = nullptr != m_pDesc || USHRT_MAX != nPoolId;
1999  if( bDeleteInfo )
2000  m_pDesc = nullptr;
2001  break;
2002 
2003  case SfxStyleFamily::Pseudo:
2004  m_pNumRule = lcl_FindNumRule(m_rDoc, aName, this, bCreate);
2005  m_bPhysical = nullptr != m_pNumRule;
2006  if( bFillOnlyInfo && !m_pNumRule )
2007  {
2009  bDeleteInfo = true;
2010  ::lcl_SaveStyles( nFamily, aDelArr, m_rDoc );
2011  m_pNumRule = lcl_FindNumRule( m_rDoc, aName, this );
2012  }
2013 
2014  if( m_pNumRule )
2015  {
2016  nPoolId = m_pNumRule->GetPoolFormatId();
2018  if( m_pNumRule->GetPoolHlpFileId() != UCHAR_MAX )
2020  else
2021  aHelpFile.clear();
2022  }
2023  else if( !bCreate )
2025  SetMask( (USER_FMT & nPoolId) ? SfxStyleSearchBits::UserDefined : SfxStyleSearchBits::Auto );
2026 
2027  bRet = nullptr != m_pNumRule || USHRT_MAX != nPoolId;
2028 
2029  if( bDeleteInfo )
2030  m_pNumRule = nullptr;
2031  break;
2032 
2033  case SfxStyleFamily::Table:
2034  m_pTableFormat = lcl_FindTableStyle(m_rDoc, aName, this, bCreate);
2035  SetMask((m_pTableFormat && m_pTableFormat->IsUserDefined()) ? SfxStyleSearchBits::UserDefined : SfxStyleSearchBits::Auto);
2036  bRet = m_bPhysical = (nullptr != m_pTableFormat);
2037  break;
2038 
2039  case SfxStyleFamily::Cell:
2041  bRet = m_bPhysical = (nullptr != m_pBoxFormat);
2042  break;
2043  default:; //prevent warning
2044  }
2045 
2046  if( SfxStyleFamily::Char == nFamily ||
2047  SfxStyleFamily::Para == nFamily ||
2048  SfxStyleFamily::Frame == nFamily )
2049  {
2050  if( pFormat )
2051  nPoolId = pFormat->GetPoolFormatId();
2052 
2053  SfxStyleSearchBits _nMask = SfxStyleSearchBits::Auto;
2054  if( pFormat == m_rDoc.GetDfltCharFormat() )
2055  _nMask |= SfxStyleSearchBits::ReadOnly;
2056  else if( USER_FMT & nPoolId )
2057  _nMask |= SfxStyleSearchBits::UserDefined;
2058 
2059  switch ( COLL_GET_RANGE_BITS & nPoolId )
2060  {
2061  case COLL_TEXT_BITS: _nMask |= SfxStyleSearchBits::SwText; break;
2062  case COLL_DOC_BITS : _nMask |= SfxStyleSearchBits::SwChapter; break;
2063  case COLL_LISTS_BITS: _nMask |= SfxStyleSearchBits::SwList; break;
2064  case COLL_REGISTER_BITS: _nMask |= SfxStyleSearchBits::SwIndex; break;
2065  case COLL_EXTRA_BITS: _nMask |= SfxStyleSearchBits::SwExtra; break;
2066  case COLL_HTML_BITS: _nMask |= SfxStyleSearchBits::SwHtml; break;
2067  }
2068 
2069  if( pFormat )
2070  {
2071  OSL_ENSURE( m_bPhysical, "Format not found" );
2072 
2073  nHelpId = pFormat->GetPoolHelpId();
2074  if( pFormat->GetPoolHlpFileId() != UCHAR_MAX )
2076  else
2077  aHelpFile.clear();
2078 
2079  if( RES_CONDTXTFMTCOLL == pFormat->Which() )
2080  _nMask |= SfxStyleSearchBits::SwCondColl;
2081 
2082  if (FillPreview == eFType)
2083  {
2084  assert(o_ppFlatSet);
2085  lcl_SwFormatToFlatItemSet(pFormat, *o_ppFlatSet);
2086  }
2087  }
2088 
2089  SetMask( _nMask );
2090  }
2091  if( bDeleteInfo && bFillOnlyInfo )
2092  {
2094  ::lcl_DeleteInfoStyles( nFamily, aDelArr, m_rDoc );
2095  if (!isModified)
2096  {
2098  }
2099  }
2100  return bRet;
2101 }
2102 
2103 // Create new format in Core
2105 {
2106  switch(nFamily)
2107  {
2108  case SfxStyleFamily::Char :
2110  if( !m_pCharFormat )
2113  m_pCharFormat->SetAuto(false);
2114  break;
2115 
2116  case SfxStyleFamily::Para :
2118  if( !m_pColl )
2119  {
2120  SwTextFormatColl *pPar = (*m_rDoc.GetTextFormatColls())[0];
2121  if( nMask & SfxStyleSearchBits::SwCondColl )
2123  else
2125  }
2126  break;
2127 
2128  case SfxStyleFamily::Frame:
2130  if( !m_pFrameFormat )
2132 
2133  break;
2134 
2135  case SfxStyleFamily::Page :
2137  if( !m_pDesc )
2138  {
2140  }
2141  break;
2142 
2143  case SfxStyleFamily::Pseudo:
2145  if( !m_pNumRule )
2146  {
2147  const OUString sTmpNm( aName.isEmpty() ? m_rDoc.GetUniqueNumRuleName() : aName );
2148  SwNumRule* pRule = m_rDoc.GetNumRuleTable()[
2149  m_rDoc.MakeNumRule( sTmpNm, nullptr, false,
2150  // #i89178#
2152  pRule->SetAutoRule( false );
2153  if( aName.isEmpty() )
2154  {
2155  // #i91400#
2156  pRule->SetName( aName, m_rDoc.getIDocumentListsAccess() );
2157  }
2158  m_pNumRule = pRule;
2159  }
2160  break;
2161 
2162  case SfxStyleFamily::Table:
2163  if (aName.isEmpty())
2164  return;
2166  if (!m_pTableFormat)
2167  {
2170  SAL_WARN_IF(!m_pTableFormat, "sw.ui", "Recently added auto format not found");
2171  }
2172  break;
2173  default:; //prevent warning
2174  }
2175  m_bPhysical = true;
2177 }
2178 
2180 {
2181  if(!m_bPhysical)
2183  return m_pCharFormat;
2184 }
2185 
2187 {
2188  if(!m_bPhysical)
2190  return m_pColl;
2191 }
2192 
2194 {
2195  if(!m_bPhysical)
2197  return m_pDesc;
2198 }
2199 
2201 {
2202  if(!m_bPhysical)
2204  return m_pNumRule;
2205 }
2206 
2207 
2209 {
2210  OSL_ENSURE(m_pNumRule, "Where is the NumRule");
2211  m_rDoc.ChgNumRuleFormats( rRule );
2212 }
2213 
2215 {
2216  if(!m_bPhysical)
2218  assert(m_pTableFormat && "SwDocStyleSheet table style, SwTableAutoFormat not found");
2219  return m_pTableFormat;
2220 }
2221 
2222 // re-generate Name AND Family from String
2223 // First() and Next() (see below) insert an identification letter at Pos.1
2224 
2225 void SwDocStyleSheet::PresetNameAndFamily(SfxStyleFamily eFamily, const OUString& rName)
2226 {
2227  this->nFamily = eFamily;
2228  this->aName = rName;
2229 }
2230 
2231 // Is the format physically present yet
2233 {
2234  m_bPhysical = bPhys;
2235 
2236  if(!bPhys)
2237  {
2238  m_pCharFormat = nullptr;
2239  m_pColl = nullptr;
2240  m_pFrameFormat = nullptr;
2241  m_pDesc = nullptr;
2242  }
2243 }
2244 
2246 {
2247  if(!m_bPhysical)
2249  return m_pFrameFormat;
2250 }
2251 
2253 {
2254  if( !m_bPhysical )
2255  {
2256  SwDocStyleSheet* pThis = const_cast<SwDocStyleSheet*>(this);
2257  pThis->FillStyleSheet( FillOnlyName );
2258  }
2259 
2260  if( !m_bPhysical )
2261  return false;
2262 
2263  const sw::BroadcastingModify* pMod;
2264  switch( nFamily )
2265  {
2266  case SfxStyleFamily::Char : pMod = m_pCharFormat; break;
2267  case SfxStyleFamily::Para : pMod = m_pColl; break;
2268  case SfxStyleFamily::Frame: pMod = m_pFrameFormat; break;
2269  case SfxStyleFamily::Page : pMod = m_pDesc; break;
2270 
2271  case SfxStyleFamily::Pseudo:
2272  return m_pNumRule && m_rDoc.IsUsed(*m_pNumRule);
2273 
2274  case SfxStyleFamily::Table:
2276 
2277  default:
2278  OSL_ENSURE(false, "unknown style family");
2279  return false;
2280  }
2281  return m_rDoc.IsUsed( *pMod );
2282 }
2283 
2285 {
2286  return m_pNumRule ? m_pNumRule->MakeParagraphStyleListString() : OUString();
2287 }
2288 
2290 {
2291  sal_uInt16 nId = 0;
2292  sal_uInt16 nPoolId = 0;
2293  unsigned char nFileId = UCHAR_MAX;
2294 
2295  rFile = "swrhlppi.hlp";
2296 
2297  const SwFormat* pTmpFormat = nullptr;
2298  switch( nFamily )
2299  {
2300  case SfxStyleFamily::Char :
2301  if( !m_pCharFormat &&
2302  nullptr == (m_pCharFormat = lcl_FindCharFormat( m_rDoc, aName, nullptr, false )) )
2303  {
2305  return USHRT_MAX == nId ? 0 : nId;
2306  }
2307  pTmpFormat = m_pCharFormat;
2308  break;
2309 
2310  case SfxStyleFamily::Para:
2311  if( !m_pColl &&
2312  nullptr == ( m_pColl = lcl_FindParaFormat( m_rDoc, aName, nullptr, false )) )
2313  {
2315  return USHRT_MAX == nId ? 0 : nId;
2316  }
2317  pTmpFormat = m_pColl;
2318  break;
2319 
2320  case SfxStyleFamily::Frame:
2321  if( !m_pFrameFormat &&
2322  nullptr == ( m_pFrameFormat = lcl_FindFrameFormat( m_rDoc, aName, nullptr, false ) ) )
2323  {
2325  return USHRT_MAX == nId ? 0 : nId;
2326  }
2327  pTmpFormat = m_pFrameFormat;
2328  break;
2329 
2330  case SfxStyleFamily::Page:
2331  if( !m_pDesc &&
2332  nullptr == ( m_pDesc = lcl_FindPageDesc( m_rDoc, aName, nullptr, false ) ) )
2333  {
2335  return USHRT_MAX == nId ? 0 : nId;
2336  }
2337 
2338  nId = m_pDesc->GetPoolHelpId();
2339  nFileId = m_pDesc->GetPoolHlpFileId();
2340  nPoolId = m_pDesc->GetPoolFormatId();
2341  break;
2342 
2343  case SfxStyleFamily::Pseudo:
2344  if( !m_pNumRule &&
2345  nullptr == ( m_pNumRule = lcl_FindNumRule( m_rDoc, aName, nullptr, false ) ) )
2346  {
2348  return USHRT_MAX == nId ? 0 : nId;
2349  }
2350 
2351  nId = m_pNumRule->GetPoolHelpId();
2352  nFileId = m_pNumRule->GetPoolHlpFileId();
2353  nPoolId = m_pNumRule->GetPoolFormatId();
2354  break;
2355 
2356  default:
2357  OSL_ENSURE(false, "unknown style family");
2358  return 0;
2359  }
2360 
2361  if( pTmpFormat )
2362  {
2363  nId = pTmpFormat->GetPoolHelpId();
2364  nFileId = pTmpFormat->GetPoolHlpFileId();
2365  nPoolId = pTmpFormat->GetPoolFormatId();
2366  }
2367 
2368  if( UCHAR_MAX != nFileId )
2369  {
2370  const OUString *pTemplate = m_rDoc.GetDocPattern( nFileId );
2371  if( pTemplate )
2372  {
2373  rFile = *pTemplate;
2374  }
2375  }
2376  else if( !IsPoolUserFormat( nPoolId ) )
2377  {
2378  nId = nPoolId;
2379  }
2380 
2381  // because SFX acts like that, with HelpId:
2382  if( USHRT_MAX == nId )
2383  nId = 0; // don't show Help accordingly
2384 
2385  return nId;
2386 }
2387 
2388 void SwDocStyleSheet::SetHelpId( const OUString& r, sal_uLong nId )
2389 {
2390  sal_uInt8 nFileId = static_cast< sal_uInt8 >(m_rDoc.SetDocPattern( r ));
2391  sal_uInt16 nHId = static_cast< sal_uInt16 >(nId);
2392 
2393  SwFormat* pTmpFormat = nullptr;
2394  switch( nFamily )
2395  {
2396  case SfxStyleFamily::Char : pTmpFormat = m_pCharFormat; break;
2397  case SfxStyleFamily::Para : pTmpFormat = m_pColl; break;
2398  case SfxStyleFamily::Frame: pTmpFormat = m_pFrameFormat; break;
2399  case SfxStyleFamily::Page :
2400  const_cast<SwPageDesc*>(m_pDesc)->SetPoolHelpId( nHId );
2401  const_cast<SwPageDesc*>(m_pDesc)->SetPoolHlpFileId( nFileId );
2402  break;
2403 
2404  case SfxStyleFamily::Pseudo:
2405  const_cast<SwNumRule*>(m_pNumRule)->SetPoolHelpId( nHId );
2406  const_cast<SwNumRule*>(m_pNumRule)->SetPoolHlpFileId( nFileId );
2407  break;
2408 
2409  default:
2410  OSL_ENSURE(false, "unknown style family");
2411  return ;
2412  }
2413  if( pTmpFormat )
2414  {
2415  pTmpFormat->SetPoolHelpId( nHId );
2416  pTmpFormat->SetPoolHlpFileId( nFileId );
2417  }
2418 }
2419 
2420 // methods for DocStyleSheetPool
2422  : SfxStyleSheetBasePool(rDocument.GetAttrPool())
2423  , mxStyleSheet(new SwDocStyleSheet(rDocument, *this))
2424  , m_rDoc(rDocument)
2425 {
2426  m_bOrganizer = bOrg;
2427 }
2428 
2430 {
2431 }
2432 
2434  SfxStyleFamily eFam,
2435  SfxStyleSearchBits _nMask)
2436 {
2437  mxStyleSheet->PresetName(rName);
2438  mxStyleSheet->PresetParent(OUString());
2439  mxStyleSheet->PresetFollow(OUString());
2440  mxStyleSheet->SetMask(_nMask) ;
2441  mxStyleSheet->SetFamily(eFam);
2442  mxStyleSheet->SetPhysical(true);
2443  mxStyleSheet->Create();
2444 
2445  return *mxStyleSheet;
2446 }
2447 
2449 {
2450  OSL_ENSURE(false , "Create in SW-Stylesheet-Pool not possible" );
2451  return nullptr;
2452 }
2453 
2456 {
2457  OSL_ENSURE( false, "Create in SW-Stylesheet-Pool not possible" );
2458  return nullptr;
2459 }
2460 
2461 std::unique_ptr<SfxStyleSheetIterator> SwDocStyleSheetPool::CreateIterator( SfxStyleFamily eFam, SfxStyleSearchBits _nMask )
2462 {
2463  return std::make_unique<SwStyleSheetIterator>(*this, eFam, _nMask);
2464 }
2465 
2467 {
2468  mxStyleSheet.clear();
2469 }
2470 
2472 {
2473  if( !pStyle )
2474  return;
2475 
2476  bool bBroadcast = true;
2477  SwImplShellAction aTmpSh( m_rDoc );
2478  const OUString sName = pStyle->GetName();
2479  switch( pStyle->GetFamily() )
2480  {
2481  case SfxStyleFamily::Char:
2482  {
2483  SwCharFormat* pFormat = lcl_FindCharFormat(m_rDoc, sName, nullptr, false );
2484  if(pFormat)
2485  m_rDoc.DelCharFormat(pFormat);
2486  }
2487  break;
2488  case SfxStyleFamily::Para:
2489  {
2490  SwTextFormatColl* pColl = lcl_FindParaFormat(m_rDoc, sName, nullptr, false );
2491  if(pColl)
2492  m_rDoc.DelTextFormatColl(pColl);
2493  }
2494  break;
2495  case SfxStyleFamily::Frame:
2496  {
2497  SwFrameFormat* pFormat = lcl_FindFrameFormat(m_rDoc, sName, nullptr, false );
2498  if(pFormat)
2499  m_rDoc.DelFrameFormat(pFormat);
2500  }
2501  break;
2502  case SfxStyleFamily::Page :
2503  {
2504  m_rDoc.DelPageDesc(sName);
2505  }
2506  break;
2507 
2508  case SfxStyleFamily::Pseudo:
2509  {
2510  if( !m_rDoc.DelNumRule( sName ) )
2511  // Only send Broadcast, when something was deleted
2512  bBroadcast = false;
2513  }
2514  break;
2515 
2516  case SfxStyleFamily::Table:
2517  {
2518  m_rDoc.DelTableStyle(sName);
2519  }
2520  break;
2521 
2522  default:
2523  OSL_ENSURE(false, "unknown style family");
2524  bBroadcast = false;
2525  }
2526 
2527  if( bBroadcast )
2528  Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetErased, *pStyle ) );
2529 }
2530 
2532  const OUString &rStyle, const OUString &rParent )
2533 {
2534  SwFormat* pFormat = nullptr, *pParent = nullptr;
2535  switch( eFam )
2536  {
2537  case SfxStyleFamily::Char :
2538  if( nullptr != ( pFormat = lcl_FindCharFormat( m_rDoc, rStyle ) ) && !rParent.isEmpty() )
2539  pParent = lcl_FindCharFormat(m_rDoc, rParent );
2540  break;
2541 
2542  case SfxStyleFamily::Para :
2543  if( nullptr != ( pFormat = lcl_FindParaFormat( m_rDoc, rStyle ) ) && !rParent.isEmpty() )
2544  pParent = lcl_FindParaFormat( m_rDoc, rParent );
2545  break;
2546 
2547  case SfxStyleFamily::Frame:
2548  if( nullptr != ( pFormat = lcl_FindFrameFormat( m_rDoc, rStyle ) ) && !rParent.isEmpty() )
2549  pParent = lcl_FindFrameFormat( m_rDoc, rParent );
2550  break;
2551 
2552  case SfxStyleFamily::Page:
2553  case SfxStyleFamily::Pseudo:
2554  break;
2555 
2556  default:
2557  OSL_ENSURE(false, "unknown style family");
2558  }
2559 
2560  bool bRet = false;
2561  if( pFormat && pFormat->DerivedFrom() &&
2562  pFormat->DerivedFrom()->GetName() != rParent )
2563  {
2564  {
2565  SwImplShellAction aTmpSh( m_rDoc );
2566  bRet = pFormat->SetDerivedFrom( pParent );
2567  }
2568 
2569  if( bRet )
2570  {
2571  // only for Broadcasting
2572  mxStyleSheet->PresetName( rStyle );
2573  mxStyleSheet->PresetParent( rParent );
2574  if( SfxStyleFamily::Para == eFam )
2575  mxStyleSheet->PresetFollow( static_cast<SwTextFormatColl*>(pFormat)->
2576  GetNextTextFormatColl().GetName() );
2577  else
2578  mxStyleSheet->PresetFollow( OUString() );
2579 
2580  Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified, *mxStyleSheet ) );
2581  }
2582  }
2583 
2584  return bRet;
2585 }
2586 
2589 {
2590  SfxStyleSearchBits nSMask = n;
2591  if( SfxStyleFamily::Para == eFam && m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) )
2592  {
2593  // then only HTML-Templates are of interest
2594  if( SfxStyleSearchBits::All == nSMask )
2595  nSMask = SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined | SfxStyleSearchBits::Used;
2596  else
2597  nSMask &= SfxStyleSearchBits::Used | SfxStyleSearchBits::UserDefined |
2598  SfxStyleSearchBits::SwCondColl | SfxStyleSearchBits::SwHtml;
2599  if( nSMask == SfxStyleSearchBits::Auto )
2600  nSMask = SfxStyleSearchBits::SwHtml;
2601  }
2602 
2603  const bool bSearchUsed = ( n != SfxStyleSearchBits::All && n & SfxStyleSearchBits::Used );
2604  const sw::BroadcastingModify* pMod = nullptr;
2605 
2606  mxStyleSheet->SetPhysical( false );
2607  mxStyleSheet->PresetName( rName );
2608  mxStyleSheet->SetFamily( eFam );
2609  bool bFnd = mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
2610 
2611  if( mxStyleSheet->IsPhysical() )
2612  {
2613  switch( eFam )
2614  {
2615  case SfxStyleFamily::Char:
2616  pMod = mxStyleSheet->GetCharFormat();
2617  break;
2618 
2619  case SfxStyleFamily::Para:
2620  pMod = mxStyleSheet->GetCollection();
2621  break;
2622 
2623  case SfxStyleFamily::Frame:
2624  pMod = mxStyleSheet->GetFrameFormat();
2625  break;
2626 
2627  case SfxStyleFamily::Page:
2628  pMod = mxStyleSheet->GetPageDesc();
2629  break;
2630 
2631  case SfxStyleFamily::Pseudo:
2632  {
2633  const SwNumRule* pRule = mxStyleSheet->GetNumRule();
2634  if( pRule &&
2635  !bSearchUsed &&
2636  (( nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2637  ? !(pRule->GetPoolFormatId() & USER_FMT)
2638  // searched for used and found none
2639  : bSearchUsed ))
2640  bFnd = false;
2641  }
2642  break;
2643 
2644  case SfxStyleFamily::Table:
2645  case SfxStyleFamily::Cell:
2646  break;
2647  default:
2648  OSL_ENSURE(false, "unknown style family");
2649  }
2650  }
2651 
2652  // then evaluate the mask:
2653  if( pMod && !bSearchUsed )
2654  {
2655  const sal_uInt16 nId = SfxStyleFamily::Page == eFam
2656  ? static_cast<const SwPageDesc*>(pMod)->GetPoolFormatId()
2657  : static_cast<const SwFormat*>(pMod)->GetPoolFormatId();
2658 
2659  if( ( nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2660  ? !(nId & USER_FMT)
2661  // searched for used and found none
2662  : bSearchUsed )
2663  bFnd = false;
2664  }
2665  return bFnd ? mxStyleSheet.get() : nullptr;
2666 }
2667 
2670  : SfxStyleSheetIterator(&rBase, eFam, n)
2671  , mxIterSheet(new SwDocStyleSheet(rBase.GetDoc(), rBase))
2672  , mxStyleSheet(new SwDocStyleSheet(rBase.GetDoc(), rBase))
2673 {
2674  m_bFirstCalled = false;
2675  m_nLastPos = 0;
2676  StartListening(rBase);
2677 }
2678 
2680 {
2681  EndListening( *mxIterSheet->GetPool() );
2682 }
2683 
2685 {
2686  // let the list fill correctly!!
2687  if( !m_bFirstCalled )
2688  First();
2689  return m_aLst.size();
2690 }
2691 
2693 {
2694  // found
2695  if( !m_bFirstCalled )
2696  First();
2697  auto const & rEntry = m_aLst[ nIdx ];
2698  mxStyleSheet->PresetNameAndFamily( rEntry.first, rEntry.second );
2699  mxStyleSheet->SetPhysical( false );
2700  mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
2701 
2702  return mxStyleSheet.get();
2703 }
2704 
2706 {
2707  // Delete old list
2708  m_bFirstCalled = true;
2709  m_nLastPos = 0;
2710  m_aLst.clear();
2711 
2712  // Delete current
2713  mxIterSheet->Reset();
2714 
2715  SwDoc& rDoc = static_cast<SwDocStyleSheetPool*>(pBasePool)->GetDoc();
2716  const SfxStyleSearchBits nSrchMask = nMask;
2717  const bool bIsSearchUsed = SearchUsed();
2718 
2719  bool bSearchHidden( nMask & SfxStyleSearchBits::Hidden );
2720  bool bOnlyHidden = nMask == SfxStyleSearchBits::Hidden;
2721 
2722  const bool bOrganizer = static_cast<SwDocStyleSheetPool*>(pBasePool)->IsOrganizerMode();
2723  bool bAll = ( nSrchMask & SfxStyleSearchBits::AllVisible ) == SfxStyleSearchBits::AllVisible;
2724 
2725  if( nSearchFamily == SfxStyleFamily::Char
2726  || nSearchFamily == SfxStyleFamily::All )
2727  {
2728  const size_t nArrLen = rDoc.GetCharFormats()->size();
2729  for( size_t i = 0; i < nArrLen; i++ )
2730  {
2731  SwCharFormat* pFormat = (*rDoc.GetCharFormats())[ i ];
2732 
2733  const bool bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(*pFormat));
2734  if( ( !bSearchHidden && pFormat->IsHidden() && !bUsed ) || ( pFormat->IsDefault() && pFormat != rDoc.GetDfltCharFormat() ) )
2735  continue;
2736 
2737  if ( nSrchMask == SfxStyleSearchBits::Hidden && !pFormat->IsHidden( ) )
2738  continue;
2739 
2740  if( !bUsed )
2741  {
2742  // Standard is no User template
2743  const sal_uInt16 nId = rDoc.GetDfltCharFormat() == pFormat ?
2744  sal_uInt16( RES_POOLCHR_INET_NORMAL ):
2745  pFormat->GetPoolFormatId();
2746  if( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2747  ? !(nId & USER_FMT)
2748  // searched for used and found none
2749  : bIsSearchUsed )
2750  {
2751  continue;
2752  }
2753 
2755  ( RES_POOLCHR_HTML_BEGIN > nId || nId >= RES_POOLCHR_HTML_END ) &&
2756  RES_POOLCHR_INET_NORMAL != nId &&
2757  RES_POOLCHR_INET_VISIT != nId &&
2758  RES_POOLCHR_FOOTNOTE != nId &&
2759  RES_POOLCHR_ENDNOTE != nId )
2760  continue;
2761  }
2762 
2763  m_aLst.Append( SfxStyleFamily::Char, pFormat == rDoc.GetDfltCharFormat()
2764  ? SwResId(STR_POOLCHR_STANDARD)
2765  : pFormat->GetName() );
2766  }
2767 
2768  // PoolFormat
2769  if( bAll )
2770  {
2773  bIsSearchUsed, bSearchHidden, bOnlyHidden,
2774  SwGetPoolIdFromName::ChrFmt, SfxStyleFamily::Char);
2775  else
2776  {
2777  m_aLst.Append( SfxStyleFamily::Char, SwStyleNameMapper::GetChrFormatUINameArray()[
2779  m_aLst.Append( SfxStyleFamily::Char, SwStyleNameMapper::GetChrFormatUINameArray()[
2781  m_aLst.Append( SfxStyleFamily::Char, SwStyleNameMapper::GetChrFormatUINameArray()[
2783  m_aLst.Append( SfxStyleFamily::Char, SwStyleNameMapper::GetChrFormatUINameArray()[
2785  }
2787  bIsSearchUsed, bSearchHidden, bOnlyHidden,
2788  SwGetPoolIdFromName::ChrFmt, SfxStyleFamily::Char);
2789  }
2790  }
2791 
2792  if( nSearchFamily == SfxStyleFamily::Para ||
2793  nSearchFamily == SfxStyleFamily::All )
2794  {
2795  SfxStyleSearchBits nSMask = nSrchMask;
2797  {
2798  // then only HTML-Template are of interest
2799  if( SfxStyleSearchBits::AllVisible == ( nSMask & SfxStyleSearchBits::AllVisible ) )
2800  nSMask = SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined |
2801  SfxStyleSearchBits::Used;
2802  else
2803  nSMask &= SfxStyleSearchBits::Used | SfxStyleSearchBits::UserDefined |
2804  SfxStyleSearchBits::SwCondColl | SfxStyleSearchBits::SwHtml;
2805  if( nSMask == SfxStyleSearchBits::Auto )
2806  nSMask = SfxStyleSearchBits::SwHtml;
2807  }
2808 
2809  const size_t nArrLen = rDoc.GetTextFormatColls()->size();
2810  for( size_t i = 0; i < nArrLen; i++ )
2811  {
2812  SwTextFormatColl* pColl = (*rDoc.GetTextFormatColls())[ i ];
2813 
2814  const bool bUsed = bOrganizer || rDoc.IsUsed(*pColl);
2815  if ( ( !bSearchHidden && pColl->IsHidden( ) && !bUsed ) || pColl->IsDefault() )
2816  continue;
2817 
2818  if ( nSMask == SfxStyleSearchBits::Hidden && !pColl->IsHidden( ) )
2819  continue;
2820 
2821  if( !(bIsSearchUsed && bUsed ))
2822  {
2823  const sal_uInt16 nId = pColl->GetPoolFormatId();
2824  auto tmpMask = nSMask & ~SfxStyleSearchBits::Used;
2825  if (tmpMask == SfxStyleSearchBits::UserDefined)
2826  {
2827  if(!IsPoolUserFormat(nId)) continue;
2828  }
2829  else if (tmpMask == SfxStyleSearchBits::SwText)
2830  {
2831  if((nId & COLL_GET_RANGE_BITS) != COLL_TEXT_BITS) continue;
2832  }
2833  else if (tmpMask == SfxStyleSearchBits::SwChapter)
2834  {
2835  if((nId & COLL_GET_RANGE_BITS) != COLL_DOC_BITS) continue;
2836  }
2837  else if (tmpMask == SfxStyleSearchBits::SwList)
2838  {
2839  if((nId & COLL_GET_RANGE_BITS) != COLL_LISTS_BITS) continue;
2840  }
2841  else if (tmpMask == SfxStyleSearchBits::SwIndex)
2842  {
2843  if((nId & COLL_GET_RANGE_BITS) != COLL_REGISTER_BITS) continue;
2844  }
2845  else if (tmpMask == SfxStyleSearchBits::SwExtra)
2846  {
2847  if((nId & COLL_GET_RANGE_BITS) != COLL_EXTRA_BITS) continue;
2848  }
2849  else if (tmpMask == (SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined)
2850  || tmpMask == SfxStyleSearchBits::SwHtml)
2851  {
2852  if((tmpMask & SfxStyleSearchBits::UserDefined) && IsPoolUserFormat(nId))
2853  ; // do nothing
2854  else if( (nId & COLL_GET_RANGE_BITS) != COLL_HTML_BITS)
2855  {
2856  // but some we also want to see in this section
2857  bool bContinue = true;
2858  switch( nId )
2859  {
2860  case RES_POOLCOLL_SEND_ADDRESS: // --> ADDRESS
2861  case RES_POOLCOLL_TABLE_HDLN: // --> TH
2862  case RES_POOLCOLL_TABLE: // --> TD
2863  case RES_POOLCOLL_TEXT: // --> P
2864  case RES_POOLCOLL_HEADLINE_BASE:// --> H
2865  case RES_POOLCOLL_HEADLINE1: // --> H1
2866  case RES_POOLCOLL_HEADLINE2: // --> H2
2867  case RES_POOLCOLL_HEADLINE3: // --> H3
2868  case RES_POOLCOLL_HEADLINE4: // --> H4
2869  case RES_POOLCOLL_HEADLINE5: // --> H5
2870  case RES_POOLCOLL_HEADLINE6: // --> H6
2871  case RES_POOLCOLL_STANDARD: // --> P
2872  case RES_POOLCOLL_FOOTNOTE:
2873  case RES_POOLCOLL_ENDNOTE:
2874  bContinue = false;
2875  break;
2876  }
2877  if( bContinue )
2878  continue;
2879  }
2880  }
2881  else if (tmpMask == SfxStyleSearchBits::SwCondColl)
2882  {
2883  if( RES_CONDTXTFMTCOLL != pColl->Which() ) continue;
2884  }
2885  else
2886  {
2887  // searched for used and found none
2888  if( bIsSearchUsed )
2889  continue;
2890  }
2891  }
2892  m_aLst.Append( SfxStyleFamily::Para, pColl->GetName() );
2893  }
2894 
2895  bAll = ( nSMask & SfxStyleSearchBits::AllVisible ) == SfxStyleSearchBits::AllVisible;
2896  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwText )
2898  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, SfxStyleFamily::Para );
2899  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwChapter )
2901  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, SfxStyleFamily::Para ) ;
2902  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwList )
2904  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, SfxStyleFamily::Para ) ;
2905  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwIndex )
2907  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, SfxStyleFamily::Para ) ;
2908  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwExtra )
2910  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, SfxStyleFamily::Para ) ;
2911  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwCondColl )
2912  {
2913  if( !bIsSearchUsed ||
2915  m_aLst.Append( SfxStyleFamily::Para, SwStyleNameMapper::GetTextUINameArray()[
2917  }
2918  if ( bAll ||
2919  (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwHtml ||
2920  (nSMask & ~SfxStyleSearchBits::Used) ==
2921  (SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined) )
2922  {
2924  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, SfxStyleFamily::Para ) ;
2925  if( !bAll )
2926  {
2927  // then also the ones, that we are mapping:
2928  static sal_uInt16 aPoolIds[] = {
2929  RES_POOLCOLL_SEND_ADDRESS, // --> ADDRESS
2930  RES_POOLCOLL_TABLE_HDLN, // --> TH
2931  RES_POOLCOLL_TABLE, // --> TD
2932  RES_POOLCOLL_STANDARD, // --> P
2933  RES_POOLCOLL_TEXT, // --> P
2934  RES_POOLCOLL_HEADLINE_BASE, // --> H
2935  RES_POOLCOLL_HEADLINE1, // --> H1
2936  RES_POOLCOLL_HEADLINE2, // --> H2
2937  RES_POOLCOLL_HEADLINE3, // --> H3
2938  RES_POOLCOLL_HEADLINE4, // --> H4
2939  RES_POOLCOLL_HEADLINE5, // --> H5
2940  RES_POOLCOLL_HEADLINE6, // --> H6
2943  0
2944  };
2945 
2946  sal_uInt16* pPoolIds = aPoolIds;
2947  OUString s;
2948  while( *pPoolIds )
2949  {
2950  if( !bIsSearchUsed || rDoc.getIDocumentStylePoolAccess().IsPoolTextCollUsed( *pPoolIds ) )
2951  {
2952  s = SwStyleNameMapper::GetUIName( *pPoolIds, s );
2953  m_aLst.Append( SfxStyleFamily::Para, s);
2954  }
2955  ++pPoolIds;
2956  }
2957  }
2958  }
2959  }
2960 
2961  if( nSearchFamily == SfxStyleFamily::Frame ||
2962  nSearchFamily == SfxStyleFamily::All )
2963  {
2964  const size_t nArrLen = rDoc.GetFrameFormats()->size();
2965  for( size_t i = 0; i < nArrLen; i++ )
2966  {
2967  const SwFrameFormat* pFormat = (*rDoc.GetFrameFormats())[ i ];
2968 
2969  bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(*pFormat));
2970  if( ( !bSearchHidden && pFormat->IsHidden( ) && !bUsed ) || pFormat->IsDefault() || pFormat->IsAuto() )
2971  continue;
2972 
2973  if ( nSrchMask == SfxStyleSearchBits::Hidden && !pFormat->IsHidden( ) )
2974  continue;
2975 
2976  const sal_uInt16 nId = pFormat->GetPoolFormatId();
2977  if( !bUsed )
2978  {
2979  if( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2980  ? !(nId & USER_FMT)
2981  // searched for used and found none
2982  : bIsSearchUsed )
2983  {
2984  continue;
2985  }
2986  }
2987 
2988  m_aLst.Append( SfxStyleFamily::Frame, pFormat->GetName() );
2989  }
2990 
2991  // PoolFormat
2992  if ( bAll )
2994  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::FrmFmt, SfxStyleFamily::Frame);
2995  }
2996 
2997  if( nSearchFamily == SfxStyleFamily::Page ||
2998  nSearchFamily == SfxStyleFamily::All )
2999  {
3000  const size_t nCount = rDoc.GetPageDescCnt();
3001  for(size_t i = 0; i < nCount; ++i)
3002  {
3003  const SwPageDesc& rDesc = rDoc.GetPageDesc(i);
3004  const sal_uInt16 nId = rDesc.GetPoolFormatId();
3005  bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rDesc));
3006  if( !bUsed )
3007  {
3008  if ( ( !bSearchHidden && rDesc.IsHidden() ) ||
3009  ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
3010  ? !(nId & USER_FMT)
3011  // searched for used and found none
3012  : bIsSearchUsed ) )
3013  continue;
3014  }
3015 
3016  if ( nSrchMask == SfxStyleSearchBits::Hidden && !rDesc.IsHidden( ) )
3017  continue;
3018 
3019  m_aLst.Append( SfxStyleFamily::Page, rDesc.GetName() );
3020  }
3021  if ( bAll )
3023  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::PageDesc, SfxStyleFamily::Page);
3024  }
3025 
3026  if( nSearchFamily == SfxStyleFamily::Pseudo ||
3027  nSearchFamily == SfxStyleFamily::All )
3028  {
3029  const SwNumRuleTable& rNumTable = rDoc.GetNumRuleTable();
3030  for(size_t i = 0; i < rNumTable.size(); ++i)
3031  {
3032  const SwNumRule& rRule = *rNumTable[ i ];
3033  if( !rRule.IsAutoRule() )
3034  {
3035  if ( nSrchMask == SfxStyleSearchBits::Hidden && !rRule.IsHidden( ) )
3036  continue;
3037 
3038  bool bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(rRule));
3039  if( !bUsed )
3040  {
3041  if( ( !bSearchHidden && rRule.IsHidden() ) ||
3042  ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
3043  ? !(rRule.GetPoolFormatId() & USER_FMT)
3044  // searched for used and found none
3045  : bIsSearchUsed ) )
3046  continue;
3047  }
3048 
3049  m_aLst.Append( SfxStyleFamily::Pseudo, rRule.GetName() );
3050  }
3051  }
3052  if ( bAll )
3054  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::NumRule, SfxStyleFamily::Pseudo);
3055  }
3056 
3057  if( nSearchFamily == SfxStyleFamily::Table ||
3058  nSearchFamily == SfxStyleFamily::All )
3059  {
3060  const SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
3061  for(size_t i = 0; i < rTableStyles.size(); ++i)
3062  {
3063  const SwTableAutoFormat& rTableStyle = rTableStyles[i];
3064 
3065  bool bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(rTableStyle));
3066  if(!bUsed)
3067  {
3068  if(nSrchMask == SfxStyleSearchBits::Hidden && !rTableStyle.IsHidden())
3069  continue;
3070 
3071  if( (!bSearchHidden && rTableStyle.IsHidden() ) ||
3072  ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
3073  ? !rTableStyle.IsUserDefined()
3074  // searched for used and found none
3075  : bIsSearchUsed ) )
3076  continue;
3077  }
3078 
3079  m_aLst.Append( SfxStyleFamily::Table, rTableStyle.GetName() );
3080  }
3081  }
3082 
3083  if( nSearchFamily == SfxStyleFamily::Cell ||
3084  nSearchFamily == SfxStyleFamily::All )
3085  {
3086  const auto& aTableTemplateMap = SwTableAutoFormat::GetTableTemplateMap();
3087  if (rDoc.HasTableStyles())
3088  {
3089  const SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
3090  for(size_t i = 0; i < rTableStyles.size(); ++i)
3091  {
3092  const SwTableAutoFormat& rTableStyle = rTableStyles[i];
3093  for(size_t nBoxFormat = 0; nBoxFormat < aTableTemplateMap.size(); ++nBoxFormat)
3094  {
3095  const sal_uInt32 nBoxIndex = aTableTemplateMap[nBoxFormat];
3096  const SwBoxAutoFormat& rBoxFormat = rTableStyle.GetBoxFormat(nBoxIndex);
3097  OUString sBoxFormatName;
3099  sBoxFormatName += rTableStyle.GetTableTemplateCellSubName(rBoxFormat);
3100  m_aLst.Append( SfxStyleFamily::Cell, sBoxFormatName );
3101  }
3102  }
3103  }
3104  const SwCellStyleTable& rCellStyles = rDoc.GetCellStyles();
3105  for(size_t i = 0; i < rCellStyles.size(); ++i)
3106  m_aLst.Append( SfxStyleFamily::Cell, rCellStyles[i].GetName() );
3107  }
3108 
3109  if(!m_aLst.empty())
3110  {
3112  return Next();
3113  }
3114  return nullptr;
3115 }
3116 
3118 {
3119  assert(m_bFirstCalled);
3120  ++m_nLastPos;
3121  if(m_nLastPos < m_aLst.size())
3122  {
3123  auto const & rEntry = m_aLst[m_nLastPos];
3124  mxIterSheet->PresetNameAndFamily(rEntry.first, rEntry.second);
3125  mxIterSheet->SetPhysical( false );
3126  mxIterSheet->SetMask( nMask );
3127  if(mxIterSheet->pSet)
3128  {
3129  mxIterSheet->pSet->ClearItem();
3130  mxIterSheet->pSet= nullptr;
3131  }
3132  return mxIterSheet.get();
3133  }
3134  return nullptr;
3135 }
3136 
3138 {
3139  // searching
3140  if( !m_bFirstCalled )
3141  First();
3142 
3144  if( SAL_MAX_UINT32 != m_nLastPos )
3145  {
3146  // found
3147  auto const & rEntry = m_aLst[m_nLastPos];
3148  mxStyleSheet->PresetNameAndFamily(rEntry.first, rEntry.second);
3149  // new name is set, so determine its Data
3150  mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
3151  if( !mxStyleSheet->IsPhysical() )
3152  mxStyleSheet->SetPhysical( false );
3153 
3154  return mxStyleSheet.get();
3155  }
3156  return nullptr;
3157 }
3158 
3159 void SwStyleSheetIterator::AppendStyleList(const std::vector<OUString>& rList,
3160  bool bTestUsed, bool bTestHidden, bool bOnlyHidden,
3161  SwGetPoolIdFromName nSection, SfxStyleFamily eFamily )
3162 {
3163  SwDoc& rDoc = static_cast<SwDocStyleSheetPool*>(pBasePool)->GetDoc();
3164  bool bUsed = false;
3165  for (const auto & i : rList)
3166  {
3167  bool bHidden = false;
3168  sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(i, nSection);
3169  switch ( nSection )
3170  {
3172  {
3173  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolTextCollUsed( nId );
3174  SwFormat* pFormat = rDoc.FindTextFormatCollByName( i );
3175  bHidden = pFormat && pFormat->IsHidden( );
3176  }
3177  break;
3179  {
3180  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolFormatUsed( nId );
3181  SwFormat* pFormat = rDoc.FindCharFormatByName( i );
3182  bHidden = pFormat && pFormat->IsHidden( );
3183  }
3184  break;
3186  {
3187  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolFormatUsed( nId );
3188  SwFormat* pFormat = rDoc.FindFrameFormatByName( i );
3189  bHidden = pFormat && pFormat->IsHidden( );
3190  }
3191  break;
3193  {
3194  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolPageDescUsed( nId );
3195  SwPageDesc* pPgDesc = rDoc.FindPageDesc(i);
3196  bHidden = pPgDesc && pPgDesc->IsHidden( );
3197  }
3198  break;
3200  {
3201  SwNumRule* pRule = rDoc.FindNumRulePtr( i );
3202  bUsed = pRule && rDoc.IsUsed(*pRule);
3203  bHidden = pRule && pRule->IsHidden( );
3204  }
3205  break;
3206  default:
3207  OSL_ENSURE( false, "unknown PoolFormat-Id" );
3208  }
3209 
3210  bool bMatchHidden = ( bTestHidden && ( bHidden || !bOnlyHidden ) ) || ( !bTestHidden && ( !bHidden || bUsed ) );
3211  if ( ( !bTestUsed && bMatchHidden ) || ( bTestUsed && bUsed ) )
3212  m_aLst.Append( eFamily, i );
3213  }
3214 }
3215 
3217 {
3219  dynamic_cast<SwStyleSheetIterator&>(*pIter).InvalidateIterator();
3220 }
3221 
3223 {
3224  // potentially we could send an SfxHint to Notify but currently it's
3225  // iterating over the vector anyway so would still be slow - why does
3226  // this iterator not use a map?
3227  m_bFirstCalled = false;
3228  m_nLastPos = 0;
3229  m_aLst.clear();
3230 }
3231 
3233 {
3234  // search and remove from View-List!!
3235  const SfxStyleSheetHint* pStyleSheetHint = dynamic_cast<const SfxStyleSheetHint*>(&rHint);
3236  if( pStyleSheetHint &&
3237  SfxHintId::StyleSheetErased == pStyleSheetHint->GetId() )
3238  {
3239  SfxStyleSheetBase* pStyle = pStyleSheetHint->GetStyleSheet();
3240 
3241  if (pStyle)
3242  m_aLst.RemoveName(pStyle->GetFamily(), pStyle->GetName());
3243  }
3244 }
3245 
3246 /* 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:890
virtual std::unique_ptr< SfxStyleSheetIterator > CreateIterator(SfxStyleFamily, SfxStyleSearchBits nMask=SfxStyleSearchBits::All) override
Definition: docstyle.cxx:2461
SfxStyleSheetBase * First(SfxStyleFamily eFamily, SfxStyleSearchBits eMask=SfxStyleSearchBits::All)
virtual OUString GetDescription(MapUnit eUnit) override
Definition: docstyle.cxx:827
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
tools::Long GetFirstLineIndent() const
const OUString & GetLink() const
Definition: docstyle.cxx:770
void SetLinkedCharFormat(SwCharFormat &rLink)
Definition: fmtcol.cxx:328
virtual bool IsUsed() const override
Definition: docstyle.cxx:2252
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:71
SwStyleSheetIterator(SwDocStyleSheetPool &rBase, SfxStyleFamily eFam, SfxStyleSearchBits n)
Definition: docstyle.cxx:2668
int GetAssignedOutlineStyleLevel() const
Definition: fmtcol.cxx:613
const sal_uInt16 COLL_DOC_BITS
Definition: poolfmt.hxx:69
virtual SfxItemSet & GetItemSet() override
Definition: docstyle.cxx:1330
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:212
void ItemSetToPageDesc(const SfxItemSet &rSet, SwPageDesc &rPageDesc)
Definition: uitool.cxx:281
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:2214
virtual void SetHelpId(const OUString &r, sal_uLong nId) override
Definition: docstyle.cxx:2388
void SetPoolHelpId(sal_uInt16 nId)
Definition: format.hxx:152
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: docfmt.cxx:2122
void SetNumRule(const SwNumRule &rRule)
Definition: docstyle.cxx:2208
SwCharFormat * MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:856
bool IsCJKFontEnabled()
bool IsHidden() const
Definition: numrule.hxx:161
static bool lcl_Contains(const std::vector< void * > &rArr, const void *p)
Definition: docstyle.cxx:1785
std::string GetValue
virtual SfxStyleSheetBase * First() override
Definition: docstyle.cxx:2705
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:2454
SwFrameFormat * MakeFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom, bool bBroadcast=false, bool bAuto=true)
Definition: docfmt.cxx:822
virtual bool HasParentSupport() const override
Definition: docstyle.cxx:798
OUString MakeParagraphStyleListString() const
Definition: number.cxx:849
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:1102
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:1211
virtual bool SetName(const OUString &rNewName, bool bReindexNow=true)
#define FN_COND_COLL
Definition: cmdid.h:799
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:181
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
virtual bool HasFollowSupport() const override
Definition: docstyle.cxx:782
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:1906
sal_uInt16 GetPoolHelpId() const
Query and set Help-IDs for document styles.
Definition: numrule.hxx:255
OUString GetUniqueNumRuleName(const OUString *pChkStr=nullptr, bool bAutoNum=true) const
Definition: docnum.cxx:2493
OUString m_aLink
Definition: docstyle.hxx:63
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:1731
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:930
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:203
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:747
void PresetNameAndFamily(SfxStyleFamily eFamily, const OUString &rName)
Definition: docstyle.cxx:2225
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:2421
void DelCharFormat(size_t nFormat, bool bBroadcast=false)
Delete the formats.
Definition: docfmt.cxx:672
Used by the UI to modify the document model.
Definition: wrtsh.hxx:93
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:165
#define SAL_MAX_UINT32
static const std::vector< OUString > & GetDocUINameArray()
SfxStyleFamily nSearchFamily
SwDoc & m_rDoc
Definition: docbm.cxx:1204
SfxStyleSearchBits nMask
SfxStyleSheetBase * GetStyleSheet() const
virtual SfxStyleSheetBase * operator[](sal_Int32 nIdx) override
Definition: docstyle.cxx:2692
void SetGrabBagItem(const css::uno::Any &rVal)
Definition: number.cxx:1110
const SfxPoolItem * NextItem()
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:120
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:2429
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:877
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:179
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:263
const OUString & GetName() const
Definition: format.hxx:115
virtual SfxStyleSheetBase * Next() override
Definition: docstyle.cxx:3117
const SwCharFormat * GetLinkedCharFormat() const
Definition: fmtcol.cxx:330
int nCount
void SetPoolHlpFileId(sal_uInt8 nId)
Definition: format.hxx:154
virtual void SetName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2570
SwFrameFormat * GetFrameFormat()
Definition: docstyle.cxx:2245
#define FN_PARAM_FTN_INFO
Definition: cmdid.h:771
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:2193
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:1121
virtual bool IsEnableSetModified() const =0
SwCharFormat * GetCharFormat()
Definition: docstyle.cxx:2179
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:2531
const char * sName
bool SetDerivedFrom(SwFormat *pDerivedFrom=nullptr)
0 is Default.
Definition: format.cxx:321
void PresetParent(const OUString &rName)
Definition: docstyle.hxx:122
static void lcl_DeleteInfoStyles(SfxStyleFamily nFamily, std::vector< void * > const &rArr, SwDoc &rDoc)
Definition: docstyle.cxx:1790
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:902
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:961
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:3137
SwNumRule * FindNumRulePtr(const OUString &rName) const
Definition: docnum.cxx:2415
virtual sal_uLong GetHelpId(OUString &rFile) override
Definition: docstyle.cxx:2289
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:1208
Style of a layout element.
Definition: frmfmt.hxx:59
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:557
OUString GetTableTemplateCellSubName(const SwBoxAutoFormat &rBoxFormat) const
Returns the cell's name postfix. eg. ".1".
Definition: tblafmt.cxx:837
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:856
size_t SetDocPattern(const OUString &rPatternName)
Definition: poolfmt.cxx:132
const SwBoxAutoFormat & GetBoxFormat(sal_uInt8 nPos) const
Definition: tblafmt.cxx:447
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:1164
sal_uInt32 m_nLastPos
Definition: docstyle.hxx:182
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:3232
const OUString & GetValue() const
sal_uInt16 Count() const
size_t size() const
Definition: tblafmt.cxx:916
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:1421
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
virtual bool SetParent(const OUString &rStr) override
Definition: docstyle.cxx:1160
#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:2200
void PresetFollow(const OUString &rName)
Definition: docstyle.hxx:123
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:1453
SwDocStyleSheet(SwDoc &rDoc, SwDocStyleSheetPool &rPool)
Definition: docstyle.cxx:411
void DeleteAssignmentToListLevelOfOutlineStyle()
Definition: fmtcol.cxx:647
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:2232
SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const
Represents the style of a text portion.
Definition: charfmt.hxx:26
SwFrameFormat * m_pFrameFormat
Definition: docstyle.hxx:54
SAL_DLLPRIVATE void Create()
Make empty shell a real StyleSheet (Core).
Definition: docstyle.cxx:2104
SfxStyleFamily nFamily
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily, SfxStyleSearchBits nMask=SfxStyleSearchBits::All) override
Definition: docstyle.cxx:2433
std::unique_ptr< SwTableAutoFormat > DelTableStyle(const OUString &rName, bool bBroadcast=false)
Definition: ndtbl.cxx:4599
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:495
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:620
FillStyleType
Fill StyleSheet with data.
Definition: docstyle.hxx:69
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:102
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:2679
const OUString & GetName() const
Definition: tblafmt.hxx:204
SwTableAutoFormatTable & GetTableStyles()
Return the available table styles.
Definition: ndtbl.cxx:3890
void CallChgLnk()
Definition: crsrsh.cxx:2526
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:1429
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:3159
constexpr TypedWhichId< XFillFloatTransparenceItem > XATTR_FILLFLOATTRANSPARENCE(XATTR_FILL_FIRST+11)
static const std::vector< OUString > & GetExtraUINameArray()
XHatchListRef GetHatchList() const
SwTextFormatColl * GetCollection()
Definition: docstyle.cxx:2186
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:423
SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
Definition: number.cxx:1500
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
const SwTextFormatColl * GetLinkedParaFormat() const
Definition: chrfmt.cxx:43
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:2587
#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
SvBaseLink * pLink
unsigned char sal_uInt8
void PageDescToItemSet(const SwPageDesc &rPageDesc, SfxItemSet &rSet)
Definition: uitool.cxx:462
virtual ~SwDocStyleSheet() override
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CTL_WEIGHT(31)
SwConditionTextFormatColl * MakeCondTextFormatColl(const OUString &rFormatName, SwTextFormatColl *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:924
rtl::Reference< SwDocStyleSheet > mxStyleSheet
Definition: docstyle.hxx:180
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1066
SAL_DLLPRIVATE bool FillStyleSheet(FillStyleType eFType, std::optional< SfxItemSet > *o_ppFlatSet=nullptr)
Definition: docstyle.cxx:1868
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:890
static const OUString & GetUIName(const OUString &rName, SwGetPoolIdFromName)
virtual bool HasClearParentSupport() const override
Definition: docstyle.cxx:812
sal_uInt16 GetPoolHelpId() const
Definition: pagedesc.hxx:277
void SetLink(const OUString &rStr)
Definition: docstyle.cxx:736
void * p
bool SetName(const OUString &rNewName)
Definition: pagedesc.cxx:148
sal_uInt16 MakeNumRule(const OUString &rName, const SwNumRule *pCpy=nullptr, bool bBroadcast=false, const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode=SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
Definition: docnum.cxx:2449
SwGetPoolIdFromName
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
OUString GetStyle(sal_uInt16 nPos) const
Definition: ccoll.cxx:148
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
constexpr sal_uInt16 RES_CHRATR_END(46)
void ChgFormat(SwFormat &rFormat, const SfxItemSet &rSet)
Definition: docfmt.cxx:1874
XBitmapListRef GetBitmapList() const
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
Definition: docfmt.cxx:699
virtual sal_Int32 Count() override
Definition: docstyle.cxx:2684
sal_uInt8 GetPoolHlpFileId() const
Definition: pagedesc.hxx:279
void SetValid(SvxBoxInfoItemValidFlags nValid, bool bValid=true)
virtual void SetEnableSetModified(bool bEnableSetModified)=0
void SetLinkedParaFormat(SwTextFormatColl &rLink)
Definition: chrfmt.cxx:41
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:1263
const sal_uInt16 COLL_TEXT_BITS
Definition: poolfmt.hxx:65
XColorListRef GetColorList() const
bool DelNumRule(const OUString &rName, bool bBroadCast=false)
Definition: docnum.cxx:1059
virtual bool SetName(const OUString &rNewName, bool bReindexNow=true) override
Definition: docstyle.cxx:1035
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:982
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
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:2284
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:524
SfxStyleSearchBits
SwTableAutoFormat * MakeTableStyle(const OUString &rName, bool bBroadcast=false)
Definition: ndtbl.cxx:4579
rtl::Reference< SwDocStyleSheet > mxStyleSheet
Definition: docstyle.hxx:210
const SfxPoolItem * GetCurItem() const
SwTextFormatColl & GetNextTextFormatColl() const
Definition: fmtcol.hxx:104
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:1099
virtual void ResetModified()=0
virtual std::optional< SfxItemSet > GetItemSetForPreview() override
Definition: docstyle.cxx:1282
virtual void Remove(SfxStyleSheetBase *pStyle) override
Definition: docstyle.cxx:2471
void SetAutoUpdateFormat(bool bNew=true)
Definition: format.hxx:173