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  FillStyleSheet(FillPreview, &pRet);
1293  assert(pRet);
1294  return pRet;
1295  }
1296  else
1297  {
1298  switch (nFamily)
1299  {
1300  case SfxStyleFamily::Char:
1302  case SfxStyleFamily::Para:
1304  case SfxStyleFamily::Frame:
1306  default:
1307  std::abort();
1308  }
1309  }
1310 }
1311 
1312 // extract ItemSet to Name and Family, Mask
1313 
1315 {
1316  if(!bPhysical)
1318 
1319  switch(nFamily)
1320  {
1321  case SfxStyleFamily::Char:
1322  case SfxStyleFamily::Para:
1323  case SfxStyleFamily::Frame:
1324  {
1325  SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1326  aBoxInfo.SetTable( false );
1327  aBoxInfo.SetDist( true ); // always show gap field
1328  aBoxInfo.SetMinDist( true );// set minimum size in tables and paragraphs
1329  aBoxInfo.SetDefDist( MIN_BORDER_DIST );// always set Default-Gap
1330  // Single lines can only have DontCare-Status in tables
1331  aBoxInfo.SetValid( SvxBoxInfoItemValidFlags::DISABLE );
1332 
1333  if( nFamily == SfxStyleFamily::Char )
1334  {
1335  SAL_WARN_IF(!pCharFormat, "sw.ui", "Where's SwCharFormat");
1337  aCoreSet.Put( aBoxInfo );
1338 
1339  if(pCharFormat->DerivedFrom())
1341  }
1342  else if ( nFamily == SfxStyleFamily::Para )
1343  {
1344  OSL_ENSURE(pColl, "Where's Collection");
1346  aCoreSet.Put( aBoxInfo );
1347  aCoreSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, pColl->IsAutoUpdateFormat()));
1348 
1349  if(pColl->DerivedFrom())
1351  }
1352  else
1353  {
1354  OSL_ENSURE(pFrameFormat, "Where's FrameFormat");
1356  aCoreSet.Put( aBoxInfo );
1357  aCoreSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, pFrameFormat->IsAutoUpdateFormat()));
1358 
1359  if(pFrameFormat->DerivedFrom())
1361 
1362  // create needed items for XPropertyList entries from the DrawModel so that
1363  // the Area TabPage can access them
1364  const SwDrawModel* pDrawModel = rDoc.getIDocumentDrawModelAccess().GetDrawModel();
1365 
1366  aCoreSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE));
1367  aCoreSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST));
1368  aCoreSet.Put(SvxHatchListItem(pDrawModel->GetHatchList(), SID_HATCH_LIST));
1369  aCoreSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), SID_BITMAP_LIST));
1370  aCoreSet.Put(SvxPatternListItem(pDrawModel->GetPatternList(), SID_PATTERN_LIST));
1371  }
1372  }
1373  break;
1374 
1375  case SfxStyleFamily::Page :
1376  {
1377  // set correct parent to get the drawing::FillStyle_NONE FillStyle as needed
1378  if(!aCoreSet.GetParent())
1379  {
1381  }
1382 
1383  OSL_ENSURE(pDesc, "No PageDescriptor");
1384  ::PageDescToItemSet(*const_cast<SwPageDesc*>(pDesc), aCoreSet);
1385  }
1386  break;
1387 
1388  case SfxStyleFamily::Pseudo:
1389  {
1390  OSL_ENSURE(pNumRule, "No NumRule");
1391  SvxNumRule aRule = pNumRule->MakeSvxNumRule();
1392  aCoreSet.Put(SvxNumBulletItem(aRule));
1393  }
1394  break;
1395 
1396  default:
1397  OSL_ENSURE(false, "unknown style family");
1398  }
1399  // Member of Baseclass
1400  pSet = &aCoreSet;
1401 
1402  return aCoreSet;
1403 }
1404 
1406 {
1407  if ( nFamily != SfxStyleFamily::Para )
1408  {
1409  return;
1410  }
1411 
1412  OSL_ENSURE( pColl, "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - missing paragraph style");
1414  {
1415  OSL_ENSURE( pColl->GetItemState( RES_PARATR_NUMRULE ) == SfxItemState::SET,
1416  "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - list level indents are applicable at paragraph style, but no list style found. Serious defect." );
1417  const OUString sNumRule = pColl->GetNumRule().GetValue();
1418  if (!sNumRule.isEmpty())
1419  {
1420  const SwNumRule* pRule = rDoc.FindNumRulePtr( sNumRule );
1421  if( pRule )
1422  {
1423  const SwNumFormat& rFormat = pRule->Get( 0 );
1425  {
1427  aLR.SetTextLeft( rFormat.GetIndentAt() );
1428  aLR.SetTextFirstLineOffset( static_cast<short>(rFormat.GetFirstLineIndent()) );
1429  rSet.Put( aLR );
1430  }
1431  }
1432  }
1433  }
1434 }
1435 
1436 // handling of parameter <bResetIndentAttrsAtParagraphStyle>
1438  const bool bResetIndentAttrsAtParagraphStyle )
1439 {
1440  // if applicable determine format first
1441  if(!bPhysical)
1443 
1444  SwImplShellAction aTmpSh( rDoc );
1445 
1446  OSL_ENSURE( &rSet != &aCoreSet, "SetItemSet with own Set is not allowed" );
1447 
1448  if (rDoc.GetIDocumentUndoRedo().DoesUndo())
1449  {
1450  SwRewriter aRewriter;
1451  aRewriter.AddRule( UndoArg1, GetName() );
1452  rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::INSFMTATTR, &aRewriter );
1453  }
1454 
1455  SwFormat* pFormat = nullptr;
1456  std::unique_ptr<SwPageDesc> pNewDsc;
1457  size_t nPgDscPos = 0;
1458 
1459  switch(nFamily)
1460  {
1461  case SfxStyleFamily::Char :
1462  {
1463  OSL_ENSURE(pCharFormat, "Where's CharFormat");
1464  pFormat = pCharFormat;
1465  }
1466  break;
1467 
1468  case SfxStyleFamily::Para :
1469  {
1470  OSL_ENSURE(pColl, "Where's Collection");
1471  const SfxPoolItem* pAutoUpdate;
1472  if(SfxItemState::SET == rSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE,false, &pAutoUpdate ))
1473  {
1474  pColl->SetAutoUpdateFormat(static_cast<const SfxBoolItem*>(pAutoUpdate)->GetValue());
1475  }
1476 
1477  const SwCondCollItem* pCondItem;
1478  if( SfxItemState::SET != rSet.GetItemState( FN_COND_COLL, false,
1479  reinterpret_cast<const SfxPoolItem**>(&pCondItem) ))
1480  pCondItem = nullptr;
1481 
1482  if( RES_CONDTXTFMTCOLL == pColl->Which() && pCondItem )
1483  {
1484  const CommandStruct* pCmds = SwCondCollItem::GetCmds();
1485  for(sal_uInt16 i = 0; i < COND_COMMAND_COUNT; i++)
1486  {
1487  SwCollCondition aCond( nullptr, pCmds[ i ].nCnd, pCmds[ i ].nSubCond );
1488  static_cast<SwConditionTextFormatColl*>(pColl)->RemoveCondition( aCond );
1489  const OUString sStyle = pCondItem->GetStyle( i );
1490  if (sStyle.isEmpty())
1491  continue;
1492  SwFormat *const pFindFormat = lcl_FindParaFormat( rDoc, sStyle );
1493  if (pFindFormat)
1494  {
1495  aCond.RegisterToFormat( *pFindFormat );
1496  static_cast<SwConditionTextFormatColl*>(pColl)->InsertCondition( aCond );
1497  }
1498  }
1499 
1500  // Update document to new conditions
1501  SwCondCollCondChg aMsg( pColl );
1502  pColl->ModifyNotification( &aMsg, &aMsg );
1503  }
1504  else if( pCondItem && !pColl->HasWriterListeners() )
1505  {
1506  // no conditional template, then first create and adopt
1507  // all important values
1509  pColl->GetName(), static_cast<SwTextFormatColl*>(pColl->DerivedFrom()) );
1510  if( pColl != &pColl->GetNextTextFormatColl() )
1512 
1515  else
1517 
1518  const CommandStruct* pCmds = SwCondCollItem::GetCmds();
1519  for( sal_uInt16 i = 0; i < COND_COMMAND_COUNT; ++i )
1520  {
1521  const OUString sStyle = pCondItem->GetStyle( i );
1522  if (sStyle.isEmpty())
1523  continue;
1524  SwTextFormatColl *const pFindFormat = lcl_FindParaFormat( rDoc, sStyle );
1525  if (pFindFormat)
1526  {
1527  pCColl->InsertCondition( SwCollCondition( pFindFormat,
1528  pCmds[ i ].nCnd, pCmds[ i ].nSubCond ) );
1529  }
1530  }
1531 
1532  rDoc.DelTextFormatColl( pColl );
1533  pColl = pCColl;
1534  }
1535  if ( bResetIndentAttrsAtParagraphStyle &&
1536  rSet.GetItemState( RES_PARATR_NUMRULE, false ) == SfxItemState::SET &&
1537  rSet.GetItemState( RES_LR_SPACE, false ) != SfxItemState::SET &&
1538  pColl->GetItemState( RES_LR_SPACE, false ) == SfxItemState::SET )
1539  {
1541  }
1542 
1543  // #i56252: If a standard numbering style is assigned to a standard paragraph style
1544  // we have to create a physical instance of the numbering style. If we do not and
1545  // neither the paragraph style nor the numbering style is used in the document
1546  // the numbering style will not be saved with the document and the assignment got lost.
1547  const SfxPoolItem* pNumRuleItem = nullptr;
1548  if( SfxItemState::SET == rSet.GetItemState( RES_PARATR_NUMRULE, false, &pNumRuleItem ) )
1549  { // Setting a numbering rule?
1550  const OUString sNumRule = static_cast<const SwNumRuleItem*>(pNumRuleItem)->GetValue();
1551  if (!sNumRule.isEmpty())
1552  {
1553  SwNumRule* pRule = rDoc.FindNumRulePtr( sNumRule );
1554  if( !pRule )
1555  { // Numbering rule not in use yet.
1556  sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( sNumRule, SwGetPoolIdFromName::NumRule );
1557  if( USHRT_MAX != nPoolId ) // It's a standard numbering rule
1558  {
1559  rDoc.getIDocumentStylePoolAccess().GetNumRuleFromPool( nPoolId ); // Create numbering rule (physical)
1560  }
1561  }
1562  }
1563  }
1564 
1565  pFormat = pColl;
1566 
1567  sal_uInt16 nId = pColl->GetPoolFormatId() &
1569  switch( GetMask() & ( static_cast<SfxStyleSearchBits>(0x0fff) & ~SfxStyleSearchBits::SwCondColl ) )
1570  {
1571  case SfxStyleSearchBits::SwText:
1572  nId |= COLL_TEXT_BITS;
1573  break;
1574  case SfxStyleSearchBits::SwChapter:
1575  nId |= COLL_DOC_BITS;
1576  break;
1577  case SfxStyleSearchBits::SwList:
1578  nId |= COLL_LISTS_BITS;
1579  break;
1580  case SfxStyleSearchBits::SwIndex:
1581  nId |= COLL_REGISTER_BITS;
1582  break;
1583  case SfxStyleSearchBits::SwExtra:
1584  nId |= COLL_EXTRA_BITS;
1585  break;
1586  case SfxStyleSearchBits::SwHtml:
1587  nId |= COLL_HTML_BITS;
1588  break;
1589  default: break;
1590  }
1591  pColl->SetPoolFormatId( nId );
1592  break;
1593  }
1594  case SfxStyleFamily::Frame:
1595  {
1596  OSL_ENSURE(pFrameFormat, "Where's FrameFormat");
1597  const SfxPoolItem* pAutoUpdate;
1598  if(SfxItemState::SET == rSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE,false, &pAutoUpdate ))
1599  {
1600  pFrameFormat->SetAutoUpdateFormat(static_cast<const SfxBoolItem*>(pAutoUpdate)->GetValue());
1601  }
1602  pFormat = pFrameFormat;
1603  }
1604  break;
1605 
1606  case SfxStyleFamily::Page :
1607  {
1608  OSL_ENSURE(pDesc, "Where's PageDescriptor");
1609 
1610  if (rDoc.FindPageDesc(pDesc->GetName(), &nPgDscPos))
1611  {
1612  pNewDsc.reset( new SwPageDesc( *pDesc ) );
1613  // #i48949# - no undo actions for the
1614  // copy of the page style
1615  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1616  rDoc.CopyPageDesc(*pDesc, *pNewDsc); // #i7983#
1617 
1618  pFormat = &pNewDsc->GetMaster();
1619  }
1620  }
1621  break;
1622 
1623  case SfxStyleFamily::Pseudo:
1624  {
1625  OSL_ENSURE(pNumRule, "Where's NumRule");
1626 
1627  if (!pNumRule)
1628  break;
1629 
1630  const SfxPoolItem* pItem;
1631  switch( rSet.GetItemState( SID_ATTR_NUMBERING_RULE, false, &pItem ))
1632  {
1633  case SfxItemState::SET:
1634  {
1635  SvxNumRule* pSetRule = static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule();
1636  pSetRule->UnLinkGraphics();
1637  SwNumRule aSetRule(*pNumRule);
1638  aSetRule.SetSvxRule(*pSetRule, &rDoc);
1639  rDoc.ChgNumRuleFormats( aSetRule );
1640  }
1641  break;
1642  case SfxItemState::DONTCARE:
1643  // set NumRule to default values
1644  // what are the default values?
1645  {
1646  SwNumRule aRule( pNumRule->GetName(),
1647  // #i89178#
1649  rDoc.ChgNumRuleFormats( aRule );
1650  }
1651  break;
1652  default: break;
1653  }
1654  }
1655  break;
1656 
1657  default:
1658  OSL_ENSURE(false, "unknown style family");
1659  }
1660 
1661  if( pFormat && rSet.Count())
1662  {
1663  SfxItemIter aIter( rSet );
1664  const SfxPoolItem* pItem = aIter.GetCurItem();
1665  do
1666  {
1667  if( IsInvalidItem( pItem ) ) // Clear
1668  {
1669  // use method <SwDoc::ResetAttrAtFormat(..)> in order to
1670  // create an Undo object for the attribute reset.
1671  rDoc.ResetAttrAtFormat( rSet.GetWhichByPos(aIter.GetCurPos()),
1672  *pFormat );
1673  }
1674 
1675  pItem = aIter.NextItem();
1676  } while (pItem);
1677  SfxItemSet aSet(rSet);
1678  aSet.ClearInvalidItems();
1679 
1680  if(SfxStyleFamily::Frame == nFamily)
1681  {
1682  // Need to check for unique item for DrawingLayer items of type NameOrIndex
1683  // and evtl. correct that item to ensure unique names for that type. This call may
1684  // modify/correct entries inside of the given SfxItemSet
1686  }
1687 
1688  aCoreSet.ClearItem();
1689 
1690  if( pNewDsc )
1691  {
1692  ::ItemSetToPageDesc( aSet, *pNewDsc );
1693  rDoc.ChgPageDesc( nPgDscPos, *pNewDsc );
1694  pDesc = &rDoc.GetPageDesc( nPgDscPos );
1695  rDoc.PreDelPageDesc(pNewDsc.get()); // #i7983#
1696  pNewDsc.reset();
1697  }
1698  else
1699  rDoc.ChgFormat(*pFormat, aSet); // put all that is set
1700  }
1701  else
1702  {
1703  aCoreSet.ClearItem();
1704  if( pNewDsc ) // we still need to delete it
1705  {
1706  rDoc.PreDelPageDesc(pNewDsc.get()); // #i7983#
1707  pNewDsc.reset();
1708  }
1709  }
1710 
1711  if (rDoc.GetIDocumentUndoRedo().DoesUndo())
1712  {
1713  rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::END, nullptr);
1714  }
1715 }
1716 
1717 static void lcl_SaveStyles( SfxStyleFamily nFamily, std::vector<void*>& rArr, SwDoc& rDoc )
1718 {
1719  switch( nFamily )
1720  {
1721  case SfxStyleFamily::Char:
1722  {
1723  const SwCharFormats& rTable = *rDoc.GetCharFormats();
1724  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1725  {
1726  rArr.push_back( rTable[ n ] );
1727  }
1728  }
1729  break;
1730  case SfxStyleFamily::Para:
1731  {
1732  const SwTextFormatColls& rTable = *rDoc.GetTextFormatColls();
1733  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1734  {
1735  rArr.push_back( rTable[ n ] );
1736  }
1737  }
1738  break;
1739  case SfxStyleFamily::Frame:
1740  {
1741  const SwFrameFormats& rTable = *rDoc.GetFrameFormats();
1742  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1743  {
1744  rArr.push_back( rTable[ n ] );
1745  }
1746  }
1747  break;
1748 
1749  case SfxStyleFamily::Page:
1750  {
1751  for( size_t n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n )
1752  {
1753  rArr.push_back( &rDoc.GetPageDesc( n ) );
1754  }
1755  }
1756  break;
1757 
1758  case SfxStyleFamily::Pseudo:
1759  {
1760  const SwNumRuleTable& rTable = rDoc.GetNumRuleTable();
1761  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1762  {
1763  rArr.push_back( rTable[ n ] );
1764  }
1765  }
1766  break;
1767  default: break;
1768  }
1769 }
1770 
1771 static bool lcl_Contains(const std::vector<void*>& rArr, const void* p)
1772 {
1773  return std::find( rArr.begin(), rArr.end(), p ) != rArr.end();
1774 }
1775 
1776 static void lcl_DeleteInfoStyles( SfxStyleFamily nFamily, std::vector<void*> const & rArr, SwDoc& rDoc )
1777 {
1778  size_t n, nCnt;
1779  switch( nFamily )
1780  {
1781  case SfxStyleFamily::Char:
1782  {
1783  std::deque<sal_uInt16> aDelArr;
1784  const SwCharFormats& rTable = *rDoc.GetCharFormats();
1785  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1786  {
1787  if( !lcl_Contains( rArr, rTable[ n ] ))
1788  aDelArr.push_front( n );
1789  }
1790  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1791  rDoc.DelCharFormat( aDelArr[ n ] );
1792  }
1793  break;
1794 
1795  case SfxStyleFamily::Para :
1796  {
1797  std::deque<sal_uInt16> aDelArr;
1798  const SwTextFormatColls& rTable = *rDoc.GetTextFormatColls();
1799  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1800  {
1801  if( !lcl_Contains( rArr, rTable[ n ] ))
1802  aDelArr.push_front( n );
1803  }
1804  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1805  rDoc.DelTextFormatColl( aDelArr[ n ] );
1806  }
1807  break;
1808 
1809  case SfxStyleFamily::Frame:
1810  {
1811  std::deque<SwFrameFormat*> aDelArr;
1812  const SwFrameFormats& rTable = *rDoc.GetFrameFormats();
1813  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1814  {
1815  if( !lcl_Contains( rArr, rTable[ n ] ))
1816  aDelArr.push_front( rTable[ n ] );
1817  }
1818  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1819  rDoc.DelFrameFormat( aDelArr[ n ] );
1820  }
1821  break;
1822 
1823  case SfxStyleFamily::Page:
1824  {
1825  std::deque<size_t> aDelArr;
1826  for( n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n )
1827  {
1828  if( !lcl_Contains( rArr, &rDoc.GetPageDesc( n ) ))
1829  aDelArr.push_front( n );
1830  }
1831  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1832  rDoc.DelPageDesc( aDelArr[ n ] );
1833  }
1834  break;
1835 
1836  case SfxStyleFamily::Pseudo:
1837  {
1838  std::deque<SwNumRule*> aDelArr;
1839  const SwNumRuleTable& rTable = rDoc.GetNumRuleTable();
1840  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1841  {
1842  if( !lcl_Contains( rArr, rTable[ n ] ))
1843  aDelArr.push_front( rTable[ n ] );
1844  }
1845  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1846  rDoc.DelNumRule( aDelArr[ n ]->GetName() );
1847  }
1848  break;
1849  default: break;
1850  }
1851 }
1852 
1853 // determine the format
1855  FillStyleType const eFType, std::unique_ptr<SfxItemSet> *const o_ppFlatSet)
1856 {
1857  bool bRet = false;
1858  sal_uInt16 nPoolId = USHRT_MAX;
1859  SwFormat* pFormat = nullptr;
1860 
1861  bool bCreate = FillPhysical == eFType;
1862  bool bDeleteInfo = false;
1863  bool bFillOnlyInfo = FillAllInfo == eFType || FillPreview == eFType;
1864  std::vector<void*> aDelArr;
1865  bool const isModified(rDoc.getIDocumentState().IsModified());
1866 
1867  switch(nFamily)
1868  {
1869  case SfxStyleFamily::Char:
1870  pCharFormat = lcl_FindCharFormat(rDoc, aName, this, bCreate );
1871  bPhysical = nullptr != pCharFormat;
1872  if( bFillOnlyInfo && !bPhysical )
1873  {
1874  // create style (plus all needed parents) and clean it up
1875  // later - without affecting the undo/redo stack
1876  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1877  bDeleteInfo = true;
1878  ::lcl_SaveStyles( nFamily, aDelArr, rDoc );
1879  pCharFormat = lcl_FindCharFormat(rDoc, aName, this );
1880  }
1881 
1882  pFormat = pCharFormat;
1883  if( !bCreate && !pFormat )
1884  {
1885  if( aName == SwResId(STR_POOLCHR_STANDARD))
1886  nPoolId = 0;
1887  else
1889  }
1890 
1891  bRet = nullptr != pCharFormat || USHRT_MAX != nPoolId;
1892 
1893  if( bDeleteInfo )
1894  pCharFormat = nullptr;
1895  break;
1896 
1897  case SfxStyleFamily::Para:
1898  {
1899  pColl = lcl_FindParaFormat(rDoc, aName, this, bCreate);
1900  bPhysical = nullptr != pColl;
1901  if( bFillOnlyInfo && !bPhysical )
1902  {
1903  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1904  bDeleteInfo = true;
1905  ::lcl_SaveStyles( nFamily, aDelArr, rDoc );
1906  pColl = lcl_FindParaFormat(rDoc, aName, this );
1907  }
1908 
1909  pFormat = pColl;
1910  if( pColl )
1912  else if( !bCreate )
1914 
1915  bRet = nullptr != pColl || USHRT_MAX != nPoolId;
1916 
1917  if( bDeleteInfo )
1918  pColl = nullptr;
1919  }
1920  break;
1921 
1922  case SfxStyleFamily::Frame:
1923  pFrameFormat = lcl_FindFrameFormat(rDoc, aName, this, bCreate);
1924  bPhysical = nullptr != pFrameFormat;
1925  if (bFillOnlyInfo && !bPhysical)
1926  {
1927  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1928  bDeleteInfo = true;
1929  ::lcl_SaveStyles( nFamily, aDelArr, rDoc );
1930  pFrameFormat = lcl_FindFrameFormat(rDoc, aName, this );
1931  }
1932  pFormat = pFrameFormat;
1933  if( !bCreate && !pFormat )
1935 
1936  bRet = nullptr != pFrameFormat || USHRT_MAX != nPoolId;
1937 
1938  if( bDeleteInfo )
1939  pFrameFormat = nullptr;
1940  break;
1941 
1942  case SfxStyleFamily::Page:
1943  pDesc = lcl_FindPageDesc(rDoc, aName, this, bCreate);
1944  bPhysical = nullptr != pDesc;
1945  if( bFillOnlyInfo && !pDesc )
1946  {
1947  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1948  bDeleteInfo = true;
1949  ::lcl_SaveStyles( nFamily, aDelArr, rDoc );
1950  pDesc = lcl_FindPageDesc( rDoc, aName, this );
1951  }
1952 
1953  if( pDesc )
1954  {
1955  nPoolId = pDesc->GetPoolFormatId();
1956  nHelpId = pDesc->GetPoolHelpId();
1957  if( pDesc->GetPoolHlpFileId() != UCHAR_MAX )
1958  aHelpFile = *rDoc.GetDocPattern( pDesc->GetPoolHlpFileId() );
1959  else
1960  aHelpFile.clear();
1961  }
1962  else if( !bCreate )
1964  SetMask( (USER_FMT & nPoolId) ? SfxStyleSearchBits::UserDefined : SfxStyleSearchBits::Auto );
1965 
1966  bRet = nullptr != pDesc || USHRT_MAX != nPoolId;
1967  if( bDeleteInfo )
1968  pDesc = nullptr;
1969  break;
1970 
1971  case SfxStyleFamily::Pseudo:
1972  pNumRule = lcl_FindNumRule(rDoc, aName, this, bCreate);
1973  bPhysical = nullptr != pNumRule;
1974  if( bFillOnlyInfo && !pNumRule )
1975  {
1976  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1977  bDeleteInfo = true;
1978  ::lcl_SaveStyles( nFamily, aDelArr, rDoc );
1979  pNumRule = lcl_FindNumRule( rDoc, aName, this );
1980  }
1981 
1982  if( pNumRule )
1983  {
1984  nPoolId = pNumRule->GetPoolFormatId();
1986  if( pNumRule->GetPoolHlpFileId() != UCHAR_MAX )
1988  else
1989  aHelpFile.clear();
1990  }
1991  else if( !bCreate )
1993  SetMask( (USER_FMT & nPoolId) ? SfxStyleSearchBits::UserDefined : SfxStyleSearchBits::Auto );
1994 
1995  bRet = nullptr != pNumRule || USHRT_MAX != nPoolId;
1996 
1997  if( bDeleteInfo )
1998  pNumRule = nullptr;
1999  break;
2000 
2001  case SfxStyleFamily::Table:
2002  pTableFormat = lcl_FindTableStyle(rDoc, aName, this, bCreate);
2003  SetMask((pTableFormat && pTableFormat->IsUserDefined()) ? SfxStyleSearchBits::UserDefined : SfxStyleSearchBits::Auto);
2004  bRet = bPhysical = (nullptr != pTableFormat);
2005  break;
2006 
2007  case SfxStyleFamily::Cell:
2008  pBoxFormat = lcl_FindCellStyle(rDoc, aName, this);
2009  bRet = bPhysical = (nullptr != pBoxFormat);
2010  break;
2011  default:; //prevent warning
2012  }
2013 
2014  if( SfxStyleFamily::Char == nFamily ||
2015  SfxStyleFamily::Para == nFamily ||
2016  SfxStyleFamily::Frame == nFamily )
2017  {
2018  if( pFormat )
2019  nPoolId = pFormat->GetPoolFormatId();
2020 
2021  SfxStyleSearchBits _nMask = SfxStyleSearchBits::Auto;
2022  if( pFormat == rDoc.GetDfltCharFormat() )
2023  _nMask |= SfxStyleSearchBits::ReadOnly;
2024  else if( USER_FMT & nPoolId )
2025  _nMask |= SfxStyleSearchBits::UserDefined;
2026 
2027  switch ( COLL_GET_RANGE_BITS & nPoolId )
2028  {
2029  case COLL_TEXT_BITS: _nMask |= SfxStyleSearchBits::SwText; break;
2030  case COLL_DOC_BITS : _nMask |= SfxStyleSearchBits::SwChapter; break;
2031  case COLL_LISTS_BITS: _nMask |= SfxStyleSearchBits::SwList; break;
2032  case COLL_REGISTER_BITS: _nMask |= SfxStyleSearchBits::SwIndex; break;
2033  case COLL_EXTRA_BITS: _nMask |= SfxStyleSearchBits::SwExtra; break;
2034  case COLL_HTML_BITS: _nMask |= SfxStyleSearchBits::SwHtml; break;
2035  }
2036 
2037  if( pFormat )
2038  {
2039  OSL_ENSURE( bPhysical, "Format not found" );
2040 
2041  nHelpId = pFormat->GetPoolHelpId();
2042  if( pFormat->GetPoolHlpFileId() != UCHAR_MAX )
2043  aHelpFile = *rDoc.GetDocPattern( pFormat->GetPoolHlpFileId() );
2044  else
2045  aHelpFile.clear();
2046 
2047  if( RES_CONDTXTFMTCOLL == pFormat->Which() )
2048  _nMask |= SfxStyleSearchBits::SwCondColl;
2049 
2050  if (FillPreview == eFType)
2051  {
2052  assert(o_ppFlatSet);
2053  *o_ppFlatSet = lcl_SwFormatToFlatItemSet(pFormat);
2054  }
2055  }
2056 
2057  SetMask( _nMask );
2058  }
2059  if( bDeleteInfo && bFillOnlyInfo )
2060  {
2061  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
2062  ::lcl_DeleteInfoStyles( nFamily, aDelArr, rDoc );
2063  if (!isModified)
2064  {
2066  }
2067  }
2068  return bRet;
2069 }
2070 
2071 // Create new format in Core
2073 {
2074  switch(nFamily)
2075  {
2076  case SfxStyleFamily::Char :
2078  if( !pCharFormat )
2080  rDoc.GetDfltCharFormat());
2081  pCharFormat->SetAuto(false);
2082  break;
2083 
2084  case SfxStyleFamily::Para :
2085  pColl = lcl_FindParaFormat( rDoc, aName );
2086  if( !pColl )
2087  {
2088  SwTextFormatColl *pPar = (*rDoc.GetTextFormatColls())[0];
2089  if( nMask & SfxStyleSearchBits::SwCondColl )
2090  pColl = rDoc.MakeCondTextFormatColl( aName, pPar );
2091  else
2092  pColl = rDoc.MakeTextFormatColl( aName, pPar );
2093  }
2094  break;
2095 
2096  case SfxStyleFamily::Frame:
2098  if( !pFrameFormat )
2099  pFrameFormat = rDoc.MakeFrameFormat(aName, rDoc.GetDfltFrameFormat(), false, false);
2100 
2101  break;
2102 
2103  case SfxStyleFamily::Page :
2104  pDesc = lcl_FindPageDesc( rDoc, aName );
2105  if( !pDesc )
2106  {
2107  pDesc = rDoc.MakePageDesc(aName);
2108  }
2109  break;
2110 
2111  case SfxStyleFamily::Pseudo:
2112  pNumRule = lcl_FindNumRule( rDoc, aName );
2113  if( !pNumRule )
2114  {
2115  const OUString sTmpNm( aName.isEmpty() ? rDoc.GetUniqueNumRuleName() : aName );
2116  SwNumRule* pRule = rDoc.GetNumRuleTable()[
2117  rDoc.MakeNumRule( sTmpNm, nullptr, false,
2118  // #i89178#
2120  pRule->SetAutoRule( false );
2121  if( aName.isEmpty() )
2122  {
2123  // #i91400#
2124  pRule->SetName( aName, rDoc.getIDocumentListsAccess() );
2125  }
2126  pNumRule = pRule;
2127  }
2128  break;
2129 
2130  case SfxStyleFamily::Table:
2131  if (aName.isEmpty())
2132  return;
2134  if (!pTableFormat)
2135  {
2136  rDoc.MakeTableStyle(aName);
2138  SAL_WARN_IF(!pTableFormat, "sw.ui", "Recently added auto format not found");
2139  }
2140  break;
2141  default:; //prevent warning
2142  }
2143  bPhysical = true;
2144  aCoreSet.ClearItem();
2145 }
2146 
2148 {
2149  if(!bPhysical)
2151  return pCharFormat;
2152 }
2153 
2155 {
2156  if(!bPhysical)
2158  return pColl;
2159 }
2160 
2162 {
2163  if(!bPhysical)
2165  return pDesc;
2166 }
2167 
2169 {
2170  if(!bPhysical)
2172  return pNumRule;
2173 }
2174 
2175 
2177 {
2178  OSL_ENSURE(pNumRule, "Where is the NumRule");
2179  rDoc.ChgNumRuleFormats( rRule );
2180 }
2181 
2183 {
2184  if(!bPhysical)
2186  assert(pTableFormat && "SwDocStyleSheet table style, SwTableAutoFormat not found");
2187  return pTableFormat;
2188 }
2189 
2190 // re-generate Name AND Family from String
2191 // First() and Next() (see below) insert an identification letter at Pos.1
2192 
2193 void SwDocStyleSheet::PresetNameAndFamily(const OUString& rName)
2194 {
2195  switch( rName[0] )
2196  {
2197  case cPARA: nFamily = SfxStyleFamily::Para; break;
2198  case cFRAME: nFamily = SfxStyleFamily::Frame; break;
2199  case cPAGE: nFamily = SfxStyleFamily::Page; break;
2200  case cNUMRULE: nFamily = SfxStyleFamily::Pseudo; break;
2201  case cTABSTYLE: nFamily = SfxStyleFamily::Table; break;
2202  default: nFamily = SfxStyleFamily::Char; break;
2203  }
2204  aName = rName.copy(1);
2205 }
2206 
2207 // Is the format physically present yet
2209 {
2210  bPhysical = bPhys;
2211 
2212  if(!bPhys)
2213  {
2214  pCharFormat = nullptr;
2215  pColl = nullptr;
2216  pFrameFormat = nullptr;
2217  pDesc = nullptr;
2218  }
2219 }
2220 
2222 {
2223  if(!bPhysical)
2225  return pFrameFormat;
2226 }
2227 
2229 {
2230  if( !bPhysical )
2231  {
2232  SwDocStyleSheet* pThis = const_cast<SwDocStyleSheet*>(this);
2233  pThis->FillStyleSheet( FillOnlyName );
2234  }
2235 
2236  if( !bPhysical )
2237  return false;
2238 
2239  const SwModify* pMod;
2240  switch( nFamily )
2241  {
2242  case SfxStyleFamily::Char : pMod = pCharFormat; break;
2243  case SfxStyleFamily::Para : pMod = pColl; break;
2244  case SfxStyleFamily::Frame: pMod = pFrameFormat; break;
2245  case SfxStyleFamily::Page : pMod = pDesc; break;
2246 
2247  case SfxStyleFamily::Pseudo:
2248  return pNumRule && SwDoc::IsUsed( *pNumRule );
2249 
2250  case SfxStyleFamily::Table:
2251  return pTableFormat && rDoc.IsUsed( *pTableFormat );
2252 
2253  default:
2254  OSL_ENSURE(false, "unknown style family");
2255  return false;
2256  }
2257  return rDoc.IsUsed( *pMod );
2258 }
2259 
2261 {
2262  return pNumRule ? pNumRule->MakeParagraphStyleListString() : OUString();
2263 }
2264 
2266 {
2267  sal_uInt16 nId = 0;
2268  sal_uInt16 nPoolId = 0;
2269  unsigned char nFileId = UCHAR_MAX;
2270 
2271  rFile = "swrhlppi.hlp";
2272 
2273  const SwFormat* pTmpFormat = nullptr;
2274  switch( nFamily )
2275  {
2276  case SfxStyleFamily::Char :
2277  if( !pCharFormat &&
2278  nullptr == (pCharFormat = lcl_FindCharFormat( rDoc, aName, nullptr, false )) )
2279  {
2281  return USHRT_MAX == nId ? 0 : nId;
2282  }
2283  pTmpFormat = pCharFormat;
2284  break;
2285 
2286  case SfxStyleFamily::Para:
2287  if( !pColl &&
2288  nullptr == ( pColl = lcl_FindParaFormat( rDoc, aName, nullptr, false )) )
2289  {
2291  return USHRT_MAX == nId ? 0 : nId;
2292  }
2293  pTmpFormat = pColl;
2294  break;
2295 
2296  case SfxStyleFamily::Frame:
2297  if( !pFrameFormat &&
2298  nullptr == ( pFrameFormat = lcl_FindFrameFormat( rDoc, aName, nullptr, false ) ) )
2299  {
2301  return USHRT_MAX == nId ? 0 : nId;
2302  }
2303  pTmpFormat = pFrameFormat;
2304  break;
2305 
2306  case SfxStyleFamily::Page:
2307  if( !pDesc &&
2308  nullptr == ( pDesc = lcl_FindPageDesc( rDoc, aName, nullptr, false ) ) )
2309  {
2311  return USHRT_MAX == nId ? 0 : nId;
2312  }
2313 
2314  nId = pDesc->GetPoolHelpId();
2315  nFileId = pDesc->GetPoolHlpFileId();
2316  nPoolId = pDesc->GetPoolFormatId();
2317  break;
2318 
2319  case SfxStyleFamily::Pseudo:
2320  if( !pNumRule &&
2321  nullptr == ( pNumRule = lcl_FindNumRule( rDoc, aName, nullptr, false ) ) )
2322  {
2324  return USHRT_MAX == nId ? 0 : nId;
2325  }
2326 
2327  nId = pNumRule->GetPoolHelpId();
2328  nFileId = pNumRule->GetPoolHlpFileId();
2329  nPoolId = pNumRule->GetPoolFormatId();
2330  break;
2331 
2332  default:
2333  OSL_ENSURE(false, "unknown style family");
2334  return 0;
2335  }
2336 
2337  if( pTmpFormat )
2338  {
2339  nId = pTmpFormat->GetPoolHelpId();
2340  nFileId = pTmpFormat->GetPoolHlpFileId();
2341  nPoolId = pTmpFormat->GetPoolFormatId();
2342  }
2343 
2344  if( UCHAR_MAX != nFileId )
2345  {
2346  const OUString *pTemplate = rDoc.GetDocPattern( nFileId );
2347  if( pTemplate )
2348  {
2349  rFile = *pTemplate;
2350  }
2351  }
2352  else if( !IsPoolUserFormat( nPoolId ) )
2353  {
2354  nId = nPoolId;
2355  }
2356 
2357  // because SFX acts like that, with HelpId:
2358  if( USHRT_MAX == nId )
2359  nId = 0; // don't show Help accordingly
2360 
2361  return nId;
2362 }
2363 
2364 void SwDocStyleSheet::SetHelpId( const OUString& r, sal_uLong nId )
2365 {
2366  sal_uInt8 nFileId = static_cast< sal_uInt8 >(rDoc.SetDocPattern( r ));
2367  sal_uInt16 nHId = static_cast< sal_uInt16 >(nId);
2368 
2369  SwFormat* pTmpFormat = nullptr;
2370  switch( nFamily )
2371  {
2372  case SfxStyleFamily::Char : pTmpFormat = pCharFormat; break;
2373  case SfxStyleFamily::Para : pTmpFormat = pColl; break;
2374  case SfxStyleFamily::Frame: pTmpFormat = pFrameFormat; break;
2375  case SfxStyleFamily::Page :
2376  const_cast<SwPageDesc*>(pDesc)->SetPoolHelpId( nHId );
2377  const_cast<SwPageDesc*>(pDesc)->SetPoolHlpFileId( nFileId );
2378  break;
2379 
2380  case SfxStyleFamily::Pseudo:
2381  const_cast<SwNumRule*>(pNumRule)->SetPoolHelpId( nHId );
2382  const_cast<SwNumRule*>(pNumRule)->SetPoolHlpFileId( nFileId );
2383  break;
2384 
2385  default:
2386  OSL_ENSURE(false, "unknown style family");
2387  return ;
2388  }
2389  if( pTmpFormat )
2390  {
2391  pTmpFormat->SetPoolHelpId( nHId );
2392  pTmpFormat->SetPoolHlpFileId( nFileId );
2393  }
2394 }
2395 
2396 // methods for DocStyleSheetPool
2398  : SfxStyleSheetBasePool(rDocument.GetAttrPool())
2399  , mxStyleSheet(new SwDocStyleSheet(rDocument, *this))
2400  , rDoc(rDocument)
2401 {
2402  bOrganizer = bOrg;
2403 }
2404 
2406 {
2407 }
2408 
2410  SfxStyleFamily eFam,
2411  SfxStyleSearchBits _nMask)
2412 {
2413  mxStyleSheet->PresetName(rName);
2414  mxStyleSheet->PresetParent(OUString());
2415  mxStyleSheet->PresetFollow(OUString());
2416  mxStyleSheet->SetMask(_nMask) ;
2417  mxStyleSheet->SetFamily(eFam);
2418  mxStyleSheet->SetPhysical(true);
2419  mxStyleSheet->Create();
2420 
2421  return *mxStyleSheet;
2422 }
2423 
2425 {
2426  OSL_ENSURE(false , "Create in SW-Stylesheet-Pool not possible" );
2427  return nullptr;
2428 }
2429 
2432 {
2433  OSL_ENSURE( false, "Create in SW-Stylesheet-Pool not possible" );
2434  return nullptr;
2435 }
2436 
2437 std::unique_ptr<SfxStyleSheetIterator> SwDocStyleSheetPool::CreateIterator( SfxStyleFamily eFam, SfxStyleSearchBits _nMask )
2438 {
2439  return std::make_unique<SwStyleSheetIterator>(*this, eFam, _nMask);
2440 }
2441 
2443 {
2444  mxStyleSheet.clear();
2445 }
2446 
2448 {
2449  if( !pStyle )
2450  return;
2451 
2452  bool bBroadcast = true;
2453  SwImplShellAction aTmpSh( rDoc );
2454  const OUString sName = pStyle->GetName();
2455  switch( pStyle->GetFamily() )
2456  {
2457  case SfxStyleFamily::Char:
2458  {
2459  SwCharFormat* pFormat = lcl_FindCharFormat(rDoc, sName, nullptr, false );
2460  if(pFormat)
2461  rDoc.DelCharFormat(pFormat);
2462  }
2463  break;
2464  case SfxStyleFamily::Para:
2465  {
2466  SwTextFormatColl* pColl = lcl_FindParaFormat(rDoc, sName, nullptr, false );
2467  if(pColl)
2468  rDoc.DelTextFormatColl(pColl);
2469  }
2470  break;
2471  case SfxStyleFamily::Frame:
2472  {
2473  SwFrameFormat* pFormat = lcl_FindFrameFormat(rDoc, sName, nullptr, false );
2474  if(pFormat)
2475  rDoc.DelFrameFormat(pFormat);
2476  }
2477  break;
2478  case SfxStyleFamily::Page :
2479  {
2480  rDoc.DelPageDesc(sName);
2481  }
2482  break;
2483 
2484  case SfxStyleFamily::Pseudo:
2485  {
2486  if( !rDoc.DelNumRule( sName ) )
2487  // Only send Broadcast, when something was deleted
2488  bBroadcast = false;
2489  }
2490  break;
2491 
2492  case SfxStyleFamily::Table:
2493  {
2494  rDoc.DelTableStyle(sName);
2495  }
2496  break;
2497 
2498  default:
2499  OSL_ENSURE(false, "unknown style family");
2500  bBroadcast = false;
2501  }
2502 
2503  if( bBroadcast )
2504  Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetErased, *pStyle ) );
2505 }
2506 
2508  const OUString &rStyle, const OUString &rParent )
2509 {
2510  SwFormat* pFormat = nullptr, *pParent = nullptr;
2511  switch( eFam )
2512  {
2513  case SfxStyleFamily::Char :
2514  if( nullptr != ( pFormat = lcl_FindCharFormat( rDoc, rStyle ) ) && !rParent.isEmpty() )
2515  pParent = lcl_FindCharFormat(rDoc, rParent );
2516  break;
2517 
2518  case SfxStyleFamily::Para :
2519  if( nullptr != ( pFormat = lcl_FindParaFormat( rDoc, rStyle ) ) && !rParent.isEmpty() )
2520  pParent = lcl_FindParaFormat( rDoc, rParent );
2521  break;
2522 
2523  case SfxStyleFamily::Frame:
2524  if( nullptr != ( pFormat = lcl_FindFrameFormat( rDoc, rStyle ) ) && !rParent.isEmpty() )
2525  pParent = lcl_FindFrameFormat( rDoc, rParent );
2526  break;
2527 
2528  case SfxStyleFamily::Page:
2529  case SfxStyleFamily::Pseudo:
2530  break;
2531 
2532  default:
2533  OSL_ENSURE(false, "unknown style family");
2534  }
2535 
2536  bool bRet = false;
2537  if( pFormat && pFormat->DerivedFrom() &&
2538  pFormat->DerivedFrom()->GetName() != rParent )
2539  {
2540  {
2541  SwImplShellAction aTmpSh( rDoc );
2542  bRet = pFormat->SetDerivedFrom( pParent );
2543  }
2544 
2545  if( bRet )
2546  {
2547  // only for Broadcasting
2548  mxStyleSheet->PresetName( rStyle );
2549  mxStyleSheet->PresetParent( rParent );
2550  if( SfxStyleFamily::Para == eFam )
2551  mxStyleSheet->PresetFollow( static_cast<SwTextFormatColl*>(pFormat)->
2552  GetNextTextFormatColl().GetName() );
2553  else
2554  mxStyleSheet->PresetFollow( OUString() );
2555 
2556  Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified, *mxStyleSheet ) );
2557  }
2558  }
2559 
2560  return bRet;
2561 }
2562 
2565 {
2566  SfxStyleSearchBits nSMask = n;
2567  if( SfxStyleFamily::Para == eFam && rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) )
2568  {
2569  // then only HTML-Templates are of interest
2570  if( SfxStyleSearchBits::All == nSMask )
2571  nSMask = SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined | SfxStyleSearchBits::Used;
2572  else
2573  nSMask &= SfxStyleSearchBits::Used | SfxStyleSearchBits::UserDefined |
2574  SfxStyleSearchBits::SwCondColl | SfxStyleSearchBits::SwHtml;
2575  if( nSMask == SfxStyleSearchBits::Auto )
2576  nSMask = SfxStyleSearchBits::SwHtml;
2577  }
2578 
2579  const bool bSearchUsed = ( n != SfxStyleSearchBits::All && n & SfxStyleSearchBits::Used );
2580  const SwModify* pMod = nullptr;
2581 
2582  mxStyleSheet->SetPhysical( false );
2583  mxStyleSheet->PresetName( rName );
2584  mxStyleSheet->SetFamily( eFam );
2585  bool bFnd = mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
2586 
2587  if( mxStyleSheet->IsPhysical() )
2588  {
2589  switch( eFam )
2590  {
2591  case SfxStyleFamily::Char:
2592  pMod = mxStyleSheet->GetCharFormat();
2593  break;
2594 
2595  case SfxStyleFamily::Para:
2596  pMod = mxStyleSheet->GetCollection();
2597  break;
2598 
2599  case SfxStyleFamily::Frame:
2600  pMod = mxStyleSheet->GetFrameFormat();
2601  break;
2602 
2603  case SfxStyleFamily::Page:
2604  pMod = mxStyleSheet->GetPageDesc();
2605  break;
2606 
2607  case SfxStyleFamily::Pseudo:
2608  {
2609  const SwNumRule* pRule = mxStyleSheet->GetNumRule();
2610  if( pRule &&
2611  !bSearchUsed &&
2612  (( nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2613  ? !(pRule->GetPoolFormatId() & USER_FMT)
2614  // searched for used and found none
2615  : bSearchUsed ))
2616  bFnd = false;
2617  }
2618  break;
2619 
2620  case SfxStyleFamily::Table:
2621  case SfxStyleFamily::Cell:
2622  break;
2623  default:
2624  OSL_ENSURE(false, "unknown style family");
2625  }
2626  }
2627 
2628  // then evaluate the mask:
2629  if( pMod && !bSearchUsed )
2630  {
2631  const sal_uInt16 nId = SfxStyleFamily::Page == eFam
2632  ? static_cast<const SwPageDesc*>(pMod)->GetPoolFormatId()
2633  : static_cast<const SwFormat*>(pMod)->GetPoolFormatId();
2634 
2635  if( ( nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2636  ? !(nId & USER_FMT)
2637  // searched for used and found none
2638  : bSearchUsed )
2639  bFnd = false;
2640  }
2641  return bFnd ? mxStyleSheet.get() : nullptr;
2642 }
2643 
2646  : SfxStyleSheetIterator(&rBase, eFam, n)
2647  , mxIterSheet(new SwDocStyleSheet(rBase.GetDoc(), rBase))
2648  , mxStyleSheet(new SwDocStyleSheet(rBase.GetDoc(), rBase))
2649 {
2650  bFirstCalled = false;
2651  nLastPos = 0;
2652  StartListening(rBase);
2653 }
2654 
2656 {
2657  EndListening( *mxIterSheet->GetPool() );
2658 }
2659 
2661 {
2662  // let the list fill correctly!!
2663  if( !bFirstCalled )
2664  First();
2665  return aLst.size();
2666 }
2667 
2669 {
2670  // found
2671  if( !bFirstCalled )
2672  First();
2673  mxStyleSheet->PresetNameAndFamily( aLst[ nIdx ] );
2674  mxStyleSheet->SetPhysical( false );
2675  mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
2676 
2677  return mxStyleSheet.get();
2678 }
2679 
2681 {
2682  // Delete old list
2683  bFirstCalled = true;
2684  nLastPos = 0;
2685  aLst.clear();
2686 
2687  // Delete current
2688  mxIterSheet->Reset();
2689 
2690  SwDoc& rDoc = static_cast<SwDocStyleSheetPool*>(pBasePool)->GetDoc();
2691  const SfxStyleSearchBits nSrchMask = nMask;
2692  const bool bIsSearchUsed = SearchUsed();
2693 
2694  bool bSearchHidden( nMask & SfxStyleSearchBits::Hidden );
2695  bool bOnlyHidden = nMask == SfxStyleSearchBits::Hidden;
2696 
2697  const bool bOrganizer = static_cast<SwDocStyleSheetPool*>(pBasePool)->IsOrganizerMode();
2698  bool bAll = ( nSrchMask & SfxStyleSearchBits::AllVisible ) == SfxStyleSearchBits::AllVisible;
2699 
2700  if( nSearchFamily == SfxStyleFamily::Char
2701  || nSearchFamily == SfxStyleFamily::All )
2702  {
2703  const size_t nArrLen = rDoc.GetCharFormats()->size();
2704  for( size_t i = 0; i < nArrLen; i++ )
2705  {
2706  SwCharFormat* pFormat = (*rDoc.GetCharFormats())[ i ];
2707 
2708  const bool bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(*pFormat));
2709  if( ( !bSearchHidden && pFormat->IsHidden() && !bUsed ) || ( pFormat->IsDefault() && pFormat != rDoc.GetDfltCharFormat() ) )
2710  continue;
2711 
2712  if ( nSrchMask == SfxStyleSearchBits::Hidden && !pFormat->IsHidden( ) )
2713  continue;
2714 
2715  if( !bUsed )
2716  {
2717  // Standard is no User template
2718  const sal_uInt16 nId = rDoc.GetDfltCharFormat() == pFormat ?
2719  sal_uInt16( RES_POOLCHR_INET_NORMAL ):
2720  pFormat->GetPoolFormatId();
2721  if( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2722  ? !(nId & USER_FMT)
2723  // searched for used and found none
2724  : bIsSearchUsed )
2725  {
2726  continue;
2727  }
2728 
2730  !( RES_POOLCHR_HTML_BEGIN <= nId &&
2731  nId < RES_POOLCHR_HTML_END ) &&
2732  RES_POOLCHR_INET_NORMAL != nId &&
2733  RES_POOLCHR_INET_VISIT != nId &&
2734  RES_POOLCHR_FOOTNOTE != nId &&
2735  RES_POOLCHR_ENDNOTE != nId )
2736  continue;
2737  }
2738 
2739  aLst.Append( cCHAR, pFormat == rDoc.GetDfltCharFormat()
2740  ? SwResId(STR_POOLCHR_STANDARD)
2741  : pFormat->GetName() );
2742  }
2743 
2744  // PoolFormat
2745  if( bAll )
2746  {
2749  bIsSearchUsed, bSearchHidden, bOnlyHidden,
2751  else
2752  {
2761  }
2763  bIsSearchUsed, bSearchHidden, bOnlyHidden,
2764  SwGetPoolIdFromName::ChrFmt, cCHAR);
2765  }
2766  }
2767 
2768  if( nSearchFamily == SfxStyleFamily::Para ||
2769  nSearchFamily == SfxStyleFamily::All )
2770  {
2771  SfxStyleSearchBits nSMask = nSrchMask;
2773  {
2774  // then only HTML-Template are of interest
2775  if( SfxStyleSearchBits::AllVisible == ( nSMask & SfxStyleSearchBits::AllVisible ) )
2776  nSMask = SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined |
2777  SfxStyleSearchBits::Used;
2778  else
2779  nSMask &= SfxStyleSearchBits::Used | SfxStyleSearchBits::UserDefined |
2780  SfxStyleSearchBits::SwCondColl | SfxStyleSearchBits::SwHtml;
2781  if( nSMask == SfxStyleSearchBits::Auto )
2782  nSMask = SfxStyleSearchBits::SwHtml;
2783  }
2784 
2785  const size_t nArrLen = rDoc.GetTextFormatColls()->size();
2786  for( size_t i = 0; i < nArrLen; i++ )
2787  {
2788  SwTextFormatColl* pColl = (*rDoc.GetTextFormatColls())[ i ];
2789 
2790  const bool bUsed = bOrganizer || rDoc.IsUsed(*pColl);
2791  if ( ( !bSearchHidden && pColl->IsHidden( ) && !bUsed ) || pColl->IsDefault() )
2792  continue;
2793 
2794  if ( nSMask == SfxStyleSearchBits::Hidden && !pColl->IsHidden( ) )
2795  continue;
2796 
2797  if( !(bIsSearchUsed && bUsed ))
2798  {
2799  const sal_uInt16 nId = pColl->GetPoolFormatId();
2800  auto tmpMask = nSMask & ~SfxStyleSearchBits::Used;
2801  if (tmpMask == SfxStyleSearchBits::UserDefined)
2802  {
2803  if(!IsPoolUserFormat(nId)) continue;
2804  }
2805  else if (tmpMask == SfxStyleSearchBits::SwText)
2806  {
2807  if((nId & COLL_GET_RANGE_BITS) != COLL_TEXT_BITS) continue;
2808  }
2809  else if (tmpMask == SfxStyleSearchBits::SwChapter)
2810  {
2811  if((nId & COLL_GET_RANGE_BITS) != COLL_DOC_BITS) continue;
2812  }
2813  else if (tmpMask == SfxStyleSearchBits::SwList)
2814  {
2815  if((nId & COLL_GET_RANGE_BITS) != COLL_LISTS_BITS) continue;
2816  }
2817  else if (tmpMask == SfxStyleSearchBits::SwIndex)
2818  {
2819  if((nId & COLL_GET_RANGE_BITS) != COLL_REGISTER_BITS) continue;
2820  }
2821  else if (tmpMask == SfxStyleSearchBits::SwExtra)
2822  {
2823  if((nId & COLL_GET_RANGE_BITS) != COLL_EXTRA_BITS) continue;
2824  }
2825  else if (tmpMask == (SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined)
2826  || tmpMask == SfxStyleSearchBits::SwHtml)
2827  {
2828  if((tmpMask & SfxStyleSearchBits::UserDefined) && IsPoolUserFormat(nId))
2829  ; // do nothing
2830  else if( (nId & COLL_GET_RANGE_BITS) != COLL_HTML_BITS)
2831  {
2832  // but some we also want to see in this section
2833  bool bContinue = true;
2834  switch( nId )
2835  {
2836  case RES_POOLCOLL_SENDADRESS: // --> ADDRESS
2837  case RES_POOLCOLL_TABLE_HDLN: // --> TH
2838  case RES_POOLCOLL_TABLE: // --> TD
2839  case RES_POOLCOLL_TEXT: // --> P
2840  case RES_POOLCOLL_HEADLINE_BASE:// --> H
2841  case RES_POOLCOLL_HEADLINE1: // --> H1
2842  case RES_POOLCOLL_HEADLINE2: // --> H2
2843  case RES_POOLCOLL_HEADLINE3: // --> H3
2844  case RES_POOLCOLL_HEADLINE4: // --> H4
2845  case RES_POOLCOLL_HEADLINE5: // --> H5
2846  case RES_POOLCOLL_HEADLINE6: // --> H6
2847  case RES_POOLCOLL_STANDARD: // --> P
2848  case RES_POOLCOLL_FOOTNOTE:
2849  case RES_POOLCOLL_ENDNOTE:
2850  bContinue = false;
2851  break;
2852  }
2853  if( bContinue )
2854  continue;
2855  }
2856  }
2857  else if (tmpMask == SfxStyleSearchBits::SwCondColl)
2858  {
2859  if( RES_CONDTXTFMTCOLL != pColl->Which() ) continue;
2860  }
2861  else
2862  {
2863  // searched for used and found none
2864  if( bIsSearchUsed )
2865  continue;
2866  }
2867  }
2868  aLst.Append( cPARA, pColl->GetName() );
2869  }
2870 
2871  bAll = ( nSMask & SfxStyleSearchBits::AllVisible ) == SfxStyleSearchBits::AllVisible;
2872  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwText )
2874  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA );
2875  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwChapter )
2877  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2878  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwList )
2880  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2881  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwIndex )
2883  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2884  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwExtra )
2886  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2887  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwCondColl )
2888  {
2889  if( !bIsSearchUsed ||
2893  }
2894  if ( bAll ||
2895  (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwHtml ||
2896  (nSMask & ~SfxStyleSearchBits::Used) ==
2897  (SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined) )
2898  {
2900  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2901  if( !bAll )
2902  {
2903  // then also the ones, that we are mapping:
2904  static sal_uInt16 aPoolIds[] = {
2905  RES_POOLCOLL_SENDADRESS, // --> ADDRESS
2906  RES_POOLCOLL_TABLE_HDLN, // --> TH
2907  RES_POOLCOLL_TABLE, // --> TD
2908  RES_POOLCOLL_STANDARD, // --> P
2909  RES_POOLCOLL_TEXT, // --> P
2910  RES_POOLCOLL_HEADLINE_BASE, // --> H
2911  RES_POOLCOLL_HEADLINE1, // --> H1
2912  RES_POOLCOLL_HEADLINE2, // --> H2
2913  RES_POOLCOLL_HEADLINE3, // --> H3
2914  RES_POOLCOLL_HEADLINE4, // --> H4
2915  RES_POOLCOLL_HEADLINE5, // --> H5
2916  RES_POOLCOLL_HEADLINE6, // --> H6
2919  0
2920  };
2921 
2922  sal_uInt16* pPoolIds = aPoolIds;
2923  OUString s;
2924  while( *pPoolIds )
2925  {
2926  if( !bIsSearchUsed || rDoc.getIDocumentStylePoolAccess().IsPoolTextCollUsed( *pPoolIds ) )
2927  {
2928  s = SwStyleNameMapper::GetUIName( *pPoolIds, s );
2929  aLst.Append( cPARA, s);
2930  }
2931  ++pPoolIds;
2932  }
2933  }
2934  }
2935  }
2936 
2937  if( nSearchFamily == SfxStyleFamily::Frame ||
2938  nSearchFamily == SfxStyleFamily::All )
2939  {
2940  const size_t nArrLen = rDoc.GetFrameFormats()->size();
2941  for( size_t i = 0; i < nArrLen; i++ )
2942  {
2943  const SwFrameFormat* pFormat = (*rDoc.GetFrameFormats())[ i ];
2944 
2945  bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(*pFormat));
2946  if( ( !bSearchHidden && pFormat->IsHidden( ) && !bUsed ) || pFormat->IsDefault() || pFormat->IsAuto() )
2947  continue;
2948 
2949  if ( nSrchMask == SfxStyleSearchBits::Hidden && !pFormat->IsHidden( ) )
2950  continue;
2951 
2952  const sal_uInt16 nId = pFormat->GetPoolFormatId();
2953  if( !bUsed )
2954  {
2955  if( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2956  ? !(nId & USER_FMT)
2957  // searched for used and found none
2958  : bIsSearchUsed )
2959  {
2960  continue;
2961  }
2962  }
2963 
2964  aLst.Append( cFRAME, pFormat->GetName() );
2965  }
2966 
2967  // PoolFormat
2968  if ( bAll )
2970  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::FrmFmt, cFRAME);
2971  }
2972 
2973  if( nSearchFamily == SfxStyleFamily::Page ||
2974  nSearchFamily == SfxStyleFamily::All )
2975  {
2976  const size_t nCount = rDoc.GetPageDescCnt();
2977  for(size_t i = 0; i < nCount; ++i)
2978  {
2979  const SwPageDesc& rDesc = rDoc.GetPageDesc(i);
2980  const sal_uInt16 nId = rDesc.GetPoolFormatId();
2981  bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rDesc));
2982  if( !bUsed )
2983  {
2984  if ( ( !bSearchHidden && rDesc.IsHidden() ) ||
2985  ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2986  ? !(nId & USER_FMT)
2987  // searched for used and found none
2988  : bIsSearchUsed ) )
2989  continue;
2990  }
2991 
2992  if ( nSrchMask == SfxStyleSearchBits::Hidden && !rDesc.IsHidden( ) )
2993  continue;
2994 
2995  aLst.Append( cPAGE, rDesc.GetName() );
2996  }
2997  if ( bAll )
2999  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::PageDesc, cPAGE);
3000  }
3001 
3002  if( nSearchFamily == SfxStyleFamily::Pseudo ||
3003  nSearchFamily == SfxStyleFamily::All )
3004  {
3005  const SwNumRuleTable& rNumTable = rDoc.GetNumRuleTable();
3006  for(size_t i = 0; i < rNumTable.size(); ++i)
3007  {
3008  const SwNumRule& rRule = *rNumTable[ i ];
3009  if( !rRule.IsAutoRule() )
3010  {
3011  if ( nSrchMask == SfxStyleSearchBits::Hidden && !rRule.IsHidden( ) )
3012  continue;
3013 
3014  bool bUsed = bIsSearchUsed && ( bOrganizer || SwDoc::IsUsed(rRule) );
3015  if( !bUsed )
3016  {
3017  if( ( !bSearchHidden && rRule.IsHidden() ) ||
3018  ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
3019  ? !(rRule.GetPoolFormatId() & USER_FMT)
3020  // searched for used and found none
3021  : bIsSearchUsed ) )
3022  continue;
3023  }
3024 
3025  aLst.Append( cNUMRULE, rRule.GetName() );
3026  }
3027  }
3028  if ( bAll )
3030  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::NumRule, cNUMRULE);
3031  }
3032 
3033  if( nSearchFamily == SfxStyleFamily::Table ||
3034  nSearchFamily == SfxStyleFamily::All )
3035  {
3036  const SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
3037  for(size_t i = 0; i < rTableStyles.size(); ++i)
3038  {
3039  const SwTableAutoFormat& rTableStyle = rTableStyles[i];
3040 
3041  bool bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(rTableStyle));
3042  if(!bUsed)
3043  {
3044  if(nSrchMask == SfxStyleSearchBits::Hidden && !rTableStyle.IsHidden())
3045  continue;
3046 
3047  if( (!bSearchHidden && rTableStyle.IsHidden() ) ||
3048  ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
3049  ? !rTableStyle.IsUserDefined()
3050  // searched for used and found none
3051  : bIsSearchUsed ) )
3052  continue;
3053  }
3054 
3055  aLst.Append( cTABSTYLE, rTableStyle.GetName() );
3056  }
3057  }
3058 
3059  if( nSearchFamily == SfxStyleFamily::Cell ||
3060  nSearchFamily == SfxStyleFamily::All )
3061  {
3062  const auto& aTableTemplateMap = SwTableAutoFormat::GetTableTemplateMap();
3063  if (rDoc.HasTableStyles())
3064  {
3065  const SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
3066  for(size_t i = 0; i < rTableStyles.size(); ++i)
3067  {
3068  const SwTableAutoFormat& rTableStyle = rTableStyles[i];
3069  for(size_t nBoxFormat = 0; nBoxFormat < aTableTemplateMap.size(); ++nBoxFormat)
3070  {
3071  const sal_uInt32 nBoxIndex = aTableTemplateMap[nBoxFormat];
3072  const SwBoxAutoFormat& rBoxFormat = rTableStyle.GetBoxFormat(nBoxIndex);
3073  OUString sBoxFormatName;
3075  sBoxFormatName += rTableStyle.GetTableTemplateCellSubName(rBoxFormat);
3076  aLst.Append( cCELLSTYLE, sBoxFormatName );
3077  }
3078  }
3079  }
3080  const SwCellStyleTable& rCellStyles = rDoc.GetCellStyles();
3081  for(size_t i = 0; i < rCellStyles.size(); ++i)
3082  aLst.Append( cCELLSTYLE, rCellStyles[i].GetName() );
3083  }
3084 
3085  if(!aLst.empty())
3086  {
3088  return Next();
3089  }
3090  return nullptr;
3091 }
3092 
3094 {
3095  assert(bFirstCalled);
3096  ++nLastPos;
3097  if(nLastPos < aLst.size())
3098  {
3099  mxIterSheet->PresetNameAndFamily(aLst[nLastPos]);
3100  mxIterSheet->SetPhysical( false );
3101  mxIterSheet->SetMask( nMask );
3102  if(mxIterSheet->pSet)
3103  {
3104  mxIterSheet->pSet->ClearItem();
3105  mxIterSheet->pSet= nullptr;
3106  }
3107  return mxIterSheet.get();
3108  }
3109  return nullptr;
3110 }
3111 
3113 {
3114  // searching
3115  if( !bFirstCalled )
3116  First();
3117 
3118  nLastPos = aLst.FindName( nSearchFamily, rName );
3119  if( SAL_MAX_UINT32 != nLastPos )
3120  {
3121  // found
3122  mxStyleSheet->PresetNameAndFamily(aLst[nLastPos]);
3123  // new name is set, so determine its Data
3124  mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
3125  if( !mxStyleSheet->IsPhysical() )
3126  mxStyleSheet->SetPhysical( false );
3127 
3128  return mxStyleSheet.get();
3129  }
3130  return nullptr;
3131 }
3132 
3133 void SwStyleSheetIterator::AppendStyleList(const std::vector<OUString>& rList,
3134  bool bTestUsed, bool bTestHidden, bool bOnlyHidden,
3135  SwGetPoolIdFromName nSection, char cType )
3136 {
3137  SwDoc& rDoc = static_cast<SwDocStyleSheetPool*>(pBasePool)->GetDoc();
3138  bool bUsed = false;
3139  for (const auto & i : rList)
3140  {
3141  bool bHidden = false;
3142  sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(i, nSection);
3143  switch ( nSection )
3144  {
3146  {
3147  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolTextCollUsed( nId );
3148  SwFormat* pFormat = rDoc.FindTextFormatCollByName( i );
3149  bHidden = pFormat && pFormat->IsHidden( );
3150  }
3151  break;
3153  {
3154  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolFormatUsed( nId );
3155  SwFormat* pFormat = rDoc.FindCharFormatByName( i );
3156  bHidden = pFormat && pFormat->IsHidden( );
3157  }
3158  break;
3160  {
3161  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolFormatUsed( nId );
3162  SwFormat* pFormat = rDoc.FindFrameFormatByName( i );
3163  bHidden = pFormat && pFormat->IsHidden( );
3164  }
3165  break;
3167  {
3168  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolPageDescUsed( nId );
3169  SwPageDesc* pPgDesc = rDoc.FindPageDesc(i);
3170  bHidden = pPgDesc && pPgDesc->IsHidden( );
3171  }
3172  break;
3174  {
3175  SwNumRule* pRule = rDoc.FindNumRulePtr( i );
3176  bUsed = pRule && SwDoc::IsUsed( *pRule );
3177  bHidden = pRule && pRule->IsHidden( );
3178  }
3179  break;
3180  default:
3181  OSL_ENSURE( false, "unknown PoolFormat-Id" );
3182  }
3183 
3184  bool bMatchHidden = ( bTestHidden && ( bHidden || !bOnlyHidden ) ) || ( !bTestHidden && ( !bHidden || bUsed ) );
3185  if ( ( !bTestUsed && bMatchHidden ) || ( bTestUsed && bUsed ) )
3186  aLst.Append( cType, i );
3187  }
3188 }
3189 
3191 {
3193  dynamic_cast<SwStyleSheetIterator&>(*pIter).InvalidateIterator();
3194 }
3195 
3197 {
3198  // potentially we could send an SfxHint to Notify but currently it's
3199  // iterating over the vector anyway so would still be slow - why does
3200  // this iterator not use a map?
3201  bFirstCalled = false;
3202  nLastPos = 0;
3203  aLst.clear();
3204 }
3205 
3207 {
3208  // search and remove from View-List!!
3209  const SfxStyleSheetHint* pStyleSheetHint = dynamic_cast<const SfxStyleSheetHint*>(&rHint);
3210  if( pStyleSheetHint &&
3211  SfxHintId::StyleSheetErased == pStyleSheetHint->GetId() )
3212  {
3213  SfxStyleSheetBase* pStyle = pStyleSheetHint->GetStyleSheet();
3214 
3215  if (pStyle)
3216  aLst.RemoveName(pStyle->GetFamily(), pStyle->GetName());
3217  }
3218 }
3219 
3220 /* 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:2437
SfxStyleSheetBase * First(SfxStyleFamily eFamily, SfxStyleSearchBits eMask=SfxStyleSearchBits::All)
virtual OUString GetDescription(MapUnit eUnit) override
Definition: docstyle.cxx:821
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
virtual bool IsUsed() const override
Definition: docstyle.cxx:2228
const sal_uInt16 COLL_LISTS_BITS
Definition: poolfmt.hxx:67
SwStyleSheetIterator(SwDocStyleSheetPool &rBase, SfxStyleFamily eFam, SfxStyleSearchBits n)
Definition: docstyle.cxx:2644
int GetAssignedOutlineStyleLevel() const
Definition: fmtcol.cxx:587
const sal_uInt16 COLL_DOC_BITS
Definition: poolfmt.hxx:70
void PresetNameAndFamily(const OUString &rName)
Definition: docstyle.cxx:2193
virtual SfxItemSet & GetItemSet() override
Definition: docstyle.cxx:1314
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:263
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()
long GetFirstLineIndent() const
bool IsDefault() const
Definition: format.hxx:109
void SetDefDist(sal_uInt16 nNew)
SwTableAutoFormat * GetTableFormat()
Definition: docstyle.cxx:2182
virtual void SetHelpId(const OUString &r, sal_uLong nId) override
Definition: docstyle.cxx:2364
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:1854
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: docfmt.cxx:2091
SwTableAutoFormat * FindAutoFormat(const OUString &rName) const
Find table style with the provided name, return nullptr when not found.
Definition: tblafmt.cxx:996
void SetNumRule(const SwNumRule &rRule)
Definition: docstyle.cxx:2176
SwCharFormat * MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:843
SwDocShell * GetDocShell()
Definition: doc.hxx:1350
bool IsHidden() const
Definition: numrule.hxx:158
static bool lcl_Contains(const std::vector< void * > &rArr, const void *p)
Definition: docstyle.cxx:1771
std::string GetValue
virtual SfxStyleSheetBase * First() override
Definition: docstyle.cxx:2680
static const std::vector< OUString > & GetFrameFormatUINameArray()
const sal_uInt16 COLL_GET_RANGE_BITS
Definition: poolfmt.hxx:72
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:844
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:798
virtual void SetModified()=0
Must be called manually at changes of format.
sal_uIntPtr sal_uLong
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
void SetTable(bool bNew)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
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:831
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat IDs.
Definition: numrule.hxx:248
bool IsAutoRule() const
Definition: numrule.hxx:227
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:71
void GetGrabBagItem(css::uno::Any &rVal) const
Definition: number.cxx:1079
Definition: doc.hxx:186
void GetGrabBagItem(css::uno::Any &rVal) const
Definition: docstyle.cxx:553
virtual bool SetFollow(const OUString &rStr) override
Definition: docstyle.cxx:1206
SwPoolFormatList aLst
Definition: docstyle.hxx:166
virtual bool SetName(const OUString &rNewName, bool bReindexNow=true)
#define FN_COND_COLL
Definition: cmdid.h:788
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:87
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
void SetTextLeft(const long nL, const sal_uInt16 nProp=100)
const OUString & GetName() const
Definition: numrule.hxx:222
virtual void SetHidden(bool bHidden) override
Definition: docstyle.cxx:580
void RenameFormat(SwFormat &rFormat, const OUString &sNewName, bool bBroadcast=false)
Definition: docfmt.cxx:1890
sal_uInt16 GetPoolHelpId() const
Query and set Help-IDs for document styles.
Definition: numrule.hxx:252
OUString GetUniqueNumRuleName(const OUString *pChkStr=nullptr, bool bAutoNum=true) const
Definition: docnum.cxx:2494
bool IsCJKFontEnabled() const
void SetHidden(bool bValue)
Definition: numrule.hxx:159
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:143
static void lcl_SaveStyles(SfxStyleFamily nFamily, std::vector< void * > &rArr, SwDoc &rDoc)
Definition: docstyle.cxx:1717
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:944
SfxStyleFamily GetFamily() const
virtual SwFrameFormat * GetFrameFormatFromPool(sal_uInt16 nId)=0
Return required automatic format.
const SwCellStyleTable & GetCellStyles() const
Definition: doc.hxx:1249
bool HasWriterListeners() const
Definition: calbck.hxx:208
#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:154
SwDocStyleSheetPool(SwDoc &, bool bOrganizer)
Definition: docstyle.cxx:2397
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
sal_uInt16 sal_Unicode
void SetGrabBagItem(const css::uno::Any &rVal)
Definition: number.cxx:1087
const SfxPoolItem * NextItem()
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:109
void SetMask(SfxStyleSearchBits mask)
const SwCharFormat * GetDfltCharFormat() const
Definition: doc.hxx:750
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
const OUString & GetName() const
virtual ~SwDocStyleSheetPool() override
Definition: docstyle.cxx:2405
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:891
void SetPoolFormatId(sal_uInt16 nId)
Definition: format.hxx:144
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)
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:425
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:3093
int nCount
void SetPoolHlpFileId(sal_uInt8 nId)
Definition: format.hxx:150
virtual void SetName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2455
SwFrameFormat * GetFrameFormat()
Definition: docstyle.cxx:2221
#define FN_PARAM_FTN_INFO
Definition: cmdid.h:760
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:2161
SfxStyleFamily
const sal_uInt16 COLL_REGISTER_BITS
Definition: poolfmt.hxx:69
bool RenameNumRule(const OUString &aOldName, const OUString &aNewName, bool bBroadcast=false)
Definition: docnum.cxx:1107
SwCharFormat * GetCharFormat()
Definition: docstyle.cxx:2147
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:2507
const char * sName
bool SetDerivedFrom(SwFormat *pDerivedFrom=nullptr)
0 is Default.
Definition: format.cxx:326
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:1776
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:154
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:884
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
Definition: docdesc.cxx:821
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:342
virtual SfxStyleSheetBase * Find(const OUString &rStr) override
Definition: docstyle.cxx:3112
#define cCELLSTYLE
Definition: docstyle.cxx:78
SwNumRule * FindNumRulePtr(const OUString &rName) const
Definition: docnum.cxx:2416
virtual sal_uLong GetHelpId(OUString &rFile) override
Definition: docstyle.cxx:2265
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:135
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:851
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:122
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:457
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
Subgroup headings.
Definition: poolfmt.hxx:261
virtual bool IsModified() const =0
Changes of document?
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:880
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:327
size_t size() const
Definition: tblafmt.cxx:1178
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:251
void AppendStyleList(const std::vector< OUString > &rLst, bool bUsed, bool bTestHidden, bool bOnlyHidden, SwGetPoolIdFromName nSection, char cType)
Definition: docstyle.cxx:3133
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:638
virtual void Notify(SfxBroadcaster &, const SfxHint &) override
Definition: docstyle.cxx:3206
const OUString & GetValue() const
sal_uInt16 Count() const
size_t size() const
Definition: tblafmt.cxx:930
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:2430
sal_uInt8 GetPoolHlpFileId() const
Definition: format.hxx:149
size_t GetPageDescCnt() const
Definition: doc.hxx:879
XGradientListRef GetGradientList() const
Internet normal.
Definition: poolfmt.hxx:121
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:1405
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:393
SwWrtShell * GetWrtShell()
Access to the SwWrtShell belonging to SwView.
Definition: docsh.hxx:224
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
Definition: docdesc.cxx:852
const SwNumRule * GetNumRule()
Definition: docstyle.cxx:2168
void PresetFollow(const OUString &rName)
Definition: docstyle.hxx:119
sal_uInt8 GetPoolHlpFileId() const
Definition: numrule.hxx:254
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:396
void SetItemSet(const SfxItemSet &rSet, const bool bResetIndentAttrsAtParagraphStyle=false)
add optional parameter , default value false, which indicates that...
Definition: docstyle.cxx:1437
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:178
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:2208
SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const
SAL_DLLPRIVATE void Create()
Make empty shell a real StyleSheet (Core).
Definition: docstyle.cxx:2072
SfxStyleFamily nFamily
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily, SfxStyleSearchBits nMask=SfxStyleSearchBits::All) override
Definition: docstyle.cxx:2409
std::unique_ptr< SwTableAutoFormat > DelTableStyle(const OUString &rName, bool bBroadcast=false)
Definition: ndtbl.cxx:4574
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:774
void ClearInvalidItems()
const SwPageDesc * GetFollow() const
Definition: pagedesc.hxx:246
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:744
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)
long GetIndentAt() const
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:2655
const OUString & GetName() const
Definition: tblafmt.hxx:208
SwTableAutoFormatTable & GetTableStyles()
Return the available table styles.
Definition: ndtbl.cxx:3863
void CallChgLnk()
Definition: crsrsh.cxx:2506
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:78
const sal_uInt16 USER_FMT
POLLCOLL-groups:
Definition: poolfmt.hxx:63
SwCharFormat * FindCharFormatByName(const OUString &rName) const
Definition: doc.hxx:770
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:2154
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:737
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:1435
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:2563
#define SAL_WARN_IF(condition, area, stream)
virtual bool IsHidden() const override
Definition: docstyle.cxx:664
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:777
unsigned char sal_uInt8
void PageDescToItemSet(const SwPageDesc &rPageDesc, SfxItemSet &rSet)
Definition: uitool.cxx:406
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:253
rtl::Reference< SwDocStyleSheet > mxStyleSheet
Definition: docstyle.hxx:165
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1065
#define cTABSTYLE
Definition: docstyle.cxx:77
void GetGrabBagItem(css::uno::Any &rVal) const
Definition: format.cxx:766
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:175
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
virtual sal_uInt16 Count() override
Definition: docstyle.cxx:2660
void SetSvxRule(const SvxNumRule &, SwDoc *pDoc)
Definition: number.cxx:872
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:2450
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)
void ChgFormat(SwFormat &rFormat, const SfxItemSet &rSet)
Definition: docfmt.cxx:1858
XBitmapListRef GetBitmapList() const
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
Definition: docfmt.cxx:686
void SetValid(SvxBoxInfoItemValidFlags nValid, bool bValid=true)
void CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet &rSet)
Definition: docfly.cxx:484
MapUnit
#define SAL_WARN(area, stream)
bool HasTableStyles() const
Counts table styles without triggering lazy-load of them.
Definition: doc.hxx:1241
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:1222
const sal_uInt16 COLL_TEXT_BITS
Definition: poolfmt.hxx:66
XColorListRef GetColorList() const
bool DelNumRule(const OUString &rName, bool bBroadCast=false)
Definition: docnum.cxx:1045
virtual bool SetName(const OUString &rNewName, bool bReindexNow=true) override
Definition: docstyle.cxx: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:735
SfxItemSet * pSet
bool IsInvalidItem(const SfxPoolItem *pItem)
Subgroup table.
Definition: poolfmt.hxx:341
void PreDelPageDesc(SwPageDesc const *pDel)
All descriptors whose Follow point to the to-be-deleted have to be adapted.
Definition: docdesc.cxx:553
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:292
virtual SfxStyleSheetBase * operator[](sal_uInt16 nIdx) override
Definition: docstyle.cxx:2668
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
virtual OUString GetUsedBy() override
Definition: docstyle.cxx:2260
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:4554
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:68
virtual OUString GetDescription(MapUnit eMetric)
void SetDist(bool bNew)
void ChgNumRuleFormats(const SwNumRule &rRule)
Definition: docnum.cxx:1085
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:2447
void SetAutoUpdateFormat(bool bNew=true)
Definition: format.hxx:169