bump product version to 7.2.5.1
[LibreOffice.git] / sd / inc / stlsheet.hxx
blob105eb4cd797ade7aa0b399e79d06726f115cf8da
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 #pragma once
22 #include <rtl/ref.hxx>
24 #include <com/sun/star/style/XStyle.hpp>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/beans/XPropertyState.hpp>
28 #include <com/sun/star/lang/XComponent.hpp>
29 #include <com/sun/star/util/XModifyBroadcaster.hpp>
31 #include <cppuhelper/interfacecontainer.h>
32 #include <cppuhelper/implbase.hxx>
33 #include <cppuhelper/basemutex.hxx>
35 #include <svl/style.hxx>
37 #include <memory>
39 #include "prlayout.hxx"
41 class ModifyListenerForwarder;
42 struct SfxItemPropertyMapEntry;
44 typedef cppu::ImplInheritanceHelper< SfxUnoStyleSheet,
45 css::beans::XPropertySet,
46 css::lang::XServiceInfo,
47 css::beans::XPropertyState,
48 css::util::XModifyBroadcaster,
49 css::lang::XComponent > SdStyleSheetBase ;
51 class SdStyleSheet final : public SdStyleSheetBase, private ::cppu::BaseMutex
53 public:
54 SdStyleSheet( const OUString& rDisplayName, SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily, SfxStyleSearchBits nMask );
56 virtual bool SetParent (const OUString& rParentName) override;
57 virtual SfxItemSet& GetItemSet() override;
58 virtual bool IsUsed() const override;
59 virtual bool HasFollowSupport() const override;
60 virtual bool HasParentSupport() const override;
61 virtual bool HasClearParentSupport() const override;
62 virtual void SetHelpId( const OUString& r, sal_uLong nId ) override;
64 void AdjustToFontHeight(SfxItemSet& rSet, bool bOnlyMissingItems = true);
66 SdStyleSheet* GetRealStyleSheet() const;
67 SdStyleSheet* GetPseudoStyleSheet() const;
69 void SetApiName( const OUString& rApiName );
70 OUString const & GetApiName() const;
72 static OUString GetFamilyString( SfxStyleFamily eFamily );
74 static rtl::Reference<SdStyleSheet> CreateEmptyUserStyle( SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily );
76 //Broadcast that a SdStyleSheet has changed, taking into account outline sublevels
77 //which need to be explicitly broadcast as changing if their parent style was
78 //the one that changed
79 static void BroadcastSdStyleSheetChange(SfxStyleSheetBase const * pStyleSheet, PresentationObjects ePO,
80 SfxStyleSheetBasePool* pSSPool);
82 // SfxStyleSheetBase
83 virtual bool SetName(const OUString& rNewName, bool bReindexNow = true) override;
85 // XInterface
86 virtual void SAL_CALL release( ) noexcept override;
88 // XServiceInfo
89 virtual OUString SAL_CALL getImplementationName() override;
90 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
91 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
93 // XNamed
94 virtual OUString SAL_CALL getName( ) override;
95 virtual void SAL_CALL setName( const OUString& aName ) override;
97 // XStyle
98 virtual sal_Bool SAL_CALL isUserDefined( ) override;
99 virtual sal_Bool SAL_CALL isInUse( ) override;
100 virtual OUString SAL_CALL getParentStyle( ) override;
101 virtual void SAL_CALL setParentStyle( const OUString& aParentStyle ) override;
103 // XPropertySet
104 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
105 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
106 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
107 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
108 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
109 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
110 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
112 // XPropertyState
113 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
114 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
115 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
116 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
118 // XModifyBroadcaster
119 virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
120 virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
122 // XComponent
123 virtual void SAL_CALL dispose( ) override;
124 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
125 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
127 void notifyModifyListener();
129 private:
130 /// @throws css::uno::RuntimeException
131 static const SfxItemPropertyMapEntry* getPropertyMapEntry( std::u16string_view rPropertyName );
133 virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
134 virtual ~SdStyleSheet() override;
136 /// @throws css::uno::RuntimeException
137 void throwIfDisposed();
139 void disposing();
141 OUString msApiName;
142 rtl::Reference< SfxStyleSheetBasePool > mxPool;
144 /** broadcast helper for events */
145 ::cppu::OBroadcastHelper mrBHelper;
147 std::unique_ptr< ModifyListenerForwarder > mpModifyListenerForwarder;
149 SdStyleSheet( const SdStyleSheet& ) = delete;
150 SdStyleSheet& operator=( const SdStyleSheet& ) = delete;
153 typedef std::vector< rtl::Reference< SdStyleSheet > > SdStyleSheetVector;
155 struct StyleSheetCopyResult
157 rtl::Reference<SdStyleSheet> m_xStyleSheet;
158 bool m_bCreatedByCopy;
159 StyleSheetCopyResult(SdStyleSheet* pStyleSheet, bool bCreatedByCopy)
160 : m_xStyleSheet(pStyleSheet)
161 , m_bCreatedByCopy(bCreatedByCopy)
166 typedef std::vector<StyleSheetCopyResult> StyleSheetCopyResultVector;
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */