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