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