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_UNOTXVW_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_UNOTXVW_HXX
22 #include <sfx2/sfxbasecontroller.hxx>
23 #include <comphelper/interfacecontainer3.hxx>
24 #include <com/sun/star/text/XTextViewCursor.hpp>
25 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
26 #include <com/sun/star/text/XTextViewTextRangeSupplier.hpp>
27 #include <com/sun/star/text/XRubySelection.hpp>
28 #include <com/sun/star/view/XFormLayerAccess.hpp>
29 #include <com/sun/star/view/XScreenCursor.hpp>
30 #include <com/sun/star/view/XViewSettingsSupplier.hpp>
31 #include <com/sun/star/view/XSelectionSupplier.hpp>
32 #include <com/sun/star/view/XLineCursor.hpp>
33 #include <com/sun/star/view/XViewCursor.hpp>
34 #include <com/sun/star/text/XPageCursor.hpp>
35 #include <com/sun/star/beans/XPropertySet.hpp>
36 #include <com/sun/star/beans/XPropertySetInfo.hpp>
37 #include <com/sun/star/beans/XPropertyState.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <com/sun/star/datatransfer/XTransferableSupplier.hpp>
40 #include <com/sun/star/datatransfer/XTransferableTextSupplier.hpp>
41 #include <com/sun/star/qa/XDumper.hpp>
42 #include <cppuhelper/implbase.hxx>
43 #include <svl/itemprop.hxx>
44 #include <TextCursorHelper.hxx>
45 #include <comphelper/uno3.hxx>
47 #include <sfx2/objsh.hxx>
51 class SwXViewSettings
;
52 class SwXTextViewCursor
;
54 typedef cppu::ImplInheritanceHelper
<
56 css::view::XSelectionSupplier
,
57 css::lang::XServiceInfo
,
58 css::view::XFormLayerAccess
,
59 css::text::XTextViewCursorSupplier
,
60 css::text::XTextViewTextRangeSupplier
,
61 css::text::XRubySelection
,
62 css::view::XViewSettingsSupplier
,
63 css::beans::XPropertySet
,
64 css::datatransfer::XTransferableSupplier
,
65 css::datatransfer::XTransferableTextSupplier
,
66 css::qa::XDumper
> SwXTextView_Base
;
67 class SwXTextView final
: public SwXTextView_Base
69 ::comphelper::OInterfaceContainerHelper3
<css::view::XSelectionChangeListener
> m_SelChangedListeners
;
72 const SfxItemPropertySet
* m_pPropSet
; // property map for SwXTextView properties
73 // (not related to mxViewSettings!)
75 rtl::Reference
< SwXViewSettings
> mxViewSettings
;
76 rtl::Reference
< SwXTextViewCursor
> mxTextViewCursor
;
78 SdrObject
* GetControl(
79 const css::uno::Reference
< css::awt::XControlModel
> & Model
,
80 css::uno::Reference
< css::awt::XControl
>& xToFill
);
82 virtual ~SwXTextView() override
;
84 SwXTextView(SwView
* pSwView
);
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
;
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
;
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 // XTextViewTextRangeSupplier
104 virtual css::uno::Reference
<css::text::XTextRange
>
105 SAL_CALL
createTextRangeByPixelPosition(const css::awt::Point
& rPixelPosition
) override
;
108 virtual css::uno::Reference
< css::beans::XPropertySet
> SAL_CALL
getViewSettings() override
;
111 virtual css::uno::Sequence
<
112 css::uno::Sequence
< css::beans::PropertyValue
> > SAL_CALL
getRubyList( sal_Bool bAutomatic
) override
;
114 virtual void SAL_CALL
setRubyList(
115 const css::uno::Sequence
<
116 css::uno::Sequence
< css::beans::PropertyValue
> >& RubyList
, sal_Bool bAutomatic
) override
;
119 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
120 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
121 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
122 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
123 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
124 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
125 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
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 //XTransferableSupplier
133 virtual css::uno::Reference
< css::datatransfer::XTransferable
> SAL_CALL
getTransferable( ) override
;
134 virtual void SAL_CALL
insertTransferable( const css::uno::Reference
< css::datatransfer::XTransferable
>& xTrans
) override
;
136 // XTransferableTextSupplier
137 virtual css::uno::Reference
<css::datatransfer::XTransferable
> SAL_CALL
getTransferableForTextRange(css::uno::Reference
<css::text::XTextRange
> const& xTextRange
) override
;
140 OUString SAL_CALL
dump(const OUString
& rKind
) override
;
142 void NotifySelChanged();
143 void NotifyDBChanged();
145 SwView
* GetView() {return m_pView
;}
148 // temporary document used for PDF export of selections/multi-selections
149 SfxObjectShellLock
BuildTmpSelectionDoc();
152 typedef cppu::WeakImplHelper
<
153 css::text::XTextViewCursor
,
154 css::lang::XServiceInfo
,
155 css::text::XPageCursor
,
156 css::view::XScreenCursor
,
157 css::view::XViewCursor
,
158 css::view::XLineCursor
,
159 css::beans::XPropertySet
,
160 css::beans::XPropertyState
161 > SwXTextViewCursor_Base
;
163 class SwXTextViewCursor final
: public SwXTextViewCursor_Base
, public OTextCursorHelper
166 const SfxItemPropertySet
* m_pPropSet
;
167 bool IsTextSelection( bool bAllowTables
= true ) const;
168 virtual ~SwXTextViewCursor() override
;
171 SwXTextViewCursor(SwView
* pVw
);
174 virtual sal_Bool SAL_CALL
isVisible() override
;
175 virtual void SAL_CALL
setVisible(sal_Bool bVisible
) override
;
176 virtual css::awt::Point SAL_CALL
getPosition() override
;
179 virtual void SAL_CALL
collapseToStart() override
;
180 virtual void SAL_CALL
collapseToEnd() override
;
181 virtual sal_Bool SAL_CALL
isCollapsed() override
;
182 virtual sal_Bool SAL_CALL
goLeft( sal_Int16 nCount
, sal_Bool bExpand
) override
;
183 virtual sal_Bool SAL_CALL
goRight( sal_Int16 nCount
, sal_Bool bExpand
) override
;
184 virtual void SAL_CALL
gotoStart( sal_Bool bExpand
) override
;
185 virtual void SAL_CALL
gotoEnd( sal_Bool bExpand
) override
;
186 virtual void SAL_CALL
gotoRange( const css::uno::Reference
< css::text::XTextRange
>& xRange
, sal_Bool bExpand
) override
;
189 virtual sal_Bool SAL_CALL
jumpToFirstPage() override
;
190 virtual sal_Bool SAL_CALL
jumpToLastPage() override
;
191 virtual sal_Bool SAL_CALL
jumpToPage(sal_Int16 nPage
) override
;
192 virtual sal_Bool SAL_CALL
jumpToNextPage() override
;
193 virtual sal_Bool SAL_CALL
jumpToPreviousPage() override
;
194 virtual sal_Bool SAL_CALL
jumpToEndOfPage() override
;
195 virtual sal_Bool SAL_CALL
jumpToStartOfPage() override
;
196 virtual sal_Int16 SAL_CALL
getPage() override
;
199 virtual css::uno::Reference
< css::text::XText
> SAL_CALL
getText() override
;
200 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
getStart() override
;
201 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
getEnd() override
;
202 virtual OUString SAL_CALL
getString() override
;
203 virtual void SAL_CALL
setString(const OUString
& aString
) override
;
206 virtual sal_Bool SAL_CALL
screenDown() override
;
207 virtual sal_Bool SAL_CALL
screenUp() override
;
210 virtual sal_Bool SAL_CALL
goDown(sal_Int16 nCount
, sal_Bool bExpand
) override
;
211 virtual sal_Bool SAL_CALL
goUp(sal_Int16 nCount
, sal_Bool bExpand
) override
;
214 virtual sal_Bool SAL_CALL
isAtStartOfLine() override
;
215 virtual sal_Bool SAL_CALL
isAtEndOfLine() override
;
216 virtual void SAL_CALL
gotoEndOfLine(sal_Bool bExpand
) override
;
217 virtual void SAL_CALL
gotoStartOfLine(sal_Bool bExpand
) override
;
220 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
221 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
222 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
223 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
224 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
225 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
226 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
229 virtual css::beans::PropertyState SAL_CALL
getPropertyState( const OUString
& PropertyName
) override
;
230 virtual css::uno::Sequence
< css::beans::PropertyState
> SAL_CALL
getPropertyStates( const css::uno::Sequence
< OUString
>& aPropertyName
) override
;
231 virtual void SAL_CALL
setPropertyToDefault( const OUString
& PropertyName
) override
;
232 virtual css::uno::Any SAL_CALL
getPropertyDefault( const OUString
& aPropertyName
) override
;
235 virtual OUString SAL_CALL
getImplementationName() override
;
236 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
237 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
239 void Invalidate(){m_pView
= nullptr;}
242 virtual const SwPaM
* GetPaM() const override
;
243 virtual SwPaM
* GetPaM() override
;
244 virtual const SwDoc
* GetDoc() const override
;
245 virtual SwDoc
* GetDoc() override
;
250 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */