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_UIVWIMP_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_UIVWIMP_HXX
24 #include <sfx2/objsh.hxx>
25 #include <com/sun/star/view/XSelectionSupplier.hpp>
26 #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
27 #include <cppuhelper/implbase.hxx>
28 #include <cppuhelper/weakref.hxx>
29 #include <unotools/weakref.hxx>
36 namespace sfx2
{ class DocumentInserter
; }
37 namespace com::sun::star
{
39 class XDispatchProviderInterceptor
;
46 class SwScannerEventListener final
: public ::cppu::WeakImplHelper
<
47 css::lang::XEventListener
>
53 SwScannerEventListener( SwView
& rView
) : m_pView( &rView
) {}
54 virtual ~SwScannerEventListener() override
;
57 virtual void SAL_CALL
disposing(
58 const css::lang::EventObject
& rEventObject
) override
;
60 void ViewDestroyed() { m_pView
= nullptr; }
63 // Clipboard EventListener
64 class SwClipboardChangeListener final
: public ::cppu::WeakImplHelper
<
65 css::datatransfer::clipboard::XClipboardListener
>
70 virtual void SAL_CALL
disposing( const css::lang::EventObject
& rEventObject
) override
;
73 virtual void SAL_CALL
changedContents( const css::datatransfer::clipboard::ClipboardEvent
& rEventObject
) override
;
76 SwClipboardChangeListener( SwView
& rView
) : m_pView( &rView
) {}
77 virtual ~SwClipboardChangeListener() override
;
79 void ViewDestroyed() { m_pView
= nullptr; }
81 void AddRemoveListener( bool bAdd
);
84 class SwMailMergeConfigItem
;
85 class SwXDispatchProviderInterceptor
;
89 rtl::Reference
< SwXDispatchProviderInterceptor
> m_xDispatchProviderInterceptor
;
90 rtl::Reference
< SwXTextView
> mxXTextView
; // UNO object
91 std::vector
< unotools::WeakReference
< SwTransferable
> > mxTransferables
;
93 // temporary document for printing text of selection / multi selection
95 SfxObjectShellLock m_xTmpSelDocShell
;
98 rtl::Reference
<SwScannerEventListener
>
100 rtl::Reference
<SwClipboardChangeListener
>
102 ShellMode m_eShellMode
;
104 std::shared_ptr
<SwMailMergeConfigItem
>
107 std::unique_ptr
<sfx2::DocumentInserter
> m_pDocInserter
;
108 std::unique_ptr
<SfxRequest
> m_pRequest
;
111 Point m_aEditingPosition
;
112 bool m_bSelectObject
;
113 bool m_bEditingPositionSet
;
116 /// Redline author that's specific to this view.
117 OUString m_sRedlineAuthor
;
119 SwView_Impl(SwView
* pShell
);
122 void SetShellMode(ShellMode eSet
);
124 css::view::XSelectionSupplier
* GetUNOObject();
125 SwXTextView
* GetUNOObject_Impl();
128 ShellMode
GetShellMode() const {return m_eShellMode
;}
130 void ExecuteScan(SfxRequest
& rReq
);
131 SwScannerEventListener
& GetScannerEventListener();
133 void AddClipboardListener();
135 void AddTransferable(SwTransferable
& rTransferable
);
137 void SetMailMergeConfigItem(std::shared_ptr
<SwMailMergeConfigItem
> const & rItem
)
139 m_xConfigItem
= rItem
;
141 std::shared_ptr
<SwMailMergeConfigItem
> const & GetMailMergeConfigItem() const {return m_xConfigItem
;}
143 //#i33307# restore editing position
144 void SetRestorePosition(const Point
& rCursorPos
, bool bSelectObj
)
146 m_aEditingPosition
= rCursorPos
;
147 m_bSelectObject
= bSelectObj
;
148 m_bEditingPositionSet
= true;
150 bool GetRestorePosition(Point
& rCursorPos
, bool& rbSelectObj
)
152 rCursorPos
= m_aEditingPosition
;
153 rbSelectObj
= m_bSelectObject
;
154 return m_bEditingPositionSet
;
157 void StartDocumentInserter(
158 const OUString
& rFactory
,
159 const Link
<sfx2::FileDialogHelper
*,void>& rEndDialogHdl
,
160 const sal_uInt16 nSlotId
162 std::unique_ptr
<SfxMedium
> CreateMedium();
163 void InitRequest( const SfxRequest
& rRequest
);
165 SfxRequest
* GetRequest() const { return m_pRequest
.get(); }
166 sal_Int16
GetParam() const { return m_nParam
; }
167 void SetParam( sal_Int16 nParam
) { m_nParam
= nParam
; }
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */