1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SW_XDOCUMENT_SETTINGS_HXX
29 #define _SW_XDOCUMENT_SETTINGS_HXX
30 
31 #ifdef PRECOMPILED
32 #include "ui_pch.hxx"
33 #endif
34 
35 #ifndef _COMPHELPER_MASTERPROPERTYSET_HXX_
36 #include <comphelper/MasterPropertySet.hxx>
37 #endif
38 #ifndef _COM_SUN_STAR_TEXT_XTEXTDOCUMENT_HPP
39 #include <com/sun/star/text/XTextDocument.hpp>
40 #endif
41 #include  <com/sun/star/lang/XServiceInfo.hpp>
42 #include  <com/sun/star/lang/XTypeProvider.hpp>
43 #include <cppuhelper/weak.hxx>
44 #include <cppuhelper/implbase5.hxx>
45 
46 
47 class SwXTextDocument;
48 class SwDocShell;
49 class SwDoc;
50 class SfxPrinter;
51 
52 class SwXDocumentSettings :
53         public comphelper::MasterPropertySet,
54         public com::sun::star::lang::XServiceInfo,
55         public com::sun::star::lang::XTypeProvider,
56         public cppu::OWeakObject
57 {
58 protected:
59 	com::sun::star::uno::Reference< com::sun::star::text::XTextDocument >		mxModel;
60 	SwXTextDocument*		mpModel;
61 	SwDocShell* 			mpDocSh;
62 	SwDoc* 					mpDoc;
63 
64     /** the printer should be set only once; since there are several
65      * printer-related properties, remember the last printer and set it in
66      * _postSetValues */
67     SfxPrinter*             mpPrinter;
68 
69 	virtual void _preSetValues ()
70 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
71 	virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
72 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
73 	virtual void _postSetValues ()
74 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
75 
76 	virtual void _preGetValues ()
77 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
78 	virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
79 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
80 	virtual void _postGetValues ()
81 		throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
82 protected:
83 	virtual ~SwXDocumentSettings()
84 		throw();
85 public:
86 	SwXDocumentSettings( SwXTextDocument* pModel );
87 
88 
89 	// XInterface
90 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
91 		throw (::com::sun::star::uno::RuntimeException);
92 	virtual void SAL_CALL acquire(  )
93 		throw ();
94 	virtual void SAL_CALL release(  )
95 		throw ();
96 
97 	// XServiceInfo
98 	virtual ::rtl::OUString SAL_CALL getImplementationName(  )
99 		throw(com::sun::star::uno::RuntimeException);
100 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
101 		throw(com::sun::star::uno::RuntimeException);
102 	virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
103 		throw(com::sun::star::uno::RuntimeException);
104 
105     // XTypeProvider
106     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw (::com::sun::star::uno::RuntimeException);
107     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw (::com::sun::star::uno::RuntimeException);
108 };
109 #endif
110