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/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 final
: 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
;
49 virtual ~SwXModule() override
;
54 virtual css::uno::Reference
< css::beans::XPropertySet
> SAL_CALL
getViewSettings() override
;
57 virtual css::uno::Reference
< css::beans::XPropertySet
> SAL_CALL
getPrintSettings() override
;
60 virtual OUString SAL_CALL
getImplementationName() override
;
61 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
62 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
65 enum class SwXPrintSettingsType
71 class SwXPrintSettings final
: public comphelper::ChainablePropertySet
73 friend class SwXDocumentSettings
;
75 SwXPrintSettingsType meType
;
76 SwPrintData
* mpPrtOpt
;
79 virtual void _preSetValues () override
;
80 virtual void _setSingleValue( const comphelper::PropertyInfo
& rInfo
, const css::uno::Any
&rValue
) override
;
81 virtual void _postSetValues () override
;
83 virtual void _preGetValues () override
;
85 virtual void _getSingleValue( const comphelper::PropertyInfo
& rInfo
, css::uno::Any
& rValue
) override
;
86 virtual void _postGetValues () override
;
88 virtual ~SwXPrintSettings()
91 SwXPrintSettings( SwXPrintSettingsType eType
, SwDoc
* pDoc
= nullptr );
94 virtual OUString SAL_CALL
getImplementationName() override
;
95 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
96 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
100 * Implements com.sun.star.text.ViewSettings: UNO access to per-view settings (e.g. if formatting
101 * marks are visible or not.)
103 class SwXViewSettings final
: public comphelper::ChainablePropertySet
105 friend class SwXDocumentSettings
;
108 std::unique_ptr
<SwViewOption
> mpViewOption
;
109 const SwViewOption
* mpConstViewOption
;
110 bool m_bObjectValid
:1, mbApplyZoom
;
112 FieldUnit m_eHRulerUnit
;
113 bool mbApplyHRulerMetric
;
114 FieldUnit m_eVRulerUnit
;
115 bool mbApplyVRulerMetric
;
117 virtual void _preSetValues () override
;
118 virtual void _setSingleValue( const comphelper::PropertyInfo
& rInfo
, const css::uno::Any
&rValue
) override
;
119 virtual void _postSetValues() override
;
121 virtual void _preGetValues () override
;
122 virtual void _getSingleValue( const comphelper::PropertyInfo
& rInfo
, css::uno::Any
& rValue
) override
;
123 virtual void _postGetValues () override
;
125 virtual ~SwXViewSettings()
128 SwXViewSettings(SwView
* pView
);
131 virtual OUString SAL_CALL
getImplementationName() override
;
132 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
133 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
135 bool IsValid() const {return m_bObjectValid
;}
136 void Invalidate() {m_bObjectValid
= false;}
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */