1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SD_INC_STLSHEET_HXX
21 #define INCLUDED_SD_INC_STLSHEET_HXX
23 #include <rtl/ref.hxx>
25 #include <com/sun/star/style/XStyle.hpp>
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/beans/XPropertyState.hpp>
29 #include <com/sun/star/lang/XComponent.hpp>
30 #include <com/sun/star/util/XModifyBroadcaster.hpp>
32 #include <cppuhelper/interfacecontainer.h>
33 #include <cppuhelper/implbase.hxx>
34 #include <cppuhelper/basemutex.hxx>
36 #include <svl/style.hxx>
40 #include "prlayout.hxx"
42 class ModifyListenerForewarder
;
43 struct SfxItemPropertySimpleEntry
;
45 typedef cppu::ImplInheritanceHelper
< SfxUnoStyleSheet
,
46 css::beans::XPropertySet
,
47 css::lang::XServiceInfo
,
48 css::beans::XPropertyState
,
49 css::util::XModifyBroadcaster
,
50 css::lang::XComponent
> SdStyleSheetBase
;
52 class SdStyleSheet final
: public SdStyleSheetBase
, private ::cppu::BaseMutex
55 SdStyleSheet( const OUString
& rDisplayName
, SfxStyleSheetBasePool
& rPool
, SfxStyleFamily eFamily
, SfxStyleSearchBits nMask
);
57 virtual bool SetParent (const OUString
& rParentName
) override
;
58 virtual SfxItemSet
& GetItemSet() override
;
59 virtual bool IsUsed() const override
;
60 virtual bool HasFollowSupport() const override
;
61 virtual bool HasParentSupport() const override
;
62 virtual bool HasClearParentSupport() const override
;
63 virtual void SetHelpId( const OUString
& r
, sal_uLong nId
) override
;
65 void AdjustToFontHeight(SfxItemSet
& rSet
, bool bOnlyMissingItems
= true);
67 SdStyleSheet
* GetRealStyleSheet() const;
68 SdStyleSheet
* GetPseudoStyleSheet() const;
70 void SetApiName( const OUString
& rApiName
);
71 OUString
const & GetApiName() const;
73 static OUString
GetFamilyString( SfxStyleFamily eFamily
);
75 static SdStyleSheet
* CreateEmptyUserStyle( SfxStyleSheetBasePool
& rPool
, SfxStyleFamily eFamily
);
77 //Broadcast that a SdStyleSheet has changed, taking into account outline sublevels
78 //which need to be explicitly broadcast as changing if their parent style was
79 //the one that changed
80 static void BroadcastSdStyleSheetChange(SfxStyleSheetBase
const * pStyleSheet
, PresentationObjects ePO
,
81 SfxStyleSheetBasePool
* pSSPool
);
84 virtual bool SetName(const OUString
& rNewName
, bool bReindexNow
= true) override
;
87 virtual void SAL_CALL
release( ) throw () override
;
90 virtual OUString SAL_CALL
getImplementationName() override
;
91 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
92 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
95 virtual OUString SAL_CALL
getName( ) override
;
96 virtual void SAL_CALL
setName( const OUString
& aName
) override
;
99 virtual sal_Bool SAL_CALL
isUserDefined( ) override
;
100 virtual sal_Bool SAL_CALL
isInUse( ) override
;
101 virtual OUString SAL_CALL
getParentStyle( ) override
;
102 virtual void SAL_CALL
setParentStyle( const OUString
& aParentStyle
) override
;
105 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() override
;
106 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
107 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
108 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
109 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
110 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
111 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
114 virtual css::beans::PropertyState SAL_CALL
getPropertyState( const OUString
& PropertyName
) override
;
115 virtual css::uno::Sequence
< css::beans::PropertyState
> SAL_CALL
getPropertyStates( const css::uno::Sequence
< OUString
>& aPropertyName
) override
;
116 virtual void SAL_CALL
setPropertyToDefault( const OUString
& PropertyName
) override
;
117 virtual css::uno::Any SAL_CALL
getPropertyDefault( const OUString
& aPropertyName
) override
;
119 // XModifyBroadcaster
120 virtual void SAL_CALL
addModifyListener( const css::uno::Reference
< css::util::XModifyListener
>& aListener
) override
;
121 virtual void SAL_CALL
removeModifyListener( const css::uno::Reference
< css::util::XModifyListener
>& aListener
) override
;
124 virtual void SAL_CALL
dispose( ) override
;
125 virtual void SAL_CALL
addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) override
;
126 virtual void SAL_CALL
removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& aListener
) override
;
128 void notifyModifyListener();
131 /// @throws css::uno::RuntimeException
132 static const SfxItemPropertySimpleEntry
* getPropertyMapEntry( const OUString
& rPropertyName
);
134 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
135 virtual ~SdStyleSheet() override
;
137 /// @throws css::uno::RuntimeException
138 void throwIfDisposed();
143 rtl::Reference
< SfxStyleSheetBasePool
> mxPool
;
145 /** broadcast helper for events */
146 ::cppu::OBroadcastHelper mrBHelper
;
148 std::unique_ptr
< ModifyListenerForewarder
> mpModifyListenerForewarder
;
150 SdStyleSheet( const SdStyleSheet
& ) = delete;
151 SdStyleSheet
& operator=( const SdStyleSheet
& ) = delete;
154 typedef std::vector
< rtl::Reference
< SdStyleSheet
> > SdStyleSheetVector
;
156 struct StyleSheetCopyResult
158 rtl::Reference
<SdStyleSheet
> m_xStyleSheet
;
159 bool m_bCreatedByCopy
;
160 StyleSheetCopyResult(SdStyleSheet
* pStyleSheet
, bool bCreatedByCopy
)
161 : m_xStyleSheet(pStyleSheet
)
162 , m_bCreatedByCopy(bCreatedByCopy
)
167 typedef std::vector
<StyleSheetCopyResult
> StyleSheetCopyResultVector
;
169 #endif // INCLUDED_SD_INC_STLSHEET_HXX
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */