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_UI_INC_UNOMOD_HXX
20 : #define INCLUDED_SW_SOURCE_UI_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(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
90 : virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
91 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
92 : virtual void _postSetValues ()
93 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
94 :
95 : virtual void _preGetValues ()
96 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
97 : virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
98 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
99 : virtual void _postGetValues ()
100 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
101 :
102 : virtual ~SwXPrintSettings()
103 : throw();
104 : public:
105 : SwXPrintSettings( SwXPrintSettingsType eType, SwDoc * pDoc = NULL );
106 :
107 : //XServiceInfo
108 : virtual OUString SAL_CALL getImplementationName(void)
109 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
110 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
111 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
112 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(void)
113 : throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
114 : };
115 :
116 : class SwXViewSettings : public comphelper::ChainableHelperNoState
117 : {
118 :
119 : friend class SwXDocumentSettings;
120 : protected:
121 : SwView* pView;
122 : SwViewOption* mpViewOption;
123 : const SwViewOption* mpConstViewOption;
124 : sal_Bool bObjectValid:1, bWeb:1, mbApplyZoom;
125 :
126 : sal_Int32 eHRulerUnit;
127 : sal_Bool mbApplyHRulerMetric;
128 : sal_Int32 eVRulerUnit;
129 : sal_Bool mbApplyVRulerMetric;
130 :
131 : virtual void _preSetValues ()
132 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
133 : virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
134 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
135 : virtual void _postSetValues ()
136 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
137 :
138 : virtual void _preGetValues ()
139 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
140 : virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
141 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
142 : virtual void _postGetValues ()
143 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) SAL_OVERRIDE;
144 :
145 : virtual ~SwXViewSettings()
146 : throw();
147 : public:
148 : SwXViewSettings(sal_Bool bWeb, SwView* pView);
149 :
150 : //XServiceInfo
151 : virtual OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
152 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
153 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
154 :
155 0 : sal_Bool IsValid() const {return bObjectValid;}
156 0 : void Invalidate() {bObjectValid = sal_False;}
157 : };
158 :
159 : #endif
160 :
161 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|