LibreOffice Module sw (master)  1
uivwimp.hxx
Go to the documentation of this file.
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 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_UIVWIMP_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_UIVWIMP_HXX
21 
22 #include <config_features.h>
23 
24 #include <view.hxx>
25 
26 #include <sfx2/objsh.hxx>
27 #include <com/sun/star/view/XSelectionSupplier.hpp>
28 #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
29 #include <cppuhelper/implbase.hxx>
30 #include <cppuhelper/weakref.hxx>
31 
32 class SwXTextView;
33 class SfxRequest;
34 class SwTransferable;
35 class SfxRequest;
36 
37 namespace sfx2 { class DocumentInserter; }
38 namespace com{ namespace sun{ namespace star {
39  namespace frame {
40  class XDispatchProviderInterceptor;
41  }
42  namespace lang {
43  class XUnoTunnel;
44  }
45 }}}
46 
47 class SwScannerEventListener : public ::cppu::WeakImplHelper<
48  css::lang::XEventListener >
49 {
51 
52 public:
53 
54  SwScannerEventListener( SwView& rView ) : pView( &rView ) {}
55  virtual ~SwScannerEventListener() override;
56 
57  // XEventListener
58  virtual void SAL_CALL disposing(
59  const css::lang::EventObject& rEventObject ) override;
60 
61  void ViewDestroyed() { pView = nullptr; }
62 };
63 
64 // Clipboard EventListener
65 class SwClipboardChangeListener : public ::cppu::WeakImplHelper<
66  css::datatransfer::clipboard::XClipboardListener >
67 {
69 
70  // XEventListener
71  virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) override;
72 
73  // XClipboardListener
74  virtual void SAL_CALL changedContents( const css::datatransfer::clipboard::ClipboardEvent& rEventObject ) override;
75 
76 public:
77  SwClipboardChangeListener( SwView& rView ) : pView( &rView ) {}
78  virtual ~SwClipboardChangeListener() override;
79 
80  void ViewDestroyed() { pView = nullptr; }
81 
82  void AddRemoveListener( bool bAdd );
83 };
84 
86 
88 {
89  css::uno::Reference< css::frame::XDispatchProviderInterceptor > xDisProvInterceptor;
90  css::uno::Reference< css::view::XSelectionSupplier > mxXTextView; // UNO object
91  std::vector< css::uno::WeakReference< css::lang::XUnoTunnel > > mxTransferables;
92 
93  // temporary document for printing text of selection / multi selection
94  // in PDF export.
96 
103 
104  std::shared_ptr<SwMailMergeConfigItem>
106 
107  std::unique_ptr<sfx2::DocumentInserter> m_pDocInserter;
108  std::unique_ptr<SfxRequest> m_pRequest;
109  sal_Int16 m_nParam;
110 
114 
115 public:
118 
119  SwView_Impl(SwView* pShell);
120  ~SwView_Impl();
121 
122  void SetShellMode(ShellMode eSet);
123 
124  css::view::XSelectionSupplier* GetUNOObject();
126  void Invalidate();
127 
129 
130  void ExecuteScan(SfxRequest& rReq);
132 
133  void AddClipboardListener();
134 
135  void AddTransferable(SwTransferable& rTransferable);
136 
137  void SetMailMergeConfigItem(std::shared_ptr<SwMailMergeConfigItem> const & rItem)
138  {
139  xConfigItem = rItem;
140  }
141  std::shared_ptr<SwMailMergeConfigItem> const & GetMailMergeConfigItem() {return xConfigItem;}
142 
143  //#i33307# restore editing position
144  void SetRestorePosition(const Point& rCursorPos, bool bSelectObj)
145  {
146  m_aEditingPosition = rCursorPos;
147  m_bSelectObject = bSelectObj;
148  m_bEditingPositionSet = true;
149  }
150  bool GetRestorePosition(Point& rCursorPos, bool& rbSelectObj)
151  {
152  rCursorPos = m_aEditingPosition;
153  rbSelectObj = m_bSelectObject;
154  return m_bEditingPositionSet;
155  }
156 
158  const OUString& rFactory,
159  const Link<sfx2::FileDialogHelper*,void>& rEndDialogHdl,
160  const sal_uInt16 nSlotId
161  );
162  std::unique_ptr<SfxMedium> CreateMedium();
163  void InitRequest( const SfxRequest& rRequest );
164 
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; }
168 };
169 #endif
170 
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Point m_aEditingPosition
Definition: uivwimp.hxx:111
ShellMode GetShellMode()
Definition: uivwimp.hxx:128
virtual ~SwScannerEventListener() override
Definition: uivwimp.cxx:275
SwXTextView * GetUNOObject_Impl()
Definition: uivwimp.cxx:104
void InitRequest(const SfxRequest &rRequest)
Definition: uivwimp.cxx:270
void ExecuteScan(SfxRequest &rReq)
Definition: uivwimp.cxx:110
std::vector< css::uno::WeakReference< css::lang::XUnoTunnel > > mxTransferables
Definition: uivwimp.hxx:91
std::shared_ptr< SwMailMergeConfigItem > const & GetMailMergeConfigItem()
Definition: uivwimp.hxx:141
std::shared_ptr< SwMailMergeConfigItem > xConfigItem
Definition: uivwimp.hxx:105
void AddRemoveListener(bool bAdd)
Definition: uivwimp.cxx:321
sal_Int16 GetParam() const
Definition: uivwimp.hxx:166
std::unique_ptr< sfx2::DocumentInserter > m_pDocInserter
Definition: uivwimp.hxx:107
void AddTransferable(SwTransferable &rTransferable)
Definition: uivwimp.cxx:225
void StartDocumentInserter(const OUString &rFactory, const Link< sfx2::FileDialogHelper *, void > &rEndDialogHdl, const sal_uInt16 nSlotId)
Definition: uivwimp.cxx:242
rtl::Reference< SwClipboardChangeListener > mxClipEvtLstnr
Definition: uivwimp.hxx:101
rtl::Reference< SwScannerEventListener > mxScanEvtLstnr
Definition: uivwimp.hxx:99
SwScannerEventListener(SwView &rView)
Definition: uivwimp.hxx:54
css::uno::Reference< css::frame::XDispatchProviderInterceptor > xDisProvInterceptor
Definition: uivwimp.hxx:89
ShellMode
Definition: view.hxx:87
virtual void SAL_CALL disposing(const css::lang::EventObject &rEventObject) override
Definition: uivwimp.cxx:279
void SetShellMode(ShellMode eSet)
Definition: uivwimp.cxx:94
bool m_bEditingPositionSet
Definition: uivwimp.hxx:113
std::unique_ptr< SfxRequest > m_pRequest
Definition: uivwimp.hxx:108
virtual ~SwClipboardChangeListener() override
Definition: uivwimp.cxx:288
sal_uInt16 & nParam
SfxRequest * GetRequest() const
Definition: uivwimp.hxx:165
virtual void SAL_CALL disposing(const css::lang::EventObject &rEventObject) override
Definition: uivwimp.cxx:292
virtual void SAL_CALL changedContents(const css::datatransfer::clipboard::ClipboardEvent &rEventObject) override
Definition: uivwimp.cxx:296
void SetRestorePosition(const Point &rCursorPos, bool bSelectObj)
Definition: uivwimp.hxx:144
OUString m_sRedlineAuthor
Redline author that's specific to this view.
Definition: uivwimp.hxx:117
void AddClipboardListener()
Definition: uivwimp.cxx:198
css::uno::Reference< css::view::XSelectionSupplier > mxXTextView
Definition: uivwimp.hxx:90
SfxObjectShellLock const xTmpSelDocSh
Definition: uivwimp.hxx:95
css::view::XSelectionSupplier * GetUNOObject()
Definition: uivwimp.cxx:99
void Invalidate()
Definition: uivwimp.cxx:207
SwScannerEventListener & GetScannerEventListener()
Definition: uivwimp.cxx:191
bool m_bSelectObject
Definition: uivwimp.hxx:112
void SetMailMergeConfigItem(std::shared_ptr< SwMailMergeConfigItem > const &rItem)
Definition: uivwimp.hxx:137
SwView_Impl(SwView *pShell)
Definition: uivwimp.cxx:54
sal_Int16 m_nParam
Definition: uivwimp.hxx:109
bool GetRestorePosition(Point &rCursorPos, bool &rbSelectObj)
Definition: uivwimp.hxx:150
ShellMode eShellMode
Definition: uivwimp.hxx:102
std::unique_ptr< SfxMedium > CreateMedium()
Definition: uivwimp.cxx:265
~SwView_Impl()
Definition: uivwimp.cxx:66
SwView * pView
Definition: uivwimp.hxx:97
Definition: view.hxx:146
SwClipboardChangeListener(SwView &rView)
Definition: uivwimp.hxx:77
void SetParam(sal_Int16 nParam)
Definition: uivwimp.hxx:167