1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
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
> & );
40 class SwXModule
: public cppu::WeakImplHelper3
42 ::com::sun::star::view::XViewSettingsSupplier
,
43 ::com::sun::star::view::XPrintSettingsSupplier
,
44 ::com::sun::star::lang::XServiceInfo
48 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> * pxViewSettings
;
49 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> * pxPrintSettings
;
58 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> SAL_CALL
getViewSettings(void)
59 throw( ::com::sun::star::uno::RuntimeException
);
62 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> SAL_CALL
getPrintSettings(void)
63 throw( ::com::sun::star::uno::RuntimeException
);
66 virtual OUString SAL_CALL
getImplementationName(void)
67 throw( ::com::sun::star::uno::RuntimeException
);
68 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
)
69 throw( ::com::sun::star::uno::RuntimeException
);
70 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames(void)
71 throw( ::com::sun::star::uno::RuntimeException
);
74 enum SwXPrintSettingsType
76 PRINT_SETTINGS_MODULE
,
78 PRINT_SETTINGS_DOCUMENT
81 class SwXPrintSettings
: public comphelper::ChainableHelperNoState
83 friend class SwXDocumentSettings
;
85 SwXPrintSettingsType meType
;
86 SwPrintData
* mpPrtOpt
;
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
);
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
);
103 virtual ~SwXPrintSettings()
106 SwXPrintSettings( SwXPrintSettingsType eType
, SwDoc
* pDoc
= NULL
);
110 virtual OUString SAL_CALL
getImplementationName(void)
111 throw( ::com::sun::star::uno::RuntimeException
);
112 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
)
113 throw( ::com::sun::star::uno::RuntimeException
);
114 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames(void)
115 throw( ::com::sun::star::uno::RuntimeException
);
118 class SwXViewSettings
: public comphelper::ChainableHelperNoState
121 friend class SwXDocumentSettings
;
124 SwViewOption
* mpViewOption
;
125 const SwViewOption
* mpConstViewOption
;
126 sal_Bool bObjectValid
:1, bWeb
:1, mbApplyZoom
;
128 sal_Int32 eHRulerUnit
;
129 sal_Bool mbApplyHRulerMetric
;
130 sal_Int32 eVRulerUnit
;
131 sal_Bool mbApplyVRulerMetric
;
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
);
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
);
147 virtual ~SwXViewSettings()
150 SwXViewSettings(sal_Bool bWeb
, SwView
* pView
);
154 virtual OUString SAL_CALL
getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException
);
155 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
);
156 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException
);
158 sal_Bool
IsValid() const {return bObjectValid
;}
159 void Invalidate() {bObjectValid
= sal_False
;}
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */