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