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/implbase.hxx>
28 : #include <comphelper/ChainablePropertySet.hxx>
29 : #include <comphelper/SettingsHelper.hxx>
30 : #include <usrpref.hxx>
31 :
32 : class SwView;
33 : class SwViewOption;
34 : class SwPrintData;
35 : class SwDoc;
36 :
37 : ::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 > & );
38 :
39 : class SwXModule : public cppu::WeakImplHelper
40 : <
41 : ::com::sun::star::view::XViewSettingsSupplier,
42 : ::com::sun::star::view::XPrintSettingsSupplier,
43 : ::com::sun::star::lang::XServiceInfo
44 : >
45 : {
46 :
47 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > * pxViewSettings;
48 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > * pxPrintSettings;
49 :
50 : protected:
51 : virtual ~SwXModule();
52 : public:
53 : SwXModule();
54 :
55 : //XViewSettings
56 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getViewSettings()
57 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
58 :
59 : //XPrintSettings
60 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getPrintSettings()
61 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
62 :
63 : //XServiceInfo
64 : virtual OUString SAL_CALL getImplementationName()
65 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
66 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
67 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
68 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
69 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
70 : };
71 :
72 : enum SwXPrintSettingsType
73 : {
74 : PRINT_SETTINGS_MODULE,
75 : PRINT_SETTINGS_WEB,
76 : PRINT_SETTINGS_DOCUMENT
77 : };
78 :
79 : class SwXPrintSettings : public comphelper::ChainableHelperNoState
80 : {
81 : friend class SwXDocumentSettings;
82 : protected:
83 : SwXPrintSettingsType meType;
84 : SwPrintData * mpPrtOpt;
85 : SwDoc *mpDoc;
86 :
87 : virtual void _preSetValues ()
88 : throw (css::beans::UnknownPropertyException,
89 : css::beans::PropertyVetoException,
90 : css::lang::IllegalArgumentException,
91 : css::lang::WrappedTargetException,
92 : css::uno::RuntimeException) SAL_OVERRIDE;
93 : virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
94 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
95 : virtual void _postSetValues ()
96 : throw (css::beans::UnknownPropertyException,
97 : css::beans::PropertyVetoException,
98 : css::lang::IllegalArgumentException,
99 : css::lang::WrappedTargetException,
100 : css::uno::RuntimeException) SAL_OVERRIDE;
101 :
102 : virtual void _preGetValues ()
103 : throw (css::beans::UnknownPropertyException,
104 : css::beans::PropertyVetoException,
105 : css::lang::IllegalArgumentException,
106 : css::lang::WrappedTargetException,
107 : css::uno::RuntimeException) SAL_OVERRIDE;
108 :
109 : virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
110 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
111 : virtual void _postGetValues ()
112 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
113 :
114 : virtual ~SwXPrintSettings()
115 : throw();
116 : public:
117 : SwXPrintSettings( SwXPrintSettingsType eType, SwDoc * pDoc = NULL );
118 :
119 : //XServiceInfo
120 : virtual OUString SAL_CALL getImplementationName()
121 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
122 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
123 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
124 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
125 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
126 : };
127 :
128 : class SwXViewSettings : public comphelper::ChainableHelperNoState
129 : {
130 :
131 : friend class SwXDocumentSettings;
132 : protected:
133 : SwView* pView;
134 : SwViewOption* mpViewOption;
135 : const SwViewOption* mpConstViewOption;
136 : bool bObjectValid:1, bWeb:1, mbApplyZoom;
137 :
138 : FieldUnit eHRulerUnit;
139 : bool mbApplyHRulerMetric;
140 : FieldUnit eVRulerUnit;
141 : bool mbApplyVRulerMetric;
142 :
143 : virtual void _preSetValues ()
144 : throw (css::beans::UnknownPropertyException,
145 : css::beans::PropertyVetoException,
146 : css::lang::IllegalArgumentException,
147 : css::lang::WrappedTargetException,
148 : css::uno::RuntimeException) SAL_OVERRIDE;
149 : virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
150 : throw (css::beans::UnknownPropertyException,
151 : css::beans::PropertyVetoException,
152 : css::lang::IllegalArgumentException,
153 : css::lang::WrappedTargetException,
154 : css::uno::RuntimeException,
155 : std::exception) 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() 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() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
185 :
186 363 : bool IsValid() const {return bObjectValid;}
187 15 : void Invalidate() {bObjectValid = false;}
188 : };
189 :
190 : #endif
191 :
192 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|