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 _SD_STLSHEET_HXX
21 #define _SD_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 class ModifyListenerForewarder
;
44 typedef cppu::ImplInheritanceHelper5
< SfxUnoStyleSheet
,
45 ::com::sun::star::beans::XPropertySet
,
46 ::com::sun::star::lang::XServiceInfo
,
47 ::com::sun::star::beans::XPropertyState
,
48 ::com::sun::star::util::XModifyBroadcaster
,
49 ::com::sun::star::lang::XComponent
> SdStyleSheetBase
;
51 class SdStyleSheet
: public SdStyleSheetBase
, private ::cppu::BaseMutex
54 SdStyleSheet( const OUString
& rDisplayName
, SfxStyleSheetBasePool
& rPool
, SfxStyleFamily eFamily
, sal_uInt16 nMask
);
55 SdStyleSheet( const SdStyleSheet
& );
57 virtual bool SetParent (const String
& rParentName
);
58 virtual SfxItemSet
& GetItemSet();
59 virtual bool IsUsed() const;
60 virtual bool HasFollowSupport() const;
61 virtual bool HasParentSupport() const;
62 virtual bool HasClearParentSupport() const;
63 virtual bool SetName( const UniString
& );
64 virtual void SetHelpId( const OUString
& r
, sal_uLong nId
);
66 void AdjustToFontHeight(SfxItemSet
& rSet
, sal_Bool bOnlyMissingItems
= sal_True
);
68 SdStyleSheet
* GetRealStyleSheet() const;
69 SdStyleSheet
* GetPseudoStyleSheet() const;
71 void SetApiName( const OUString
& rApiName
);
72 OUString
GetApiName() const;
74 static OUString
GetFamilyString( SfxStyleFamily eFamily
);
76 static SdStyleSheet
* CreateEmptyUserStyle( SfxStyleSheetBasePool
& rPool
, SfxStyleFamily eFamily
);
79 virtual void SAL_CALL
release( ) throw ();
82 virtual OUString SAL_CALL
getImplementationName() throw(::com::sun::star::uno::RuntimeException
);
83 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
);
84 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
);
87 virtual OUString SAL_CALL
getName( ) throw(::com::sun::star::uno::RuntimeException
);
88 virtual void SAL_CALL
setName( const OUString
& aName
) throw(::com::sun::star::uno::RuntimeException
);
91 virtual sal_Bool SAL_CALL
isUserDefined( ) throw(::com::sun::star::uno::RuntimeException
);
92 virtual sal_Bool SAL_CALL
isInUse( ) throw(::com::sun::star::uno::RuntimeException
);
93 virtual OUString SAL_CALL
getParentStyle( ) throw(::com::sun::star::uno::RuntimeException
);
94 virtual void SAL_CALL
setParentStyle( const OUString
& aParentStyle
) throw(::com::sun::star::container::NoSuchElementException
, ::com::sun::star::uno::RuntimeException
);
97 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException
);
98 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
);
99 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
);
100 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
);
101 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
);
102 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
);
103 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
);
106 virtual ::com::sun::star::beans::PropertyState SAL_CALL
getPropertyState( const OUString
& PropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
107 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
);
108 virtual void SAL_CALL
setPropertyToDefault( const OUString
& PropertyName
) throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
109 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
);
111 // XModifyBroadcaster
112 virtual void SAL_CALL
addModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
113 virtual void SAL_CALL
removeModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
116 virtual void SAL_CALL
dispose( ) throw (::com::sun::star::uno::RuntimeException
);
117 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
);
118 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
120 void notifyModifyListener();
123 const SfxItemPropertySimpleEntry
* getPropertyMapEntry( const OUString
& rPropertyName
) const throw();
125 virtual void Load (SvStream
& rIn
, sal_uInt16 nVersion
);
126 virtual void Store(SvStream
& rOut
);
128 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
129 virtual ~SdStyleSheet();
131 void throwIfDisposed() throw (::com::sun::star::uno::RuntimeException
);
133 virtual void disposing();
136 rtl::Reference
< SfxStyleSheetBasePool
> mxPool
;
138 /** boradcast helper for events */
139 ::cppu::OBroadcastHelper mrBHelper
;
141 boost::scoped_ptr
< ModifyListenerForewarder
> mpModifyListenerForewarder
;
144 SdStyleSheet
& operator=( const SdStyleSheet
& ); // not implemented
147 typedef rtl::Reference
< SdStyleSheet
> SdStyleSheetRef
;
148 typedef std::vector
< SdStyleSheetRef
> SdStyleSheetVector
;
150 #endif // _SD_STLSHEET_HXX
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */