xref: /aoo4110/main/sfx2/inc/sfx2/objuno.hxx (revision b1cdbd2c)
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 #ifndef _SFX_OBJUNO_HXX
24 #define _SFX_OBJUNO_HXX
25 
26 #include <com/sun/star/document/XDocumentInfo.hpp>
27 #include <com/sun/star/document/XStandaloneDocumentInfo.hpp>
28 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
29 #include <com/sun/star/util/XModifyListener.hpp>
30 #include <com/sun/star/util/XModifyBroadcaster.hpp>
31 #include <com/sun/star/beans/XPropertySet.hpp>
32 #include <com/sun/star/beans/PropertyValue.hpp>
33 #include <com/sun/star/beans/XFastPropertySet.hpp>
34 #include <com/sun/star/beans/XVetoableChangeListener.hpp>
35 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
36 #include <com/sun/star/beans/XPropertyContainer.hpp>
37 #include <com/sun/star/beans/XPropertyAccess.hpp>
38 #include <com/sun/star/lang/XEventListener.hpp>
39 #include <com/sun/star/lang/XServiceInfo.hpp>
40 #include <com/sun/star/embed/XStorage.hpp>
41 #include <com/sun/star/lang/XComponent.hpp>
42 #include <com/sun/star/lang/XInitialization.hpp>
43 #include <com/sun/star/util/XCloneable.hpp>
44 
45 #include <com/sun/star/io/IOException.hpp>
46 
47 #include <svl/itemprop.hxx>
48 #include <cppuhelper/implbase10.hxx>
49 
50 #include "sfxuno.hxx"
51 
52 
53 // this is now just a wrapper around a XDocumentProperties instance
54 
55 class SAL_DLLPRIVATE SfxDocumentInfoObject: public ::cppu::WeakImplHelper10<
56         ::com::sun::star::document::XDocumentInfo,
57 		::com::sun::star::lang::XComponent,
58 		::com::sun::star::beans::XPropertySet,
59 		::com::sun::star::beans::XFastPropertySet,
60 		::com::sun::star::beans::XPropertyAccess,
61 		::com::sun::star::beans::XPropertyContainer,
62         ::com::sun::star::document::XDocumentPropertiesSupplier,
63         ::com::sun::star::util::XModifyBroadcaster,
64 		::com::sun::star::lang::XInitialization,
65 		::com::sun::star::util::XCloneable>
66 {
67 protected:
68     struct SfxDocumentInfoObject_Impl* _pImp;
69 
70 public:
71     SfxDocumentInfoObject();
72 	~SfxDocumentInfoObject();
73 
74 	// XComponent
75 	virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
76 	virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener) throw( ::com::sun::star::uno::RuntimeException );
77 	virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener) throw( ::com::sun::star::uno::RuntimeException );
78 
79 	// XPropertySet
80 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException );
81 	virtual void SAL_CALL setPropertyValue(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue) throw(
82         ::com::sun::star::uno::RuntimeException,
83         ::com::sun::star::beans::UnknownPropertyException,
84         ::com::sun::star::beans::PropertyVetoException,
85         ::com::sun::star::lang::IllegalArgumentException,
86         ::com::sun::star::lang::WrappedTargetException);
87 	virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName) throw(
88         ::com::sun::star::uno::RuntimeException,
89         ::com::sun::star::beans::UnknownPropertyException,
90         ::com::sun::star::lang::WrappedTargetException);
91 	virtual void SAL_CALL addPropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener) throw(
92         ::com::sun::star::uno::RuntimeException,
93         ::com::sun::star::beans::UnknownPropertyException,
94         ::com::sun::star::lang::WrappedTargetException);
95 	virtual void SAL_CALL removePropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener) throw(
96         ::com::sun::star::uno::RuntimeException,
97         ::com::sun::star::beans::UnknownPropertyException,
98         ::com::sun::star::lang::WrappedTargetException);
99 	virtual void SAL_CALL addVetoableChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener) throw(
100         ::com::sun::star::uno::RuntimeException,
101         ::com::sun::star::beans::UnknownPropertyException,
102         ::com::sun::star::lang::WrappedTargetException);
103 	virtual void SAL_CALL removeVetoableChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener) throw(
104         ::com::sun::star::uno::RuntimeException,
105         ::com::sun::star::beans::UnknownPropertyException,
106         ::com::sun::star::lang::WrappedTargetException);
107 
108 	// ::com::sun::star::beans::XFastPropertySet
109 	virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue) throw(
110         ::com::sun::star::uno::RuntimeException,
111         ::com::sun::star::beans::UnknownPropertyException,
112         ::com::sun::star::beans::PropertyVetoException,
113         ::com::sun::star::lang::IllegalArgumentException,
114         ::com::sun::star::lang::WrappedTargetException);
115 	virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) throw(
116         ::com::sun::star::uno::RuntimeException,
117         ::com::sun::star::beans::UnknownPropertyException,
118         ::com::sun::star::lang::WrappedTargetException);
119 
120     // ::com::sun::star::beans::XPropertyAccess
121     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues() throw( ::com::sun::star::uno::RuntimeException );
122     virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps ) 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 );
123 
124     // ::com::sun::star::beans::XPropertyContainer
125     virtual void SAL_CALL addProperty( const ::rtl::OUString& Name, ::sal_Int16 Attributes, const ::com::sun::star::uno::Any& DefaultValue ) throw (::com::sun::star::beans::PropertyExistException, ::com::sun::star::beans::IllegalTypeException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
126     virtual void SAL_CALL removeProperty( const ::rtl::OUString& Name ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::NotRemoveableException, ::com::sun::star::uno::RuntimeException);
127 
128 	// ::com::sun::star::document::XDocumentInfo
129 	virtual sal_Int16 SAL_CALL getUserFieldCount() throw( ::com::sun::star::uno::RuntimeException );
130 	virtual ::rtl::OUString SAL_CALL getUserFieldName(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException );
131 	virtual ::rtl::OUString SAL_CALL getUserFieldValue(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException );
132 	virtual void SAL_CALL setUserFieldName(sal_Int16 nIndex, const ::rtl::OUString& aName ) throw( ::com::sun::star::uno::RuntimeException );
133 	virtual void SAL_CALL setUserFieldValue(sal_Int16 nIndex, const ::rtl::OUString& aValue ) throw( ::com::sun::star::uno::RuntimeException );
134 
135     // ::com::sun::star::document::XDocumentPropertiesSupplier
136     virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties >
137         SAL_CALL getDocumentProperties()
138         throw (::com::sun::star::uno::RuntimeException);
139 
140     // ::com::sun::star::util::XModifiable
141 	virtual sal_Bool SAL_CALL isModified() throw (::com::sun::star::uno::RuntimeException);
142     virtual void SAL_CALL setModified( sal_Bool bModified ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
143 
144     // ::com::sun::star::util::XModifyBroadcaster
145     virtual void SAL_CALL addModifyListener( const com::sun::star::uno::Reference< com::sun::star::util::XModifyListener >& xListener ) throw( ::com::sun::star::uno::RuntimeException ) ;
146     virtual void SAL_CALL removeModifyListener( const com::sun::star::uno::Reference< com::sun::star::util::XModifyListener > & xListener) throw( ::com::sun::star::uno::RuntimeException ) ;
147 
148     // ::com::sun::star::lang::XInitialization:
149     virtual void SAL_CALL initialize(
150         const com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > & aArguments)
151         throw (com::sun::star::uno::RuntimeException,
152                com::sun::star::uno::Exception);
153 
154     // ::com::sun::star::util::XCloneable:
155     virtual com::sun::star::uno::Reference<com::sun::star::util::XCloneable> SAL_CALL createClone()
156         throw (com::sun::star::uno::RuntimeException);
157 
158     const SfxDocumentInfoObject& operator=( const SfxDocumentInfoObject & rOther);
159 };
160 
161 class SfxStandaloneDocumentInfoObject: public SfxDocumentInfoObject,
162                                        public ::com::sun::star::lang::XServiceInfo,
163 									   public ::com::sun::star::document::XStandaloneDocumentInfo
164 {
165     ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > _xFactory;
166 
167 public:
168 	SfxStandaloneDocumentInfoObject( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
169 	virtual ~SfxStandaloneDocumentInfoObject();
170 
171 	void Clear();
172 
173 	// XInterface, XTypeProvider, XServiceInfo
174 	SFX_DECL_XINTERFACE_XTYPEPROVIDER_XSERVICEINFO
175 
176 	// ::com::sun::star::document::XDocumentInfo
177 	virtual sal_Int16 SAL_CALL getUserFieldCount() throw( ::com::sun::star::uno::RuntimeException );
178 	virtual ::rtl::OUString SAL_CALL getUserFieldName(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException );
179 	virtual ::rtl::OUString SAL_CALL getUserFieldValue(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException );
180 	virtual void SAL_CALL setUserFieldName(sal_Int16 nIndex, const ::rtl::OUString& aName ) throw( ::com::sun::star::uno::RuntimeException );
181 	virtual void SAL_CALL setUserFieldValue(sal_Int16 nIndex, const ::rtl::OUString& aValue ) throw( ::com::sun::star::uno::RuntimeException );
182 
183 	// ::com::sun::star::document::XStandaloneDocumentInfo
184     virtual void SAL_CALL loadFromURL(const ::rtl::OUString& aURL) throw( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
185     virtual void SAL_CALL storeIntoURL(const ::rtl::OUString& aURL) throw( ::com::sun::star::io::IOException );
186 };
187 
188 #endif
189