xref: /aoo41x/main/sfx2/inc/sfx2/objuno.hxx (revision 353d8f4d)
1*353d8f4dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*353d8f4dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*353d8f4dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*353d8f4dSAndrew Rist  * distributed with this work for additional information
6*353d8f4dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*353d8f4dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*353d8f4dSAndrew Rist  * "License"); you may not use this file except in compliance
9*353d8f4dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*353d8f4dSAndrew Rist  *
11*353d8f4dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*353d8f4dSAndrew Rist  *
13*353d8f4dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*353d8f4dSAndrew Rist  * software distributed under the License is distributed on an
15*353d8f4dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*353d8f4dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*353d8f4dSAndrew Rist  * specific language governing permissions and limitations
18*353d8f4dSAndrew Rist  * under the License.
19*353d8f4dSAndrew Rist  *
20*353d8f4dSAndrew Rist  *************************************************************/
21*353d8f4dSAndrew Rist 
22*353d8f4dSAndrew Rist 
23cdf0e10cSrcweir #ifndef _SFX_OBJUNO_HXX
24cdf0e10cSrcweir #define _SFX_OBJUNO_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <com/sun/star/document/XDocumentInfo.hpp>
27cdf0e10cSrcweir #include <com/sun/star/document/XStandaloneDocumentInfo.hpp>
28cdf0e10cSrcweir #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
29cdf0e10cSrcweir #include <com/sun/star/util/XModifyListener.hpp>
30cdf0e10cSrcweir #include <com/sun/star/util/XModifyBroadcaster.hpp>
31cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
32cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
33cdf0e10cSrcweir #include <com/sun/star/beans/XFastPropertySet.hpp>
34cdf0e10cSrcweir #include <com/sun/star/beans/XVetoableChangeListener.hpp>
35cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp>
36cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyContainer.hpp>
37cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyAccess.hpp>
38cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp>
39cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
40cdf0e10cSrcweir #include <com/sun/star/embed/XStorage.hpp>
41cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
42cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
43cdf0e10cSrcweir #include <com/sun/star/util/XCloneable.hpp>
44cdf0e10cSrcweir 
45cdf0e10cSrcweir #include <com/sun/star/io/IOException.hpp>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir #include <svl/itemprop.hxx>
48cdf0e10cSrcweir #include <cppuhelper/implbase10.hxx>
49cdf0e10cSrcweir 
50cdf0e10cSrcweir #include "sfxuno.hxx"
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 
53cdf0e10cSrcweir // this is now just a wrapper around a XDocumentProperties instance
54cdf0e10cSrcweir 
55cdf0e10cSrcweir class SAL_DLLPRIVATE SfxDocumentInfoObject: public ::cppu::WeakImplHelper10<
56cdf0e10cSrcweir         ::com::sun::star::document::XDocumentInfo,
57cdf0e10cSrcweir 		::com::sun::star::lang::XComponent,
58cdf0e10cSrcweir 		::com::sun::star::beans::XPropertySet,
59cdf0e10cSrcweir 		::com::sun::star::beans::XFastPropertySet,
60cdf0e10cSrcweir 		::com::sun::star::beans::XPropertyAccess,
61cdf0e10cSrcweir 		::com::sun::star::beans::XPropertyContainer,
62cdf0e10cSrcweir         ::com::sun::star::document::XDocumentPropertiesSupplier,
63cdf0e10cSrcweir         ::com::sun::star::util::XModifyBroadcaster,
64cdf0e10cSrcweir 		::com::sun::star::lang::XInitialization,
65cdf0e10cSrcweir 		::com::sun::star::util::XCloneable>
66cdf0e10cSrcweir {
67cdf0e10cSrcweir protected:
68cdf0e10cSrcweir     struct SfxDocumentInfoObject_Impl* _pImp;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir public:
71cdf0e10cSrcweir     SfxDocumentInfoObject();
72cdf0e10cSrcweir 	~SfxDocumentInfoObject();
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	// XComponent
75cdf0e10cSrcweir 	virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
76cdf0e10cSrcweir 	virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener) throw( ::com::sun::star::uno::RuntimeException );
77cdf0e10cSrcweir 	virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener) throw( ::com::sun::star::uno::RuntimeException );
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	// XPropertySet
80cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException );
81cdf0e10cSrcweir 	virtual void SAL_CALL setPropertyValue(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue) throw(
82cdf0e10cSrcweir         ::com::sun::star::uno::RuntimeException,
83cdf0e10cSrcweir         ::com::sun::star::beans::UnknownPropertyException,
84cdf0e10cSrcweir         ::com::sun::star::beans::PropertyVetoException,
85cdf0e10cSrcweir         ::com::sun::star::lang::IllegalArgumentException,
86cdf0e10cSrcweir         ::com::sun::star::lang::WrappedTargetException);
87cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName) throw(
88cdf0e10cSrcweir         ::com::sun::star::uno::RuntimeException,
89cdf0e10cSrcweir         ::com::sun::star::beans::UnknownPropertyException,
90cdf0e10cSrcweir         ::com::sun::star::lang::WrappedTargetException);
91cdf0e10cSrcweir 	virtual void SAL_CALL addPropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener) throw(
92cdf0e10cSrcweir         ::com::sun::star::uno::RuntimeException,
93cdf0e10cSrcweir         ::com::sun::star::beans::UnknownPropertyException,
94cdf0e10cSrcweir         ::com::sun::star::lang::WrappedTargetException);
95cdf0e10cSrcweir 	virtual void SAL_CALL removePropertyChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener) throw(
96cdf0e10cSrcweir         ::com::sun::star::uno::RuntimeException,
97cdf0e10cSrcweir         ::com::sun::star::beans::UnknownPropertyException,
98cdf0e10cSrcweir         ::com::sun::star::lang::WrappedTargetException);
99cdf0e10cSrcweir 	virtual void SAL_CALL addVetoableChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener) throw(
100cdf0e10cSrcweir         ::com::sun::star::uno::RuntimeException,
101cdf0e10cSrcweir         ::com::sun::star::beans::UnknownPropertyException,
102cdf0e10cSrcweir         ::com::sun::star::lang::WrappedTargetException);
103cdf0e10cSrcweir 	virtual void SAL_CALL removeVetoableChangeListener(const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener) throw(
104cdf0e10cSrcweir         ::com::sun::star::uno::RuntimeException,
105cdf0e10cSrcweir         ::com::sun::star::beans::UnknownPropertyException,
106cdf0e10cSrcweir         ::com::sun::star::lang::WrappedTargetException);
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	// ::com::sun::star::beans::XFastPropertySet
109cdf0e10cSrcweir 	virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue) throw(
110cdf0e10cSrcweir         ::com::sun::star::uno::RuntimeException,
111cdf0e10cSrcweir         ::com::sun::star::beans::UnknownPropertyException,
112cdf0e10cSrcweir         ::com::sun::star::beans::PropertyVetoException,
113cdf0e10cSrcweir         ::com::sun::star::lang::IllegalArgumentException,
114cdf0e10cSrcweir         ::com::sun::star::lang::WrappedTargetException);
115cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) throw(
116cdf0e10cSrcweir         ::com::sun::star::uno::RuntimeException,
117cdf0e10cSrcweir         ::com::sun::star::beans::UnknownPropertyException,
118cdf0e10cSrcweir         ::com::sun::star::lang::WrappedTargetException);
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     // ::com::sun::star::beans::XPropertyAccess
121cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPropertyValues() throw( ::com::sun::star::uno::RuntimeException );
122cdf0e10cSrcweir     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 );
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     // ::com::sun::star::beans::XPropertyContainer
125cdf0e10cSrcweir     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);
126cdf0e10cSrcweir     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);
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 	// ::com::sun::star::document::XDocumentInfo
129cdf0e10cSrcweir 	virtual sal_Int16 SAL_CALL getUserFieldCount() throw( ::com::sun::star::uno::RuntimeException );
130cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getUserFieldName(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException );
131cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getUserFieldValue(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException );
132cdf0e10cSrcweir 	virtual void SAL_CALL setUserFieldName(sal_Int16 nIndex, const ::rtl::OUString& aName ) throw( ::com::sun::star::uno::RuntimeException );
133cdf0e10cSrcweir 	virtual void SAL_CALL setUserFieldValue(sal_Int16 nIndex, const ::rtl::OUString& aValue ) throw( ::com::sun::star::uno::RuntimeException );
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     // ::com::sun::star::document::XDocumentPropertiesSupplier
136cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties >
137cdf0e10cSrcweir         SAL_CALL getDocumentProperties()
138cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
139cdf0e10cSrcweir 
140cdf0e10cSrcweir     // ::com::sun::star::util::XModifiable
141cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL isModified() throw (::com::sun::star::uno::RuntimeException);
142cdf0e10cSrcweir     virtual void SAL_CALL setModified( sal_Bool bModified ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     // ::com::sun::star::util::XModifyBroadcaster
145cdf0e10cSrcweir     virtual void SAL_CALL addModifyListener( const com::sun::star::uno::Reference< com::sun::star::util::XModifyListener >& xListener ) throw( ::com::sun::star::uno::RuntimeException ) ;
146cdf0e10cSrcweir     virtual void SAL_CALL removeModifyListener( const com::sun::star::uno::Reference< com::sun::star::util::XModifyListener > & xListener) throw( ::com::sun::star::uno::RuntimeException ) ;
147cdf0e10cSrcweir 
148cdf0e10cSrcweir     // ::com::sun::star::lang::XInitialization:
149cdf0e10cSrcweir     virtual void SAL_CALL initialize(
150cdf0e10cSrcweir         const com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > & aArguments)
151cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException,
152cdf0e10cSrcweir                com::sun::star::uno::Exception);
153cdf0e10cSrcweir 
154cdf0e10cSrcweir     // ::com::sun::star::util::XCloneable:
155cdf0e10cSrcweir     virtual com::sun::star::uno::Reference<com::sun::star::util::XCloneable> SAL_CALL createClone()
156cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException);
157cdf0e10cSrcweir 
158cdf0e10cSrcweir     const SfxDocumentInfoObject& operator=( const SfxDocumentInfoObject & rOther);
159cdf0e10cSrcweir };
160cdf0e10cSrcweir 
161cdf0e10cSrcweir class SfxStandaloneDocumentInfoObject: public SfxDocumentInfoObject,
162cdf0e10cSrcweir                                        public ::com::sun::star::lang::XServiceInfo,
163cdf0e10cSrcweir 									   public ::com::sun::star::document::XStandaloneDocumentInfo
164cdf0e10cSrcweir {
165cdf0e10cSrcweir     ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > _xFactory;
166cdf0e10cSrcweir 
167cdf0e10cSrcweir public:
168cdf0e10cSrcweir 	SfxStandaloneDocumentInfoObject( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
169cdf0e10cSrcweir 	virtual ~SfxStandaloneDocumentInfoObject();
170cdf0e10cSrcweir 
171cdf0e10cSrcweir 	void Clear();
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 	// XInterface, XTypeProvider, XServiceInfo
174cdf0e10cSrcweir 	SFX_DECL_XINTERFACE_XTYPEPROVIDER_XSERVICEINFO
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 	// ::com::sun::star::document::XDocumentInfo
177cdf0e10cSrcweir 	virtual sal_Int16 SAL_CALL getUserFieldCount() throw( ::com::sun::star::uno::RuntimeException );
178cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getUserFieldName(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException );
179cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getUserFieldValue(sal_Int16 nIndex) throw( ::com::sun::star::uno::RuntimeException );
180cdf0e10cSrcweir 	virtual void SAL_CALL setUserFieldName(sal_Int16 nIndex, const ::rtl::OUString& aName ) throw( ::com::sun::star::uno::RuntimeException );
181cdf0e10cSrcweir 	virtual void SAL_CALL setUserFieldValue(sal_Int16 nIndex, const ::rtl::OUString& aValue ) throw( ::com::sun::star::uno::RuntimeException );
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 	// ::com::sun::star::document::XStandaloneDocumentInfo
184cdf0e10cSrcweir     virtual void SAL_CALL loadFromURL(const ::rtl::OUString& aURL) throw( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
185cdf0e10cSrcweir     virtual void SAL_CALL storeIntoURL(const ::rtl::OUString& aURL) throw( ::com::sun::star::io::IOException );
186cdf0e10cSrcweir };
187cdf0e10cSrcweir 
188cdf0e10cSrcweir #endif
189