LibreOffice Module svl (master) 1
style.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 <svl/style.hxx>
22
23#include <com/sun/star/lang/XComponent.hpp>
24
25#include <sal/log.hxx>
26#include <osl/diagnose.h>
28#include <svl/hint.hxx>
29#include <svl/poolitem.hxx>
30#include <svl/itemset.hxx>
31#include <svl/itempool.hxx>
33#include <svl/itemiter.hxx>
36#include <rtl/ustrbuf.hxx>
37#include <utility>
38
39#ifdef DBG_UTIL
40namespace {
41
42class DbgStyleSheetReferences
43{
44public:
45 DbgStyleSheetReferences() : mnStyles(0), mnPools(0) {}
46 ~DbgStyleSheetReferences()
47 {
49 mnStyles != 0 || mnPools != 0, "svl.items",
50 "SfxStyleSheetBase left " << mnStyles
51 << "; SfxStyleSheetBasePool left " << mnPools);
52 }
53
54 sal_uInt32 mnStyles;
55 sal_uInt32 mnPools;
56};
57
58}
59
60static DbgStyleSheetReferences aDbgStyleSheetReferences;
61#endif
62
63
64SfxStyleSheetModifiedHint::SfxStyleSheetModifiedHint
65(
66 OUString aOldName,
67 SfxStyleSheetBase& rStyleSheet // Remains with the caller
68)
70 aName(std::move( aOldName ))
71{}
72
73
75(
76 SfxHintId nAction,
77 SfxStyleSheetBase& rStyleSheet // Remains with the caller
78)
79: SfxHint(nAction), pStyleSh( &rStyleSheet )
80{}
81
82
84{
85private:
88public:
89 std::shared_ptr<SfxStyleSheetIterator> pIter;
90
97 std::shared_ptr<svl::IndexedStyleSheets> mxIndexedStyleSheets;
98
100 mxIndexedStyleSheets(std::make_shared<svl::IndexedStyleSheets>()) {}
101};
102
103
105 : m_pPool( p )
106 , nFamily( eFam )
107 , aName( rName )
108 , aFollow( rName )
109 , pSet( nullptr )
110 , nMask(mask)
111 , nHelpId( 0 )
112 , bMySet( false )
113 , bHidden( false )
114{
115#ifdef DBG_UTIL
116 aDbgStyleSheetReferences.mnStyles++;
117#endif
118}
119
121 : WeakImplHelper()
122 , m_pPool( r.m_pPool )
123 , nFamily( r.nFamily )
124 , aName( r.aName )
125 , aParent( r.aParent )
126 , aFollow( r.aFollow )
127 , aHelpFile( r.aHelpFile )
128 , nMask( r.nMask )
129 , nHelpId( r.nHelpId )
130 , bMySet( r.bMySet )
131 , bHidden( r.bHidden )
132{
133#ifdef DBG_UTIL
134 aDbgStyleSheetReferences.mnStyles++;
135#endif
136 if( r.pSet )
137 pSet = bMySet ? new SfxItemSet( *r.pSet ) : r.pSet;
138 else
139 pSet = nullptr;
140}
141
143{
144#ifdef DBG_UTIL
145 --aDbgStyleSheetReferences.mnStyles;
146#endif
147
148 if( bMySet )
149 {
150 delete pSet;
151 pSet = nullptr;
152 }
153}
154
155// Change name
156const OUString& SfxStyleSheetBase::GetName() const
157{
158 return aName;
159}
160
161bool SfxStyleSheetBase::SetName(const OUString& rName, bool bReIndexNow)
162{
163 if(rName.isEmpty())
164 return false;
165
166 if( aName != rName )
167 {
168 OUString aOldName = aName;
169 SfxStyleSheetBase *pOther = m_pPool->Find( rName, nFamily ) ;
170 if ( pOther && pOther != this )
171 return false;
172
173 if ( !aName.isEmpty() )
174 m_pPool->ChangeParent(aName, rName, nFamily, false);
175
176 if ( aFollow == aName )
177 aFollow = rName;
178 aName = rName;
179 if (bReIndexNow)
180 m_pPool->Reindex();
181
182 m_pPool->Broadcast( SfxStyleSheetModifiedHint( aOldName, *this ) );
183 }
184 return true;
185}
186
187// Change Parent
188const OUString& SfxStyleSheetBase::GetParent() const
189{
190 return aParent;
191}
192
193bool SfxStyleSheetBase::SetParent( const OUString& rName )
194{
195 if ( rName == aName )
196 return false;
197
198 if( aParent != rName )
199 {
200 SfxStyleSheetBase* pIter = m_pPool->Find(rName, nFamily);
201 if( !rName.isEmpty() && !pIter )
202 {
203 OSL_FAIL( "StyleSheet-Parent not found" );
204 return false;
205 }
206 // prevent recursive linkages
207 if( !aName.isEmpty() )
208 {
209 while(pIter)
210 {
211 if(pIter->GetName() == aName)
212 return false;
213 pIter = m_pPool->Find(pIter->GetParent(), nFamily);
214 }
215 }
216 aParent = rName;
217 }
219 return true;
220}
221
223{
224 bHidden = hidden;
226}
227
231const OUString& SfxStyleSheetBase::GetFollow() const
232{
233 return aFollow;
234}
235
236bool SfxStyleSheetBase::SetFollow( const OUString& rName )
237{
238 if( aFollow != rName )
240 if( !m_pPool->Find( rName, nFamily ) )
241 {
242 SAL_WARN( "svl.items", "StyleSheet-Follow not found" );
243 return false;
244 }
245 aFollow = rName;
246 }
248 return true;
249}
250
256{
257 if( !pSet )
258 {
259 pSet = new SfxItemSet( m_pPool->GetPool() );
260 bMySet = true;
261 }
262 return *pSet;
263}
264
266{
267 return GetItemSet();
268}
269
274{
275 rFile = aHelpFile;
276 return nHelpId;
277}
278
279void SfxStyleSheetBase::SetHelpId( const OUString& rFile, sal_uLong nId )
280{
281 aHelpFile = rFile;
282 nHelpId = nId;
283}
284
290{
291 return true;
292}
293
299{
300 return true;
301}
302
308{
309 return false;
310}
311
316{
317 return true;
318}
319
324{
325 SfxItemIter aIter( GetItemSet() );
326 OUStringBuffer aDesc;
327
328 IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
329 for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
330 {
331 OUString aItemPresentation;
332
333 if ( !IsInvalidItem( pItem ) &&
335 *pItem, eMetric, aItemPresentation, aIntlWrapper ) )
336 {
337 if ( !aDesc.isEmpty() && !aItemPresentation.isEmpty() )
338 aDesc.append(" + ");
339 if ( !aItemPresentation.isEmpty() )
340 aDesc.append(aItemPresentation);
341 }
342 }
343 return aDesc.makeStringAndClear();
344}
345
347{
348 return nSearchFamily;
349}
350
352{
355}
356
357namespace {
358
359struct DoesStyleMatchStyleSheetPredicate final : public svl::StyleSheetPredicate
360{
361 explicit DoesStyleMatchStyleSheetPredicate(SfxStyleSheetIterator *it)
362 : mIterator(it) {}
363
364 bool
365 Check(const SfxStyleSheetBase& styleSheet) override
366 {
367 bool bMatchFamily = ((mIterator->GetSearchFamily() == SfxStyleFamily::All) ||
368 ( styleSheet.GetFamily() == mIterator->GetSearchFamily() ));
369
370 bool bUsed = mIterator->SearchUsed() && styleSheet.IsUsed( );
371
372 bool bSearchHidden( mIterator->GetSearchMask() & SfxStyleSearchBits::Hidden );
373 bool bMatchVisibility = bSearchHidden || !styleSheet.IsHidden() || bUsed;
374 bool bOnlyHidden = mIterator->GetSearchMask( ) == SfxStyleSearchBits::Hidden && styleSheet.IsHidden( );
375
376 bool bMatches = bMatchFamily && bMatchVisibility
377 && (( styleSheet.GetMask() & ( mIterator->GetSearchMask() & ~SfxStyleSearchBits::Used )) ||
378 bUsed || bOnlyHidden ||
379 ( mIterator->GetSearchMask() & SfxStyleSearchBits::AllVisible ) == SfxStyleSearchBits::AllVisible );
380 return bMatches;
381 }
382
383 SfxStyleSheetIterator *mIterator;
384};
385
386}
387
390 : pBasePool(pBase)
391 , pCurrentStyle(nullptr)
392 , mnCurrentPosition(0)
393{
394 nSearchFamily=eFam;
395 bSearchUsed=false;
398 {
399 bSearchUsed = true;
400 n &= ~SfxStyleSearchBits::Used;
401 }
402 nMask=n;
403}
404
406{
407}
408
410{
411 sal_Int32 n = 0;
412 if( IsTrivialSearch())
413 {
414 n = static_cast<sal_uInt16>(pBasePool->pImpl->mxIndexedStyleSheets->GetNumberOfStyleSheets());
415 }
417 {
418 n = static_cast<sal_uInt16>(pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetPositionsByFamily(nSearchFamily).size());
419 }
420 else
421 {
422 DoesStyleMatchStyleSheetPredicate predicate(this);
423 n = pBasePool->pImpl->mxIndexedStyleSheets->GetNumberOfStyleSheetsWithPredicate(predicate);
424 }
425 return n;
426}
427
429{
430 SfxStyleSheetBase* retval = nullptr;
431 if( IsTrivialSearch())
432 {
433 retval = pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetByPosition(nIdx);
434 mnCurrentPosition = nIdx;
435 }
437 {
439 pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetByPosition(
440 pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetPositionsByFamily(nSearchFamily).at(nIdx))
441 ;
442 retval = ref.get();
443 mnCurrentPosition = nIdx;
444 }
445 else
446 {
447 DoesStyleMatchStyleSheetPredicate predicate(this);
449 pBasePool->pImpl->mxIndexedStyleSheets->GetNthStyleSheetThatMatchesPredicate(nIdx, predicate);
450 if (ref)
451 {
452 mnCurrentPosition = pBasePool->pImpl->mxIndexedStyleSheets->FindStyleSheetPosition(*ref);
453 retval = ref.get();
454 }
455 }
456
457 if (retval == nullptr)
458 {
459 OSL_FAIL("Incorrect index");
460 }
461
462 return retval;
463}
464
466{
467 if (Count() != 0) {
468 return operator[](0);
469 }
470 else {
471 return nullptr;
472 }
473}
474
476{
477 SfxStyleSheetBase* retval = nullptr;
478
479 if ( IsTrivialSearch() )
480 {
481 sal_Int32 nStyleSheets = pBasePool->pImpl->mxIndexedStyleSheets->GetNumberOfStyleSheets();
482 sal_Int32 newPosition = mnCurrentPosition + 1;
483 if (nStyleSheets > newPosition)
484 {
485 mnCurrentPosition = newPosition;
486 retval = pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetByPosition(mnCurrentPosition);
487 }
488 }
490 {
491 sal_Int32 newPosition = mnCurrentPosition + 1;
492 const std::vector<sal_Int32>& familyVector
493 =
494 pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetPositionsByFamily(nSearchFamily);
495 if (static_cast<sal_Int32>(familyVector.size()) > newPosition)
496 {
497 mnCurrentPosition = newPosition;
498 sal_Int32 stylePosition = familyVector[newPosition];
499 retval = pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetByPosition(stylePosition);
500 }
501 }
502 else
503 {
504 DoesStyleMatchStyleSheetPredicate predicate(this);
506 pBasePool->pImpl->mxIndexedStyleSheets->GetNthStyleSheetThatMatchesPredicate(
507 0, predicate, mnCurrentPosition+1);
508 retval = ref.get();
509 if (retval != nullptr) {
510 mnCurrentPosition = pBasePool->pImpl->mxIndexedStyleSheets->FindStyleSheetPosition(*ref);
511 }
512 }
513 pCurrentStyle = retval;
514 return retval;
515}
516
518{
519 DoesStyleMatchStyleSheetPredicate predicate(this);
520
521 std::vector<sal_Int32> positions =
522 pBasePool->pImpl->mxIndexedStyleSheets->FindPositionsByNameAndPredicate(rStr, predicate,
524 if (positions.empty()) {
525 return nullptr;
526 }
527
528 sal_Int32 pos = positions.front();
529 SfxStyleSheetBase* pStyle = pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetByPosition(pos);
531 pCurrentStyle = pStyle;
532 return pCurrentStyle;
533}
534
536{
538
539 if ( bSearchUsed )
541 return mask;
542}
543
545{
546 return pImpl->pIter.get();
547}
548
550{
551 if (!pImpl->pIter || (pImpl->pIter->GetSearchMask() != eMask) || (pImpl->pIter->GetSearchFamily() != eFamily))
552 pImpl->pIter = CreateIterator(eFamily, eMask);
553 return *pImpl->pIter;
554}
555
558 rPool(r)
559{
560#ifdef DBG_UTIL
561 aDbgStyleSheetReferences.mnPools++;
562#endif
563}
564
566 SfxBroadcaster( r ),
567 WeakImplHelper(),
569 rPool(r.rPool)
570{
571#ifdef DBG_UTIL
572 aDbgStyleSheetReferences.mnPools++;
573#endif
574
575 *this += r;
576}
577
579{
580#ifdef DBG_UTIL
581 aDbgStyleSheetReferences.mnPools--;
582#endif
583
585 Clear();
586}
587
588std::unique_ptr<SfxStyleSheetIterator> SfxStyleSheetBasePool::CreateIterator
589(
590 SfxStyleFamily eFam,
592)
593{
594 return std::make_unique<SfxStyleSheetIterator>(this,eFam,mask);
595}
596
598(
599 const OUString& rName,
600 SfxStyleFamily eFam,
602)
603{
604 return new SfxStyleSheetBase( rName, this, eFam, mask );
605}
606
608{
609 return new SfxStyleSheetBase( r );
610}
611
613{
614 OSL_ENSURE( eFam != SfxStyleFamily::All, "svl::SfxStyleSheetBasePool::Make(), FamilyAll is not an allowed Family" );
615
616 SfxStyleSheetIterator aIter(this, eFam, mask);
617 rtl::Reference< SfxStyleSheetBase > xStyle( aIter.Find( rName ) );
618 OSL_ENSURE( !xStyle.is(), "svl::SfxStyleSheetBasePool::Make(), StyleSheet already exists" );
619
620 if( !xStyle.is() )
621 {
622 xStyle = Create( rName, eFam, mask );
623 StoreStyleSheet(xStyle);
625 }
626 return *xStyle;
627}
628
634{
636 SfxStyleSheetBase* pOld = aIter.Find( rSheet.GetName() );
637 if (pOld) {
638 Remove( pOld );
639 }
641 pImpl->mxIndexedStyleSheets->AddStyleSheet(xNew);
643}
644
646{
647 if( &r != this )
648 {
649 Clear();
650 *this += r;
651 }
652 return *this;
653}
654
655namespace {
656struct AddStyleSheetCallback : svl::StyleSheetCallback
657{
658 explicit AddStyleSheetCallback(SfxStyleSheetBasePool *pool)
659 : mPool(pool) {}
660
661 void DoIt(const SfxStyleSheetBase& ssheet) override
662 {
663 mPool->Add(ssheet);
664 }
665
667};
668}
669
671{
672 if( &r != this )
673 {
674 AddStyleSheetCallback callback(this);
675 pImpl->mxIndexedStyleSheets->ApplyToAllStyleSheets(callback);
676 }
677 return *this;
678}
679
681 SfxStyleFamily eFamily,
682 SfxStyleSearchBits eMask)
683{
684 SfxStyleSheetIterator aIter(this, eFamily, eMask);
685 return aIter.Find(rName);
686}
687
689{
690 return GetIterator_Impl(eFamily, eMask).First();
691}
692
694{
695 assert(pImpl->pIter && "Next called without a previous First");
696 return pImpl->pIter->Next();
697}
698
700{
701 if( !p )
702 return;
703
704 // Reference to keep p alive until after Broadcast call!
706 bool bWasRemoved = pImpl->mxIndexedStyleSheets->RemoveStyleSheet(xP);
707 if( !bWasRemoved )
708 return;
709
710 // Adapt all styles which have this style as parent
711 ChangeParent(p->GetName(), p->GetParent(), p->GetFamily());
712
713 // #120015# Do not dispose, the removed StyleSheet may still be used in
714 // existing SdrUndoAttrObj incarnations. Rely on refcounting for disposal,
715 // this works well under normal conditions (checked breaking and counting
716 // on SfxStyleSheetBase constructors and destructors)
717
718 // css::uno::Reference< css::lang::XComponent > xComp( getXWeak((*aIter).get()), css::uno::UNO_QUERY );
719 // if( xComp.is() ) try
720 // {
721 // xComp->dispose();
722 // }
723 // catch( css::uno::Exception& )
724 // {
725 // }
727}
728
730{
731#if OSL_DEBUG_LEVEL > 0
732 OSL_ENSURE( p, "svl::SfxStyleSheetBasePool::Insert(), no stylesheet?" );
733
734 SfxStyleSheetIterator aIter(this, p->GetFamily(), p->GetMask());
735 SfxStyleSheetBase* pOld = aIter.Find( p->GetName() );
736 OSL_ENSURE( !pOld, "svl::SfxStyleSheetBasePool::Insert(), StyleSheet already inserted" );
737 if( !p->GetParent().isEmpty() )
738 {
739 pOld = aIter.Find( p->GetParent() );
740 OSL_ENSURE( pOld, "svl::SfxStyleSheetBasePool::Insert(), Parent not found!" );
741 }
742#endif
745}
746
747namespace
748{
749
750struct StyleSheetDisposerFunctor final : public svl::StyleSheetDisposer
751{
752 explicit StyleSheetDisposerFunctor(SfxStyleSheetBasePool* pool)
753 : mPool(pool) {}
754
755 void
756 Dispose(rtl::Reference<SfxStyleSheetBase> styleSheet) override
757 {
758 cppu::OWeakObject* weakObject = styleSheet.get();
759 css::uno::Reference< css::lang::XComponent > xComp( weakObject, css::uno::UNO_QUERY );
760 if( xComp.is() ) try
761 {
762 xComp->dispose();
763 }
764 catch( css::uno::Exception& )
765 {
766 }
767 mPool->Broadcast(SfxStyleSheetHint(SfxHintId::StyleSheetErased, *styleSheet));
768 }
769
771};
772
773}
774
776{
777 StyleSheetDisposerFunctor cleanup(this);
778 pImpl->mxIndexedStyleSheets->Clear(cleanup);
779}
780
781void SfxStyleSheetBasePool::ChangeParent(std::u16string_view rOld,
782 const OUString& rNew,
783 SfxStyleFamily eFamily,
784 bool bVirtual)
785{
786 for( SfxStyleSheetBase* p = First(eFamily); p; p = Next() )
787 {
788 if( p->GetParent() == rOld )
789 {
790 if(bVirtual)
791 p->SetParent( rNew );
792 else
793 p->aParent = rNew;
794 }
795 }
796}
797
798SfxStyleSheet::SfxStyleSheet(const OUString &rName,
799 const SfxStyleSheetBasePool& r_Pool,
800 SfxStyleFamily eFam,
801 SfxStyleSearchBits mask )
802 : SfxStyleSheetBase(rName, const_cast< SfxStyleSheetBasePool* >( &r_Pool ), eFam, mask)
803{
804}
805
807 : SfxStyleSheetBase(rStyle)
808 , SfxListener( rStyle )
809 , SfxBroadcaster( rStyle )
810 , svl::StyleSheetUser()
811{
812}
813
815{
817}
818
819
820bool SfxStyleSheet::SetParent( const OUString& rName )
821{
822 if(aParent == rName)
823 return true;
824 const OUString aOldParent(aParent);
826 {
827 // Remove from notification chain of the old parent if applicable
828 if(!aOldParent.isEmpty())
829 {
830 SfxStyleSheet *pParent = static_cast<SfxStyleSheet *>(m_pPool->Find(aOldParent, nFamily));
831 if(pParent)
832 EndListening(*pParent);
833 }
834 // Add to the notification chain of the new parent
835 if(!aParent.isEmpty())
836 {
837 SfxStyleSheet *pParent = static_cast<SfxStyleSheet *>(m_pPool->Find(aParent, nFamily));
838 if(pParent)
839 StartListening(*pParent);
840 }
841 return true;
842 }
843 return false;
844}
845
850{
851 Forward(rBC, rHint);
852}
853
855{
856 return IsUsed();
857}
858
859
861: SfxStyleSheetBasePool( const_cast< SfxItemPool& >( rSet ) )
862{
863}
864
867{
868 return new SfxStyleSheet( rName, *this, eFam, mask );
869}
870
871SfxUnoStyleSheet::SfxUnoStyleSheet( const OUString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, SfxStyleSearchBits _nMask )
872: cppu::ImplInheritanceHelper<SfxStyleSheet, css::style::XStyle>(_rName, _rPool, _eFamily, _nMask)
873{
874}
875
876SfxUnoStyleSheet* SfxUnoStyleSheet::getUnoStyleSheet( const css::uno::Reference< css::style::XStyle >& xStyle )
877{
878 return dynamic_cast<SfxUnoStyleSheet*>(xStyle.get());
879}
880
881void
883{
884 pImpl->mxIndexedStyleSheets->AddStyleSheet(xStyle);
885}
886
887void
889{
890 pImpl->mxIndexedStyleSheets->Reindex();
891}
892
895{
896 return *pImpl->mxIndexedStyleSheets;
897}
898
901{
902 return pImpl->mxIndexedStyleSheets->GetStyleSheetByPosition(pos);
903}
904
905/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void Broadcast(const SfxHint &rHint)
void Forward(SfxBroadcaster &rBC, const SfxHint &rHint)
const SfxPoolItem * GetCurItem() const
get item, or null if no items
Definition: itemiter.hxx:38
const SfxPoolItem * NextItem()
Definition: itemiter.hxx:42
Base class for providers of defaults of SfxPoolItems.
Definition: itempool.hxx:51
virtual bool GetPresentation(const SfxPoolItem &rItem, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
Request string representation of pool items.
Definition: itempool.cxx:497
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
Registers a specific SfxBroadcaster.
Definition: lstner.cxx:79
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
Definition: lstner.cxx:105
std::shared_ptr< SfxStyleSheetIterator > pIter
Definition: style.cxx:89
SfxStyleSheetBasePool_Impl & operator=(const SfxStyleSheetBasePool_Impl &)=delete
std::shared_ptr< svl::IndexedStyleSheets > mxIndexedStyleSheets
This member holds the indexed style sheets.
Definition: style.cxx:97
SfxStyleSheetBasePool_Impl(const SfxStyleSheetBasePool_Impl &)=delete
SfxStyleSheetBase * First(SfxStyleFamily eFamily, SfxStyleSearchBits eMask=SfxStyleSearchBits::All)
Definition: style.cxx:688
friend class SfxStyleSheetBase
Definition: style.hxx:228
virtual std::unique_ptr< SfxStyleSheetIterator > CreateIterator(SfxStyleFamily, SfxStyleSearchBits nMask=SfxStyleSearchBits::All)
Definition: style.cxx:589
std::unique_ptr< SfxStyleSheetBasePool_Impl > pImpl
Definition: style.hxx:230
SfxItemPool & GetPool()
Definition: style.hxx:256
SfxStyleSheetIterator * GetCachedIterator()
Definition: style.cxx:544
SfxStyleSheetBase * GetStyleSheetByPositionInIndex(unsigned pos)
Definition: style.cxx:900
void Insert(SfxStyleSheetBase *)
Definition: style.cxx:729
SfxStyleSheetIterator & GetIterator_Impl(SfxStyleFamily eFamily, SfxStyleSearchBits eMask)
Definition: style.cxx:549
virtual void Remove(SfxStyleSheetBase *)
Definition: style.cxx:699
SfxStyleSheetBasePool(SfxItemPool &)
Definition: style.cxx:556
virtual ~SfxStyleSheetBasePool() override
Definition: style.cxx:578
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All)
Definition: style.cxx:612
void Add(const SfxStyleSheetBase &)
Add a style sheet.
Definition: style.cxx:633
void ChangeParent(std::u16string_view rOld, const OUString &rNew, SfxStyleFamily eFamily, bool bVirtual=true)
Definition: style.cxx:781
SfxStyleSheetBase * Next()
Definition: style.cxx:693
SfxStyleSheetBasePool & operator+=(const SfxStyleSheetBasePool &)
Definition: style.cxx:670
virtual rtl::Reference< SfxStyleSheetBase > Create(const OUString &, SfxStyleFamily, SfxStyleSearchBits)
Definition: style.cxx:598
void StoreStyleSheet(const rtl::Reference< SfxStyleSheetBase > &)
Definition: style.cxx:882
const svl::IndexedStyleSheets & GetIndexedStyleSheets() const
Obtain the indexed style sheets.
Definition: style.cxx:894
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
Definition: style.cxx:680
SfxStyleSheetBasePool & operator=(const SfxStyleSheetBasePool &)
Definition: style.cxx:645
OUString aHelpFile
Definition: style.hxx:124
SfxStyleSearchBits GetMask() const
Definition: style.hxx:164
virtual bool HasClearParentSupport() const
Setting base template to NULL possible? Default: No.
Definition: style.cxx:307
virtual bool SetName(const OUString &rNewName, bool bReindexNow=true)
Definition: style.cxx:161
OUString aFollow
Definition: style.hxx:123
virtual const OUString & GetParent() const
Definition: style.cxx:188
const OUString & GetName() const
Definition: style.cxx:156
virtual bool HasFollowSupport() const
Next style possible? Default: Yes.
Definition: style.cxx:289
SfxStyleSheetBase(const OUString &, SfxStyleSheetBasePool *, SfxStyleFamily eFam, SfxStyleSearchBits mask)
Definition: style.cxx:104
SfxStyleFamily GetFamily() const
Definition: style.hxx:163
virtual void SetHidden(bool bValue)
Definition: style.cxx:222
OUString aName
Definition: style.hxx:123
virtual sal_uLong GetHelpId(OUString &rFile)
Set help file and ID and return it.
Definition: style.cxx:273
virtual void SetHelpId(const OUString &r, sal_uLong nId)
Definition: style.cxx:279
virtual bool HasParentSupport() const
Base template possible? Default: Yes.
Definition: style.cxx:298
virtual const OUString & GetFollow() const
Change follow.
Definition: style.cxx:231
virtual bool IsHidden() const
Definition: style.hxx:169
virtual bool SetParent(const OUString &)
Definition: style.cxx:193
virtual SfxItemSet & GetItemSet()
Set Itemset The default implementation creates a new set.
Definition: style.cxx:255
SfxItemSet * pSet
Definition: style.hxx:125
virtual bool IsUsed() const
By default all stylesheets are set to used.
Definition: style.cxx:315
virtual bool SetFollow(const OUString &)
Definition: style.cxx:236
OUString aParent
Definition: style.hxx:123
SfxStyleSheetBasePool * m_pPool
Definition: style.hxx:120
sal_uLong nHelpId
Definition: style.hxx:128
virtual ~SfxStyleSheetBase() override
Definition: style.cxx:142
virtual OUString GetDescription(MapUnit eMetric)
Return set attributes.
Definition: style.cxx:323
SfxStyleFamily nFamily
Definition: style.hxx:121
virtual std::optional< SfxItemSet > GetItemSetForPreview()
Due to writer's usual lack of sanity this is a separate function for preview only; it shall not creat...
Definition: style.cxx:265
SfxStyleSheetHint(SfxHintId, SfxStyleSheetBase &)
Definition: style.cxx:75
virtual SfxStyleSheetBase * Find(const OUString &rStr)
Definition: style.cxx:517
SfxStyleFamily nSearchFamily
Definition: style.hxx:209
SVL_DLLPRIVATE bool IsTrivialSearch() const
Definition: style.cxx:351
virtual sal_Int32 Count()
Definition: style.cxx:409
virtual SfxStyleSheetBase * operator[](sal_Int32 nIdx)
Definition: style.cxx:428
SfxStyleFamily GetSearchFamily() const
Definition: style.cxx:346
virtual SfxStyleSheetBase * Next()
Definition: style.cxx:475
SfxStyleSearchBits GetSearchMask() const
Definition: style.cxx:535
const SfxStyleSheetBasePool * pBasePool
Definition: style.hxx:208
SfxStyleSheetIterator(const SfxStyleSheetBasePool *pBase, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
Constructor.
Definition: style.cxx:388
sal_Int32 mnCurrentPosition
Definition: style.hxx:217
virtual ~SfxStyleSheetIterator()
Definition: style.cxx:405
SfxStyleSheetBase * pCurrentStyle
Definition: style.hxx:216
virtual SfxStyleSheetBase * First()
Definition: style.cxx:465
SfxStyleSearchBits nMask
Definition: style.hxx:210
SfxStyleSheetPool(SfxItemPool const &)
Definition: style.cxx:860
virtual rtl::Reference< SfxStyleSheetBase > Create(const OUString &, SfxStyleFamily, SfxStyleSearchBits mask) override
Definition: style.cxx:865
virtual ~SfxStyleSheet() override
Definition: style.cxx:814
SfxStyleSheet(const OUString &, const SfxStyleSheetBasePool &, SfxStyleFamily, SfxStyleSearchBits)
Definition: style.cxx:798
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Notify all listeners.
Definition: style.cxx:849
virtual bool SetParent(const OUString &) override
Definition: style.cxx:820
virtual bool isUsedByModel() const override
Definition: style.cxx:854
static SfxUnoStyleSheet * getUnoStyleSheet(const css::uno::Reference< css::style::XStyle > &xStyle)
Definition: style.cxx:876
SfxUnoStyleSheet(const OUString &_rName, const SfxStyleSheetBasePool &_rPool, SfxStyleFamily _eFamily, SfxStyleSearchBits _nMask)
Definition: style.cxx:871
This class holds SfxStyleSheets and allows for access via an id and a name.
SfxHintId
hint ids, mostly used to avoid dynamic_cast of SfxHint
Definition: hint.hxx:28
@ StyleSheetErased
@ StyleSheetCreated
@ StyleSheetChanged
@ StyleSheetModified
@ StyleSheetInDestruction
OUString aName
void * p
sal_Int64 n
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
MapUnit
tDoubleVectorPair cleanup(const css::uno::Sequence< double > &rXValues, const css::uno::Sequence< double > &rYValues, Pred aPred)
std::shared_ptr< T > make_shared(Args &&... args)
sal_Int16 nId
bool IsInvalidItem(const SfxPoolItem *pItem)
Definition: poolitem.hxx:289
static SfxItemSet & rSet
sal_uIntPtr sal_uLong
Function object to apply a method on all style sheets.
virtual void DoIt(const SfxStyleSheetBase &styleSheet)=0
Function object for cleanup-Strategy for IndexedSfxStyleSheets::Clear().
virtual void Dispose(rtl::Reference< SfxStyleSheetBase > styleSheet)=0
Function object to check whether a style sheet a fulfills specific criteria.
virtual bool Check(const SfxStyleSheetBase &styleSheet)=0
static DbgStyleSheetReferences aDbgStyleSheetReferences
Definition: style.cxx:60
SfxStyleFamily
Definition: style.hxx:42
SfxStyleSearchBits
Definition: style.hxx:54
@ Used
used styles (search mask)
@ AllVisible
all visible styles
@ Hidden
hidden styles (search mask)
size_t pos