/src/libreoffice/sw/source/uibase/inc/unomod.hxx
Line | Count | Source |
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 | | |
20 | | #pragma once |
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/implbase.hxx> |
28 | | #include <comphelper/ChainablePropertySet.hxx> |
29 | | #include <tools/fldunit.hxx> |
30 | | |
31 | | class SwView; |
32 | | class SwViewOption; |
33 | | class SwPrintData; |
34 | | class SwDoc; |
35 | | class SwXViewSettings; |
36 | | class SwXPrintSettings; |
37 | | |
38 | | css::uno::Reference< css::uno::XInterface > SAL_CALL SwXModule_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > & ); |
39 | | |
40 | | class SwXModule final : public cppu::WeakImplHelper |
41 | | < |
42 | | css::view::XViewSettingsSupplier, |
43 | | css::view::XPrintSettingsSupplier, |
44 | | css::lang::XServiceInfo |
45 | | > |
46 | | { |
47 | | |
48 | | rtl::Reference< SwXViewSettings > mxViewSettings; |
49 | | rtl::Reference< SwXPrintSettings > mxPrintSettings; |
50 | | |
51 | | virtual ~SwXModule() override; |
52 | | public: |
53 | | SwXModule(); |
54 | | |
55 | | //XViewSettings |
56 | | virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getViewSettings() override; |
57 | | |
58 | | //XPrintSettings |
59 | | virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getPrintSettings() override; |
60 | | |
61 | | //XServiceInfo |
62 | | virtual OUString SAL_CALL getImplementationName() override; |
63 | | virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; |
64 | | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
65 | | }; |
66 | | |
67 | | enum class SwXPrintSettingsType |
68 | | { |
69 | | Module, |
70 | | Document |
71 | | }; |
72 | | |
73 | | class SwXPrintSettings final : public comphelper::ChainablePropertySet |
74 | | { |
75 | | friend class SwXDocumentSettings; |
76 | | |
77 | | SwXPrintSettingsType meType; |
78 | | SwPrintData * mpPrtOpt; |
79 | | SwDoc *mpDoc; |
80 | | |
81 | | virtual void _preSetValues () override; |
82 | | virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const css::uno::Any &rValue ) override; |
83 | | virtual void _postSetValues () override; |
84 | | |
85 | | virtual void _preGetValues () override; |
86 | | |
87 | | virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, css::uno::Any & rValue ) override; |
88 | | virtual void _postGetValues () override; |
89 | | |
90 | | virtual ~SwXPrintSettings() |
91 | | noexcept override; |
92 | | public: |
93 | | SwXPrintSettings( SwXPrintSettingsType eType, SwDoc * pDoc = nullptr ); |
94 | | |
95 | | //XServiceInfo |
96 | | virtual OUString SAL_CALL getImplementationName() override; |
97 | | virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; |
98 | | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
99 | | }; |
100 | | |
101 | | /** |
102 | | * Implements com.sun.star.text.ViewSettings: UNO access to per-view settings (e.g. if formatting |
103 | | * marks are visible or not.) |
104 | | */ |
105 | | class SwXViewSettings final : public comphelper::ChainablePropertySet |
106 | | { |
107 | | friend class SwXDocumentSettings; |
108 | | |
109 | | SwView* m_pView; |
110 | | std::unique_ptr<SwViewOption> mpViewOption; |
111 | | const SwViewOption* mpConstViewOption; |
112 | | bool m_bObjectValid:1, mbApplyZoom; |
113 | | |
114 | | FieldUnit m_eHRulerUnit; |
115 | | bool mbApplyHRulerMetric; |
116 | | FieldUnit m_eVRulerUnit; |
117 | | bool mbApplyVRulerMetric; |
118 | | |
119 | | virtual void _preSetValues () override; |
120 | | virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const css::uno::Any &rValue ) override; |
121 | | virtual void _postSetValues() override; |
122 | | |
123 | | virtual void _preGetValues () override; |
124 | | virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, css::uno::Any & rValue ) override; |
125 | | virtual void _postGetValues () override; |
126 | | |
127 | | virtual ~SwXViewSettings() |
128 | | noexcept override; |
129 | | public: |
130 | | SwXViewSettings(SwView* pView); |
131 | | |
132 | | //XServiceInfo |
133 | | virtual OUString SAL_CALL getImplementationName() override; |
134 | | virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; |
135 | | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
136 | | |
137 | 7.98k | bool IsValid() const {return m_bObjectValid;} |
138 | 3.93k | void Invalidate() {m_bObjectValid = false;} |
139 | | }; |
140 | | |
141 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |