nss: upgrade to release 3.73
[LibreOffice.git] / sw / source / uibase / inc / unotxvw.hxx
blobdb2f6eae398f1a961d9aaecaa497ae1eef3c7df6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_UNOTXVW_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_UNOTXVW_HXX
22 #include <sfx2/sfxbasecontroller.hxx>
23 #include <comphelper/interfacecontainer2.hxx>
24 #include <com/sun/star/text/XTextViewCursor.hpp>
25 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
26 #include <com/sun/star/text/XRubySelection.hpp>
27 #include <com/sun/star/view/XFormLayerAccess.hpp>
28 #include <com/sun/star/view/XScreenCursor.hpp>
29 #include <com/sun/star/view/XViewSettingsSupplier.hpp>
30 #include <com/sun/star/view/XSelectionSupplier.hpp>
31 #include <com/sun/star/view/XLineCursor.hpp>
32 #include <com/sun/star/view/XViewCursor.hpp>
33 #include <com/sun/star/text/XPageCursor.hpp>
34 #include <com/sun/star/beans/XPropertySet.hpp>
35 #include <com/sun/star/beans/XPropertySetInfo.hpp>
36 #include <com/sun/star/beans/XPropertyState.hpp>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/datatransfer/XTransferableSupplier.hpp>
39 #include <cppuhelper/implbase.hxx>
40 #include <svl/itemprop.hxx>
41 #include <TextCursorHelper.hxx>
42 #include <comphelper/uno3.hxx>
44 #include <sfx2/objsh.hxx>
46 class SdrObject;
47 class SwView;
49 class SwXTextView :
50 public css::view::XSelectionSupplier,
51 public css::lang::XServiceInfo,
52 public css::view::XFormLayerAccess,
53 public css::text::XTextViewCursorSupplier,
54 public css::text::XRubySelection,
55 public css::view::XViewSettingsSupplier,
56 public css::beans::XPropertySet,
57 public css::datatransfer::XTransferableSupplier,
58 public SfxBaseController
60 ::comphelper::OInterfaceContainerHelper2 m_SelChangedListeners;
62 SwView* m_pView;
63 const SfxItemPropertySet* m_pPropSet; // property map for SwXTextView properties
64 // (not related to mxViewSettings!)
66 css::uno::Reference< css::beans::XPropertySet > mxViewSettings;
67 css::uno::Reference< css::text::XTextViewCursor > mxTextViewCursor;
69 SdrObject* GetControl(
70 const css::uno::Reference< css::awt::XControlModel > & Model,
71 css::uno::Reference< css::awt::XControl >& xToFill );
73 protected:
74 virtual ~SwXTextView() override;
75 public:
76 SwXTextView(SwView* pSwView);
78 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
79 virtual void SAL_CALL acquire( ) throw() override;
80 virtual void SAL_CALL release( ) throw() override;
82 //XTypeProvider
83 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
84 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
86 //XSelectionSupplier
87 virtual css::uno::Any SAL_CALL getSelection() override;
88 virtual sal_Bool SAL_CALL select(const css::uno::Any& rInterface) override;
89 virtual void SAL_CALL addSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > & xListener) override;
90 virtual void SAL_CALL removeSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > & xListener) override;
92 // XFormLayerAccess
93 virtual css::uno::Reference< css::form::runtime::XFormController > SAL_CALL getFormController( const css::uno::Reference< css::form::XForm >& Form ) override;
94 virtual sal_Bool SAL_CALL isFormDesignMode( ) override;
95 virtual void SAL_CALL setFormDesignMode( sal_Bool DesignMode ) override;
97 // XControlAccess
98 virtual css::uno::Reference< css::awt::XControl > SAL_CALL getControl(const css::uno::Reference< css::awt::XControlModel > & Model) override;
100 //XTextViewCursorSupplier
101 virtual css::uno::Reference< css::text::XTextViewCursor > SAL_CALL getViewCursor() override;
103 //XViewSettings
104 virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getViewSettings() override;
106 //XRubySelection
107 virtual css::uno::Sequence<
108 css::uno::Sequence< css::beans::PropertyValue > > SAL_CALL getRubyList( sal_Bool bAutomatic ) override;
110 virtual void SAL_CALL setRubyList(
111 const css::uno::Sequence<
112 css::uno::Sequence< css::beans::PropertyValue > >& RubyList, sal_Bool bAutomatic ) override;
114 //XPropertySet
115 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
116 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
117 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
118 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
119 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
120 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
121 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
123 //XServiceInfo
124 virtual OUString SAL_CALL getImplementationName() override;
125 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
126 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
128 //XTransferableSupplier
129 virtual css::uno::Reference< css::datatransfer::XTransferable > SAL_CALL getTransferable( ) override;
130 virtual void SAL_CALL insertTransferable( const css::uno::Reference< css::datatransfer::XTransferable >& xTrans ) override;
132 void NotifySelChanged();
133 void NotifyDBChanged();
135 SwView* GetView() {return m_pView;}
136 void Invalidate();
138 // temporary document used for PDF export of selections/multi-selections
139 SfxObjectShellLock BuildTmpSelectionDoc();
142 typedef cppu::WeakImplHelper<
143 css::text::XTextViewCursor,
144 css::lang::XServiceInfo,
145 css::text::XPageCursor,
146 css::view::XScreenCursor,
147 css::view::XViewCursor,
148 css::view::XLineCursor,
149 css::beans::XPropertySet,
150 css::beans::XPropertyState
151 > SwXTextViewCursor_Base;
153 class SwXTextViewCursor final: public SwXTextViewCursor_Base, public OTextCursorHelper
155 SwView* m_pView;
156 const SfxItemPropertySet* m_pPropSet;
157 bool IsTextSelection( bool bAllowTables = true ) const;
158 virtual ~SwXTextViewCursor() override;
160 public:
161 SwXTextViewCursor(SwView* pVw);
163 DECLARE_XINTERFACE()
165 //XTextViewCursor
166 virtual sal_Bool SAL_CALL isVisible() override;
167 virtual void SAL_CALL setVisible(sal_Bool bVisible) override;
168 virtual css::awt::Point SAL_CALL getPosition() override;
170 //XTextCursor - new
171 virtual void SAL_CALL collapseToStart() override;
172 virtual void SAL_CALL collapseToEnd() override;
173 virtual sal_Bool SAL_CALL isCollapsed() override;
174 virtual sal_Bool SAL_CALL goLeft( sal_Int16 nCount, sal_Bool bExpand ) override;
175 virtual sal_Bool SAL_CALL goRight( sal_Int16 nCount, sal_Bool bExpand ) override;
176 virtual void SAL_CALL gotoStart( sal_Bool bExpand ) override;
177 virtual void SAL_CALL gotoEnd( sal_Bool bExpand ) override;
178 virtual void SAL_CALL gotoRange( const css::uno::Reference< css::text::XTextRange >& xRange, sal_Bool bExpand ) override;
180 //XPageCursor
181 virtual sal_Bool SAL_CALL jumpToFirstPage() override;
182 virtual sal_Bool SAL_CALL jumpToLastPage() override;
183 virtual sal_Bool SAL_CALL jumpToPage(sal_Int16 nPage) override;
184 virtual sal_Bool SAL_CALL jumpToNextPage() override;
185 virtual sal_Bool SAL_CALL jumpToPreviousPage() override;
186 virtual sal_Bool SAL_CALL jumpToEndOfPage() override;
187 virtual sal_Bool SAL_CALL jumpToStartOfPage() override;
188 virtual sal_Int16 SAL_CALL getPage() override;
190 //XTextRange
191 virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override;
192 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override;
193 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override;
194 virtual OUString SAL_CALL getString() override;
195 virtual void SAL_CALL setString(const OUString& aString) override;
197 //XScreenCursor
198 virtual sal_Bool SAL_CALL screenDown() override;
199 virtual sal_Bool SAL_CALL screenUp() override;
201 //XViewCursor
202 virtual sal_Bool SAL_CALL goDown(sal_Int16 nCount, sal_Bool bExpand) override;
203 virtual sal_Bool SAL_CALL goUp(sal_Int16 nCount, sal_Bool bExpand) override;
205 //XLineCursor
206 virtual sal_Bool SAL_CALL isAtStartOfLine() override;
207 virtual sal_Bool SAL_CALL isAtEndOfLine() override;
208 virtual void SAL_CALL gotoEndOfLine(sal_Bool bExpand) override;
209 virtual void SAL_CALL gotoStartOfLine(sal_Bool bExpand) override;
211 //XPropertySet
212 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
213 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
214 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
215 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
216 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
217 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
218 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
220 //XPropertyState
221 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
222 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
223 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
224 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
226 //XServiceInfo
227 virtual OUString SAL_CALL getImplementationName() override;
228 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
229 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
231 static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
233 //XUnoTunnel
234 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
236 void Invalidate(){m_pView = nullptr;}
238 // ITextCursorHelper
239 virtual const SwPaM* GetPaM() const override;
240 virtual SwPaM* GetPaM() override;
241 virtual const SwDoc* GetDoc() const override;
242 virtual SwDoc* GetDoc() override;
245 #endif
247 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */