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