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/implbase5.hxx>
34 #include <cppuhelper/basemutex.hxx>
36 #include <svl/style.hxx>
38 #include <editeng/unoipset.hxx>
40 #include <boost/scoped_ptr.hpp>
42 #include "prlayout.hxx"
44 class ModifyListenerForewarder
;
46 typedef cppu::ImplInheritanceHelper5
< SfxUnoStyleSheet
,
47 ::com::sun::star::beans::XPropertySet
,
48 ::com::sun::star::lang::XServiceInfo
,
49 ::com::sun::star::beans::XPropertyState
,
50 ::com::sun::star::util::XModifyBroadcaster
,
51 ::com::sun::star::lang::XComponent
> SdStyleSheetBase
;
53 class SdStyleSheet
: public SdStyleSheetBase
, private ::cppu::BaseMutex
56 SdStyleSheet( const OUString
& rDisplayName
, SfxStyleSheetBasePool
& rPool
, SfxStyleFamily eFamily
, sal_uInt16 nMask
);
57 SdStyleSheet( const SdStyleSheet
& );
59 virtual bool SetParent (const OUString
& rParentName
) SAL_OVERRIDE
;
60 virtual SfxItemSet
& GetItemSet() SAL_OVERRIDE
;
61 virtual bool IsUsed() const SAL_OVERRIDE
;
62 virtual bool HasFollowSupport() const SAL_OVERRIDE
;
63 virtual bool HasParentSupport() const SAL_OVERRIDE
;
64 virtual bool HasClearParentSupport() const SAL_OVERRIDE
;
65 virtual bool SetName(const OUString
& rNewName
, bool bReindexNow
= true) SAL_OVERRIDE
;
66 virtual void SetHelpId( const OUString
& r
, sal_uLong nId
) SAL_OVERRIDE
;
68 void AdjustToFontHeight(SfxItemSet
& rSet
, bool bOnlyMissingItems
= true);
70 SdStyleSheet
* GetRealStyleSheet() const;
71 SdStyleSheet
* GetPseudoStyleSheet() const;
73 void SetApiName( const OUString
& rApiName
);
74 OUString
GetApiName() const;
76 static OUString
GetFamilyString( SfxStyleFamily eFamily
);
78 static SdStyleSheet
* CreateEmptyUserStyle( SfxStyleSheetBasePool
& rPool
, SfxStyleFamily eFamily
);
80 //Broadcast that a SdStyleSheet has changed, taking into account outline sublevels
81 //which need to be explicitly broadcast as changing if their parent style was
82 //the one that changed
83 static void BroadcastSdStyleSheetChange(SfxStyleSheetBase
* pStyleSheet
, PresentationObjects ePO
,
84 SfxStyleSheetBasePool
* pSSPool
);
87 virtual void SAL_CALL
release( ) throw () SAL_OVERRIDE
;
90 virtual OUString SAL_CALL
getImplementationName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
91 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
92 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
95 virtual OUString SAL_CALL
getName( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
96 virtual void SAL_CALL
setName( const OUString
& aName
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
99 virtual sal_Bool SAL_CALL
isUserDefined( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
100 virtual sal_Bool SAL_CALL
isInUse( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
101 virtual OUString SAL_CALL
getParentStyle( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
102 virtual void SAL_CALL
setParentStyle( const OUString
& aParentStyle
) throw(::com::sun::star::container::NoSuchElementException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
105 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
106 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const ::com::sun::star::uno::Any
& aValue
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
107 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
108 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& xListener
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
109 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& aListener
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
110 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
111 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
114 virtual ::com::sun::star::beans::PropertyState SAL_CALL
getPropertyState( const OUString
& PropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
115 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyState
> SAL_CALL
getPropertyStates( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
116 virtual void SAL_CALL
setPropertyToDefault( const OUString
& PropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
117 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyDefault( const OUString
& aPropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
119 // XModifyBroadcaster
120 virtual void SAL_CALL
addModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
121 virtual void SAL_CALL
removeModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
124 virtual void SAL_CALL
dispose( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
125 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
126 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
128 void notifyModifyListener();
131 static const SfxItemPropertySimpleEntry
* getPropertyMapEntry( const OUString
& rPropertyName
) throw (css::uno::RuntimeException
);
133 virtual void Load (SvStream
& rIn
, sal_uInt16 nVersion
) SAL_OVERRIDE
;
134 virtual void Store(SvStream
& rOut
) SAL_OVERRIDE
;
136 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
137 virtual ~SdStyleSheet();
139 void throwIfDisposed() throw (::com::sun::star::uno::RuntimeException
);
144 rtl::Reference
< SfxStyleSheetBasePool
> mxPool
;
146 /** broadcast helper for events */
147 ::cppu::OBroadcastHelper mrBHelper
;
149 boost::scoped_ptr
< ModifyListenerForewarder
> mpModifyListenerForewarder
;
152 SdStyleSheet
& operator=( const SdStyleSheet
& ) SAL_DELETED_FUNCTION
;
155 typedef rtl::Reference
< SdStyleSheet
> SdStyleSheetRef
;
156 typedef std::vector
< SdStyleSheetRef
> SdStyleSheetVector
;
158 #endif // INCLUDED_SD_INC_STLSHEET_HXX
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */