Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / uibase / inc / uivwimp.hxx
blobcbdfb18c7fc93688dfbb30e068c5f86620c10321
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_UIVWIMP_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_UIVWIMP_HXX
22 #include <view.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>
31 class SwXTextView;
32 class SfxRequest;
33 class SwTransferable;
34 class SfxRequest;
36 namespace sfx2 { class DocumentInserter; }
37 namespace com::sun::star {
38 namespace frame {
39 class XDispatchProviderInterceptor;
41 namespace lang {
42 class XUnoTunnel;
46 class SwScannerEventListener final : public ::cppu::WeakImplHelper<
47 css::lang::XEventListener >
49 SwView* m_pView;
51 public:
53 SwScannerEventListener( SwView& rView ) : m_pView( &rView ) {}
54 virtual ~SwScannerEventListener() override;
56 // XEventListener
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 >
67 SwView* m_pView;
69 // XEventListener
70 virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) override;
72 // XClipboardListener
73 virtual void SAL_CALL changedContents( const css::datatransfer::clipboard::ClipboardEvent& rEventObject ) override;
75 public:
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;
87 class SwView_Impl
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
94 // in PDF export.
95 SfxObjectShellLock m_xTmpSelDocShell;
97 SwView* m_pView;
98 rtl::Reference<SwScannerEventListener>
99 mxScanEvtLstnr;
100 rtl::Reference<SwClipboardChangeListener>
101 mxClipEvtLstnr;
102 ShellMode m_eShellMode;
104 std::shared_ptr<SwMailMergeConfigItem>
105 m_xConfigItem;
107 std::unique_ptr<sfx2::DocumentInserter> m_pDocInserter;
108 std::unique_ptr<SfxRequest> m_pRequest;
109 sal_Int16 m_nParam;
111 Point m_aEditingPosition;
112 bool m_bSelectObject;
113 bool m_bEditingPositionSet;
115 public:
116 /// Redline author that's specific to this view.
117 OUString m_sRedlineAuthor;
119 SwView_Impl(SwView* pShell);
120 ~SwView_Impl();
122 void SetShellMode(ShellMode eSet);
124 css::view::XSelectionSupplier* GetUNOObject();
125 SwXTextView* GetUNOObject_Impl();
126 void Invalidate();
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; }
169 #endif
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */