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