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 <svl/itemiter.hxx>
28 #include <svl/eitem.hxx>
29 #include <unotools/syslocale.hxx>
30 #include <editeng/boxitem.hxx>
31 #include <editeng/numitem.hxx>
32 #include <editeng/lrspitem.hxx>
33 #include <drawdoc.hxx>
34 #include <fmtcol.hxx>
35 #include <uitool.hxx>
36 #include <wrtsh.hxx>
37 #include <docsh.hxx>
38 #include <frmfmt.hxx>
39 #include <charfmt.hxx>
40 #include <tblafmt.hxx>
41 #include <poolfmt.hxx>
42 #include <pagedesc.hxx>
43 #include <docstyle.hxx>
44 #include <docary.hxx>
45 #include <ccoll.hxx>
46 #include <doc.hxx>
47 #include <IDocumentUndoRedo.hxx>
51 #include <IDocumentState.hxx>
52 #include <cmdid.h>
53 #include <strings.hrc>
54 #include <paratr.hxx>
55 #include <SwStyleNameMapper.hxx>
56 #include <svl/cjkoptions.hxx>
57 #include <svl/ctloptions.hxx>
58 #include <unotools/intlwrapper.hxx>
59 #include <numrule.hxx>
60 #include <svx/xdef.hxx>
61 #include <SwRewriter.hxx>
62 #include <hints.hxx>
63 #include <svx/xfillit0.hxx>
64 #include <svx/xflftrit.hxx>
65 #include <svx/drawitem.hxx>
66 
67 // The Format names in the list of all names have the
68 // following family as their first character:
69 
70 #define cCHAR u'c'
71 #define cPARA u'p'
72 #define cFRAME u'f'
73 #define cPAGE u'g'
74 #define cNUMRULE u'n'
75 #define cTABSTYLE u't'
76 #define cCELLSTYLE u'b'
77 
78 using namespace com::sun::star;
79 
80 // At the names' publication, this character is removed again and the
81 // family is newly generated.
82 
83 // In addition now there is the Bit bPhysical. In case this Bit is
84 // TRUE, the Pool-Formatnames are not being submitted.
85 
86 namespace {
87 
88 class SwImplShellAction
89 {
90  SwWrtShell* pSh;
91  std::unique_ptr<CurrShell> pCurrSh;
92 public:
93  explicit SwImplShellAction( SwDoc& rDoc );
94  ~SwImplShellAction() COVERITY_NOEXCEPT_FALSE;
95  SwImplShellAction(const SwImplShellAction&) = delete;
96  SwImplShellAction& operator=(const SwImplShellAction&) = delete;
97 };
98 
99 }
100 
101 SwImplShellAction::SwImplShellAction( SwDoc& rDoc )
102 {
103  if( rDoc.GetDocShell() )
104  pSh = rDoc.GetDocShell()->GetWrtShell();
105  else
106  pSh = nullptr;
107 
108  if( pSh )
109  {
110  pCurrSh.reset( new CurrShell( pSh ) );
111  pSh->StartAllAction();
112  }
113 }
114 
115 SwImplShellAction::~SwImplShellAction() COVERITY_NOEXCEPT_FALSE
116 {
117  if( pCurrSh )
118  {
119  pSh->EndAllAction();
120  pCurrSh.reset();
121  }
122 }
123 
124 // find/create SwCharFormate
125 // possibly fill Style
127  const OUString& rName,
128  SwDocStyleSheet* pStyle = nullptr,
129  bool bCreate = true )
130 {
131  SwCharFormat* pFormat = nullptr;
132  if (!rName.isEmpty())
133  {
134  pFormat = rDoc.FindCharFormatByName( rName );
137  {
138  // Standard-Character template
139  pFormat = rDoc.GetDfltCharFormat();
140  }
141 
142  if( !pFormat && bCreate )
143  { // explore Pool
145  if(nId != USHRT_MAX)
147  }
148  }
149  if(pStyle)
150  {
151  if(pFormat)
152  {
153  pStyle->SetPhysical(true);
154  SwFormat* p = pFormat->DerivedFrom();
155  if( p && !p->IsDefault() )
156  pStyle->PresetParent( p->GetName() );
157  else
158  pStyle->PresetParent( OUString() );
159  }
160  else
161  pStyle->SetPhysical(false);
162  }
163  return pFormat;
164 }
165 
166 // find/create ParaFormats
167 // fill Style
169  const OUString& rName,
170  SwDocStyleSheet* pStyle = nullptr,
171  bool bCreate = true )
172 {
173  SwTextFormatColl* pColl = nullptr;
174 
175  if (!rName.isEmpty())
176  {
177  pColl = rDoc.FindTextFormatCollByName( rName );
178  if( !pColl && bCreate )
179  { // explore Pool
181  if(nId != USHRT_MAX)
183  }
184  }
185 
186  if(pStyle)
187  {
188  if(pColl)
189  {
190  pStyle->SetPhysical(true);
191  if( pColl->DerivedFrom() && !pColl->DerivedFrom()->IsDefault() )
192  pStyle->PresetParent( pColl->DerivedFrom()->GetName() );
193  else
194  pStyle->PresetParent( OUString() );
195 
196  SwTextFormatColl& rNext = pColl->GetNextTextFormatColl();
197  pStyle->PresetFollow(rNext.GetName());
198  }
199  else
200  pStyle->SetPhysical(false);
201  }
202  return pColl;
203 }
204 
205 // Border formats
207  const OUString& rName,
208  SwDocStyleSheet* pStyle = nullptr,
209  bool bCreate = true )
210 {
211  SwFrameFormat* pFormat = nullptr;
212  if( !rName.isEmpty() )
213  {
214  pFormat = rDoc.FindFrameFormatByName( rName );
215  if( !pFormat && bCreate )
216  { // explore Pool
218  if(nId != USHRT_MAX)
220  }
221  }
222 
223  if(pStyle)
224  {
225  if(pFormat)
226  {
227  pStyle->SetPhysical(true);
228  if( pFormat->DerivedFrom() && !pFormat->DerivedFrom()->IsDefault() )
229  pStyle->PresetParent( pFormat->DerivedFrom()->GetName() );
230  else
231  pStyle->PresetParent( OUString() );
232  }
233  else
234  pStyle->SetPhysical(false);
235  }
236  return pFormat;
237 }
238 
239 // Page descriptors
240 static const SwPageDesc* lcl_FindPageDesc( SwDoc& rDoc,
241  const OUString& rName,
242  SwDocStyleSheet* pStyle = nullptr,
243  bool bCreate = true )
244 {
245  const SwPageDesc* pDesc = nullptr;
246 
247  if (!rName.isEmpty())
248  {
249  pDesc = rDoc.FindPageDesc(rName);
250  if( !pDesc && bCreate )
251  {
253  if(nId != USHRT_MAX)
255  }
256  }
257 
258  if(pStyle)
259  {
260  if(pDesc)
261  {
262  pStyle->SetPhysical(true);
263  if(pDesc->GetFollow())
264  pStyle->PresetFollow(pDesc->GetFollow()->GetName());
265  else
266  pStyle->PresetParent( OUString() );
267  }
268  else
269  pStyle->SetPhysical(false);
270  }
271  return pDesc;
272 }
273 
274 static const SwNumRule* lcl_FindNumRule( SwDoc& rDoc,
275  const OUString& rName,
276  SwDocStyleSheet* pStyle = nullptr,
277  bool bCreate = true )
278 {
279  const SwNumRule* pRule = nullptr;
280 
281  if (!rName.isEmpty())
282  {
283  pRule = rDoc.FindNumRulePtr( rName );
284  if( !pRule && bCreate )
285  {
287  if(nId != USHRT_MAX)
289  }
290  }
291 
292  if(pStyle)
293  {
294  if(pRule)
295  {
296  pStyle->SetPhysical(true);
297  pStyle->PresetParent( OUString() );
298  }
299  else
300  pStyle->SetPhysical(false);
301  }
302  return pRule;
303 }
304 
305 static SwTableAutoFormat* lcl_FindTableStyle(SwDoc& rDoc, const OUString& rName, SwDocStyleSheet *pStyle = nullptr, bool bCreate = true)
306 {
307  SwTableAutoFormat* pFormat = nullptr;
308 
309  if (!rName.isEmpty())
310  {
311  pFormat = rDoc.GetTableStyles().FindAutoFormat(rName);
312  if (!pFormat && bCreate)
313  {
314  SwTableAutoFormat aNew(rName);
315  rDoc.GetTableStyles().AddAutoFormat(aNew);
316  }
317  }
318 
319  if(pStyle)
320  {
321  if(pFormat)
322  {
323  pStyle->SetPhysical(true);
324  pStyle->PresetParent(OUString());
325  }
326  else
327  pStyle->SetPhysical(false);
328  }
329  return pFormat;
330 }
331 
332 static const SwBoxAutoFormat* lcl_FindCellStyle(SwDoc& rDoc, const OUString& rName, SwDocStyleSheet *pStyle)
333 {
334  const SwBoxAutoFormat* pFormat = rDoc.GetCellStyles().GetBoxFormat(rName);
335 
336  if (!pFormat)
337  {
338  const auto& aTableTemplateMap = SwTableAutoFormat::GetTableTemplateMap();
339  SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
340  for (size_t i=0; i < rTableStyles.size() && !pFormat; ++i)
341  {
342  const SwTableAutoFormat& rTableStyle = rTableStyles[i];
343  for (size_t nBoxFormat=0; nBoxFormat < aTableTemplateMap.size() && !pFormat; ++nBoxFormat)
344  {
345  const sal_uInt32 nBoxIndex = aTableTemplateMap[nBoxFormat];
346  const SwBoxAutoFormat& rBoxFormat = rTableStyle.GetBoxFormat(nBoxIndex);
347  OUString sBoxFormatName;
349  sBoxFormatName += rTableStyle.GetTableTemplateCellSubName(rBoxFormat);
350  if (rName == sBoxFormatName)
351  pFormat = &rBoxFormat;
352  }
353  }
354  }
355 
356  if(pStyle)
357  {
358  if(pFormat)
359  {
360  pStyle->SetPhysical(true);
361  pStyle->PresetParent(OUString());
362  }
363  else
364  pStyle->SetPhysical(false);
365  }
366  return pFormat;
367 }
368 
370  const OUString &rName)
371 {
372  if(!maImpl.empty())
373  {
374  sal_Unicode cStyle(0);
375  switch( eFam )
376  {
377  case SfxStyleFamily::Char:
378  cStyle = cCHAR;
379  break;
380  case SfxStyleFamily::Para:
381  cStyle = cPARA;
382  break;
383  case SfxStyleFamily::Frame:
384  cStyle = cFRAME;
385  break;
386  case SfxStyleFamily::Page:
387  cStyle = cPAGE;
388  break;
389  case SfxStyleFamily::Pseudo:
390  cStyle = cNUMRULE;
391  break;
392  case SfxStyleFamily::Table:
393  cStyle = cTABSTYLE;
394  break;
395  case SfxStyleFamily::Cell:
396  cStyle = cCELLSTYLE;
397  break;
398  default:
399  cStyle = ' ';
400  break;
401  }
402  const OUString sSrch = OUStringChar(cStyle) + rName;
403 
404  UniqueHash::const_iterator it = maUnique.find(sSrch);
405  if (it != maUnique.end())
406  {
407  sal_uInt32 nIdx = it->second;
408  assert (nIdx < maImpl.size());
409  assert (maImpl.size() == maUnique.size());
410  return nIdx;
411  }
412  }
413  return SAL_MAX_UINT32;
414 }
415 
417 {
418  maUnique.clear();
419  for (size_t i = 0; i < maImpl.size(); i++)
420  maUnique[maImpl[i]] = i;
421  assert (maImpl.size() == maUnique.size());
422 }
423 
425  const OUString &rName)
426 {
427  sal_uInt32 nTmpPos = FindName( eFam, rName );
428  if( nTmpPos < maImpl.size() )
429  maImpl.erase(maImpl.begin() + nTmpPos);
430 
431  // assumption: this seldom occurs, the iterator is built, then emptied.
432  rehash();
433  assert (maImpl.size() == maUnique.size());
434 }
435 
436 // Add Strings to the list of templates
437 void SwStyleSheetIterator::SwPoolFormatList::Append( char cChar, const OUString& rStr )
438 {
439  const OUString aStr = OUStringChar(cChar) + rStr;
440 
441  UniqueHash::const_iterator it = maUnique.find(aStr);
442  if (it != maUnique.end())
443  return;
444 
445  maUnique[aStr] = static_cast<sal_uInt32>(maImpl.size());
446  maImpl.push_back(aStr);
447 }
448 
449 // UI-sided implementation of StyleSheets
450 // uses the Core-Engine
452  SwDocStyleSheetPool& rPool) :
453 
454  SfxStyleSheetBase( OUString(), &rPool, SfxStyleFamily::Char, SfxStyleSearchBits::Auto ),
455  pCharFormat(nullptr),
456  pColl(nullptr),
457  pFrameFormat(nullptr),
458  pDesc(nullptr),
459  pNumRule(nullptr),
460  pTableFormat(nullptr),
461  pBoxFormat(nullptr),
462  rDoc(rDocument),
463  aCoreSet(
464  rPool.GetPool(),
465  svl::Items<
469  // FillAttribute support:
471  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
472  SID_ATTR_PAGE, SID_ATTR_PAGE_EXT1,
473  SID_ATTR_PAGE_HEADERSET, SID_ATTR_PAGE_FOOTERSET,
474  SID_ATTR_PARA_MODEL, SID_ATTR_PARA_MODEL,
475  // Items to hand over XPropertyList things like XColorList,
476  // XHatchList, XGradientList, and XBitmapList to the Area TabPage:
477  SID_COLOR_TABLE, SID_PATTERN_LIST,
478  SID_SWREGISTER_COLLECTION, SID_SWREGISTER_COLLECTION,
479  SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM,
480  SID_SWREGISTER_MODE, SID_SWREGISTER_MODE,
481  SID_ATTR_BRUSH_CHAR, SID_ATTR_BRUSH_CHAR,
482  SID_ATTR_NUMBERING_RULE, SID_ATTR_NUMBERING_RULE,
483  SID_ATTR_AUTO_STYLE_UPDATE, SID_ATTR_AUTO_STYLE_UPDATE,
486  bPhysical(false)
487 {
488  nHelpId = UCHAR_MAX;
489 }
490 
492 
494 
496 {
497  aName.clear();
498  aFollow.clear();
499  aParent.clear();
500  SetPhysical(false);
501 }
502 
504 {
505  bool bChg = false;
506  if (!bPhysical)
508 
509  SwFormat* pFormat = nullptr;
510  switch (nFamily)
511  {
512  case SfxStyleFamily::Char:
513  pFormat = rDoc.FindCharFormatByName(aName);
514  if (pFormat)
515  {
516  pFormat->SetGrabBagItem(rVal);
517  bChg = true;
518  }
519  break;
520  case SfxStyleFamily::Para:
521  pFormat = rDoc.FindTextFormatCollByName(aName);
522  if (pFormat)
523  {
524  pFormat->SetGrabBagItem(rVal);
525  bChg = true;
526  }
527  break;
528  case SfxStyleFamily::Pseudo:
529  {
530  SwNumRule* pRule = rDoc.FindNumRulePtr(aName);
531  if (pRule)
532  {
533  pRule->SetGrabBagItem(rVal);
534  bChg = true;
535  }
536  }
537  break;
538  default:
539  break;
540  }
541 
542  if (bChg)
543  {
544  dynamic_cast<SwDocStyleSheetPool&>(*m_pPool).InvalidateIterator();
545  m_pPool->Broadcast(SfxStyleSheetHint(SfxHintId::StyleSheetModified, *this));
546  SwEditShell* pSh = rDoc.GetEditShell();
547  if (pSh)
548  pSh->CallChgLnk();
549  }
550 }
551 
553 {
554  SwFormat* pFormat = nullptr;
555  switch (nFamily)
556  {
557  case SfxStyleFamily::Char:
558  pFormat = rDoc.FindCharFormatByName(aName);
559  if (pFormat)
560  pFormat->GetGrabBagItem(rVal);
561  break;
562  case SfxStyleFamily::Para:
563  pFormat = rDoc.FindTextFormatCollByName(aName);
564  if (pFormat)
565  pFormat->GetGrabBagItem(rVal);
566  break;
567  case SfxStyleFamily::Pseudo:
568  {
569  SwNumRule* pRule = rDoc.FindNumRulePtr(aName);
570  if (pRule)
571  pRule->GetGrabBagItem(rVal);
572  }
573  break;
574  default:
575  break;
576  }
577 }
578 // virtual methods
579 void SwDocStyleSheet::SetHidden( bool bValue )
580 {
581  bool bChg = false;
582  if(!bPhysical)
584 
585  SwFormat* pFormat = nullptr;
586  switch(nFamily)
587  {
588  case SfxStyleFamily::Char:
589  pFormat = rDoc.FindCharFormatByName( aName );
590  if ( pFormat )
591  {
592  pFormat->SetHidden( bValue );
593  bChg = true;
594  }
595  break;
596 
597  case SfxStyleFamily::Para:
598  pFormat = rDoc.FindTextFormatCollByName( aName );
599  if ( pFormat )
600  {
601  pFormat->SetHidden( bValue );
602  bChg = true;
603  }
604  break;
605 
606  case SfxStyleFamily::Frame:
607  pFormat = rDoc.FindFrameFormatByName( aName );
608  if ( pFormat )
609  {
610  pFormat->SetHidden( bValue );
611  bChg = true;
612  }
613  break;
614 
615  case SfxStyleFamily::Page:
616  {
617  SwPageDesc* pPgDesc = rDoc.FindPageDesc(aName);
618  if ( pPgDesc )
619  {
620  pPgDesc->SetHidden( bValue );
621  bChg = true;
622  }
623  }
624  break;
625 
626  case SfxStyleFamily::Pseudo:
627  {
628  SwNumRule* pRule = rDoc.FindNumRulePtr( aName );
629  if ( pRule )
630  {
631  pRule->SetHidden( bValue );
632  bChg = true;
633  }
634  }
635  break;
636 
637  case SfxStyleFamily::Table:
638  {
639  SwTableAutoFormat* pTableAutoFormat = rDoc.GetTableStyles().FindAutoFormat( aName );
640  if ( pTableAutoFormat )
641  {
642  pTableAutoFormat->SetHidden( bValue );
643  bChg = true;
644  }
645  }
646  break;
647 
648  default:
649  break;
650  }
651 
652  if( bChg )
653  {
654  // calling pPool->First() here would be quite slow...
655  dynamic_cast<SwDocStyleSheetPool&>(*m_pPool).InvalidateIterator(); // internal list has to be updated
656  m_pPool->Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified, *this ) );
657  SwEditShell* pSh = rDoc.GetEditShell();
658  if( pSh )
659  pSh->CallChgLnk();
660  }
661 }
662 
664 {
665  bool bRet = false;
666 
667  SwFormat* pFormat = nullptr;
668  switch(nFamily)
669  {
670  case SfxStyleFamily::Char:
671  pFormat = rDoc.FindCharFormatByName( aName );
672  bRet = pFormat && pFormat->IsHidden( );
673  break;
674 
675  case SfxStyleFamily::Para:
676  pFormat = rDoc.FindTextFormatCollByName( aName );
677  bRet = pFormat && pFormat->IsHidden( );
678  break;
679 
680  case SfxStyleFamily::Frame:
681  pFormat = rDoc.FindFrameFormatByName( aName );
682  bRet = pFormat && pFormat->IsHidden( );
683  break;
684 
685  case SfxStyleFamily::Page:
686  {
687  SwPageDesc* pPgDesc = rDoc.FindPageDesc(aName);
688  bRet = pPgDesc && pPgDesc->IsHidden( );
689  }
690  break;
691  case SfxStyleFamily::Pseudo:
692  {
693  SwNumRule* pRule = rDoc.FindNumRulePtr( aName );
694  bRet = pRule && pRule->IsHidden( );
695  }
696  break;
697  case SfxStyleFamily::Table:
698  {
699  SwTableAutoFormat* pTableAutoFormat = rDoc.GetTableStyles().FindAutoFormat( aName );
700  bRet = pTableAutoFormat && pTableAutoFormat->IsHidden( );
701  }
702  break;
703  default:
704  break;
705  }
706 
707  return bRet;
708 }
709 
710 const OUString& SwDocStyleSheet::GetParent() const
711 {
712  if( !bPhysical )
713  {
714  // check if it's already in document
715  SwFormat* pFormat = nullptr;
716  SwGetPoolIdFromName eGetType;
717  switch(nFamily)
718  {
719  case SfxStyleFamily::Char:
720  pFormat = rDoc.FindCharFormatByName( aName );
721  eGetType = SwGetPoolIdFromName::ChrFmt;
722  break;
723 
724  case SfxStyleFamily::Para:
725  pFormat = rDoc.FindTextFormatCollByName( aName );
726  eGetType = SwGetPoolIdFromName::TxtColl;
727  break;
728 
729  case SfxStyleFamily::Frame:
730  pFormat = rDoc.FindFrameFormatByName( aName );
731  eGetType = SwGetPoolIdFromName::FrmFmt;
732  break;
733 
734  case SfxStyleFamily::Page:
735  case SfxStyleFamily::Pseudo:
736  default:
737  {
738  static const OUString sEmpty;
739  return sEmpty; // there's no parent
740  }
741  }
742 
743  OUString sTmp;
744  if( !pFormat ) // not yet there, so default Parent
745  {
746  sal_uInt16 i = SwStyleNameMapper::GetPoolIdFromUIName( aName, eGetType );
747  i = ::GetPoolParent( i );
748  if( i && USHRT_MAX != i )
750  }
751  else
752  {
753  SwFormat* p = pFormat->DerivedFrom();
754  if( p && !p->IsDefault() )
755  sTmp = p->GetName();
756  }
757  SwDocStyleSheet* pThis = const_cast<SwDocStyleSheet*>(this);
758  pThis->aParent = sTmp;
759  }
760  return aParent;
761 }
762 
763 // Follower
764 const OUString& SwDocStyleSheet::GetFollow() const
765 {
766  if( !bPhysical )
767  {
768  SwDocStyleSheet* pThis = const_cast<SwDocStyleSheet*>(this);
769  pThis->FillStyleSheet( FillAllInfo );
770  }
771  return aFollow;
772 }
773 
774 // What Linkage is possible
776 {
777  switch(nFamily)
778  {
779  case SfxStyleFamily::Para :
780  case SfxStyleFamily::Page : return true;
781  case SfxStyleFamily::Frame:
782  case SfxStyleFamily::Char :
783  case SfxStyleFamily::Pseudo: return false;
784  default:
785  OSL_ENSURE(false, "unknown style family");
786  }
787  return false;
788 }
789 
790 // Parent ?
792 {
793  bool bRet = false;
794  switch(nFamily)
795  {
796  case SfxStyleFamily::Char :
797  case SfxStyleFamily::Para :
798  case SfxStyleFamily::Frame: bRet = true;
799  break;
800  default:; //prevent warning
801  }
802  return bRet;
803 }
804 
806 {
807  bool bRet = false;
808  switch(nFamily)
809  {
810  case SfxStyleFamily::Para :
811  case SfxStyleFamily::Char :
812  case SfxStyleFamily::Frame: bRet = true;
813  break;
814  default:; //prevent warning
815  }
816  return bRet;
817 }
818 
819 // determine textual description
821 {
822  IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
823 
824  const OUString sPlus(" + ");
825  if ( SfxStyleFamily::Page == nFamily )
826  {
827  if( !pSet )
828  GetItemSet();
829 
830  SfxItemIter aIter( *pSet );
831  OUStringBuffer aDesc;
832 
833  for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
834  {
835  if(!IsInvalidItem(pItem))
836  {
837  switch ( pItem->Which() )
838  {
839  case RES_LR_SPACE:
840  case SID_ATTR_PAGE_SIZE:
841  case SID_ATTR_PAGE_MAXSIZE:
842  case SID_ATTR_PAGE_PAPERBIN:
843  case SID_ATTR_BORDER_INNER:
844  break;
845  default:
846  {
847  OUString aItemPresentation;
848  if ( !IsInvalidItem( pItem ) &&
850  *pItem, eUnit, aItemPresentation, aIntlWrapper ) )
851  {
852  if ( !aDesc.isEmpty() && !aItemPresentation.isEmpty() )
853  aDesc.append(sPlus);
854  aDesc.append(aItemPresentation);
855  }
856  }
857  }
858  }
859  }
860  return aDesc.makeStringAndClear();
861  }
862 
863  if ( SfxStyleFamily::Frame == nFamily || SfxStyleFamily::Para == nFamily || SfxStyleFamily::Char == nFamily )
864  {
865  if( !pSet )
866  GetItemSet();
867 
868  SfxItemIter aIter( *pSet );
869  OUStringBuffer aDesc;
870  OUString sPageNum;
871  OUString sModel;
872  OUString sBreak;
873  bool bHasWesternFontPrefix = false;
874  bool bHasCJKFontPrefix = false;
875  bool bHasCTLFontPrefix = false;
876  SvtCJKOptions aCJKOptions;
877  SvtCTLOptions aCTLOptions;
878 
879  // Get currently used FillStyle and remember, also need the XFillFloatTransparenceItem
880  // to decide if gradient transparence is used
881  const drawing::FillStyle eFillStyle(pSet->Get(XATTR_FILLSTYLE).GetValue());
882  const bool bUseFloatTransparence(pSet->Get(XATTR_FILLFLOATTRANSPARENCE).IsEnabled());
883 
884  for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
885  {
886  if(!IsInvalidItem(pItem))
887  {
888  switch ( pItem->Which() )
889  {
890  case SID_ATTR_AUTO_STYLE_UPDATE:
891  case RES_PAGEDESC:
892  break;
893  default:
894  {
895  OUString aItemPresentation;
896  if ( !IsInvalidItem( pItem ) &&
898  *pItem, eUnit, aItemPresentation, aIntlWrapper ) )
899  {
900  bool bIsDefault = false;
901  switch ( pItem->Which() )
902  {
903  case XATTR_FILLCOLOR:
904  {
905  // only use active FillStyle information
906  bIsDefault = (drawing::FillStyle_SOLID == eFillStyle);
907  break;
908  }
909  case XATTR_FILLGRADIENT:
910  {
911  // only use active FillStyle information
912  bIsDefault = (drawing::FillStyle_GRADIENT == eFillStyle);
913  break;
914  }
915  case XATTR_FILLHATCH:
916  {
917  // only use active FillStyle information
918  bIsDefault = (drawing::FillStyle_HATCH == eFillStyle);
919  break;
920  }
921  case XATTR_FILLBITMAP:
922  {
923  // only use active FillStyle information
924  bIsDefault = (drawing::FillStyle_BITMAP == eFillStyle);
925  break;
926  }
928  {
929  // only active when not FloatTransparence
930  bIsDefault = !bUseFloatTransparence;
931  break;
932  }
934  {
935  // only active when FloatTransparence
936  bIsDefault = bUseFloatTransparence;
937  break;
938  }
939 
940  case SID_ATTR_PARA_PAGENUM:
941  sPageNum = aItemPresentation;
942  break;
943  case SID_ATTR_PARA_MODEL:
944  sModel = aItemPresentation;
945  break;
946  case RES_BREAK:
947  sBreak = aItemPresentation;
948  break;
949  case RES_CHRATR_CJK_FONT:
954  if(aCJKOptions.IsCJKFontEnabled())
955  bIsDefault = true;
956  if(!bHasCJKFontPrefix)
957  {
958  aItemPresentation = SwResId(STR_CJK_FONT) + aItemPresentation;
959  bHasCJKFontPrefix = true;
960  }
961  break;
962  case RES_CHRATR_CTL_FONT:
967  if(aCTLOptions.IsCTLFontEnabled())
968  bIsDefault = true;
969  if(!bHasCTLFontPrefix)
970  {
971  aItemPresentation = SwResId(STR_CTL_FONT) + aItemPresentation;
972  bHasCTLFontPrefix = true;
973  }
974  break;
975  case RES_CHRATR_FONT:
976  case RES_CHRATR_FONTSIZE:
977  case RES_CHRATR_LANGUAGE:
978  case RES_CHRATR_POSTURE:
979  case RES_CHRATR_WEIGHT:
980  if(!bHasWesternFontPrefix)
981  {
982  aItemPresentation = SwResId(STR_WESTERN_FONT) + aItemPresentation;
983  bHasWesternFontPrefix = true;
984  }
985  [[fallthrough]];
986  default:
987  bIsDefault = true;
988  }
989  if(bIsDefault)
990  {
991  if ( !aDesc.isEmpty() && !aItemPresentation.isEmpty() )
992  aDesc.append(sPlus);
993  aDesc.append(aItemPresentation);
994  }
995  }
996  }
997  }
998  }
999  }
1000  // Special treatment for Break, Page template and Site offset
1001  if (!sModel.isEmpty())
1002  {
1003  if (!aDesc.isEmpty())
1004  aDesc.append(sPlus);
1005  aDesc.append(SwResId(STR_PAGEBREAK)).append(sPlus).append(sModel);
1006  if (sPageNum != "0")
1007  {
1008  aDesc.append(sPlus).append(SwResId(STR_PAGEOFFSET)).append(sPageNum);
1009  }
1010  }
1011  else if (!sBreak.isEmpty()) // Break can be valid only when NO Model
1012  {
1013  if (!aDesc.isEmpty())
1014  aDesc.append(sPlus);
1015  aDesc.append(sBreak);
1016  }
1017  return aDesc.makeStringAndClear();
1018  }
1019 
1020  if( SfxStyleFamily::Pseudo == nFamily )
1021  {
1022  return OUString();
1023  }
1024 
1025  return SfxStyleSheetBase::GetDescription(eUnit);
1026 }
1027 
1028 // Set names
1029 bool SwDocStyleSheet::SetName(const OUString& rStr, bool bReindexNow)
1030 {
1031  if( rStr.isEmpty() )
1032  return false;
1033 
1034  if( aName != rStr )
1035  {
1036  if( !SfxStyleSheetBase::SetName(rStr, bReindexNow))
1037  return false;
1038  }
1039  else if(!bPhysical)
1041 
1042  bool bChg = false;
1043  switch(nFamily)
1044  {
1045  case SfxStyleFamily::Char :
1046  {
1047  OSL_ENSURE(pCharFormat, "SwCharFormat missing!");
1048  if( pCharFormat && pCharFormat->GetName() != rStr )
1049  {
1050  if (!pCharFormat->GetName().isEmpty())
1051  rDoc.RenameFormat(*pCharFormat, rStr);
1052  else
1053  pCharFormat->SetName(rStr);
1054 
1055  bChg = true;
1056  }
1057  break;
1058  }
1059  case SfxStyleFamily::Para :
1060  {
1061  OSL_ENSURE(pColl, "Collection missing!");
1062  if( pColl && pColl->GetName() != rStr )
1063  {
1064  if (!pColl->GetName().isEmpty())
1065  rDoc.RenameFormat(*pColl, rStr);
1066  else
1067  pColl->SetName(rStr);
1068 
1069  bChg = true;
1070  }
1071  break;
1072  }
1073  case SfxStyleFamily::Frame:
1074  {
1075  OSL_ENSURE(pFrameFormat, "FrameFormat missing!");
1076  if( pFrameFormat && pFrameFormat->GetName() != rStr )
1077  {
1078  if (!pFrameFormat->GetName().isEmpty())
1079  rDoc.RenameFormat(*pFrameFormat, rStr);
1080  else
1081  pFrameFormat->SetName( rStr );
1082 
1083  bChg = true;
1084  }
1085  break;
1086  }
1087  case SfxStyleFamily::Page :
1088  OSL_ENSURE(pDesc, "PageDesc missing!");
1089  if( pDesc && pDesc->GetName() != rStr )
1090  {
1091  // Set PageDesc - copy with earlier one - probably not
1092  // necessary for setting the name. So here we allow a
1093  // cast.
1094  SwPageDesc aPageDesc(*const_cast<SwPageDesc*>(pDesc));
1095  const OUString aOldName(aPageDesc.GetName());
1096 
1097  aPageDesc.SetName( rStr );
1098  bool const bDoesUndo = rDoc.GetIDocumentUndoRedo().DoesUndo();
1099 
1100  rDoc.GetIDocumentUndoRedo().DoUndo(!aOldName.isEmpty());
1101  rDoc.ChgPageDesc(aOldName, aPageDesc);
1102  rDoc.GetIDocumentUndoRedo().DoUndo(bDoesUndo);
1103 
1104  rDoc.getIDocumentState().SetModified();
1105  bChg = true;
1106  }
1107  break;
1108  case SfxStyleFamily::Pseudo:
1109  OSL_ENSURE(pNumRule, "NumRule missing!");
1110 
1111  if (pNumRule)
1112  {
1113  OUString aOldName = pNumRule->GetName();
1114 
1115  if (!aOldName.isEmpty())
1116  {
1117  if ( aOldName != rStr &&
1118  rDoc.RenameNumRule(aOldName, rStr))
1119  {
1120  pNumRule = rDoc.FindNumRulePtr(rStr);
1121  rDoc.getIDocumentState().SetModified();
1122 
1123  bChg = true;
1124  }
1125  }
1126  else
1127  {
1128  // #i91400#
1129  const_cast<SwNumRule*>(pNumRule)->SetName( rStr, rDoc.getIDocumentListsAccess() );
1130  rDoc.getIDocumentState().SetModified();
1131 
1132  bChg = true;
1133  }
1134  }
1135 
1136  break;
1137 
1138  default:
1139  OSL_ENSURE(false, "unknown style family");
1140  }
1141 
1142  if( bChg )
1143  {
1144  m_pPool->First(); // internal list has to be updated
1145  m_pPool->Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified, *this ) );
1146  SwEditShell* pSh = rDoc.GetEditShell();
1147  if( pSh )
1148  pSh->CallChgLnk();
1149  }
1150  return true;
1151 }
1152 
1153 // hierarchy of deduction
1154 bool SwDocStyleSheet::SetParent( const OUString& rStr)
1155 {
1156  SwFormat* pFormat = nullptr, *pParent = nullptr;
1157  switch(nFamily)
1158  {
1159  case SfxStyleFamily::Char :
1160  OSL_ENSURE( pCharFormat, "SwCharFormat missing!" );
1161  if( nullptr != ( pFormat = pCharFormat ) && !rStr.isEmpty() )
1162  pParent = lcl_FindCharFormat(rDoc, rStr);
1163  break;
1164 
1165  case SfxStyleFamily::Para :
1166  OSL_ENSURE( pColl, "Collection missing!");
1167  if( nullptr != ( pFormat = pColl ) && !rStr.isEmpty() )
1168  pParent = lcl_FindParaFormat( rDoc, rStr );
1169  break;
1170 
1171  case SfxStyleFamily::Frame:
1172  OSL_ENSURE(pFrameFormat, "FrameFormat missing!");
1173  if( nullptr != ( pFormat = pFrameFormat ) && !rStr.isEmpty() )
1174  pParent = lcl_FindFrameFormat( rDoc, rStr );
1175  break;
1176 
1177  case SfxStyleFamily::Page:
1178  case SfxStyleFamily::Pseudo:
1179  break;
1180  default:
1181  OSL_ENSURE(false, "unknown style family");
1182  }
1183 
1184  bool bRet = false;
1185  if( pFormat && pFormat->DerivedFrom() &&
1186  pFormat->DerivedFrom()->GetName() != rStr )
1187  {
1188  {
1189  SwImplShellAction aTmp( rDoc );
1190  bRet = pFormat->SetDerivedFrom( pParent );
1191  }
1192 
1193  if( bRet )
1194  {
1195  aParent = rStr;
1196  m_pPool->Broadcast( SfxStyleSheetHint( SfxHintId::StyleSheetModified,
1197  *this ) );
1198  }
1199  }
1200 
1201  return bRet;
1202 }
1203 
1204 // Set Follower
1205 bool SwDocStyleSheet::SetFollow( const OUString& rStr)
1206 {
1207  if( !rStr.isEmpty() && !SfxStyleSheetBase::SetFollow( rStr ))
1208  return false;
1209 
1210  SwImplShellAction aTmpSh( rDoc );
1211  switch(nFamily)
1212  {
1213  case SfxStyleFamily::Para :
1214  {
1215  OSL_ENSURE(pColl, "Collection missing!");
1216  if( pColl )
1217  {
1218  SwTextFormatColl* pFollow = pColl;
1219  if( !rStr.isEmpty() && nullptr == (pFollow = lcl_FindParaFormat(rDoc, rStr) ))
1220  pFollow = pColl;
1221 
1222  pColl->SetNextTextFormatColl(*pFollow);
1223  }
1224  break;
1225  }
1226  case SfxStyleFamily::Page :
1227  {
1228  OSL_ENSURE(pDesc, "PageDesc missing!");
1229  if( pDesc )
1230  {
1231  const SwPageDesc* pFollowDesc = !rStr.isEmpty()
1232  ? lcl_FindPageDesc(rDoc, rStr)
1233  : nullptr;
1234  size_t nId = 0;
1235  if (pFollowDesc != pDesc->GetFollow() && rDoc.FindPageDesc(pDesc->GetName(), &nId))
1236  {
1237  SwPageDesc aDesc( *pDesc );
1238  aDesc.SetFollow( pFollowDesc );
1239  rDoc.ChgPageDesc( nId, aDesc );
1240  pDesc = &rDoc.GetPageDesc( nId );
1241  }
1242  }
1243  break;
1244  }
1245  case SfxStyleFamily::Char:
1246  case SfxStyleFamily::Frame:
1247  case SfxStyleFamily::Pseudo:
1248  break;
1249  default:
1250  OSL_ENSURE(false, "unknown style family");
1251  }
1252 
1253  return true;
1254 }
1255 
1256 static
1257 std::unique_ptr<SfxItemSet> lcl_SwFormatToFlatItemSet(SwFormat const *const pFormat)
1258 {
1259  // note: we don't add the odd items that GetItemSet() would add
1260  // because they don't seem relevant for preview
1261  std::vector<SfxItemSet const*> sets;
1262  sets.push_back(&pFormat->GetAttrSet());
1263  while (SfxItemSet const*const pParent = sets.back()->GetParent())
1264  {
1265  sets.push_back(pParent);
1266  }
1267  // start by copying top-level parent set
1268  std::unique_ptr<SfxItemSet> pRet(new SfxItemSet(*sets.back()));
1269  sets.pop_back();
1270  for (auto iter = sets.rbegin(); iter != sets.rend(); ++iter)
1271  { // in reverse so child overrides parent
1272  pRet->Put(**iter);
1273  }
1274  return pRet;
1275 }
1276 
1277 std::unique_ptr<SfxItemSet> SwDocStyleSheet::GetItemSetForPreview()
1278 {
1279  if (SfxStyleFamily::Page == nFamily || SfxStyleFamily::Pseudo == nFamily || SfxStyleFamily::Table == nFamily)
1280  {
1281  SAL_WARN("sw.ui", "GetItemSetForPreview not implemented for page or number or table style");
1282  return std::unique_ptr<SfxItemSet>();
1283  }
1284  if (!bPhysical)
1285  {
1286  // because not only this style, but also any number of its parents
1287  // (or follow style) may not actually exist in the document at this
1288  // time, return one "flattened" item set that contains all items from
1289  // all parents.
1290  std::unique_ptr<SfxItemSet> pRet;
1291  FillStyleSheet(FillPreview, &pRet);
1292  assert(pRet);
1293  return pRet;
1294  }
1295  else
1296  {
1297  switch (nFamily)
1298  {
1299  case SfxStyleFamily::Char:
1301  case SfxStyleFamily::Para:
1303  case SfxStyleFamily::Frame:
1305  default:
1306  std::abort();
1307  }
1308  }
1309 }
1310 
1311 // extract ItemSet to Name and Family, Mask
1312 
1314 {
1315  if(!bPhysical)
1317 
1318  switch(nFamily)
1319  {
1320  case SfxStyleFamily::Char:
1321  case SfxStyleFamily::Para:
1322  case SfxStyleFamily::Frame:
1323  {
1324  SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
1325  aBoxInfo.SetTable( false );
1326  aBoxInfo.SetDist( true ); // always show gap field
1327  aBoxInfo.SetMinDist( true );// set minimum size in tables and paragraphs
1328  aBoxInfo.SetDefDist( MIN_BORDER_DIST );// always set Default-Gap
1329  // Single lines can only have DontCare-Status in tables
1330  aBoxInfo.SetValid( SvxBoxInfoItemValidFlags::DISABLE );
1331 
1332  if( nFamily == SfxStyleFamily::Char )
1333  {
1334  SAL_WARN_IF(!pCharFormat, "sw.ui", "Where's SwCharFormat");
1336  aCoreSet.Put( aBoxInfo );
1337 
1338  if(pCharFormat->DerivedFrom())
1340  }
1341  else if ( nFamily == SfxStyleFamily::Para )
1342  {
1343  OSL_ENSURE(pColl, "Where's Collection");
1345  aCoreSet.Put( aBoxInfo );
1346  aCoreSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, pColl->IsAutoUpdateFormat()));
1347 
1348  if(pColl->DerivedFrom())
1350  }
1351  else
1352  {
1353  OSL_ENSURE(pFrameFormat, "Where's FrameFormat");
1355  aCoreSet.Put( aBoxInfo );
1356  aCoreSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, pFrameFormat->IsAutoUpdateFormat()));
1357 
1358  if(pFrameFormat->DerivedFrom())
1360 
1361  // create needed items for XPropertyList entries from the DrawModel so that
1362  // the Area TabPage can access them
1363  const SwDrawModel* pDrawModel = rDoc.getIDocumentDrawModelAccess().GetDrawModel();
1364 
1365  aCoreSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE));
1366  aCoreSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST));
1367  aCoreSet.Put(SvxHatchListItem(pDrawModel->GetHatchList(), SID_HATCH_LIST));
1368  aCoreSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), SID_BITMAP_LIST));
1369  aCoreSet.Put(SvxPatternListItem(pDrawModel->GetPatternList(), SID_PATTERN_LIST));
1370  }
1371  }
1372  break;
1373 
1374  case SfxStyleFamily::Page :
1375  {
1376  // set correct parent to get the drawing::FillStyle_NONE FillStyle as needed
1377  if(!aCoreSet.GetParent())
1378  {
1380  }
1381 
1382  OSL_ENSURE(pDesc, "No PageDescriptor");
1383  ::PageDescToItemSet(*const_cast<SwPageDesc*>(pDesc), aCoreSet);
1384  }
1385  break;
1386 
1387  case SfxStyleFamily::Pseudo:
1388  {
1389  OSL_ENSURE(pNumRule, "No NumRule");
1390  SvxNumRule aRule = pNumRule->MakeSvxNumRule();
1391  aCoreSet.Put(SvxNumBulletItem(aRule));
1392  }
1393  break;
1394 
1395  default:
1396  OSL_ENSURE(false, "unknown style family");
1397  }
1398  // Member of Baseclass
1399  pSet = &aCoreSet;
1400 
1401  return aCoreSet;
1402 }
1403 
1405 {
1406  if ( nFamily != SfxStyleFamily::Para )
1407  {
1408  return;
1409  }
1410 
1411  OSL_ENSURE( pColl, "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - missing paragraph style");
1413  {
1414  OSL_ENSURE( pColl->GetItemState( RES_PARATR_NUMRULE ) == SfxItemState::SET,
1415  "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - list level indents are applicable at paragraph style, but no list style found. Serious defect." );
1416  const OUString sNumRule = pColl->GetNumRule().GetValue();
1417  if (!sNumRule.isEmpty())
1418  {
1419  const SwNumRule* pRule = rDoc.FindNumRulePtr( sNumRule );
1420  if( pRule )
1421  {
1422  const SwNumFormat& rFormat = pRule->Get( 0 );
1424  {
1426  aLR.SetTextLeft( rFormat.GetIndentAt() );
1427  aLR.SetTextFirstLineOfst( static_cast<short>(rFormat.GetFirstLineIndent()) );
1428  rSet.Put( aLR );
1429  }
1430  }
1431  }
1432  }
1433 }
1434 
1435 // handling of parameter <bResetIndentAttrsAtParagraphStyle>
1437  const bool bResetIndentAttrsAtParagraphStyle )
1438 {
1439  // if applicable determine format first
1440  if(!bPhysical)
1442 
1443  SwImplShellAction aTmpSh( rDoc );
1444 
1445  OSL_ENSURE( &rSet != &aCoreSet, "SetItemSet with own Set is not allowed" );
1446 
1447  if (rDoc.GetIDocumentUndoRedo().DoesUndo())
1448  {
1449  SwRewriter aRewriter;
1450  aRewriter.AddRule( UndoArg1, GetName() );
1451  rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::INSFMTATTR, &aRewriter );
1452  }
1453 
1454  SwFormat* pFormat = nullptr;
1455  std::unique_ptr<SwPageDesc> pNewDsc;
1456  size_t nPgDscPos = 0;
1457 
1458  switch(nFamily)
1459  {
1460  case SfxStyleFamily::Char :
1461  {
1462  OSL_ENSURE(pCharFormat, "Where's CharFormat");
1463  pFormat = pCharFormat;
1464  }
1465  break;
1466 
1467  case SfxStyleFamily::Para :
1468  {
1469  OSL_ENSURE(pColl, "Where's Collection");
1470  const SfxPoolItem* pAutoUpdate;
1471  if(SfxItemState::SET == rSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE,false, &pAutoUpdate ))
1472  {
1473  pColl->SetAutoUpdateFormat(static_cast<const SfxBoolItem*>(pAutoUpdate)->GetValue());
1474  }
1475 
1476  const SwCondCollItem* pCondItem;
1477  if( SfxItemState::SET != rSet.GetItemState( FN_COND_COLL, false,
1478  reinterpret_cast<const SfxPoolItem**>(&pCondItem) ))
1479  pCondItem = nullptr;
1480 
1481  if( RES_CONDTXTFMTCOLL == pColl->Which() && pCondItem )
1482  {
1483  const CommandStruct* pCmds = SwCondCollItem::GetCmds();
1484  for(sal_uInt16 i = 0; i < COND_COMMAND_COUNT; i++)
1485  {
1486  SwCollCondition aCond( nullptr, pCmds[ i ].nCnd, pCmds[ i ].nSubCond );
1487  static_cast<SwConditionTextFormatColl*>(pColl)->RemoveCondition( aCond );
1488  const OUString sStyle = pCondItem->GetStyle( i );
1489  if (sStyle.isEmpty())
1490  continue;
1491  SwFormat *const pFindFormat = lcl_FindParaFormat( rDoc, sStyle );
1492  if (pFindFormat)
1493  {
1494  aCond.RegisterToFormat( *pFindFormat );
1495  static_cast<SwConditionTextFormatColl*>(pColl)->InsertCondition( aCond );
1496  }
1497  }
1498 
1499  // Update document to new conditions
1500  SwCondCollCondChg aMsg( pColl );
1501  pColl->ModifyNotification( &aMsg, &aMsg );
1502  }
1503  else if( pCondItem && !pColl->HasWriterListeners() )
1504  {
1505  // no conditional template, then first create and adopt
1506  // all important values
1508  pColl->GetName(), static_cast<SwTextFormatColl*>(pColl->DerivedFrom()) );
1509  if( pColl != &pColl->GetNextTextFormatColl() )
1511 
1514  else
1516 
1517  const CommandStruct* pCmds = SwCondCollItem::GetCmds();
1518  for( sal_uInt16 i = 0; i < COND_COMMAND_COUNT; ++i )
1519  {
1520  const OUString sStyle = pCondItem->GetStyle( i );
1521  if (sStyle.isEmpty())
1522  continue;
1523  SwTextFormatColl *const pFindFormat = lcl_FindParaFormat( rDoc, sStyle );
1524  if (pFindFormat)
1525  {
1526  pCColl->InsertCondition( SwCollCondition( pFindFormat,
1527  pCmds[ i ].nCnd, pCmds[ i ].nSubCond ) );
1528  }
1529  }
1530 
1531  rDoc.DelTextFormatColl( pColl );
1532  pColl = pCColl;
1533  }
1534  if ( bResetIndentAttrsAtParagraphStyle &&
1535  rSet.GetItemState( RES_PARATR_NUMRULE, false ) == SfxItemState::SET &&
1536  rSet.GetItemState( RES_LR_SPACE, false ) != SfxItemState::SET &&
1537  pColl->GetItemState( RES_LR_SPACE, false ) == SfxItemState::SET )
1538  {
1540  }
1541 
1542  // #i56252: If a standard numbering style is assigned to a standard paragraph style
1543  // we have to create a physical instance of the numbering style. If we do not and
1544  // neither the paragraph style nor the numbering style is used in the document
1545  // the numbering style will not be saved with the document and the assignment got lost.
1546  const SfxPoolItem* pNumRuleItem = nullptr;
1547  if( SfxItemState::SET == rSet.GetItemState( RES_PARATR_NUMRULE, false, &pNumRuleItem ) )
1548  { // Setting a numbering rule?
1549  const OUString sNumRule = static_cast<const SwNumRuleItem*>(pNumRuleItem)->GetValue();
1550  if (!sNumRule.isEmpty())
1551  {
1552  SwNumRule* pRule = rDoc.FindNumRulePtr( sNumRule );
1553  if( !pRule )
1554  { // Numbering rule not in use yet.
1555  sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( sNumRule, SwGetPoolIdFromName::NumRule );
1556  if( USHRT_MAX != nPoolId ) // It's a standard numbering rule
1557  {
1558  rDoc.getIDocumentStylePoolAccess().GetNumRuleFromPool( nPoolId ); // Create numbering rule (physical)
1559  }
1560  }
1561  }
1562  }
1563 
1564  pFormat = pColl;
1565 
1566  sal_uInt16 nId = pColl->GetPoolFormatId() &
1568  switch( GetMask() & ( static_cast<SfxStyleSearchBits>(0x0fff) & ~SfxStyleSearchBits::SwCondColl ) )
1569  {
1570  case SfxStyleSearchBits::SwText:
1571  nId |= COLL_TEXT_BITS;
1572  break;
1573  case SfxStyleSearchBits::SwChapter:
1574  nId |= COLL_DOC_BITS;
1575  break;
1576  case SfxStyleSearchBits::SwList:
1577  nId |= COLL_LISTS_BITS;
1578  break;
1579  case SfxStyleSearchBits::SwIndex:
1580  nId |= COLL_REGISTER_BITS;
1581  break;
1582  case SfxStyleSearchBits::SwExtra:
1583  nId |= COLL_EXTRA_BITS;
1584  break;
1585  case SfxStyleSearchBits::SwHtml:
1586  nId |= COLL_HTML_BITS;
1587  break;
1588  default: break;
1589  }
1590  pColl->SetPoolFormatId( nId );
1591  break;
1592  }
1593  case SfxStyleFamily::Frame:
1594  {
1595  OSL_ENSURE(pFrameFormat, "Where's FrameFormat");
1596  const SfxPoolItem* pAutoUpdate;
1597  if(SfxItemState::SET == rSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE,false, &pAutoUpdate ))
1598  {
1599  pFrameFormat->SetAutoUpdateFormat(static_cast<const SfxBoolItem*>(pAutoUpdate)->GetValue());
1600  }
1601  pFormat = pFrameFormat;
1602  }
1603  break;
1604 
1605  case SfxStyleFamily::Page :
1606  {
1607  OSL_ENSURE(pDesc, "Where's PageDescriptor");
1608 
1609  if (rDoc.FindPageDesc(pDesc->GetName(), &nPgDscPos))
1610  {
1611  pNewDsc.reset( new SwPageDesc( *pDesc ) );
1612  // #i48949# - no undo actions for the
1613  // copy of the page style
1614  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1615  rDoc.CopyPageDesc(*pDesc, *pNewDsc); // #i7983#
1616 
1617  pFormat = &pNewDsc->GetMaster();
1618  }
1619  }
1620  break;
1621 
1622  case SfxStyleFamily::Pseudo:
1623  {
1624  OSL_ENSURE(pNumRule, "Where's NumRule");
1625 
1626  if (!pNumRule)
1627  break;
1628 
1629  const SfxPoolItem* pItem;
1630  switch( rSet.GetItemState( SID_ATTR_NUMBERING_RULE, false, &pItem ))
1631  {
1632  case SfxItemState::SET:
1633  {
1634  SvxNumRule* pSetRule = static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule();
1635  pSetRule->UnLinkGraphics();
1636  SwNumRule aSetRule(*pNumRule);
1637  aSetRule.SetSvxRule(*pSetRule, &rDoc);
1638  rDoc.ChgNumRuleFormats( aSetRule );
1639  }
1640  break;
1641  case SfxItemState::DONTCARE:
1642  // set NumRule to default values
1643  // what are the default values?
1644  {
1645  SwNumRule aRule( pNumRule->GetName(),
1646  // #i89178#
1648  rDoc.ChgNumRuleFormats( aRule );
1649  }
1650  break;
1651  default: break;
1652  }
1653  }
1654  break;
1655 
1656  default:
1657  OSL_ENSURE(false, "unknown style family");
1658  }
1659 
1660  if( pFormat && rSet.Count())
1661  {
1662  SfxItemIter aIter( rSet );
1663  const SfxPoolItem* pItem = aIter.GetCurItem();
1664  do
1665  {
1666  if( IsInvalidItem( pItem ) ) // Clear
1667  {
1668  // use method <SwDoc::ResetAttrAtFormat(..)> in order to
1669  // create an Undo object for the attribute reset.
1670  rDoc.ResetAttrAtFormat( rSet.GetWhichByPos(aIter.GetCurPos()),
1671  *pFormat );
1672  }
1673 
1674  pItem = aIter.NextItem();
1675  } while (pItem);
1676  SfxItemSet aSet(rSet);
1677  aSet.ClearInvalidItems();
1678 
1679  if(SfxStyleFamily::Frame == nFamily)
1680  {
1681  // Need to check for unique item for DrawingLayer items of type NameOrIndex
1682  // and evtl. correct that item to ensure unique names for that type. This call may
1683  // modify/correct entries inside of the given SfxItemSet
1685  }
1686 
1687  aCoreSet.ClearItem();
1688 
1689  if( pNewDsc )
1690  {
1691  ::ItemSetToPageDesc( aSet, *pNewDsc );
1692  rDoc.ChgPageDesc( nPgDscPos, *pNewDsc );
1693  pDesc = &rDoc.GetPageDesc( nPgDscPos );
1694  rDoc.PreDelPageDesc(pNewDsc.get()); // #i7983#
1695  pNewDsc.reset();
1696  }
1697  else
1698  rDoc.ChgFormat(*pFormat, aSet); // put all that is set
1699  }
1700  else
1701  {
1702  aCoreSet.ClearItem();
1703  if( pNewDsc ) // we still need to delete it
1704  {
1705  rDoc.PreDelPageDesc(pNewDsc.get()); // #i7983#
1706  pNewDsc.reset();
1707  }
1708  }
1709 
1710  if (rDoc.GetIDocumentUndoRedo().DoesUndo())
1711  {
1712  rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::END, nullptr);
1713  }
1714 }
1715 
1716 static void lcl_SaveStyles( SfxStyleFamily nFamily, std::vector<void*>& rArr, SwDoc& rDoc )
1717 {
1718  switch( nFamily )
1719  {
1720  case SfxStyleFamily::Char:
1721  {
1722  const SwCharFormats& rTable = *rDoc.GetCharFormats();
1723  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1724  {
1725  rArr.push_back( rTable[ n ] );
1726  }
1727  }
1728  break;
1729  case SfxStyleFamily::Para:
1730  {
1731  const SwTextFormatColls& rTable = *rDoc.GetTextFormatColls();
1732  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1733  {
1734  rArr.push_back( rTable[ n ] );
1735  }
1736  }
1737  break;
1738  case SfxStyleFamily::Frame:
1739  {
1740  const SwFrameFormats& rTable = *rDoc.GetFrameFormats();
1741  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1742  {
1743  rArr.push_back( rTable[ n ] );
1744  }
1745  }
1746  break;
1747 
1748  case SfxStyleFamily::Page:
1749  {
1750  for( size_t n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n )
1751  {
1752  rArr.push_back( &rDoc.GetPageDesc( n ) );
1753  }
1754  }
1755  break;
1756 
1757  case SfxStyleFamily::Pseudo:
1758  {
1759  const SwNumRuleTable& rTable = rDoc.GetNumRuleTable();
1760  for( size_t n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1761  {
1762  rArr.push_back( rTable[ n ] );
1763  }
1764  }
1765  break;
1766  default: break;
1767  }
1768 }
1769 
1770 static bool lcl_Contains(const std::vector<void*>& rArr, const void* p)
1771 {
1772  return std::find( rArr.begin(), rArr.end(), p ) != rArr.end();
1773 }
1774 
1775 static void lcl_DeleteInfoStyles( SfxStyleFamily nFamily, std::vector<void*> const & rArr, SwDoc& rDoc )
1776 {
1777  size_t n, nCnt;
1778  switch( nFamily )
1779  {
1780  case SfxStyleFamily::Char:
1781  {
1782  std::deque<sal_uInt16> aDelArr;
1783  const SwCharFormats& rTable = *rDoc.GetCharFormats();
1784  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1785  {
1786  if( !lcl_Contains( rArr, rTable[ n ] ))
1787  aDelArr.push_front( n );
1788  }
1789  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1790  rDoc.DelCharFormat( aDelArr[ n ] );
1791  }
1792  break;
1793 
1794  case SfxStyleFamily::Para :
1795  {
1796  std::deque<sal_uInt16> aDelArr;
1797  const SwTextFormatColls& rTable = *rDoc.GetTextFormatColls();
1798  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1799  {
1800  if( !lcl_Contains( rArr, rTable[ n ] ))
1801  aDelArr.push_front( n );
1802  }
1803  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1804  rDoc.DelTextFormatColl( aDelArr[ n ] );
1805  }
1806  break;
1807 
1808  case SfxStyleFamily::Frame:
1809  {
1810  std::deque<SwFrameFormat*> aDelArr;
1811  const SwFrameFormats& rTable = *rDoc.GetFrameFormats();
1812  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1813  {
1814  if( !lcl_Contains( rArr, rTable[ n ] ))
1815  aDelArr.push_front( rTable[ n ] );
1816  }
1817  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1818  rDoc.DelFrameFormat( aDelArr[ n ] );
1819  }
1820  break;
1821 
1822  case SfxStyleFamily::Page:
1823  {
1824  std::deque<size_t> aDelArr;
1825  for( n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n )
1826  {
1827  if( !lcl_Contains( rArr, &rDoc.GetPageDesc( n ) ))
1828  aDelArr.push_front( n );
1829  }
1830  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1831  rDoc.DelPageDesc( aDelArr[ n ] );
1832  }
1833  break;
1834 
1835  case SfxStyleFamily::Pseudo:
1836  {
1837  std::deque<SwNumRule*> aDelArr;
1838  const SwNumRuleTable& rTable = rDoc.GetNumRuleTable();
1839  for( n = 0, nCnt = rTable.size(); n < nCnt; ++n )
1840  {
1841  if( !lcl_Contains( rArr, rTable[ n ] ))
1842  aDelArr.push_front( rTable[ n ] );
1843  }
1844  for( n = 0, nCnt = aDelArr.size(); n < nCnt; ++n )
1845  rDoc.DelNumRule( aDelArr[ n ]->GetName() );
1846  }
1847  break;
1848  default: break;
1849  }
1850 }
1851 
1852 // determine the format
1854  FillStyleType const eFType, std::unique_ptr<SfxItemSet> *const o_ppFlatSet)
1855 {
1856  bool bRet = false;
1857  sal_uInt16 nPoolId = USHRT_MAX;
1858  SwFormat* pFormat = nullptr;
1859 
1860  bool bCreate = FillPhysical == eFType;
1861  bool bDeleteInfo = false;
1862  bool bFillOnlyInfo = FillAllInfo == eFType || FillPreview == eFType;
1863  std::vector<void*> aDelArr;
1864  bool const isModified(rDoc.getIDocumentState().IsModified());
1865 
1866  switch(nFamily)
1867  {
1868  case SfxStyleFamily::Char:
1869  pCharFormat = lcl_FindCharFormat(rDoc, aName, this, bCreate );
1870  bPhysical = nullptr != pCharFormat;
1871  if( bFillOnlyInfo && !bPhysical )
1872  {
1873  // create style (plus all needed parents) and clean it up
1874  // later - without affecting the undo/redo stack
1875  ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
1876  bDeleteInfo = true;
1877  ::lcl_SaveStyles( nFamily, aDelArr, rDoc );
1878  pCharFormat = lcl_FindCharFormat(rDoc, aName, this );
1879  }
1880 
1881  pFormat = pCharFormat;
1882  if( !bCreate && !pFormat )
1883  {
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()
2742  : pFormat->GetName() );
2743  }
2744 
2745  // PoolFormat
2746  if( bAll )
2747  {
2750  bIsSearchUsed, bSearchHidden, bOnlyHidden,
2752  else
2753  {
2762  }
2764  bIsSearchUsed, bSearchHidden, bOnlyHidden,
2765  SwGetPoolIdFromName::ChrFmt, cCHAR);
2766  }
2767  }
2768 
2769  if( nSearchFamily == SfxStyleFamily::Para ||
2770  nSearchFamily == SfxStyleFamily::All )
2771  {
2772  SfxStyleSearchBits nSMask = nSrchMask;
2774  {
2775  // then only HTML-Template are of interest
2776  if( SfxStyleSearchBits::AllVisible == ( nSMask & SfxStyleSearchBits::AllVisible ) )
2777  nSMask = SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined |
2778  SfxStyleSearchBits::Used;
2779  else
2780  nSMask &= SfxStyleSearchBits::Used | SfxStyleSearchBits::UserDefined |
2781  SfxStyleSearchBits::SwCondColl | SfxStyleSearchBits::SwHtml;
2782  if( nSMask == SfxStyleSearchBits::Auto )
2783  nSMask = SfxStyleSearchBits::SwHtml;
2784  }
2785 
2786  const size_t nArrLen = rDoc.GetTextFormatColls()->size();
2787  for( size_t i = 0; i < nArrLen; i++ )
2788  {
2789  SwTextFormatColl* pColl = (*rDoc.GetTextFormatColls())[ i ];
2790 
2791  const bool bUsed = bOrganizer || rDoc.IsUsed(*pColl);
2792  if ( ( !bSearchHidden && pColl->IsHidden( ) && !bUsed ) || pColl->IsDefault() )
2793  continue;
2794 
2795  if ( nSMask == SfxStyleSearchBits::Hidden && !pColl->IsHidden( ) )
2796  continue;
2797 
2798  if( !(bIsSearchUsed && bUsed ))
2799  {
2800  const sal_uInt16 nId = pColl->GetPoolFormatId();
2801  auto tmpMask = nSMask & ~SfxStyleSearchBits::Used;
2802  if (tmpMask == SfxStyleSearchBits::UserDefined)
2803  {
2804  if(!IsPoolUserFormat(nId)) continue;
2805  }
2806  else if (tmpMask == SfxStyleSearchBits::SwText)
2807  {
2808  if((nId & COLL_GET_RANGE_BITS) != COLL_TEXT_BITS) continue;
2809  }
2810  else if (tmpMask == SfxStyleSearchBits::SwChapter)
2811  {
2812  if((nId & COLL_GET_RANGE_BITS) != COLL_DOC_BITS) continue;
2813  }
2814  else if (tmpMask == SfxStyleSearchBits::SwList)
2815  {
2816  if((nId & COLL_GET_RANGE_BITS) != COLL_LISTS_BITS) continue;
2817  }
2818  else if (tmpMask == SfxStyleSearchBits::SwIndex)
2819  {
2820  if((nId & COLL_GET_RANGE_BITS) != COLL_REGISTER_BITS) continue;
2821  }
2822  else if (tmpMask == SfxStyleSearchBits::SwExtra)
2823  {
2824  if((nId & COLL_GET_RANGE_BITS) != COLL_EXTRA_BITS) continue;
2825  }
2826  else if (tmpMask == (SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined)
2827  || tmpMask == SfxStyleSearchBits::SwHtml)
2828  {
2829  if((tmpMask & SfxStyleSearchBits::UserDefined) && IsPoolUserFormat(nId))
2830  ; // do nothing
2831  else if( (nId & COLL_GET_RANGE_BITS) != COLL_HTML_BITS)
2832  {
2833  // but some we also want to see in this section
2834  bool bContinue = true;
2835  switch( nId )
2836  {
2837  case RES_POOLCOLL_SENDADRESS: // --> ADDRESS
2838  case RES_POOLCOLL_TABLE_HDLN: // --> TH
2839  case RES_POOLCOLL_TABLE: // --> TD
2840  case RES_POOLCOLL_TEXT: // --> P
2841  case RES_POOLCOLL_HEADLINE_BASE:// --> H
2842  case RES_POOLCOLL_HEADLINE1: // --> H1
2843  case RES_POOLCOLL_HEADLINE2: // --> H2
2844  case RES_POOLCOLL_HEADLINE3: // --> H3
2845  case RES_POOLCOLL_HEADLINE4: // --> H4
2846  case RES_POOLCOLL_HEADLINE5: // --> H5
2847  case RES_POOLCOLL_HEADLINE6: // --> H6
2848  case RES_POOLCOLL_STANDARD: // --> P
2849  case RES_POOLCOLL_FOOTNOTE:
2850  case RES_POOLCOLL_ENDNOTE:
2851  bContinue = false;
2852  break;
2853  }
2854  if( bContinue )
2855  continue;
2856  }
2857  }
2858  else if (tmpMask == SfxStyleSearchBits::SwCondColl)
2859  {
2860  if( RES_CONDTXTFMTCOLL != pColl->Which() ) continue;
2861  }
2862  else
2863  {
2864  // searched for used and found none
2865  if( bIsSearchUsed )
2866  continue;
2867  }
2868  }
2869  aLst.Append( cPARA, pColl->GetName() );
2870  }
2871 
2872  bAll = ( nSMask & SfxStyleSearchBits::AllVisible ) == SfxStyleSearchBits::AllVisible;
2873  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwText )
2875  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA );
2876  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwChapter )
2878  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2879  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwList )
2881  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2882  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwIndex )
2884  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2885  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwExtra )
2887  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2888  if ( bAll || (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwCondColl )
2889  {
2890  if( !bIsSearchUsed ||
2894  }
2895  if ( bAll ||
2896  (nSMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::SwHtml ||
2897  (nSMask & ~SfxStyleSearchBits::Used) ==
2898  (SfxStyleSearchBits::SwHtml | SfxStyleSearchBits::UserDefined) )
2899  {
2901  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::TxtColl, cPARA ) ;
2902  if( !bAll )
2903  {
2904  // then also the ones, that we are mapping:
2905  static sal_uInt16 aPoolIds[] = {
2906  RES_POOLCOLL_SENDADRESS, // --> ADDRESS
2907  RES_POOLCOLL_TABLE_HDLN, // --> TH
2908  RES_POOLCOLL_TABLE, // --> TD
2909  RES_POOLCOLL_STANDARD, // --> P
2910  RES_POOLCOLL_TEXT, // --> P
2911  RES_POOLCOLL_HEADLINE_BASE, // --> H
2912  RES_POOLCOLL_HEADLINE1, // --> H1
2913  RES_POOLCOLL_HEADLINE2, // --> H2
2914  RES_POOLCOLL_HEADLINE3, // --> H3
2915  RES_POOLCOLL_HEADLINE4, // --> H4
2916  RES_POOLCOLL_HEADLINE5, // --> H5
2917  RES_POOLCOLL_HEADLINE6, // --> H6
2920  0
2921  };
2922 
2923  sal_uInt16* pPoolIds = aPoolIds;
2924  OUString s;
2925  while( *pPoolIds )
2926  {
2927  if( !bIsSearchUsed || rDoc.getIDocumentStylePoolAccess().IsPoolTextCollUsed( *pPoolIds ) )
2928  {
2929  s = SwStyleNameMapper::GetUIName( *pPoolIds, s );
2930  aLst.Append( cPARA, s);
2931  }
2932  ++pPoolIds;
2933  }
2934  }
2935  }
2936  }
2937 
2938  if( nSearchFamily == SfxStyleFamily::Frame ||
2939  nSearchFamily == SfxStyleFamily::All )
2940  {
2941  const size_t nArrLen = rDoc.GetFrameFormats()->size();
2942  for( size_t i = 0; i < nArrLen; i++ )
2943  {
2944  const SwFrameFormat* pFormat = (*rDoc.GetFrameFormats())[ i ];
2945 
2946  bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(*pFormat));
2947  if( ( !bSearchHidden && pFormat->IsHidden( ) && !bUsed ) || pFormat->IsDefault() || pFormat->IsAuto() )
2948  continue;
2949 
2950  if ( nSrchMask == SfxStyleSearchBits::Hidden && !pFormat->IsHidden( ) )
2951  continue;
2952 
2953  const sal_uInt16 nId = pFormat->GetPoolFormatId();
2954  if( !bUsed )
2955  {
2956  if( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2957  ? !(nId & USER_FMT)
2958  // searched for used and found none
2959  : bIsSearchUsed )
2960  {
2961  continue;
2962  }
2963  }
2964 
2965  aLst.Append( cFRAME, pFormat->GetName() );
2966  }
2967 
2968  // PoolFormat
2969  if ( bAll )
2971  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::FrmFmt, cFRAME);
2972  }
2973 
2974  if( nSearchFamily == SfxStyleFamily::Page ||
2975  nSearchFamily == SfxStyleFamily::All )
2976  {
2977  const size_t nCount = rDoc.GetPageDescCnt();
2978  for(size_t i = 0; i < nCount; ++i)
2979  {
2980  const SwPageDesc& rDesc = rDoc.GetPageDesc(i);
2981  const sal_uInt16 nId = rDesc.GetPoolFormatId();
2982  bool bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rDesc));
2983  if( !bUsed )
2984  {
2985  if ( ( !bSearchHidden && rDesc.IsHidden() ) ||
2986  ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
2987  ? !(nId & USER_FMT)
2988  // searched for used and found none
2989  : bIsSearchUsed ) )
2990  continue;
2991  }
2992 
2993  if ( nSrchMask == SfxStyleSearchBits::Hidden && !rDesc.IsHidden( ) )
2994  continue;
2995 
2996  aLst.Append( cPAGE, rDesc.GetName() );
2997  }
2998  if ( bAll )
3000  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::PageDesc, cPAGE);
3001  }
3002 
3003  if( nSearchFamily == SfxStyleFamily::Pseudo ||
3004  nSearchFamily == SfxStyleFamily::All )
3005  {
3006  const SwNumRuleTable& rNumTable = rDoc.GetNumRuleTable();
3007  for(size_t i = 0; i < rNumTable.size(); ++i)
3008  {
3009  const SwNumRule& rRule = *rNumTable[ i ];
3010  if( !rRule.IsAutoRule() )
3011  {
3012  if ( nSrchMask == SfxStyleSearchBits::Hidden && !rRule.IsHidden( ) )
3013  continue;
3014 
3015  bool bUsed = bIsSearchUsed && ( bOrganizer || SwDoc::IsUsed(rRule) );
3016  if( !bUsed )
3017  {
3018  if( ( !bSearchHidden && rRule.IsHidden() ) ||
3019  ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
3020  ? !(rRule.GetPoolFormatId() & USER_FMT)
3021  // searched for used and found none
3022  : bIsSearchUsed ) )
3023  continue;
3024  }
3025 
3026  aLst.Append( cNUMRULE, rRule.GetName() );
3027  }
3028  }
3029  if ( bAll )
3031  bIsSearchUsed, bSearchHidden, bOnlyHidden, SwGetPoolIdFromName::NumRule, cNUMRULE);
3032  }
3033 
3034  if( nSearchFamily == SfxStyleFamily::Table ||
3035  nSearchFamily == SfxStyleFamily::All )
3036  {
3037  const SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
3038  for(size_t i = 0; i < rTableStyles.size(); ++i)
3039  {
3040  const SwTableAutoFormat& rTableStyle = rTableStyles[i];
3041 
3042  bool bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(rTableStyle));
3043  if(!bUsed)
3044  {
3045  if(nSrchMask == SfxStyleSearchBits::Hidden && !rTableStyle.IsHidden())
3046  continue;
3047 
3048  if( (!bSearchHidden && rTableStyle.IsHidden() ) ||
3049  ( (nSrchMask & ~SfxStyleSearchBits::Used) == SfxStyleSearchBits::UserDefined
3050  ? !rTableStyle.IsUserDefined()
3051  // searched for used and found none
3052  : bIsSearchUsed ) )
3053  continue;
3054  }
3055 
3056  aLst.Append( cTABSTYLE, rTableStyle.GetName() );
3057  }
3058  }
3059 
3060  if( nSearchFamily == SfxStyleFamily::Cell ||
3061  nSearchFamily == SfxStyleFamily::All )
3062  {
3063  const auto& aTableTemplateMap = SwTableAutoFormat::GetTableTemplateMap();
3064  if (rDoc.HasTableStyles())
3065  {
3066  const SwTableAutoFormatTable& rTableStyles = rDoc.GetTableStyles();
3067  for(size_t i = 0; i < rTableStyles.size(); ++i)
3068  {
3069  const SwTableAutoFormat& rTableStyle = rTableStyles[i];
3070  for(size_t nBoxFormat = 0; nBoxFormat < aTableTemplateMap.size(); ++nBoxFormat)
3071  {
3072  const sal_uInt32 nBoxIndex = aTableTemplateMap[nBoxFormat];
3073  const SwBoxAutoFormat& rBoxFormat = rTableStyle.GetBoxFormat(nBoxIndex);
3074  OUString sBoxFormatName;
3076  sBoxFormatName += rTableStyle.GetTableTemplateCellSubName(rBoxFormat);
3077  aLst.Append( cCELLSTYLE, sBoxFormatName );
3078  }
3079  }
3080  }
3081  const SwCellStyleTable& rCellStyles = rDoc.GetCellStyles();
3082  for(size_t i = 0; i < rCellStyles.size(); ++i)
3083  aLst.Append( cCELLSTYLE, rCellStyles[i].GetName() );
3084  }
3085 
3086  if(!aLst.empty())
3087  {
3089  return Next();
3090  }
3091  return nullptr;
3092 }
3093 
3095 {
3096  assert(bFirstCalled);
3097  ++nLastPos;
3098  if(nLastPos < aLst.size())
3099  {
3100  mxIterSheet->PresetNameAndFamily(aLst[nLastPos]);
3101  mxIterSheet->SetPhysical( false );
3102  mxIterSheet->SetMask( nMask );
3103  if(mxIterSheet->pSet)
3104  {
3105  mxIterSheet->pSet->ClearItem();
3106  mxIterSheet->pSet= nullptr;
3107  }
3108  return mxIterSheet.get();
3109  }
3110  return nullptr;
3111 }
3112 
3114 {
3115  // searching
3116  if( !bFirstCalled )
3117  First();
3118 
3119  nLastPos = aLst.FindName( nSearchFamily, rName );
3120  if( SAL_MAX_UINT32 != nLastPos )
3121  {
3122  // found
3123  mxStyleSheet->PresetNameAndFamily(aLst[nLastPos]);
3124  // new name is set, so determine its Data
3125  mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
3126  if( !mxStyleSheet->IsPhysical() )
3127  mxStyleSheet->SetPhysical( false );
3128 
3129  return mxStyleSheet.get();
3130  }
3131  return nullptr;
3132 }
3133 
3134 void SwStyleSheetIterator::AppendStyleList(const std::vector<OUString>& rList,
3135  bool bTestUsed, bool bTestHidden, bool bOnlyHidden,
3136  SwGetPoolIdFromName nSection, char cType )
3137 {
3138  SwDoc& rDoc = static_cast<SwDocStyleSheetPool*>(pBasePool)->GetDoc();
3139  bool bUsed = false;
3140  for (const auto & i : rList)
3141  {
3142  bool bHidden = false;
3143  sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(i, nSection);
3144  switch ( nSection )
3145  {
3147  {
3148  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolTextCollUsed( nId );
3149  SwFormat* pFormat = rDoc.FindTextFormatCollByName( i );
3150  bHidden = pFormat && pFormat->IsHidden( );
3151  }
3152  break;
3154  {
3155  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolFormatUsed( nId );
3156  SwFormat* pFormat = rDoc.FindCharFormatByName( i );
3157  bHidden = pFormat && pFormat->IsHidden( );
3158  }
3159  break;
3161  {
3162  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolFormatUsed( nId );
3163  SwFormat* pFormat = rDoc.FindFrameFormatByName( i );
3164  bHidden = pFormat && pFormat->IsHidden( );
3165  }
3166  break;
3168  {
3169  bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolPageDescUsed( nId );
3170  SwPageDesc* pPgDesc = rDoc.FindPageDesc(i);
3171  bHidden = pPgDesc && pPgDesc->IsHidden( );
3172  }
3173  break;
3175  {
3176  SwNumRule* pRule = rDoc.FindNumRulePtr( i );
3177  bUsed = pRule && SwDoc::IsUsed( *pRule );
3178  bHidden = pRule && pRule->IsHidden( );
3179  }
3180  break;
3181  default:
3182  OSL_ENSURE( false, "unknown PoolFormat-Id" );
3183  }
3184 
3185  bool bMatchHidden = ( bTestHidden && ( bHidden || !bOnlyHidden ) ) || ( !bTestHidden && ( !bHidden || bUsed ) );
3186  if ( ( !bTestUsed && bMatchHidden ) || ( bTestUsed && bUsed ) )
3187  aLst.Append( cType, i );
3188  }
3189 }
3190 
3192 {
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:869
virtual OUString GetDescription(MapUnit eUnit) override
Definition: docstyle.cxx:820
#define RES_CHRATR_WEIGHT
Definition: hintids.hxx:177
virtual bool IsUsed() const override
Definition: docstyle.cxx:2228
#define XATTR_FILLHATCH
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:1313
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:274
static const std::vector< OUString > & GetListsUINameArray()
#define RES_CHRATR_CJK_LANGUAGE
Definition: hintids.hxx:186
#define RES_CONDTXTFMTCOLL
Definition: hintids.hxx:373
static SwTextFormatColl * lcl_FindParaFormat(SwDoc &rDoc, const OUString &rName, SwDocStyleSheet *pStyle=nullptr, bool bCreate=true)
Definition: docstyle.cxx:168
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)
SfxStyleSheetBase * First()
#define RES_CHRATR_FONTSIZE
Definition: hintids.hxx:170
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
#define RES_CHRATR_LANGUAGE
Definition: hintids.hxx:172
SAL_DLLPRIVATE bool FillStyleSheet(FillStyleType eFType, std::unique_ptr< SfxItemSet > *o_ppFlatSet=nullptr)
Definition: docstyle.cxx:1853
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: docfmt.cxx:2078
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:835
SwDocShell * GetDocShell()
Definition: doc.hxx:1346
bool IsHidden() const
Definition: numrule.hxx:158
static bool lcl_Contains(const std::vector< void * > &rArr, const void *p)
Definition: docstyle.cxx:1770
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:845
#define RES_CHRATR_CJK_POSTURE
Definition: hintids.hxx:187
void SetMinDist(bool bNew)
#define cCHAR
Definition: docstyle.cxx:70
sal_uInt16 char char * pDesc
static const std::vector< OUString > & GetHTMLUINameArray()
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
Definition: doc.hxx:796
virtual void SetModified()=0
Must be called manually at changes of format.
sal_uIntPtr sal_uLong
void SetTable(bool bNew)
SwFrameFormat * MakeFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom, bool bBroadcast=false, bool bAuto=true)
Definition: docfmt.cxx:801
virtual bool HasParentSupport() const override
Definition: docstyle.cxx:791
OUString MakeParagraphStyleListString() const
Definition: number.cxx:798
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat IDs.
Definition: numrule.hxx:248
bool IsAutoRule() const
Definition: numrule.hxx:227
#define RES_FRMATR_END
Definition: hintids.hxx:331
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:1035
#define XATTR_FILLGRADIENT
Definition: doc.hxx:185
void GetGrabBagItem(css::uno::Any &rVal) const
Definition: docstyle.cxx:552
virtual bool SetFollow(const OUString &rStr) override
Definition: docstyle.cxx:1205
SwPoolFormatList aLst
Definition: docstyle.hxx:166
virtual bool SetName(const OUString &rNewName, bool bReindexNow=true)
#define FN_COND_COLL
Definition: cmdid.h:783
sal_Int16 nId
#define XATTR_FILLFLOATTRANSPARENCE
#define RES_CHRATR_CJK_WEIGHT
Definition: hintids.hxx:188
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
#define RES_CHRATR_FONT
Definition: hintids.hxx:169
virtual bool HasFollowSupport() const override
Definition: docstyle.cxx:775
virtual const OUString & GetFollow() const override
Definition: docstyle.cxx:764
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:579
void RenameFormat(SwFormat &rFormat, const OUString &sNewName, bool bBroadcast=false)
Definition: docfmt.cxx:1878
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:2492
bool IsCJKFontEnabled() const
void SetHidden(bool bValue)
Definition: numrule.hxx:159
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:143
#define RES_CHRATR_CJK_FONT
Definition: hintids.hxx:184
static void lcl_SaveStyles(SfxStyleFamily nFamily, std::vector< void * > &rArr, SwDoc &rDoc)
Definition: docstyle.cxx:1716
static SwCharFormat * lcl_FindCharFormat(SwDoc &rDoc, const OUString &rName, SwDocStyleSheet *pStyle=nullptr, bool bCreate=true)
Definition: docstyle.cxx:126
#define RES_CHRATR_CJK_FONTSIZE
Definition: hintids.hxx:185
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:1245
bool HasWriterListeners() const
Definition: calbck.hxx:208
#define MIN_BORDER_DIST
Definition: swtypes.hxx:74
virtual std::unique_ptr< SfxStyleSheetIterator > CreateIterator(SfxStyleFamily, SfxStyleSearchBits nMask) override
Definition: docstyle.cxx:2437
SfxStyleSearchBits GetMask() const
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:1257
void SetFollow(const SwPageDesc *pNew)
Definition: pagedesc.hxx:293
#define XATTR_FILLCOLOR
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:656
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:437
SfxStyleSearchBits nMask
SfxStyleSheetBase * GetStyleSheet() const
sal_uInt16 sal_Unicode
void SetGrabBagItem(const css::uno::Any &rVal)
Definition: number.cxx:1043
#define RES_CHRATR_END
Definition: hintids.hxx:208
const SfxPoolItem * NextItem()
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:109
void SetMask(SfxStyleSearchBits mask)
const SwCharFormat * GetDfltCharFormat() const
Definition: doc.hxx:747
const OUString & GetName() const
#define XATTR_FILL_LAST
virtual ~SwDocStyleSheetPool() override
Definition: docstyle.cxx:2405
#define RES_CHRATR_CTL_FONTSIZE
Definition: hintids.hxx:190
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
#define XATTR_FILL_FIRST
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:3094
int nCount
void SetPoolHlpFileId(sal_uInt8 nId)
Definition: format.hxx:150
virtual void SetName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2454
SwFrameFormat * GetFrameFormat()
Definition: docstyle.cxx:2221
#define FN_PARAM_FTN_INFO
Definition: cmdid.h:755
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:369
virtual const OUString & GetParent() const override
Definition: docstyle.cxx:710
SfxStyleSearchBits nMask
#define RES_PARATR_NUMRULE
Definition: hintids.hxx:264
const SwPageDesc * GetPageDesc()
Definition: docstyle.cxx:2161
#define RES_PARATR_BEGIN
Definition: hintids.hxx:254
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:1106
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:1775
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).
Definition: docary.hxx:201
SvxNumRule MakeSvxNumRule() const
Definition: number.cxx:851
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
Definition: docdesc.cxx:822
SwFrameFormat * FindFrameFormatByName(const OUString &rName) const
Definition: doc.hxx:761
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:940
static SwTableAutoFormat * lcl_FindTableStyle(SwDoc &rDoc, const OUString &rName, SwDocStyleSheet *pStyle=nullptr, bool bCreate=true)
Definition: docstyle.cxx:305
Table of Contents - heading.
Definition: poolfmt.hxx:342
virtual SfxStyleSheetBase * Find(const OUString &rStr) override
Definition: docstyle.cxx:3113
#define cCELLSTYLE
Definition: docstyle.cxx:76
SwNumRule * FindNumRulePtr(const OUString &rName) const
Definition: docnum.cxx:2414
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
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define RES_CHRATR_CTL_FONT
Definition: hintids.hxx:189
static const SwBoxAutoFormat * lcl_FindCellStyle(SwDoc &rDoc, const OUString &rName, SwDocStyleSheet *pStyle)
Definition: docstyle.cxx:332
Internet visited.
Definition: poolfmt.hxx:122
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:206
SfxStyleSheetIterator & GetIterator_Impl()
size_t SetDocPattern(const OUString &rPatternName)
Definition: poolfmt.cxx:125
const SwBoxAutoFormat & GetBoxFormat(sal_uInt8 nPos) const
Definition: tblafmt.cxx:457
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:878
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:317
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:274
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:503
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:3134
SfxStyleSheetBasePool * m_pPool
int i
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:639
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
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
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:877
XGradientListRef GetGradientList() const
Internet normal.
Definition: poolfmt.hxx:121
size_t size() const
Definition: docary.hxx:91
void MergeIndentAttrsOfListStyle(SfxItemSet &rSet)
new method for paragraph styles to merge indent attributes of applied list style into the given item ...
Definition: docstyle.cxx:1404
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:29
#define RES_CHRATR_BEGIN
Definition: hintids.hxx:162
virtual bool SetParent(const OUString &rStr) override
Definition: docstyle.cxx:1154
const SwNumRule * pNumRule
Definition: docstyle.hxx:54
virtual std::unique_ptr< SfxItemSet > GetItemSetForPreview() override
Definition: docstyle.cxx:1277
#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:853
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:1436
SwDocStyleSheet(SwDoc &rDoc, SwDocStyleSheetPool &rPool)
Definition: docstyle.cxx:451
void DeleteAssignmentToListLevelOfOutlineStyle()
Definition: fmtcol.cxx:621
bool IsHidden() const
Definition: pagedesc.hxx:207
void SetHidden(bool const bValue)
Definition: pagedesc.hxx:208
#define RES_UNKNOWNATR_BEGIN
Definition: hintids.hxx:361
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
OUString SwResId(const char *pId)
Definition: swmodule.cxx:178
sal_uInt16 GetWhichByPos(sal_uInt16 nPos) const
#define XATTR_FILLSTYLE
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:4573
const SwNumRuleItem & GetNumRule(bool=true) const
Definition: paratr.hxx:218
void RemoveName(SfxStyleFamily eFam, const OUString &rName)
Definition: docstyle.cxx:424
void SetHidden(bool bHidden)
Set if style is hidden.
Definition: tblafmt.hxx:238
void ResetAttrAtFormat(const sal_uInt16 nWhichId, SwFormat &rChangedFormat)
Definition: docfmt.cxx:479
void push_back(Value const &rVal)
Definition: docary.hxx:105
SwFrameFormat * pFrameFormat
Definition: docstyle.hxx:52
void SetGrabBagItem(const css::uno::Any &rVal)
Definition: format.cxx:774
void ClearInvalidItems()
#define RES_LR_SPACE
Definition: hintids.hxx:291
const SwPageDesc * GetFollow() const
Definition: pagedesc.hxx:246
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:741
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
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:3862
void CallChgLnk()
Definition: crsrsh.cxx:2500
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:77
const sal_uInt16 USER_FMT
POLLCOLL-groups:
Definition: poolfmt.hxx:63
SwCharFormat * FindCharFormatByName(const OUString &rName) const
Definition: doc.hxx:768
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:240
sal_uInt32 nLastPos
Definition: docstyle.hxx:167
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
static const std::vector< OUString > & GetHTMLChrFormatUINameArray()
void CopyPageDesc(const SwPageDesc &rSrcDesc, SwPageDesc &rDstDesc, bool bCopyPoolIds=true)
Copy the complete PageDesc - beyond document and "deep"! Optionally copying of PoolFormatId, -HlpId can be prevented.
Definition: docfmt.cxx:1399
void Broadcast(const SfxHint &rHint)
static const std::vector< OUString > & GetChrFormatUINameArray()
static const std::vector< OUString > & GetExtraUINameArray()
XHatchListRef GetHatchList() const
SwTextFormatColl * GetCollection()
Definition: docstyle.cxx:2154
void SetTextFirstLineOfst(const short nF, const sal_uInt16 nProp=100)
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:734
bool IsHidden() const
Check if style is hidden.
Definition: tblafmt.hxx:226
bool AreListLevelIndentsApplicable() const
Definition: fmtcol.cxx:409
SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
Definition: number.cxx:1391
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:663
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:775
#define RES_CHRATR_CTL_LANGUAGE
Definition: hintids.hxx:191
unsigned char sal_uInt8
#define RES_CHRATR_POSTURE
Definition: hintids.hxx:173
void PageDescToItemSet(const SwPageDesc &rPageDesc, SfxItemSet &rSet)
Definition: uitool.cxx:417
#define RES_CHRATR_CTL_WEIGHT
Definition: hintids.hxx:193
#define RES_CHRATR_CTL_POSTURE
Definition: hintids.hxx:192
virtual ~SwDocStyleSheet() override
SwConditionTextFormatColl * MakeCondTextFormatColl(const OUString &rFormatName, SwTextFormatColl *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:903
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:1061
#define cTABSTYLE
Definition: docstyle.cxx:75
void GetGrabBagItem(css::uno::Any &rVal) const
Definition: format.cxx:766
bool IsUsed(const SwModify &) const
Definition: poolfmt.cxx:84
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.
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:839
static const OUString & GetUIName(const OUString &rName, SwGetPoolIdFromName)
#define cFRAME
Definition: docstyle.cxx:72
virtual bool HasClearParentSupport() const override
Definition: docstyle.cxx:805
void * p
bool SetName(const OUString &rNewName)
Definition: pagedesc.cxx:129
sal_uInt16 MakeNumRule(const OUString &rName, const SwNumRule *pCpy=nullptr, bool bBroadcast=false, const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode=SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
Definition: docnum.cxx:2448
SwGetPoolIdFromName
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:74
void ChgFormat(SwFormat &rFormat, const SfxItemSet &rSet)
Definition: docfmt.cxx:1846
XBitmapListRef GetBitmapList() const
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
Definition: docfmt.cxx:683
void SetValid(SvxBoxInfoItemValidFlags nValid, bool bValid=true)
#define XATTR_FILLBITMAP
void CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet &rSet)
Definition: docfly.cxx:483
MapUnit
#define SAL_WARN(area, stream)
bool HasTableStyles() const
Counts table styles without triggering lazy-load of them.
Definition: doc.hxx:1237
size_t size() const
Definition: docary.hxx:225
#define cPAGE
Definition: docstyle.cxx:73
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
#define RES_UNKNOWNATR_END
Definition: hintids.hxx:363
XColorListRef GetColorList() const
bool DelNumRule(const OUString &rName, bool bBroadCast=false)
Definition: docnum.cxx:1044
virtual bool SetName(const OUString &rNewName, bool bReindexNow=true) override
Definition: docstyle.cxx:1029
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:116
#define cPARA
Definition: docstyle.cxx:71
SwTextFormatColl * pColl
Definition: docstyle.hxx:51
const SwFrameFormats * GetFrameFormats() const
Definition: doc.hxx:732
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
#define RES_PAGEDESC
Definition: hintids.hxx:293
#define RES_BREAK
Definition: hintids.hxx:294
void StartAllAction()
For all views of this document.
Definition: edws.cxx:85
bool SearchUsed() const
IDocumentListsAccess const & getIDocumentListsAccess() const
Definition: doc.cxx:292
virtual SfxStyleSheetBase * operator[](sal_uInt16 nIdx) override
Definition: docstyle.cxx:2668
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
SfxStyleSheetBasePool * pBasePool
void RegisterToFormat(SwFormat &)
Definition: fmtcol.cxx:498
SfxStyleSearchBits
SwTableAutoFormat * MakeTableStyle(const OUString &rName, bool bBroadcast=false)
Definition: ndtbl.cxx:4553
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:1084
SfxItemSet aCoreSet
Definition: docstyle.hxx:58
#define XATTR_FILLTRANSPARENCE
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