Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_UNOMOD_HXX
20 : #define INCLUDED_SW_SOURCE_UIBASE_INC_UNOMOD_HXX
21 :
22 : #include <com/sun/star/beans/XPropertySet.hpp>
23 : #include <com/sun/star/view/XPrintSettingsSupplier.hpp>
24 : #include <com/sun/star/view/XViewSettingsSupplier.hpp>
25 : #include <com/sun/star/lang/XServiceInfo.hpp>
26 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27 : #include <cppuhelper/implbase2.hxx>
28 : #include <cppuhelper/implbase3.hxx>
29 : #include <comphelper/ChainablePropertySet.hxx>
30 : #include <comphelper/SettingsHelper.hxx>
31 : #include <usrpref.hxx>
32 :
33 : class SwView;
34 : class SwViewOption;
35 : class SwPrintData;
36 : class SwDoc;
37 :
38 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SwXModule_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
39 :
40 : class SwXModule : public cppu::WeakImplHelper3
41 : <
42 : ::com::sun::star::view::XViewSettingsSupplier,
43 : ::com::sun::star::view::XPrintSettingsSupplier,
44 : ::com::sun::star::lang::XServiceInfo
45 : >
46 : {
47 :
48 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > * pxViewSettings;
49 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > * pxPrintSettings;
50 :
51 : protected:
52 : virtual ~SwXModule();
53 : public:
54 : SwXModule();
55 :
56 : //XViewSettings
57 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getViewSettings(void)
58 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
59 :
60 : //XPrintSettings
61 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getPrintSettings(void)
62 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
63 :
64 : //XServiceInfo
65 : virtual OUString SAL_CALL getImplementationName(void)
66 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
67 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
68 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
69 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(void)
70 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
71 : };
72 :
73 : enum SwXPrintSettingsType
74 : {
75 : PRINT_SETTINGS_MODULE,
76 : PRINT_SETTINGS_WEB,
77 : PRINT_SETTINGS_DOCUMENT
78 : };
79 :
80 : class SwXPrintSettings : public comphelper::ChainableHelperNoState
81 : {
82 : friend class SwXDocumentSettings;
83 : protected:
84 : SwXPrintSettingsType meType;
85 : SwPrintData * mpPrtOpt;
86 : SwDoc *mpDoc;
87 :
88 : virtual void _preSetValues ()
89 : throw (css::beans::UnknownPropertyException,
90 : css::beans::PropertyVetoException,
91 : css::lang::IllegalArgumentException,
92 : css::lang::WrappedTargetException,
93 : css::uno::RuntimeException) SAL_OVERRIDE;
94 : virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
95 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
96 : virtual void _postSetValues ()
97 : throw (css::beans::UnknownPropertyException,
98 : css::beans::PropertyVetoException,
99 : css::lang::IllegalArgumentException,
100 : css::lang::WrappedTargetException,
101 : css::uno::RuntimeException) SAL_OVERRIDE;
102 :
103 : virtual void _preGetValues ()
104 : throw (css::beans::UnknownPropertyException,
105 : css::beans::PropertyVetoException,
106 : css::lang::IllegalArgumentException,
107 : css::lang::WrappedTargetException,
108 : css::uno::RuntimeException) SAL_OVERRIDE;
109 :
110 : virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
111 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
112 : virtual void _postGetValues ()
113 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
114 :
115 : virtual ~SwXPrintSettings()
116 : throw();
117 : public:
118 : SwXPrintSettings( SwXPrintSettingsType eType, SwDoc * pDoc = NULL );
119 :
120 : //XServiceInfo
121 : virtual OUString SAL_CALL getImplementationName(void)
122 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
123 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
124 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
125 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(void)
126 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
127 : };
128 :
129 : class SwXViewSettings : public comphelper::ChainableHelperNoState
130 : {
131 :
132 : friend class SwXDocumentSettings;
133 : protected:
134 : SwView* pView;
135 : SwViewOption* mpViewOption;
136 : const SwViewOption* mpConstViewOption;
137 : bool bObjectValid:1, bWeb:1, mbApplyZoom;
138 :
139 : FieldUnit eHRulerUnit;
140 : bool mbApplyHRulerMetric;
141 : FieldUnit eVRulerUnit;
142 : bool mbApplyVRulerMetric;
143 :
144 : virtual void _preSetValues ()
145 : throw (css::beans::UnknownPropertyException,
146 : css::beans::PropertyVetoException,
147 : css::lang::IllegalArgumentException,
148 : css::lang::WrappedTargetException,
149 : css::uno::RuntimeException) SAL_OVERRIDE;
150 : virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
151 : throw (css::beans::UnknownPropertyException,
152 : css::beans::PropertyVetoException,
153 : css::lang::IllegalArgumentException,
154 : css::lang::WrappedTargetException,
155 : css::uno::RuntimeException) SAL_OVERRIDE;
156 : virtual void _postSetValues()
157 : throw (css::beans::UnknownPropertyException,
158 : css::beans::PropertyVetoException,
159 : css::lang::IllegalArgumentException,
160 : css::lang::WrappedTargetException,
161 : css::uno::RuntimeException) SAL_OVERRIDE;
162 :
163 : virtual void _preGetValues ()
164 : throw (css::beans::UnknownPropertyException,
165 : css::beans::PropertyVetoException,
166 : css::lang::IllegalArgumentException,
167 : css::lang::WrappedTargetException,
168 : css::uno::RuntimeException) SAL_OVERRIDE;
169 : virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
170 : throw (css::beans::UnknownPropertyException,
171 : css::lang::WrappedTargetException,
172 : css::uno::RuntimeException) SAL_OVERRIDE;
173 : virtual void _postGetValues ()
174 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
175 :
176 : virtual ~SwXViewSettings()
177 : throw();
178 : public:
179 : SwXViewSettings(bool bWeb, SwView* pView);
180 :
181 : //XServiceInfo
182 : virtual OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
183 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
184 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
185 :
186 722 : bool IsValid() const {return bObjectValid;}
187 26 : void Invalidate() {bObjectValid = false;}
188 : };
189 :
190 : #endif
191 :
192 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|