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 _UNOMOD_HXX
20 : #define _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> // helper for implementations
28 : #include <cppuhelper/implbase3.hxx> // helper for implementations
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 :
57 : //XViewSettings
58 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getViewSettings(void)
59 : throw( ::com::sun::star::uno::RuntimeException );
60 :
61 : //XPrintSettings
62 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getPrintSettings(void)
63 : throw( ::com::sun::star::uno::RuntimeException );
64 :
65 : //XServiceInfo
66 : virtual rtl::OUString SAL_CALL getImplementationName(void)
67 : throw( ::com::sun::star::uno::RuntimeException );
68 : virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
69 : throw( ::com::sun::star::uno::RuntimeException );
70 : virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void)
71 : throw( ::com::sun::star::uno::RuntimeException );
72 : };
73 :
74 : enum SwXPrintSettingsType
75 : {
76 : PRINT_SETTINGS_MODULE,
77 : PRINT_SETTINGS_WEB,
78 : PRINT_SETTINGS_DOCUMENT
79 : };
80 :
81 : class SwXPrintSettings : public comphelper::ChainableHelperNoState
82 : {
83 : friend class SwXDocumentSettings;
84 : protected:
85 : SwXPrintSettingsType meType;
86 : SwPrintData * mpPrtOpt;
87 : SwDoc *mpDoc;
88 :
89 : virtual void _preSetValues ()
90 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
91 : virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
92 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
93 : virtual void _postSetValues ()
94 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
95 :
96 : virtual void _preGetValues ()
97 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
98 : virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
99 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
100 : virtual void _postGetValues ()
101 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
102 :
103 : virtual ~SwXPrintSettings()
104 : throw();
105 : public:
106 : SwXPrintSettings( SwXPrintSettingsType eType, SwDoc * pDoc = NULL );
107 :
108 :
109 : //XServiceInfo
110 : virtual rtl::OUString SAL_CALL getImplementationName(void)
111 : throw( ::com::sun::star::uno::RuntimeException );
112 : virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
113 : throw( ::com::sun::star::uno::RuntimeException );
114 : virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void)
115 : throw( ::com::sun::star::uno::RuntimeException );
116 : };
117 :
118 : class SwXViewSettings : public comphelper::ChainableHelperNoState
119 : {
120 :
121 : friend class SwXDocumentSettings;
122 : protected:
123 : SwView* pView;
124 : SwViewOption* mpViewOption;
125 : const SwViewOption* mpConstViewOption;
126 : sal_Bool bObjectValid:1, bWeb:1, mbApplyZoom;
127 :
128 : sal_Int32 eHRulerUnit;
129 : sal_Bool mbApplyHRulerMetric;
130 : sal_Int32 eVRulerUnit;
131 : sal_Bool mbApplyVRulerMetric;
132 :
133 : virtual void _preSetValues ()
134 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
135 : virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
136 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
137 : virtual void _postSetValues ()
138 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
139 :
140 : virtual void _preGetValues ()
141 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
142 : virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
143 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
144 : virtual void _postGetValues ()
145 : throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
146 :
147 : virtual ~SwXViewSettings()
148 : throw();
149 : public:
150 : SwXViewSettings(sal_Bool bWeb, SwView* pView);
151 :
152 :
153 : //XServiceInfo
154 : virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
155 : virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
156 : virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
157 :
158 4 : sal_Bool IsValid() const {return bObjectValid;}
159 2 : void Invalidate() {bObjectValid = sal_False;}
160 : };
161 :
162 : #endif
163 :
164 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|