build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / sd / inc / stlsheet.hxx
bloba57f3fe9c1872314611abcfbc10a3f4017a566ae
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
38 #include <editeng/unoipset.hxx>
40 #include <memory>
42 #include "prlayout.hxx"
44 class ModifyListenerForewarder;
46 typedef cppu::ImplInheritanceHelper< SfxUnoStyleSheet,
47 css::beans::XPropertySet,
48 css::lang::XServiceInfo,
49 css::beans::XPropertyState,
50 css::util::XModifyBroadcaster,
51 css::lang::XComponent > SdStyleSheetBase ;
53 class SdStyleSheet : public SdStyleSheetBase, private ::cppu::BaseMutex
55 public:
56 SdStyleSheet( const OUString& rDisplayName, SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily, sal_uInt16 nMask );
57 SdStyleSheet( const SdStyleSheet& );
59 virtual bool SetParent (const OUString& rParentName) override;
60 virtual SfxItemSet& GetItemSet() override;
61 virtual bool IsUsed() const override;
62 virtual bool HasFollowSupport() const override;
63 virtual bool HasParentSupport() const override;
64 virtual bool HasClearParentSupport() const override;
65 virtual void SetHelpId( const OUString& r, sal_uLong nId ) override;
67 void AdjustToFontHeight(SfxItemSet& rSet, bool bOnlyMissingItems = true);
69 SdStyleSheet* GetRealStyleSheet() const;
70 SdStyleSheet* GetPseudoStyleSheet() const;
72 void SetApiName( const OUString& rApiName );
73 OUString GetApiName() const;
75 static OUString GetFamilyString( SfxStyleFamily eFamily );
77 static SdStyleSheet* CreateEmptyUserStyle( SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily );
79 //Broadcast that a SdStyleSheet has changed, taking into account outline sublevels
80 //which need to be explicitly broadcast as changing if their parent style was
81 //the one that changed
82 static void BroadcastSdStyleSheetChange(SfxStyleSheetBase* pStyleSheet, PresentationObjects ePO,
83 SfxStyleSheetBasePool* pSSPool);
85 // XInterface
86 virtual void SAL_CALL release( ) throw () override;
88 // XServiceInfo
89 virtual OUString SAL_CALL getImplementationName() throw(css::uno::RuntimeException, std::exception) override;
90 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(css::uno::RuntimeException, std::exception) override;
91 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(css::uno::RuntimeException, std::exception) override;
93 // XNamed
94 virtual OUString SAL_CALL getName( ) throw(css::uno::RuntimeException, std::exception) override;
95 virtual void SAL_CALL setName( const OUString& aName ) throw(css::uno::RuntimeException, std::exception) override;
97 // XStyle
98 virtual sal_Bool SAL_CALL isUserDefined( ) throw(css::uno::RuntimeException, std::exception) override;
99 virtual sal_Bool SAL_CALL isInUse( ) throw(css::uno::RuntimeException, std::exception) override;
100 virtual OUString SAL_CALL getParentStyle( ) throw(css::uno::RuntimeException, std::exception) override;
101 virtual void SAL_CALL setParentStyle( const OUString& aParentStyle ) throw(css::container::NoSuchElementException, css::uno::RuntimeException, std::exception) override;
103 // XPropertySet
104 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(css::uno::RuntimeException, std::exception) override;
105 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) throw(css::beans::UnknownPropertyException, css::beans::PropertyVetoException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) override;
106 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) override;
107 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) override;
108 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) override;
109 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) override;
110 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) override;
112 // XPropertyState
113 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw(css::beans::UnknownPropertyException, css::uno::RuntimeException, std::exception) override;
114 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) throw(css::beans::UnknownPropertyException, css::uno::RuntimeException, std::exception) override;
115 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw(css::beans::UnknownPropertyException, css::uno::RuntimeException, std::exception) override;
116 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) override;
118 // XModifyBroadcaster
119 virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) throw (css::uno::RuntimeException, std::exception) override;
120 virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) throw (css::uno::RuntimeException, std::exception) override;
122 // XComponent
123 virtual void SAL_CALL dispose( ) throw (css::uno::RuntimeException, std::exception) override;
124 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw (css::uno::RuntimeException, std::exception) override;
125 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw (css::uno::RuntimeException, std::exception) override;
127 void notifyModifyListener();
129 protected:
130 static const SfxItemPropertySimpleEntry* getPropertyMapEntry( const OUString& rPropertyName ) throw (css::uno::RuntimeException);
132 virtual void Load (SvStream& rIn, sal_uInt16 nVersion) override;
134 virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
135 virtual ~SdStyleSheet() override;
137 void throwIfDisposed() throw (css::uno::RuntimeException);
139 void disposing();
141 OUString msApiName;
142 rtl::Reference< SfxStyleSheetBasePool > mxPool;
144 /** broadcast helper for events */
145 ::cppu::OBroadcastHelper mrBHelper;
147 std::unique_ptr< ModifyListenerForewarder > mpModifyListenerForewarder;
149 private:
150 SdStyleSheet& operator=( const SdStyleSheet& ) = delete;
153 typedef rtl::Reference< SdStyleSheet > SdStyleSheetRef;
154 typedef std::vector< SdStyleSheetRef > SdStyleSheetVector;
156 #endif // INCLUDED_SD_INC_STLSHEET_HXX
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */