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 _SW_XDOCUMENT_SETTINGS_HXX
25 #define _SW_XDOCUMENT_SETTINGS_HXX
26 
27 #ifdef PRECOMPILED
28 #include "ui_pch.hxx"
29 #endif
30 
31 #ifndef _COMPHELPER_MASTERPROPERTYSET_HXX_
32 #include <comphelper/MasterPropertySet.hxx>
33 #endif
34 #ifndef _COM_SUN_STAR_TEXT_XTEXTDOCUMENT_HPP
35 #include <com/sun/star/text/XTextDocument.hpp>
36 #endif
37 #include  <com/sun/star/lang/XServiceInfo.hpp>
38 #include  <com/sun/star/lang/XTypeProvider.hpp>
39 #include <cppuhelper/weak.hxx>
40 #include <cppuhelper/implbase5.hxx>
41 
42 
43 class SwXTextDocument;
44 class SwDocShell;
45 class SwDoc;
46 class SfxPrinter;
47 
48 class SwXDocumentSettings :
49         public comphelper::MasterPropertySet,
50         public com::sun::star::lang::XServiceInfo,
51         public com::sun::star::lang::XTypeProvider,
52         public cppu::OWeakObject
53 {
54 protected:
55 	com::sun::star::uno::Reference< com::sun::star::text::XTextDocument >		mxModel;
56 	SwXTextDocument*		mpModel;
57 	SwDocShell* 			mpDocSh;
58 	SwDoc* 					mpDoc;
59 
60     /** the printer should be set only once; since there are several
61      * printer-related properties, remember the last printer and set it in
62      * _postSetValues */
63     SfxPrinter*             mpPrinter;
64 
65 	virtual void _preSetValues ()
66 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
67 	virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
68 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
69 	virtual void _postSetValues ()
70 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
71 
72 	virtual void _preGetValues ()
73 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
74 	virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
75 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
76 	virtual void _postGetValues ()
77 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
78 protected:
79 	virtual ~SwXDocumentSettings()
80 		throw();
81 public:
82 	SwXDocumentSettings( SwXTextDocument* pModel );
83 
84 
85 	// XInterface
86 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
87 		throw (::com::sun::star::uno::RuntimeException);
88 	virtual void SAL_CALL acquire(  )
89 		throw ();
90 	virtual void SAL_CALL release(  )
91 		throw ();
92 
93 	// XServiceInfo
94 	virtual ::rtl::OUString SAL_CALL getImplementationName(  )
95 		throw(com::sun::star::uno::RuntimeException);
96 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
97 		throw(com::sun::star::uno::RuntimeException);
98 	virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
99 		throw(com::sun::star::uno::RuntimeException);
100 
101     // XTypeProvider
102     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw (::com::sun::star::uno::RuntimeException);
103     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw (::com::sun::star::uno::RuntimeException);
104 };
105 #endif
106