xref: /AOO41X/main/sd/inc/stlsheet.hxx (revision 67e470dafe1997e73f56ff7ff4878983707e3e07)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SD_STLSHEET_HXX
25 #define _SD_STLSHEET_HXX
26 
27 #include <rtl/ref.hxx>
28 
29 #include <com/sun/star/style/XStyle.hpp>
30 #include <com/sun/star/beans/XPropertySet.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/beans/XPropertyState.hpp>
33 #include <com/sun/star/lang/XComponent.hpp>
34 #include <com/sun/star/util/XModifyBroadcaster.hpp>
35 
36 #include <cppuhelper/interfacecontainer.h>
37 #include <cppuhelper/implbase5.hxx>
38 #include <cppuhelper/basemutex.hxx>
39 
40 #include <svl/style.hxx>
41 
42 #include <editeng/unoipset.hxx>
43 
44 #include <boost/scoped_ptr.hpp>
45 
46 class ModifyListenerForewarder;
47 
48 typedef cppu::ImplInheritanceHelper5< SfxUnoStyleSheet,
49                                     ::com::sun::star::beans::XPropertySet,
50                                     ::com::sun::star::lang::XServiceInfo,
51                                     ::com::sun::star::beans::XPropertyState,
52                                     ::com::sun::star::util::XModifyBroadcaster,
53                                     ::com::sun::star::lang::XComponent > SdStyleSheetBase ;
54 
55 class SdStyleSheet : public SdStyleSheetBase, private ::cppu::BaseMutex
56 {
57 public:
58     SdStyleSheet( const rtl::OUString& rDisplayName, SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily, sal_uInt16 nMask );
59     SdStyleSheet( const SdStyleSheet& );
60 
61     virtual sal_Bool        SetParent (const String& rParentName);
62     virtual SfxItemSet& GetItemSet();
63     virtual sal_Bool        IsUsed() const;
64     virtual sal_Bool        HasFollowSupport() const;
65     virtual sal_Bool        HasParentSupport() const;
66     virtual sal_Bool        HasClearParentSupport() const;
67     virtual sal_Bool        SetName( const UniString& );
68     virtual void        SetHelpId( const String& r, sal_uLong nId );
69 
70     void        AdjustToFontHeight(SfxItemSet& rSet, sal_Bool bOnlyMissingItems = sal_True);
71 
72     SdStyleSheet* GetRealStyleSheet() const;
73     SdStyleSheet* GetPseudoStyleSheet() const;
74 
75     void SetApiName( const ::rtl::OUString& rApiName );
76     rtl::OUString GetApiName() const;
77 
78     static rtl::OUString GetFamilyString( SfxStyleFamily eFamily );
79 
80     static SdStyleSheet* CreateEmptyUserStyle( SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily );
81 
82     // XInterface
83     virtual void SAL_CALL release(  ) throw ();
84 
85     // XServiceInfo
86     virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
87     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
88     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
89 
90     // XNamed
91     virtual ::rtl::OUString SAL_CALL getName(  ) throw(::com::sun::star::uno::RuntimeException);
92     virtual void SAL_CALL setName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
93 
94     // XStyle
95     virtual sal_Bool SAL_CALL isUserDefined(  ) throw(::com::sun::star::uno::RuntimeException);
96     virtual sal_Bool SAL_CALL isInUse(  ) throw(::com::sun::star::uno::RuntimeException);
97     virtual ::rtl::OUString SAL_CALL getParentStyle(  ) throw(::com::sun::star::uno::RuntimeException);
98     virtual void SAL_CALL setParentStyle( const ::rtl::OUString& aParentStyle ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
99 
100     // XPropertySet
101     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
102     virtual void SAL_CALL setPropertyValue( const ::rtl::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);
103     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
104     virtual void SAL_CALL addPropertyChangeListener( const ::rtl::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);
105     virtual void SAL_CALL removePropertyChangeListener( const ::rtl::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);
106     virtual void SAL_CALL addVetoableChangeListener( const ::rtl::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);
107     virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::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);
108 
109     // XPropertyState
110     virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
111     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
112     virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
113     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
114 
115     // XModifyBroadcaster
116     virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
117     virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
118 
119     // XComponent
120     virtual void SAL_CALL dispose(  ) throw (::com::sun::star::uno::RuntimeException);
121     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
122     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
123 
124     void notifyModifyListener();
125 
126 protected:
127     const SfxItemPropertySimpleEntry* getPropertyMapEntry( const ::rtl::OUString& rPropertyName ) const throw();
128 
129     virtual void Load (SvStream& rIn, sal_uInt16 nVersion);
130     virtual void Store(SvStream& rOut);
131 
132     virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
133     virtual             ~SdStyleSheet();
134 
135     void throwIfDisposed() throw (::com::sun::star::uno::RuntimeException);
136 
137     virtual void disposing();
138 
139     rtl::OUString   msApiName;
140     rtl::Reference< SfxStyleSheetBasePool > mxPool;
141 
142     /** boradcast helper for events */
143     ::cppu::OBroadcastHelper mrBHelper;
144 
145     boost::scoped_ptr< ModifyListenerForewarder > mpModifyListenerForewarder;
146 
147 private:
148     SdStyleSheet& operator=( const SdStyleSheet& ); // not implemented
149 };
150 
151 typedef rtl::Reference< SdStyleSheet > SdStyleSheetRef;
152 typedef std::vector< SdStyleSheetRef > SdStyleSheetVector;
153 
154 #endif     // _SD_STLSHEET_HXX
155 
156 
157 
158