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 .
19 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_UNOMOD_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_UNOMOD_HXX
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 <tools/fldunit.hxx>
36 css::uno::Reference
< css::uno::XInterface
> SAL_CALL
SwXModule_CreateInstance(const css::uno::Reference
< css::lang::XMultiServiceFactory
> & );
38 class SwXModule
: public cppu::WeakImplHelper
40 css::view::XViewSettingsSupplier
,
41 css::view::XPrintSettingsSupplier
,
42 css::lang::XServiceInfo
46 css::uno::Reference
< css::beans::XPropertySet
> mxViewSettings
;
47 css::uno::Reference
< css::beans::XPropertySet
> mxPrintSettings
;
50 virtual ~SwXModule() override
;
55 virtual css::uno::Reference
< css::beans::XPropertySet
> SAL_CALL
getViewSettings() override
;
58 virtual css::uno::Reference
< css::beans::XPropertySet
> SAL_CALL
getPrintSettings() override
;
61 virtual OUString SAL_CALL
getImplementationName() override
;
62 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
63 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
66 enum class SwXPrintSettingsType
72 class SwXPrintSettings final
: public comphelper::ChainablePropertySet
74 friend class SwXDocumentSettings
;
76 SwXPrintSettingsType meType
;
77 SwPrintData
* mpPrtOpt
;
80 virtual void _preSetValues () override
;
81 virtual void _setSingleValue( const comphelper::PropertyInfo
& rInfo
, const css::uno::Any
&rValue
) override
;
82 virtual void _postSetValues () override
;
84 virtual void _preGetValues () override
;
86 virtual void _getSingleValue( const comphelper::PropertyInfo
& rInfo
, css::uno::Any
& rValue
) override
;
87 virtual void _postGetValues () override
;
89 virtual ~SwXPrintSettings()
92 SwXPrintSettings( SwXPrintSettingsType eType
, SwDoc
* pDoc
= nullptr );
95 virtual OUString SAL_CALL
getImplementationName() override
;
96 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
97 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
100 class SwXViewSettings final
: public comphelper::ChainablePropertySet
102 friend class SwXDocumentSettings
;
105 std::unique_ptr
<SwViewOption
> mpViewOption
;
106 const SwViewOption
* mpConstViewOption
;
107 bool bObjectValid
:1, mbApplyZoom
;
109 FieldUnit eHRulerUnit
;
110 bool mbApplyHRulerMetric
;
111 FieldUnit eVRulerUnit
;
112 bool mbApplyVRulerMetric
;
114 virtual void _preSetValues () override
;
115 virtual void _setSingleValue( const comphelper::PropertyInfo
& rInfo
, const css::uno::Any
&rValue
) override
;
116 virtual void _postSetValues() override
;
118 virtual void _preGetValues () override
;
119 virtual void _getSingleValue( const comphelper::PropertyInfo
& rInfo
, css::uno::Any
& rValue
) override
;
120 virtual void _postGetValues () override
;
122 virtual ~SwXViewSettings()
125 SwXViewSettings(SwView
* pView
);
128 virtual OUString SAL_CALL
getImplementationName() override
;
129 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
130 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
132 bool IsValid() const {return bObjectValid
;}
133 void Invalidate() {bObjectValid
= false;}
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */