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, const OUString& 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  const OUString &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  const OUString &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, const OUString& 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 
1507  // Update document to new conditions
1508  SwCondCollCondChg aMsg( pColl );
1509  pColl->ModifyNotification( &aMsg, &aMsg );
1510  }
1511  else if( pCondItem && !pColl->HasWriterListeners() )
1512  {
1513  // no conditional template, then first create and adopt
1514  // all important values
1516  pColl->GetName(), static_cast<SwTextFormatColl*>(pColl->DerivedFrom()) );
1517  if( pColl != &pColl->GetNextTextFormatColl() )
1519 
1522  else
1524 
1525  const CommandStruct* pCmds = SwCondCollItem::GetCmds();
1526  for( sal_uInt16 i = 0; i < COND_COMMAND_COUNT; ++i )
1527  {
1528  const OUString sStyle = pCondItem->GetStyle( i );
1529  if (sStyle.isEmpty())
1530  continue;
1531  SwTextFormatColl *const pFindFormat = lcl_FindParaFormat( rDoc, sStyle );
1532  if (pFindFormat)
1533  {
1534  pCColl->InsertCondition( SwCollCondition( pFindFormat,
1535  pCmds[ i ].nCnd, pCmds[ i ].nSubCond ) );
1536  }
1537  }
1538 
1539  rDoc.DelTextFormatColl( pColl );
1540  pColl = pCColl;
1541  }
1542  if ( bResetIndentAttrsAtParagraphStyle &&
1543  rSet.GetItemState( RES_PARATR_NUMRULE, false ) == SfxItemState::SET &&
1544  rSet.GetItemState( RES_LR_SPACE, false ) != SfxItemState::SET &&
1545  pColl->GetItemState( RES_LR_SPACE, false ) == SfxItemState::SET )
1546  {
1548  }
1549 
1550  // #i56252: If a standard numbering style is assigned to a standard paragraph style
1551  // we have to create a physical instance of the numbering style. If we do not and
1552  // neither the paragraph style nor the numbering style is used in the document
1553  // the numbering style will not be saved with the document and the assignment got lost.
1554  const SfxPoolItem* pNumRuleItem = nullptr;
1555  if( SfxItemState::SET == rSet.GetItemState( RES_PARATR_NUMRULE, false, &pNumRuleItem ) )
1556  { // Setting a numbering rule?
1557  const OUString sNumRule = static_cast<const SwNumRuleItem*>(pNumRuleItem)->GetValue();
1558  if (!sNumRule.isEmpty())
1559  {
1560  SwNumRule* pRule = rDoc.FindNumRulePtr( sNumRule );
1561  if( !pRule )
1562  { // Numbering rule not in use yet.
1563  sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( sNumRule, SwGetPoolIdFromName::NumRule );
1564  if( USHRT_MAX != nPoolId ) // It's a standard numbering rule
1565  {
1566  rDoc.getIDocumentStylePoolAccess().GetNumRuleFromPool( nPoolId ); // Create numbering rule (physical)
1567  }
1568  }
1569  }
1570  }
1571 
1572  pFormat = pColl;
1573 
1574  sal_uInt16 nId = pColl->GetPoolFormatId() &
1576  switch( GetMask() & ( static_cast<SfxStyleSearchBits>(0x0fff) & ~SfxStyleSearchBits::SwCondColl ) )
1577  {
1578  case SfxStyleSearchBits::SwText:
1579  nId |= COLL_TEXT_BITS;
1580  break;
1581  case SfxStyleSearchBits::SwChapter:
1582  nId |= COLL_DOC_BITS;
1583  break;
1584  case SfxStyleSearchBits::SwList:
1585  nId |= COLL_LISTS_BITS;
1586  break;
1587  case SfxStyleSearchBits::SwIndex:
1588  nId |= COLL_REGISTER_BITS;
1589  break;
1590  case SfxStyleSearchBits::SwExtra:
1591  nId |= COLL_EXTRA_BITS;
1592  break;
1593  case SfxStyleSearchBits::SwHtml:
1594  nId |= COLL_HTML_BITS;
1595  break;
1596  default: break;
1597  }
1598  pColl->SetPoolFormatId( nId );
1599  break;
1600  }
1601  case SfxStyleFamily::Frame:
1602  {
1603  OSL_ENSURE(pFrameFormat, "Where's FrameFormat");
1604  const SfxPoolItem* pAutoUpdate;
1605  if(SfxItemState::SET == rSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE,false, &pAutoUpdate ))
1606  {
1607  pFrameFormat->SetAutoUpdateFormat(static_cast<const SfxBoolItem*>(pAutoUpdate)->GetValue());
1608  }
1609  pFormat = pFrameFormat;
1610  }
1611  break;
1612 
1613  case SfxStyleFamily::Page :
1614  {
1615  OSL_ENSURE(pDesc, "Where's PageDescriptor");
1616 
1617  if (rDoc.FindPageDesc(pDesc->GetName(), &nPgDscPos))
1618  {
1619  pNewDsc.reset( new SwPageDesc( *pDesc ) );
1620  // #i48949# - no undo actions for the
1621  // copy of the page style
1622  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1623  rDoc.CopyPageDesc(*pDesc, *pNewDsc); // #i7983#
1624 
1625  pFormat = &pNewDsc->GetMaster();
1626  }
1627  }
1628  break;
1629 
1630  case SfxStyleFamily::Pseudo:
1631  {
1632  OSL_ENSURE(pNumRule, "Where's NumRule");
1633 
1634  if (!pNumRule)
1635  break;
1636 
1637  const SfxPoolItem* pItem;
1638  switch( rSet.GetItemState( SID_ATTR_NUMBERING_RULE, false, &pItem ))
1639  {
1640  case SfxItemState::SET:
1641  {
1642  SvxNumRule* pSetRule = static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule();
1643  pSetRule->UnLinkGraphics();
1644  SwNumRule aSetRule(*pNumRule);
1645  aSetRule.SetSvxRule(*pSetRule, &rDoc);
1646  rDoc.ChgNumRuleFormats( aSetRule );
1647  }
1648  break;
1649  case SfxItemState::DONTCARE:
1650  // set NumRule to default values
1651  // what are the default values?
1652  {
1653  SwNumRule aRule( pNumRule->GetName(),
1654  // #i89178#
1656  rDoc.ChgNumRuleFormats( aRule );
1657  }
1658  break;
1659  default: break;
1660  }
1661  }
1662  break;
1663 
1664  default:
1665  OSL_ENSURE(false, "unknown style family");
1666  }
1667 
1668  if( pFormat && rSet.Count())
1669  {
1670  SfxItemIter aIter( rSet );
1671  const SfxPoolItem* pItem = aIter.GetCurItem();
1672  do
1673  {
1674  if( IsInvalidItem( pItem ) ) // Clear
1675  {
1676  // use method <SwDoc::ResetAttrAtFormat(..)> in order to
1677  // create an Undo object for the attribute reset.
1678  rDoc.ResetAttrAtFormat( rSet.GetWhichByPos(aIter.GetCurPos()),
1679  *pFormat );
1680  }
1681 
1682  pItem = aIter.NextItem();
1683  } while (pItem);
1684  SfxItemSet aSet(rSet);
1685  aSet.ClearInvalidItems();
1686 
1687  if(SfxStyleFamily::Frame == nFamily)
1688  {
1689  // Need to check for unique item for DrawingLayer items of type NameOrIndex
1690  // and evtl. correct that item to ensure unique names for that type. This call may
1691  // modify/correct entries inside of the given SfxItemSet
1693  }
1694 
1695  aCoreSet.ClearItem();
1696 
1697  if( pNewDsc )
1698  {
1699  ::ItemSetToPageDesc( aSet, *pNewDsc );
1700  rDoc.ChgPageDesc( nPgDscPos, *pNewDsc );
1701  pDesc = &rDoc.GetPageDesc( nPgDscPos );
1702  rDoc.PreDelPageDesc(pNewDsc.get()); // #i7983#
1703  pNewDsc.reset();
1704  }
1705  else
1706  rDoc.ChgFormat(*pFormat, aSet); // put all that is set
1707  }
1708  else
1709  {
1710  aCoreSet.ClearItem();
1711  if( pNewDsc ) // we still need to delete it
1712  {
1713  rDoc.PreDelPageDesc(pNewDsc.get()); // #i7983#
1714  pNewDsc.reset();
1715  }
1716  }
1717 
1718  if (rDoc.GetIDocumentUndoRedo().DoesUndo())
1719  {
1720  rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::END, nullptr);
1721  }
1722 }
1723 
1724 static void lcl_SaveStyles( SfxStyleFamily nFamily, std::vector<void*>& rArr, SwDoc& rDoc )
1725 {
1726  switch( nFamily )
1727  {
1728  case SfxStyleFamily::Char:
1729  {
1730  const SwCharFormats& rTable = *rDoc.GetCharFormats();
1731  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1732  {
1733  rArr.push_back( rTable[ n ] );
1734  }
1735  }
1736  break;
1737  case SfxStyleFamily::Para:
1738  {
1739  const SwTextFormatColls& rTable = *rDoc.GetTextFormatColls();
1740  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1741  {
1742  rArr.push_back( rTable[ n ] );
1743  }
1744  }
1745  break;
1746  case SfxStyleFamily::Frame:
1747  {
1748  const SwFrameFormats& rTable = *rDoc.GetFrameFormats();
1749  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1750  {
1751  rArr.push_back( rTable[ n ] );
1752  }
1753  }
1754  break;
1755 
1756  case SfxStyleFamily::Page:
1757  {
1758  for( size_t n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n )
1759  {
1760  rArr.push_back( &rDoc.GetPageDesc( n ) );
1761  }
1762  }
1763  break;
1764 
1765  case SfxStyleFamily::Pseudo:
1766  {
1767  const SwNumRuleTable& rTable = rDoc.GetNumRuleTable();
1768  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1769  {
1770  rArr.push_back( rTable[ n ] );
1771  }
1772  }
1773  break;
1774  default: break;
1775  }
1776 }
1777 
1778 static bool lcl_Contains(const std::vector<void*>& rArr, const void* p)
1779 {
1780  return std::find( rArr.begin(), rArr.end(), p ) != rArr.end();
1781 }
1782 
1783 static void lcl_DeleteInfoStyles( SfxStyleFamily nFamily, std::vector<void*> const & rArr, SwDoc& rDoc )
1784 {
1785  size_t n, nCnt;
1786  switch( nFamily )
1787  {
1788  case SfxStyleFamily::Char:
1789  {
1790  std::deque<sal_uInt16> aDelArr;
1791  const SwCharFormats& rTable = *rDoc.GetCharFormats();
1792  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1793  {
1794  if( !lcl_Contains( rArr, rTable[ n ] ))
1795  aDelArr.push_front( n );
1796  }
1797  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1798  rDoc.DelCharFormat( aDelArr[ n ] );
1799  }
1800  break;
1801 
1802  case SfxStyleFamily::Para :
1803  {
1804  std::deque<sal_uInt16> aDelArr;
1805  const SwTextFormatColls& rTable = *rDoc.GetTextFormatColls();
1806  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1807  {
1808  if( !lcl_Contains( rArr, rTable[ n ] ))
1809  aDelArr.push_front( n );
1810  }
1811  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1812  rDoc.DelTextFormatColl( aDelArr[ n ] );
1813  }
1814  break;
1815 
1816  case SfxStyleFamily::Frame:
1817  {
1818  std::deque<SwFrameFormat*> aDelArr;
1819  const SwFrameFormats& rTable = *rDoc.GetFrameFormats();
1820  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1821  {
1822  if( !lcl_Contains( rArr, rTable[ n ] ))
1823  aDelArr.push_front( rTable[ n ] );
1824  }
1825  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1826  rDoc.DelFrameFormat( aDelArr[ n ] );
1827  }
1828  break;
1829 
1830  case SfxStyleFamily::Page:
1831  {
1832  std::deque<size_t> aDelArr;
1833  for( n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n )
1834  {
1835  if( !lcl_Contains( rArr, &rDoc.GetPageDesc( n ) ))
1836  aDelArr.push_front( n );
1837  }
1838  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1839  rDoc.DelPageDesc( aDelArr[ n ] );
1840  }
1841  break;
1842 
1843  case SfxStyleFamily::Pseudo:
1844  {
1845  std::deque<SwNumRule*> aDelArr;
1846  const SwNumRuleTable& rTable = rDoc.GetNumRuleTable();
1847  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1848  {
1849  if( !lcl_Contains( rArr, rTable[ n ] ))
1850  aDelArr.push_front( rTable[ n ] );
1851  }
1852  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1853  rDoc.DelNumRule( aDelArr[ n ]->GetName() );
1854  }
1855  break;
1856  default: break;
1857  }
1858 }
1859 
1860 // determine the format
1862  FillStyleType const eFType, std::unique_ptr<SfxItemSet> *const o_ppFlatSet)
1863 {
1864  bool bRet = false;
1865  sal_uInt16 nPoolId = USHRT_MAX;
1866  SwFormat* pFormat = nullptr;
1867 
1868  bool bCreate = FillPhysical == eFType;
1869  bool bDeleteInfo = false;
1870  bool bFillOnlyInfo = FillAllInfo == eFType || FillPreview == eFType;
1871  std::vector<void*> aDelArr;
1872  bool const isModified(rDoc.getIDocumentState().IsModified());
1873 
1874  switch(nFamily)
1875  {
1876  case SfxStyleFamily::Char:
1877  pCharFormat = lcl_FindCharFormat(rDoc, aName, this, bCreate );
1878  bPhysical = nullptr != pCharFormat;
1879  if( bFillOnlyInfo && !bPhysical )
1880  {
1881  // create style (plus all needed parents) and clean it up
1882  // later - without affecting the undo/redo stack
1883  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1884  bDeleteInfo = true;
1885  ::lcl_SaveStyles( nFamily, aDelArr, rDoc );
1886  pCharFormat = lcl_FindCharFormat(rDoc, aName, this );
1887  }
1888 
1889  pFormat = pCharFormat;
1890  if( !bCreate && !pFormat )
1891  {
1892  if( aName == SwResId(STR_POOLCHR_STANDARD))
1893  nPoolId = 0;
1894  else
1896  }
1897 
1898  bRet = nullptr != pCharFormat || USHRT_MAX != nPoolId;
1899 
1900  if( bDeleteInfo )
1901  pCharFormat = nullptr;
1902  break;
1903 
1904  case SfxStyleFamily::Para:
1905  {
1906  pColl = lcl_FindParaFormat(rDoc, aName, this, bCreate);
1907  bPhysical = nullptr != pColl;
1908  if( bFillOnlyInfo && !bPhysical )
1909  {
1910  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1911  bDeleteInfo = true;
1912  ::lcl_SaveStyles( nFamily, aDelArr, rDoc );
1913  pColl = lcl_FindParaFormat(rDoc, aName, this );
1914  }
1915 
1916  pFormat = pColl;
1917  if( pColl )
1919  else if( !bCreate )
1921 
1922  bRet = nullptr != pColl || USHRT_MAX != nPoolId;
1923 
1924  if( bDeleteInfo )
1925  pColl = nullptr;
1926  }
1927  break;
1928 
1929  case SfxStyleFamily::Frame:
1930  pFrameFormat = lcl_FindFrameFormat(rDoc, aName, this, bCreate);
1931  bPhysical = nullptr != pFrameFormat;
1932  if (bFillOnlyInfo && !bPhysical)
1933  {
1934  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1935  bDeleteInfo = true;
1936  ::lcl_SaveStyles( nFamily, aDelArr, rDoc );
1937  pFrameFormat = lcl_FindFrameFormat(rDoc, aName, this );
1938  }
1939  pFormat = pFrameFormat;
1940  if( !bCreate && !pFormat )
1942 
1943  bRet = nullptr != pFrameFormat || USHRT_MAX != nPoolId;
1944 
1945  if( bDeleteInfo )
1946  pFrameFormat = nullptr;
1947  break;
1948 
1949  case SfxStyleFamily::Page:
1950  pDesc = lcl_FindPageDesc(rDoc, aName, this, bCreate);
1951  bPhysical = nullptr != pDesc;
1952  if( bFillOnlyInfo && !pDesc )
1953  {
1954  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1955  bDeleteInfo = true;
1956  ::lcl_SaveStyles( nFamily, aDelArr, rDoc );
1957  pDesc = lcl_FindPageDesc( rDoc, aName, this );
1958  }
1959 
1960  if( pDesc )
1961  {
1962  nPoolId = pDesc->GetPoolFormatId();
1963  nHelpId = pDesc->GetPoolHelpId();
1964  if( pDesc->GetPoolHlpFileId() != UCHAR_MAX )
1965  aHelpFile = *rDoc.GetDocPattern( pDesc->GetPoolHlpFileId() );
1966  else
1967  aHelpFile.clear();
1968  }
1969  else if( !bCreate )
1971  SetMask( (USER_FMT & nPoolId) ? SfxStyleSearchBits::UserDefined : SfxStyleSearchBits::Auto );
1972 
1973  bRet = nullptr != pDesc || USHRT_MAX != nPoolId;
1974  if( bDeleteInfo )
1975  pDesc = nullptr;
1976  break;
1977 
1978  case SfxStyleFamily::Pseudo:
1979  pNumRule = lcl_FindNumRule(rDoc, aName, this, bCreate);
1980  bPhysical = nullptr != pNumRule;
1981  if( bFillOnlyInfo && !pNumRule )
1982  {
1983  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1984  bDeleteInfo = true;
1985  ::lcl_SaveStyles( nFamily, aDelArr, rDoc );
1986  pNumRule = lcl_FindNumRule( rDoc, aName, this );
1987  }
1988 
1989  if( pNumRule )
1990  {
1991  nPoolId = pNumRule->GetPoolFormatId();
1993  if( pNumRule->GetPoolHlpFileId() != UCHAR_MAX )
1995  else
1996  aHelpFile.clear();
1997  }
1998  else if( !bCreate )
2000  SetMask( (USER_FMT & nPoolId) ? SfxStyleSearchBits::UserDefined : SfxStyleSearchBits::Auto );
2001 
2002  bRet = nullptr != pNumRule || USHRT_MAX != nPoolId;
2003 
2004  if( bDeleteInfo )
2005  pNumRule = nullptr;
2006  break;
2007 
2008  case SfxStyleFamily::Table:
2009  pTableFormat = lcl_FindTableStyle(rDoc, aName, this, bCreate);
2010  SetMask((pTableFormat && pTableFormat->IsUserDefined()) ? SfxStyleSearchBits::UserDefined : SfxStyleSearchBits::Auto);
2011  bRet = bPhysical = (nullptr != pTableFormat);
2012  break;
2013 
2014  case SfxStyleFamily::Cell:
2015  pBoxFormat = lcl_FindCellStyle(rDoc, aName, this);
2016  bRet = bPhysical = (nullptr != pBoxFormat);
2017  break;
2018  default:; //prevent warning
2019  }
2020 
2021  if( SfxStyleFamily::Char == nFamily ||
2022  SfxStyleFamily::Para == nFamily ||
2023  SfxStyleFamily::Frame == nFamily )
2024  {
2025  if( pFormat )
2026  nPoolId = pFormat->GetPoolFormatId();
2027 
2028  SfxStyleSearchBits _nMask = SfxStyleSearchBits::Auto;
2029  if( pFormat == rDoc.GetDfltCharFormat() )
2030  _nMask |= SfxStyleSearchBits::ReadOnly;
2031  else if( USER_FMT & nPoolId )
2032  _nMask |= SfxStyleSearchBits::UserDefined;
2033 
2034  switch ( COLL_GET_RANGE_BITS & nPoolId )
2035  {
2036  case COLL_TEXT_BITS: _nMask |= SfxStyleSearchBits::SwText; break;
2037  case COLL_DOC_BITS : _nMask |= SfxStyleSearchBits::SwChapter; break;
2038  case COLL_LISTS_BITS: _nMask |= SfxStyleSearchBits::SwList; break;
2039  case COLL_REGISTER_BITS: _nMask |= SfxStyleSearchBits::SwIndex; break;
2040  case COLL_EXTRA_BITS: _nMask |= SfxStyleSearchBits::SwExtra; break;
2041  case COLL_HTML_BITS: _nMask |= SfxStyleSearchBits::SwHtml; break;
2042  }
2043 
2044  if( pFormat )
2045  {
2046  OSL_ENSURE( bPhysical, "Format not found" );
2047 
2048  nHelpId = pFormat->GetPoolHelpId();
2049  if( pFormat->GetPoolHlpFileId() != UCHAR_MAX )
2050  aHelpFile = *rDoc.GetDocPattern( pFormat->GetPoolHlpFileId() );
2051  else
2052  aHelpFile.clear();
2053 
2054  if( RES_CONDTXTFMTCOLL == pFormat->Which() )
2055  _nMask |= SfxStyleSearchBits::SwCondColl;
2056 
2057  if (FillPreview == eFType)
2058  {
2059  assert(o_ppFlatSet);
2060  *o_ppFlatSet = lcl_SwFormatToFlatItemSet(pFormat);
2061  }
2062  }
2063 
2064  SetMask( _nMask );
2065  }
2066  if( bDeleteInfo && bFillOnlyInfo )
2067  {
2068  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
2069  ::lcl_DeleteInfoStyles( nFamily, aDelArr, rDoc );
2070  if (!isModified)
2071  {
2073  }
2074  }
2075  return bRet;
2076 }
2077 
2078 // Create new format in Core
2080 {
2081  switch(nFamily)
2082  {
2083  case SfxStyleFamily::Char :
2085  if( !pCharFormat )
2087  rDoc.GetDfltCharFormat());
2088  pCharFormat->SetAuto(false);
2089  break;
2090 
2091  case SfxStyleFamily::Para :
2092  pColl = lcl_FindParaFormat( rDoc, aName );
2093  if( !pColl )
2094  {
2095  SwTextFormatColl *pPar = (*rDoc.GetTextFormatColls())[0];
2096  if( nMask & SfxStyleSearchBits::SwCondColl )
2097  pColl = rDoc.MakeCondTextFormatColl( aName, pPar );
2098  else
2099  pColl = rDoc.MakeTextFormatColl( aName, pPar );
2100  }
2101  break;
2102 
2103  case SfxStyleFamily::Frame:
2105  if( !pFrameFormat )
2106  pFrameFormat = rDoc.MakeFrameFormat(aName, rDoc.GetDfltFrameFormat(), false, false);
2107 
2108  break;
2109 
2110  case SfxStyleFamily::Page :
2111  pDesc = lcl_FindPageDesc( rDoc, aName );
2112  if( !pDesc )
2113  {
2114  pDesc = rDoc.MakePageDesc(aName);
2115  }
2116  break;
2117 
2118  case SfxStyleFamily::Pseudo:
2119  pNumRule = lcl_FindNumRule( rDoc, aName );
2120  if( !pNumRule )
2121  {
2122  const OUString sTmpNm( aName.isEmpty() ? rDoc.GetUniqueNumRuleName() : aName );
2123  SwNumRule* pRule = rDoc.GetNumRuleTable()[
2124  rDoc.MakeNumRule( sTmpNm, nullptr, false,
2125  // #i89178#
2127  pRule->SetAutoRule( false );
2128  if( aName.isEmpty() )
2129  {
2130  // #i91400#
2131  pRule->SetName( aName, rDoc.getIDocumentListsAccess() );
2132  }
2133  pNumRule = pRule;
2134  }
2135  break;
2136 
2137  case SfxStyleFamily::Table:
2138  if (aName.isEmpty())
2139  return;
2141  if (!pTableFormat)
2142  {
2143  rDoc.MakeTableStyle(aName);
2145  SAL_WARN_IF(!pTableFormat, "sw.ui", "Recently added auto format not found");
2146  }
2147  break;
2148  default:; //prevent warning
2149  }
2150  bPhysical = true;
2151  aCoreSet.ClearItem();
2152 }
2153 
2155 {
2156  if(!bPhysical)
2158  return pCharFormat;
2159 }
2160 
2162 {
2163  if(!bPhysical)
2165  return pColl;
2166 }
2167 
2169 {
2170  if(!bPhysical)
2172  return pDesc;
2173 }
2174 
2176 {
2177  if(!bPhysical)
2179  return pNumRule;
2180 }
2181 
2182 
2184 {
2185  OSL_ENSURE(pNumRule, "Where is the NumRule");
2186  rDoc.ChgNumRuleFormats( rRule );
2187 }
2188 
2190 {
2191  if(!bPhysical)
2193  assert(pTableFormat && "SwDocStyleSheet table style, SwTableAutoFormat not found");
2194  return pTableFormat;
2195 }
2196 
2197 // re-generate Name AND Family from String
2198 // First() and Next() (see below) insert an identification letter at Pos.1
2199 
2200 void SwDocStyleSheet::PresetNameAndFamily(const OUString& rName)
2201 {
2202  switch( rName[0] )
2203  {
2204  case cPARA: nFamily = SfxStyleFamily::Para; break;
2205  case cFRAME: nFamily = SfxStyleFamily::Frame; break;
2206  case cPAGE: nFamily = SfxStyleFamily::Page; break;
2207  case cNUMRULE: nFamily = SfxStyleFamily::Pseudo; break;
2208  case cTABSTYLE: nFamily = SfxStyleFamily::Table; break;
2209  default: nFamily = SfxStyleFamily::Char; break;
2210  }
2211  aName = rName.copy(1);
2212 }
2213 
2214 // Is the format physically present yet
2216 {
2217  bPhysical = bPhys;
2218 
2219  if(!bPhys)
2220  {
2221  pCharFormat = nullptr;
2222  pColl = nullptr;
2223  pFrameFormat = nullptr;
2224  pDesc = nullptr;
2225  }
2226 }
2227 
2229 {
2230  if(!bPhysical)
2232  return pFrameFormat;
2233 }
2234 
2236 {
2237  if( !bPhysical )
2238  {
2239  SwDocStyleSheet* pThis = const_cast<SwDocStyleSheet*>(this);
2240  pThis->FillStyleSheet( FillOnlyName );
2241  }
2242 
2243  if( !bPhysical )
2244  return false;
2245 
2246  const SwModify* pMod;
2247  switch( nFamily )
2248  {
2249  case SfxStyleFamily::Char : pMod = pCharFormat; break;
2250  case SfxStyleFamily::Para : pMod = pColl; break;
2251  case SfxStyleFamily::Frame: pMod = pFrameFormat; break;
2252  case SfxStyleFamily::Page : pMod = pDesc; break;
2253 
2254  case SfxStyleFamily::Pseudo:
2255  return pNumRule && SwDoc::IsUsed( *pNumRule );
2256 
2257  case SfxStyleFamily::Table:
2258  return pTableFormat && rDoc.IsUsed( *pTableFormat );
2259 
2260  default:
2261  OSL_ENSURE(false, "unknown style family");
2262  return false;
2263  }
2264  return rDoc.IsUsed( *pMod );
2265 }
2266 
2268 {
2269  return pNumRule ? pNumRule->MakeParagraphStyleListString() : OUString();
2270 }
2271 
2273 {
2274  sal_uInt16 nId = 0;
2275  sal_uInt16 nPoolId = 0;
2276  unsigned char nFileId = UCHAR_MAX;
2277 
2278  rFile = "swrhlppi.hlp";
2279 
2280  const SwFormat* pTmpFormat = nullptr;
2281  switch( nFamily )
2282  {
2283  case SfxStyleFamily::Char :
2284  if( !pCharFormat &&
2285  nullptr == (pCharFormat = lcl_FindCharFormat( rDoc, aName, nullptr, false )) )
2286  {
2288  return USHRT_MAX == nId ? 0 : nId;
2289  }
2290  pTmpFormat = pCharFormat;
2291  break;
2292 
2293  case SfxStyleFamily::Para:
2294  if( !pColl &&
2295  nullptr == ( pColl = lcl_FindParaFormat( rDoc, aName, nullptr, false )) )
2296  {
2298  return USHRT_MAX == nId ? 0 : nId;
2299  }
2300  pTmpFormat = pColl;
2301  break;
2302 
2303  case SfxStyleFamily::Frame:
2304  if( !pFrameFormat &&
2305  nullptr == ( pFrameFormat = lcl_FindFrameFormat( rDoc, aName, nullptr, false ) ) )
2306  {
2308  return USHRT_MAX == nId ? 0 : nId;
2309  }
2310  pTmpFormat = pFrameFormat;
2311  break;
2312 
2313  case SfxStyleFamily::Page:
2314  if( !pDesc &&
2315  nullptr == ( pDesc = lcl_FindPageDesc( rDoc, aName, nullptr, false ) ) )
2316  {
2318  return USHRT_MAX == nId ? 0 : nId;
2319  }
2320 
2321  nId = pDesc->GetPoolHelpId();
2322  nFileId = pDesc->GetPoolHlpFileId();
2323  nPoolId = pDesc->GetPoolFormatId();
2324  break;
2325 
2326  case SfxStyleFamily::Pseudo:
2327  if( !pNumRule &&
2328  nullptr == ( pNumRule = lcl_FindNumRule( rDoc, aName, nullptr, false ) ) )
2329  {
2331  return USHRT_MAX == nId ? 0 : nId;
2332  }
2333 
2334  nId = pNumRule->GetPoolHelpId();
2335  nFileId = pNumRule->GetPoolHlpFileId();
2336  nPoolId = pNumRule->GetPoolFormatId();
2337  break;
2338 
2339  default:
2340  OSL_ENSURE(false, "unknown style family");
2341  return 0;
2342  }
2343 
2344  if( pTmpFormat )
2345  {
2346  nId = pTmpFormat->GetPoolHelpId();
2347  nFileId = pTmpFormat->GetPoolHlpFileId();
2348  nPoolId = pTmpFormat->GetPoolFormatId();
2349  }
2350 
2351  if( UCHAR_MAX != nFileId )
2352  {
2353  const OUString *pTemplate = rDoc.GetDocPattern( nFileId );
2354  if( pTemplate )
2355  {
2356  rFile = *pTemplate;
2357  }
2358  }
2359  else if( !IsPoolUserFormat( nPoolId ) )
2360  {
2361  nId = nPoolId;
2362  }
2363 
2364  // because SFX acts like that, with HelpId:
2365  if( USHRT_MAX == nId )
2366  nId = 0; // don't show Help accordingly
2367 
2368  return nId;
2369 }
2370 
2371 void SwDocStyleSheet::SetHelpId( const OUString& r, sal_uLong nId )
2372 {
2373  sal_uInt8 nFileId = static_cast< sal_uInt8 >(rDoc.SetDocPattern( r ));
2374  sal_uInt16 nHId = static_cast< sal_uInt16 >(nId);
2375 
2376  SwFormat* pTmpFormat = nullptr;
2377  switch( nFamily )
2378  {
2379  case SfxStyleFamily::Char : pTmpFormat = pCharFormat; break;
2380  case SfxStyleFamily::Para : pTmpFormat = pColl; break;
2381  case SfxStyleFamily::Frame: pTmpFormat = pFrameFormat; break;
2382  case SfxStyleFamily::Page :
2383  const_cast<SwPageDesc*>(pDesc)->SetPoolHelpId( nHId );
2384  const_cast<SwPageDesc*>(pDesc)->SetPoolHlpFileId( nFileId );
2385  break;
2386 
2387  case SfxStyleFamily::Pseudo:
2388  const_cast<SwNumRule*>(pNumRule)->SetPoolHelpId( nHId );
2389  const_cast<SwNumRule*>(pNumRule)->SetPoolHlpFileId( nFileId );
2390  break;
2391 
2392  default:
2393  OSL_ENSURE(false, "unknown style family");
2394  return ;
2395  }
2396  if( pTmpFormat )
2397  {
2398  pTmpFormat->SetPoolHelpId( nHId );
2399  pTmpFormat->SetPoolHlpFileId( nFileId );
2400  }
2401 }
2402 
2403 // methods for DocStyleSheetPool
2405  : SfxStyleSheetBasePool(rDocument.GetAttrPool())
2406  , mxStyleSheet(new SwDocStyleSheet(rDocument, *this))
2407  , rDoc(rDocument)
2408 {
2409  bOrganizer = bOrg;
2410 }
2411 
2413 {
2414 }
2415 
2417  SfxStyleFamily eFam,
2418  SfxStyleSearchBits _nMask)
2419 {
2420  mxStyleSheet->PresetName(rName);
2421  mxStyleSheet->PresetParent(OUString());
2422  mxStyleSheet->PresetFollow(OUString());
2423  mxStyleSheet->SetMask(_nMask) ;
2424  mxStyleSheet->SetFamily(eFam);
2425  mxStyleSheet->SetPhysical(true);
2426  mxStyleSheet->Create();
2427 
2428  return *mxStyleSheet;
2429 }
2430 
2432 {
2433  OSL_ENSURE(false , "Create in SW-Stylesheet-Pool not possible" );
2434  return nullptr;
2435 }
2436 
2439 {
2440  OSL_ENSURE( false, "Create in SW-Stylesheet-Pool not possible" );
2441  return nullptr;
2442 }
2443 
2444 std::unique_ptr<SfxStyleSheetIterator> SwDocStyleSheetPool::CreateIterator( SfxStyleFamily eFam, SfxStyleSearchBits _nMask )
2445 {
2446  return std::make_unique<SwStyleSheetIterator>(*this, eFam, _nMask);
2447 }
2448 
2450 {
2451  mxStyleSheet.clear();
2452 }
2453 
2455 {
2456  if( !pStyle )
2457  return;
2458 
2459  bool bBroadcast = true;
2460  SwImplShellAction aTmpSh( rDoc );
2461  const OUString sName = pStyle->GetName();
2462  switch( pStyle->GetFamily() )
2463  {
2464  case SfxStyleFamily::Char:
2465  {
2466  SwCharFormat* pFormat = lcl_FindCharFormat(rDoc, sName, nullptr, false );
2467  if(pFormat)
2468  rDoc.DelCharFormat(pFormat);
2469  }
2470  break;
2471  case SfxStyleFamily::Para:
2472  {
2473  SwTextFormatColl* pColl = lcl_FindParaFormat(rDoc, sName, nullptr, false );
2474  if(pColl)
2475  rDoc.DelTextFormatColl(pColl);
2476  }
2477  break;
2478  case SfxStyleFamily::Frame:
2479  {
2480  SwFrameFormat* pFormat = lcl_FindFrameFormat(rDoc, sName, nullptr, false );
2481  if(pFormat)
2482  rDoc.DelFrameFormat(pFormat);
2483  }
2484  break;
2485  case SfxStyleFamily::Page :
2486  {
2487  rDoc.DelPageDesc(sName);
2488  }
2489  break;
2490 
2491  case SfxStyleFamily::Pseudo:
2492  {
2493  if( !rDoc.DelNumRule( sName ) )
2494  // Only send Broadcast, when something was deleted
2495  bBroadcast = false;
2496  }
2497  break;
2498 
2499  case SfxStyleFamily::Table:
2500  {
2501  rDoc.DelTableStyle(sName);
2502  }
2503  break;
2504 
2505  default:
2506  OSL_ENSURE(false, "unknown style family");
2507  bBroadcast = false;
2508  }
2509 
2510  if( bBroadcast )
2511  Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetErased, *pStyle ) );
2512 }
2513 
2515  const OUString &rStyle, const OUString &rParent )
2516 {
2517  SwFormat* pFormat = nullptr, *pParent = nullptr;
2518  switch( eFam )
2519  {
2520  case SfxStyleFamily::Char :
2521  if( nullptr != ( pFormat = lcl_FindCharFormat( rDoc, rStyle ) ) && !rParent.isEmpty() )
2522  pParent = lcl_FindCharFormat(rDoc, rParent );
2523  break;
2524 
2525  case SfxStyleFamily::Para :
2526  if( nullptr != ( pFormat = lcl_FindParaFormat( rDoc, rStyle ) ) && !rParent.isEmpty() )
2527  pParent = lcl_FindParaFormat( rDoc, rParent );
2528  break;
2529 
2530  case SfxStyleFamily::Frame:
2531  if( nullptr != ( pFormat = lcl_FindFrameFormat( rDoc, rStyle ) ) && !rParent.isEmpty() )
2532  pParent = lcl_FindFrameFormat( rDoc, rParent );
2533  break;
2534 
2535  case SfxStyleFamily::Page:
2536  case SfxStyleFamily::Pseudo:
2537  break;
2538 
2539  default:
2540  OSL_ENSURE(false, "unknown style family");
2541  }
2542 
2543  bool bRet = false;
2544  if( pFormat && pFormat->DerivedFrom() &&
2545  pFormat->DerivedFrom()->GetName() != rParent )
2546  {
2547  {
2548  SwImplShellAction aTmpSh( rDoc );
2549  bRet = pFormat->SetDerivedFrom( pParent );
2550  }
2551 
2552  if( bRet )
2553  {
2554  // only for Broadcasting
2555  mxStyleSheet->PresetName( rStyle );
2556  mxStyleSheet->PresetParent( rParent );
2557  if( SfxStyleFamily::Para == eFam )
2558  mxStyleSheet->PresetFollow( static_cast<SwTextFormatColl*>(pFormat)->
2559  GetNextTextFormatColl().GetName() );
2560  else
2561  mxStyleSheet->PresetFollow( OUString() );
2562 
2563  Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified, *mxStyleSheet ) );
2564  }
2565  }
2566 
2567  return bRet;
2568 }
2569 
2572 {
2573  SfxStyleSearchBits nSMask = n;
2574  if( SfxStyleFamily::Para == eFam && rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) )
2575  {
2576  // then only HTML-Templates are of interest
2577  if( SfxStyleSearchBits::All == nSMask )
2578  nSMask = SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined | SfxStyleSearchBits::Used;
2579  else
2580  nSMask &= SfxStyleSearchBits::Used | SfxStyleSearchBits::UserDefined |
2581  SfxStyleSearchBits::SwCondColl | SfxStyleSearchBits::SwHtml;
2582  if( nSMask == SfxStyleSearchBits::Auto )
2583  nSMask = SfxStyleSearchBits::SwHtml;
2584  }
2585 
2586  const bool bSearchUsed = ( n != SfxStyleSearchBits::All && n & SfxStyleSearchBits::Used );
2587  const SwModify* pMod = nullptr;
2588 
2589  mxStyleSheet->SetPhysical( false );
2590  mxStyleSheet->PresetName( rName );
2591  mxStyleSheet->SetFamily( eFam );
2592  bool bFnd = mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
2593 
2594  if( mxStyleSheet->IsPhysical() )
2595  {
2596  switch( eFam )
2597  {
2598  case SfxStyleFamily::Char:
2599  pMod = mxStyleSheet->GetCharFormat();
2600  break;
2601 
2602  case SfxStyleFamily::Para:
2603  pMod = mxStyleSheet->GetCollection();
2604  break;
2605 
2606  case SfxStyleFamily::Frame:
2607  pMod = mxStyleSheet->GetFrameFormat();
2608  break;
2609 
2610  case SfxStyleFamily::Page:
2611  pMod = mxStyleSheet->GetPageDesc();
2612  break;
2613 
2614  case SfxStyleFamily::Pseudo:
2615  {
2616  const SwNumRule* pRule = mxStyleSheet->GetNumRule();
2617  if( pRule &&
2618  !bSearchUsed &&
2619  (( nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2620  ? !(pRule->GetPoolFormatId() & USER_FMT)
2621  // searched for used and found none
2622  : bSearchUsed ))
2623  bFnd = false;
2624  }
2625  break;
2626 
2627  case SfxStyleFamily::Table:
2628  case SfxStyleFamily::Cell:
2629  break;
2630  default:
2631  OSL_ENSURE(false, "unknown style family");
2632  }
2633  }
2634 
2635  // then evaluate the mask:
2636  if( pMod && !bSearchUsed )
2637  {
2638  const sal_uInt16 nId = SfxStyleFamily::Page == eFam
2639  ? static_cast<const SwPageDesc*>(pMod)->GetPoolFormatId()
2640  : static_cast<const SwFormat*>(pMod)->GetPoolFormatId();
2641 
2642  if( ( nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2643  ? !(nId & USER_FMT)
2644  // searched for used and found none
2645  : bSearchUsed )
2646  bFnd = false;
2647  }
2648  return bFnd ? mxStyleSheet.get() : nullptr;
2649 }
2650 
2653  : SfxStyleSheetIterator(&rBase, eFam, n)
2654  , mxIterSheet(new SwDocStyleSheet(rBase.GetDoc(), rBase))
2655  , mxStyleSheet(new SwDocStyleSheet(rBase.GetDoc(), rBase))
2656 {
2657  bFirstCalled = false;
2658  nLastPos = 0;
2659  StartListening(rBase);
2660 }
2661 
2663 {
2664  EndListening( *mxIterSheet->GetPool() );
2665 }
2666 
2668 {
2669  // let the list fill correctly!!
2670  if( !bFirstCalled )
2671  First();
2672  return aLst.size();
2673 }
2674 
2676 {
2677  // found
2678  if( !bFirstCalled )
2679  First();
2680  mxStyleSheet->PresetNameAndFamily( aLst[ nIdx ] );
2681  mxStyleSheet->SetPhysical( false );
2682  mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
2683 
2684  return mxStyleSheet.get();
2685 }
2686 
2688 {
2689  // Delete old list
2690  bFirstCalled = true;
2691  nLastPos = 0;
2692  aLst.clear();
2693 
2694  // Delete current
2695  mxIterSheet->Reset();
2696 
2697  SwDoc& rDoc = static_cast<SwDocStyleSheetPool*>(pBasePool)->GetDoc();
2698  const SfxStyleSearchBits nSrchMask = nMask;
2699  const bool bIsSearchUsed = SearchUsed();
2700 
2701  bool bSearchHidden( nMask & SfxStyleSearchBits::Hidden );
2702  bool bOnlyHidden = nMask == SfxStyleSearchBits::Hidden;
2703 
2704  const bool bOrganizer = static_cast<SwDocStyleSheetPool*>(pBasePool)->IsOrganizerMode();
2705  bool bAll = ( nSrchMask & SfxStyleSearchBits::AllVisible ) == SfxStyleSearchBits::AllVisible;
2706 
2707  if( nSearchFamily == SfxStyleFamily::Char
2708  || nSearchFamily == SfxStyleFamily::All )
2709  {
2710  const size_t nArrLen = rDoc.GetCharFormats()->size();
2711  for( size_t i = 0; i < nArrLen; i++ )
2712  {
2713  SwCharFormat* pFormat = (*rDoc.GetCharFormats())[ i ];
2714 
2715  const bool bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(*pFormat));
2716  if( ( !bSearchHidden && pFormat->IsHidden() && !bUsed ) || ( pFormat->IsDefault() && pFormat != rDoc.GetDfltCharFormat() ) )
2717  continue;
2718 
2719  if ( nSrchMask == SfxStyleSearchBits::Hidden && !pFormat->IsHidden( ) )
2720  continue;
2721 
2722  if( !bUsed )
2723  {
2724  // Standard is no User template
2725  const sal_uInt16 nId = rDoc.GetDfltCharFormat() == pFormat ?
2726  sal_uInt16( RES_POOLCHR_INET_NORMAL ):
2727  pFormat->GetPoolFormatId();
2728  if( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2729  ? !(nId & USER_FMT)
2730  // searched for used and found none
2731  : bIsSearchUsed )
2732  {
2733  continue;
2734  }
2735 
2737  ( RES_POOLCHR_HTML_BEGIN > nId || nId >= RES_POOLCHR_HTML_END ) &&
2738  RES_POOLCHR_INET_NORMAL != nId &&
2739  RES_POOLCHR_INET_VISIT != nId &&
2740  RES_POOLCHR_FOOTNOTE != nId &&
2741  RES_POOLCHR_ENDNOTE != nId )
2742  continue;
2743  }
2744 
2745  aLst.Append( cCHAR, pFormat == rDoc.GetDfltCharFormat()
2746  ? SwResId(STR_POOLCHR_STANDARD)
2747  : pFormat->GetName() );
2748  }
2749 
2750  // PoolFormat
2751  if( bAll )
2752  {
2755  bIsSearchUsed, bSearchHidden, bOnlyHidden,
2757  else
2758  {
2767  }
2769  bIsSearchUsed, bSearchHidden, bOnlyHidden,
2770  SwGetPoolIdFromName::ChrFmt, cCHAR);
2771  }
2772  }
2773 
2774  if( nSearchFamily == SfxStyleFamily::Para ||
2775  nSearchFamily == SfxStyleFamily::All )
2776  {
2777  SfxStyleSearchBits nSMask = nSrchMask;
2779  {
2780  // then only HTML-Template are of interest
2781  if( SfxStyleSearchBits::AllVisible == ( nSMask & SfxStyleSearchBits::AllVisible ) )
2782  nSMask = SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined |
2783  SfxStyleSearchBits::Used;
2784  else
2785  nSMask &= SfxStyleSearchBits::Used | SfxStyleSearchBits::UserDefined |
2786  SfxStyleSearchBits::SwCondColl | SfxStyleSearchBits::SwHtml;
2787  if( nSMask == SfxStyleSearchBits::Auto )
2788  nSMask = SfxStyleSearchBits::SwHtml;
2789  }
2790 
2791  const size_t nArrLen = rDoc.GetTextFormatColls()->size();
2792  for( size_t i = 0; i < nArrLen; i++ )
2793  {
2794  SwTextFormatColl* pColl = (*rDoc.GetTextFormatColls())[ i ];
2795 
2796  const bool bUsed = bOrganizer || rDoc.IsUsed(*pColl);
2797  if ( ( !bSearchHidden && pColl->IsHidden( ) && !bUsed ) || pColl->IsDefault() )
2798  continue;
2799 
2800  if ( nSMask == SfxStyleSearchBits::Hidden && !pColl->IsHidden( ) )
2801  continue;
2802 
2803  if( !(bIsSearchUsed && bUsed ))
2804  {
2805  const sal_uInt16 nId = pColl->GetPoolFormatId();
2806  auto tmpMask = nSMask & ~SfxStyleSearchBits::Used;
2807  if (tmpMask == SfxStyleSearchBits::UserDefined)
2808  {
2809  if(!IsPoolUserFormat(nId)) continue;
2810  }
2811  else if (tmpMask == SfxStyleSearchBits::SwText)
2812  {
2813  if((nId & COLL_GET_RANGE_BITS) != COLL_TEXT_BITS) continue;
2814  }
2815  else if (tmpMask == SfxStyleSearchBits::SwChapter)
2816  {
2817  if((nId & COLL_GET_RANGE_BITS) != COLL_DOC_BITS) continue;
2818  }
2819  else if (tmpMask == SfxStyleSearchBits::SwList)
2820  {
2821  if((nId & COLL_GET_RANGE_BITS) != COLL_LISTS_BITS) continue;
2822  }
2823  else if (tmpMask == SfxStyleSearchBits::SwIndex)
2824  {
2825  if((nId & COLL_GET_RANGE_BITS) != COLL_REGISTER_BITS) continue;
2826  }
2827  else if (tmpMask == SfxStyleSearchBits::SwExtra)
2828  {
2829  if((nId & COLL_GET_RANGE_BITS) != COLL_EXTRA_BITS) continue;
2830  }
2831  else if (tmpMask == (SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined)
2832  || tmpMask == SfxStyleSearchBits::SwHtml)
2833  {
2834  if((tmpMask & SfxStyleSearchBits::UserDefined) && IsPoolUserFormat(nId))
2835  ; // do nothing
2836  else if( (nId & COLL_GET_RANGE_BITS) != COLL_HTML_BITS)
2837  {
2838  // but some we also want to see in this section
2839  bool bContinue = true;
2840  switch( nId )
2841  {
2842  case RES_POOLCOLL_SEND_ADDRESS: // --> ADDRESS
2843  case RES_POOLCOLL_TABLE_HDLN: // --> TH
2844  case RES_POOLCOLL_TABLE: // --> TD
2845  case RES_POOLCOLL_TEXT: // --> P
2846  case RES_POOLCOLL_HEADLINE_BASE:// --> H
2847  case RES_POOLCOLL_HEADLINE1: // --> H1
2848  case RES_POOLCOLL_HEADLINE2: // --> H2
2849  case RES_POOLCOLL_HEADLINE3: // --> H3
2850  case RES_POOLCOLL_HEADLINE4: // --> H4
2851  case RES_POOLCOLL_HEADLINE5: // --> H5
2852  case RES_POOLCOLL_HEADLINE6: // --> H6
2853  case RES_POOLCOLL_STANDARD: // --> P
2854  case RES_POOLCOLL_FOOTNOTE:
2855  case RES_POOLCOLL_ENDNOTE:
2856  bContinue = false;
2857  break;
2858  }
2859  if( bContinue )
2860  continue;
2861  }
2862  }
2863  else if (tmpMask == SfxStyleSearchBits::SwCondColl)
2864  {
2865  if( RES_CONDTXTFMTCOLL != pColl->Which() ) continue;
2866  }
2867  else
2868  {
2869  // searched for used and found none
2870  if( bIsSearchUsed )
2871  continue;
2872  }
2873  }
2874  aLst.Append( cPARA, pColl->GetName() );
2875  }
2876 
2877  bAll = ( nSMask & SfxStyleSearchBits::AllVisible ) == SfxStyleSearchBits::AllVisible;
2878  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwText )
2880  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA );
2881  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwChapter )
2883  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2884  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwList )
2886  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2887  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwIndex )
2889  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2890  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwExtra )
2892  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2893  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwCondColl )
2894  {
2895  if( !bIsSearchUsed ||
2899  }
2900  if ( bAll ||
2901  (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwHtml ||
2902  (nSMask & ~SfxStyleSearchBits::Used) ==
2903  (SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined) )
2904  {
2906  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2907  if( !bAll )
2908  {
2909  // then also the ones, that we are mapping:
2910  static sal_uInt16 aPoolIds[] = {
2911  RES_POOLCOLL_SEND_ADDRESS, // --> ADDRESS
2912  RES_POOLCOLL_TABLE_HDLN, // --> TH
2913  RES_POOLCOLL_TABLE, // --> TD
2914  RES_POOLCOLL_STANDARD, // --> P
2915  RES_POOLCOLL_TEXT, // --> P
2916  RES_POOLCOLL_HEADLINE_BASE, // --> H
2917  RES_POOLCOLL_HEADLINE1, // --> H1
2918  RES_POOLCOLL_HEADLINE2, // --> H2
2919  RES_POOLCOLL_HEADLINE3, // --> H3
2920  RES_POOLCOLL_HEADLINE4, // --> H4
2921  RES_POOLCOLL_HEADLINE5, // --> H5
2922  RES_POOLCOLL_HEADLINE6, // --> H6
2925  0
2926  };
2927 
2928  sal_uInt16* pPoolIds = aPoolIds;
2929  OUString s;
2930  while( *pPoolIds )
2931  {
2932  if( !bIsSearchUsed || rDoc.getIDocumentStylePoolAccess().IsPoolTextCollUsed( *pPoolIds ) )
2933  {
2934  s = SwStyleNameMapper::GetUIName( *pPoolIds, s );
2935  aLst.Append( cPARA, s);
2936  }
2937  ++pPoolIds;
2938  }
2939  }
2940  }
2941  }
2942 
2943  if( nSearchFamily == SfxStyleFamily::Frame ||
2944  nSearchFamily == SfxStyleFamily::All )
2945  {
2946  const size_t nArrLen = rDoc.GetFrameFormats()->size();
2947  for( size_t i = 0; i < nArrLen; i++ )
2948  {
2949  const SwFrameFormat* pFormat = (*rDoc.GetFrameFormats())[ i ];
2950 
2951  bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(*pFormat));
2952  if( ( !bSearchHidden && pFormat->IsHidden( ) && !bUsed ) || pFormat->IsDefault() || pFormat->IsAuto() )
2953  continue;
2954 
2955  if ( nSrchMask == SfxStyleSearchBits::Hidden && !pFormat->IsHidden( ) )
2956  continue;
2957 
2958  const sal_uInt16 nId = pFormat->GetPoolFormatId();
2959  if( !bUsed )
2960  {
2961  if( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2962  ? !(nId & USER_FMT)
2963  // searched for used and found none
2964  : bIsSearchUsed )
2965  {
2966  continue;
2967  }
2968  }
2969 
2970  aLst.Append( cFRAME, pFormat->GetName() );
2971  }
2972 
2973  // PoolFormat
2974  if ( bAll )
2976  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::FrmFmt, cFRAME);
2977  }
2978 
2979  if( nSearchFamily == SfxStyleFamily::Page ||
2980  nSearchFamily == SfxStyleFamily::All )
2981  {
2982  const size_t nCount = rDoc.GetPageDescCnt();
2983  for(size_t i = 0; i < nCount; ++i)
2984  {
2985  const SwPageDesc& rDesc = rDoc.GetPageDesc(i);
2986  const sal_uInt16 nId = rDesc.GetPoolFormatId();
2987  bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rDesc));
2988  if( !bUsed )
2989  {
2990  if ( ( !bSearchHidden && rDesc.IsHidden() ) ||
2991  ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2992  ? !(nId & USER_FMT)
2993  // searched for used and found none
2994  : bIsSearchUsed ) )
2995  continue;
2996  }
2997 
2998  if ( nSrchMask == SfxStyleSearchBits::Hidden && !rDesc.IsHidden( ) )
2999  continue;
3000 
3001  aLst.Append( cPAGE, rDesc.GetName() );
3002  }
3003  if ( bAll )
3005  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::PageDesc, cPAGE);
3006  }
3007 
3008  if( nSearchFamily == SfxStyleFamily::Pseudo ||
3009  nSearchFamily == SfxStyleFamily::All )
3010  {
3011  const SwNumRuleTable& rNumTable = rDoc.GetNumRuleTable();
3012  for(size_t i = 0; i < rNumTable.size(); ++i)
3013  {
3014  const SwNumRule& rRule = *rNumTable[ i ];
3015  if( !rRule.IsAutoRule() )
3016  {
3017  if ( nSrchMask == SfxStyleSearchBits::Hidden && !rRule.IsHidden( ) )
3018  continue;
3019 
3020  bool bUsed = bIsSearchUsed && ( bOrganizer || SwDoc::IsUsed(rRule) );
3021  if( !bUsed )
3022  {
3023  if( ( !bSearchHidden && rRule.IsHidden() ) ||
3024  ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
3025  ? !(rRule.GetPoolFormatId() & USER_FMT)
3026  // searched for used and found none
3027  : bIsSearchUsed ) )
3028  continue;
3029  }
3030 
3031  aLst.Append( cNUMRULE, rRule.GetName() );
3032  }
3033  }
3034  if ( bAll )
3036  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::NumRule, cNUMRULE);
3037  }
3038 
3039  if( nSearchFamily == SfxStyleFamily::Table ||
3040  nSearchFamily == SfxStyleFamily::All )
3041  {
3042  const SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
3043  for(size_t i = 0; i < rTableStyles.size(); ++i)
3044  {
3045  const SwTableAutoFormat& rTableStyle = rTableStyles[i];
3046 
3047  bool bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(rTableStyle));
3048  if(!bUsed)
3049  {
3050  if(nSrchMask == SfxStyleSearchBits::Hidden && !rTableStyle.IsHidden())
3051  continue;
3052 
3053  if( (!bSearchHidden && rTableStyle.IsHidden() ) ||
3054  ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
3055  ? !rTableStyle.IsUserDefined()
3056  // searched for used and found none
3057  : bIsSearchUsed ) )
3058  continue;
3059  }
3060 
3061  aLst.Append( cTABSTYLE, rTableStyle.GetName() );
3062  }
3063  }
3064 
3065  if( nSearchFamily == SfxStyleFamily::Cell ||
3066  nSearchFamily == SfxStyleFamily::All )
3067  {
3068  const auto& aTableTemplateMap = SwTableAutoFormat::GetTableTemplateMap();
3069  if (rDoc.HasTableStyles())
3070  {
3071  const SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
3072  for(size_t i = 0; i < rTableStyles.size(); ++i)
3073  {
3074  const SwTableAutoFormat& rTableStyle = rTableStyles[i];
3075  for(size_t nBoxFormat = 0; nBoxFormat < aTableTemplateMap.size(); ++nBoxFormat)
3076  {
3077  const sal_uInt32 nBoxIndex = aTableTemplateMap[nBoxFormat];
3078  const SwBoxAutoFormat& rBoxFormat = rTableStyle.GetBoxFormat(nBoxIndex);
3079  OUString sBoxFormatName;
3081  sBoxFormatName += rTableStyle.GetTableTemplateCellSubName(rBoxFormat);
3082  aLst.Append( cCELLSTYLE, sBoxFormatName );
3083  }
3084  }
3085  }
3086  const SwCellStyleTable& rCellStyles = rDoc.GetCellStyles();
3087  for(size_t i = 0; i < rCellStyles.size(); ++i)
3088  aLst.Append( cCELLSTYLE, rCellStyles[i].GetName() );
3089  }
3090 
3091  if(!aLst.empty())
3092  {
3094  return Next();
3095  }
3096  return nullptr;
3097 }
3098 
3100 {
3102  ++nLastPos;
3103  if(nLastPos < aLst.size())
3104  {
3105  mxIterSheet->PresetNameAndFamily(aLst[nLastPos]);
3106  mxIterSheet->SetPhysical( false );
3107  mxIterSheet->SetMask( nMask );
3108  if(mxIterSheet->pSet)
3109  {
3110  mxIterSheet->pSet->ClearItem();
3111  mxIterSheet->pSet= nullptr;
3112  }
3113  return mxIterSheet.get();
3114  }
3115  return nullptr;
3116 }
3117 
3119 {
3120  // searching
3121  if( !bFirstCalled )
3122  First();
3123 
3124  nLastPos = aLst.FindName( nSearchFamily, rName );
3125  if( SAL_MAX_UINT32 != nLastPos )
3126  {
3127  // found
3128  mxStyleSheet->PresetNameAndFamily(aLst[nLastPos]);
3129  // new name is set, so determine its Data
3130  mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
3131  if( !mxStyleSheet->IsPhysical() )
3132  mxStyleSheet->SetPhysical( false );
3133 
3134  return mxStyleSheet.get();
3135  }
3136  return nullptr;
3137 }
3138 
3139 void SwStyleSheetIterator::AppendStyleList(const std::vector<OUString>& rList,
3140  bool bTestUsed, bool bTestHidden, bool bOnlyHidden,
3141  SwGetPoolIdFromName nSection, char cType )
3142 {
3143  SwDoc& rDoc = static_cast<SwDocStyleSheetPool*>(pBasePool)->GetDoc();
3144  bool bUsed = false;
3145  for (const auto & i : rList)
3146  {
3147  bool bHidden = false;
3148  sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(i, nSection);
3149  switch ( nSection )
3150  {
3152  {
3153  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolTextCollUsed( nId );
3154  SwFormat* pFormat = rDoc.FindTextFormatCollByName( i );
3155  bHidden = pFormat && pFormat->IsHidden( );
3156  }
3157  break;
3159  {
3160  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolFormatUsed( nId );
3161  SwFormat* pFormat = rDoc.FindCharFormatByName( i );
3162  bHidden = pFormat && pFormat->IsHidden( );
3163  }
3164  break;
3166  {
3167  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolFormatUsed( nId );
3168  SwFormat* pFormat = rDoc.FindFrameFormatByName( i );
3169  bHidden = pFormat && pFormat->IsHidden( );
3170  }
3171  break;
3173  {
3174  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolPageDescUsed( nId );
3175  SwPageDesc* pPgDesc = rDoc.FindPageDesc(i);
3176  bHidden = pPgDesc && pPgDesc->IsHidden( );
3177  }
3178  break;
3180  {
3181  SwNumRule* pRule = rDoc.FindNumRulePtr( i );
3182  bUsed = pRule && SwDoc::IsUsed( *pRule );
3183  bHidden = pRule && pRule->IsHidden( );
3184  }
3185  break;
3186  default:
3187  OSL_ENSURE( false, "unknown PoolFormat-Id" );
3188  }
3189 
3190  bool bMatchHidden = ( bTestHidden && ( bHidden || !bOnlyHidden ) ) || ( !bTestHidden && ( !bHidden || bUsed ) );
3191  if ( ( !bTestUsed && bMatchHidden ) || ( bTestUsed && bUsed ) )
3192  aLst.Append( cType, i );
3193  }
3194 }
3195 
3197 {
3199  dynamic_cast<SwStyleSheetIterator&>(*pIter).InvalidateIterator();
3200 }
3201 
3203 {
3204  // potentially we could send an SfxHint to Notify but currently it's
3205  // iterating over the vector anyway so would still be slow - why does
3206  // this iterator not use a map?
3207  bFirstCalled = false;
3208  nLastPos = 0;
3209  aLst.clear();
3210 }
3211 
3213 {
3214  // search and remove from View-List!!
3215  const SfxStyleSheetHint* pStyleSheetHint = dynamic_cast<const SfxStyleSheetHint*>(&rHint);
3216  if( pStyleSheetHint &&
3217  SfxHintId::StyleSheetErased == pStyleSheetHint->GetId() )
3218  {
3219  SfxStyleSheetBase* pStyle = pStyleSheetHint->GetStyleSheet();
3220 
3221  if (pStyle)
3222  aLst.RemoveName(pStyle->GetFamily(), pStyle->GetName());
3223  }
3224 }
3225 
3226 /* 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:2444
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:2235
const sal_uInt16 COLL_LISTS_BITS
Definition: poolfmt.hxx:66
SwStyleSheetIterator(SwDocStyleSheetPool &rBase, SfxStyleFamily eFam, SfxStyleSearchBits n)
Definition: docstyle.cxx:2651
int GetAssignedOutlineStyleLevel() const
Definition: fmtcol.cxx:587
const sal_uInt16 COLL_DOC_BITS
Definition: poolfmt.hxx:69
void PresetNameAndFamily(const OUString &rName)
Definition: docstyle.cxx:2200
virtual SfxItemSet & GetItemSet() override
Definition: docstyle.cxx:1321
Represents the style of a paragraph.
Definition: fmtcol.hxx:55
virtual bool GetPresentation(const SfxPoolItem &rItem, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
void ItemSetToPageDesc(const SfxItemSet &rSet, SwPageDesc &rPageDesc)
Definition: uitool.cxx:262
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()
bool IsDefault() const
Definition: format.hxx:109
void SetDefDist(sal_uInt16 nNew)
SwTableAutoFormat * GetTableFormat()
Definition: docstyle.cxx:2189
virtual void SetHelpId(const OUString &r, sal_uLong nId) override
Definition: docstyle.cxx:2371
void SetPoolHelpId(sal_uInt16 nId)
Definition: format.hxx:148
SAL_DLLPRIVATE bool FillStyleSheet(FillStyleType eFType, std::unique_ptr< SfxItemSet > *o_ppFlatSet=nullptr)
Definition: docstyle.cxx:1861
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: docfmt.cxx:2094
SwTableAutoFormat * FindAutoFormat(const OUString &rName) const
Find table style with the provided name, return nullptr when not found.
Definition: tblafmt.cxx:995
void SetNumRule(const SwNumRule &rRule)
Definition: docstyle.cxx:2183
SwCharFormat * MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:843
SwDocShell * GetDocShell()
Definition: doc.hxx:1348
bool IsHidden() const
Definition: numrule.hxx:159
static bool lcl_Contains(const std::vector< void * > &rArr, const void *p)
Definition: docstyle.cxx:1778
std::string GetValue
virtual SfxStyleSheetBase * First() override
Definition: docstyle.cxx:2687
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:161
void DelPageDesc(const OUString &rName, bool bBroadcast=false)
Definition: docdesc.cxx:848
void SetMinDist(bool bNew)
#define cCHAR
Definition: docstyle.cxx:72
sal_uInt16 char char * pDesc
static const std::vector< OUString > & GetHTMLUINameArray()
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
Definition: doc.hxx:796
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:839
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:1087
Definition: doc.hxx:184
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:166
virtual bool SetName(const OUString &rNewName, bool bReindexNow=true)
#define FN_COND_COLL
Definition: cmdid.h:796
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:143
bool IsPoolUserFormat(sal_uInt16 nId)
Definition: poolfmt.hxx:86
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:2492
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:1724
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:1247
bool HasWriterListeners() const
Definition: calbck.hxx:210
#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:293
SwFrameFormat * FindFrameFormatByName(const OUString &rName) const
Definition: docfmt.cxx:734
XPatternListRef GetPatternList() const
const OUString & GetName() const
Definition: pagedesc.hxx:187
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:155
SwDocStyleSheetPool(SwDoc &, bool bOrganizer)
Definition: docstyle.cxx:2404
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
void Append(char cChar, const OUString &rStr)
Definition: docstyle.cxx:438
SfxStyleSearchBits nMask
SfxStyleSheetBase * GetStyleSheet() const
virtual SfxStyleSheetBase * operator[](sal_Int32 nIdx) override
Definition: docstyle.cxx:2675
sal_uInt16 sal_Unicode
void SetGrabBagItem(const css::uno::Any &rVal)
Definition: number.cxx:1095
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:748
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
const OUString & GetName() const
virtual ~SwDocStyleSheetPool() override
Definition: docstyle.cxx:2412
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:144
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat-Id.
Definition: pagedesc.hxx:254
rtl::Reference< SwDocStyleSheet > mxIterSheet
Definition: docstyle.hxx:164
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:228
const OUString & GetName() const
Definition: format.hxx:111
virtual SfxStyleSheetBase * Next() override
Definition: docstyle.cxx:3099
int nCount
void SetPoolHlpFileId(sal_uInt8 nId)
Definition: format.hxx:150
virtual void SetName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2493
SwFrameFormat * GetFrameFormat()
Definition: docstyle.cxx:2228
#define FN_PARAM_FTN_INFO
Definition: cmdid.h:768
virtual bool SetFollow(const OUString &)
virtual void DoUndo(bool const bDoUndo)=0
Enable/Disable Undo.
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
sal_uInt32 FindName(SfxStyleFamily eFam, const OUString &rName)
Definition: docstyle.cxx:370
virtual const OUString & GetParent() const override
Definition: docstyle.cxx:711
SfxStyleSearchBits nMask
const SwPageDesc * GetPageDesc()
Definition: docstyle.cxx:2168
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:2154
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:2514
const char * sName
bool SetDerivedFrom(SwFormat *pDerivedFrom=nullptr)
0 is Default.
Definition: format.cxx:328
void PresetParent(const OUString &rName)
Definition: docstyle.hxx:118
static void lcl_DeleteInfoStyles(SfxStyleFamily nFamily, std::vector< void * > const &rArr, SwDoc &rDoc)
Definition: docstyle.cxx:1783
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:143
virtual void ModifyNotification(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue)
Definition: calbck.hxx:156
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:892
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
Definition: docdesc.cxx:825
SwTableAutoFormat * pTableFormat
Definition: docstyle.hxx:55
Base class for various Writer styles.
Definition: format.hxx:43
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:3118
#define cCELLSTYLE
Definition: docstyle.cxx:78
SwNumRule * FindNumRulePtr(const OUString &rName) const
Definition: docnum.cxx:2414
virtual sal_uLong GetHelpId(OUString &rFile) override
Definition: docstyle.cxx:2272
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
Style of a layout element.
Definition: frmfmt.hxx:57
const SwPageDesc * pDesc
Definition: docstyle.hxx:53
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:531
OUString GetTableTemplateCellSubName(const SwBoxAutoFormat &rBoxFormat) const
Returns the cell's name postfix. eg. ".1".
Definition: tblafmt.cxx:850
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
static const SwBoxAutoFormat * lcl_FindCellStyle(SwDoc &rDoc, const OUString &rName, SwDocStyleSheet *pStyle)
Definition: docstyle.cxx:333
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:125
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:878
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:327
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:159
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:3139
SfxStyleSheetBasePool * m_pPool
void SetHidden(bool bValue)
Definition: format.hxx:162
SwPageDesc * MakePageDesc(const OUString &rName, const SwPageDesc *pCpy=nullptr, bool bRegardLanguage=true, bool bBroadcast=false)
Definition: docdesc.cxx:642
virtual void Notify(SfxBroadcaster &, const SfxHint &) override
Definition: docstyle.cxx:3212
const OUString & GetValue() const
sal_uInt16 Count() const
size_t size() const
Definition: tblafmt.cxx:929
SwCharFormat * pCharFormat
Definition: docstyle.hxx:50
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:2437
sal_uInt8 GetPoolHlpFileId() const
Definition: format.hxx:149
size_t GetPageDescCnt() const
Definition: doc.hxx:877
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:29
virtual bool SetParent(const OUString &rStr) override
Definition: docstyle.cxx:1155
const SwNumRule * pNumRule
Definition: docstyle.hxx:54
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:856
const SwNumRule * GetNumRule()
Definition: docstyle.cxx:2175
void PresetFollow(const OUString &rName)
Definition: docstyle.hxx:119
sal_uInt8 GetPoolHlpFileId() const
Definition: numrule.hxx:255
const OUString * GetDocPattern(size_t nPos) const
Definition: poolfmt.cxx:116
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:398
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:621
bool IsHidden() const
Definition: pagedesc.hxx:207
void SetHidden(bool const bValue)
Definition: pagedesc.hxx:208
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
OUString SwResId(const char *pId)
Definition: swmodule.cxx:165
sal_uInt16 GetWhichByPos(sal_uInt16 nPos) const
bool IsAutoUpdateFormat() const
Query / set bAutoUpdateFormat-flag.
Definition: format.hxx:168
void SetPhysical(bool bPhys)
Definition: docstyle.cxx:2215
SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const
SAL_DLLPRIVATE void Create()
Make empty shell a real StyleSheet (Core).
Definition: docstyle.cxx:2079
SfxStyleFamily nFamily
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily, SfxStyleSearchBits nMask=SfxStyleSearchBits::All) override
Definition: docstyle.cxx:2416
std::unique_ptr< SwTableAutoFormat > DelTableStyle(const OUString &rName, bool bBroadcast=false)
Definition: ndtbl.cxx:4594
const SwNumRuleItem & GetNumRule(bool=true) const
Definition: paratr.hxx:218
void RemoveName(SfxStyleFamily eFam, const OUString &rName)
Definition: docstyle.cxx:425
void SetHidden(bool bHidden)
Set if style is hidden.
Definition: tblafmt.hxx:238
void ResetAttrAtFormat(const sal_uInt16 nWhichId, SwFormat &rChangedFormat)
Definition: docfmt.cxx:481
void push_back(Value const &rVal)
Definition: docary.hxx:98
SwFrameFormat * pFrameFormat
Definition: docstyle.hxx:52
void SetGrabBagItem(const css::uno::Any &rVal)
Definition: format.cxx:776
void ClearInvalidItems()
const SwPageDesc * GetFollow() const
Definition: pagedesc.hxx:246
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:742
void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel)
Definition: fmtcol.cxx:594
FillStyleType
Fill StyleSheet with data.
Definition: docstyle.hxx:66
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
static const std::vector< OUString > & GetNumRuleUINameArray()
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:78
virtual ~SwStyleSheetIterator() override
Definition: docstyle.cxx:2662
const OUString & GetName() const
Definition: tblafmt.hxx:208
SwTableAutoFormatTable & GetTableStyles()
Return the available table styles.
Definition: ndtbl.cxx:3885
void CallChgLnk()
Definition: crsrsh.cxx:2510
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:79
const sal_uInt16 USER_FMT
POLLCOLL-groups:
Definition: poolfmt.hxx:63
SwCharFormat * FindCharFormatByName(const OUString &rName) const
Definition: doc.hxx:768
constexpr sal_uInt16 RES_FRMATR_END(131)
SwFormat * DerivedFrom() const
Definition: format.hxx:108
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:167
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:2161
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:735
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:409
SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
Definition: number.cxx:1486
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_CJK_WEIGHT(26)
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:147
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All) override
Definition: docstyle.cxx:2570
#define SAL_WARN_IF(condition, area, stream)
virtual bool IsHidden() const override
Definition: docstyle.cxx:664
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:775
unsigned char sal_uInt8
void PageDescToItemSet(const SwPageDesc &rPageDesc, SfxItemSet &rSet)
Definition: uitool.cxx:405
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:165
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1063
#define cTABSTYLE
Definition: docstyle.cxx:77
void GetGrabBagItem(css::uno::Any &rVal) const
Definition: format.cxx:768
bool IsUsed(const SwModify &) const
Definition: poolfmt.cxx:84
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:197
void SetSvxRule(const SvxNumRule &, SwDoc *pDoc)
Definition: number.cxx:880
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:129
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:2448
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:2667
void SetValid(SvxBoxInfoItemValidFlags nValid, bool bValid=true)
virtual void SetEnableSetModified(bool bEnableSetModified)=0
void CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet &rSet)
Definition: docfly.cxx:501
MapUnit
#define SAL_WARN(area, stream)
bool HasTableStyles() const
Counts table styles without triggering lazy-load of them.
Definition: doc.hxx:1239
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLBACKGROUND)
size_t size() const
#define cPAGE
Definition: docstyle.cxx:75
SwBoxAutoFormat * GetBoxFormat(const OUString &sName) const
If found returns a ptr to a BoxFormat. If not found returns nullptr.
Definition: tblafmt.cxx:1221
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:116
#define cPARA
Definition: docstyle.cxx:73
SwTextFormatColl * pColl
Definition: docstyle.hxx:51
const SwFrameFormats * GetFrameFormats() const
Definition: doc.hxx:733
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:557
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:2267
static const std::vector< OUString > & GetTextUINameArray()
bool IsAuto() const
Query / set AutoFormat-flag.
Definition: format.hxx:158
aStr
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
SfxStyleSheetBasePool * pBasePool
void RegisterToFormat(SwFormat &)
Definition: fmtcol.cxx:498
SfxStyleSearchBits
SwTableAutoFormat * MakeTableStyle(const OUString &rName, bool bBroadcast=false)
Definition: ndtbl.cxx:4574
rtl::Reference< SwDocStyleSheet > mxStyleSheet
Definition: docstyle.hxx:195
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:58
const SwBoxAutoFormat * pBoxFormat
Definition: docstyle.hxx:56
virtual void ResetModified()=0
virtual void Remove(SfxStyleSheetBase *pStyle) override
Definition: docstyle.cxx:2454
void SetAutoUpdateFormat(bool bNew=true)
Definition: format.hxx:169