Line data Source code
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 <com/sun/star/embed/XEmbeddedObject.hpp>
25 : #include <view.hxx>
26 :
27 : #include <sfx2/objsh.hxx>
28 : #include <com/sun/star/view/XSelectionSupplier.hpp>
29 : #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
30 : #include <cppuhelper/implbase1.hxx>
31 : #include <cppuhelper/weakref.hxx>
32 :
33 : class SwXTextView;
34 : class SfxRequest;
35 : class SwTransferable;
36 : class SfxRequest;
37 :
38 : namespace sfx2 { class DocumentInserter; }
39 : namespace com{ namespace sun{ namespace star {
40 : namespace frame {
41 : class XDispatchProviderInterceptor;
42 : }
43 : namespace lang {
44 : class XUnoTunnel;
45 : }
46 : }}}
47 :
48 : class SwScannerEventListener : public ::cppu::WeakImplHelper1<
49 : ::com::sun::star::lang::XEventListener >
50 : {
51 : SwView* pView;
52 :
53 : public:
54 :
55 0 : SwScannerEventListener( SwView& rView ) : pView( &rView ) {}
56 : virtual ~SwScannerEventListener();
57 :
58 : // XEventListener
59 : virtual void SAL_CALL disposing(
60 : const ::com::sun::star::lang::EventObject& rEventObject ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
61 :
62 0 : void ViewDestroyed() { pView = 0; }
63 : };
64 :
65 : // Clipboard EventListener
66 : class SwClipboardChangeListener : public ::cppu::WeakImplHelper1<
67 : ::com::sun::star::datatransfer::clipboard::XClipboardListener >
68 : {
69 : SwView* pView;
70 :
71 : // XEventListener
72 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rEventObject )
73 : throw ( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
74 :
75 : // XClipboardListener
76 : virtual void SAL_CALL changedContents( const ::com::sun::star::datatransfer::clipboard::ClipboardEvent& rEventObject )
77 : throw (com::sun::star::uno::RuntimeException,
78 : std::exception) SAL_OVERRIDE;
79 :
80 : public:
81 714 : SwClipboardChangeListener( SwView& rView ) : pView( &rView ) {}
82 : virtual ~SwClipboardChangeListener();
83 :
84 714 : void ViewDestroyed() { pView = 0; }
85 :
86 : void AddRemoveListener( bool bAdd );
87 : };
88 :
89 : class SwMailMergeConfigItem;
90 :
91 : class SwView_Impl
92 : {
93 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > xScanEvtLstnr;
94 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > xClipEvtLstnr;
95 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > xDisProvInterceptor;
96 : ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier > *pxXTextView; // UNO object
97 : com::sun::star::uno::WeakReference< com::sun::star::lang::XUnoTunnel > xTransferable;
98 :
99 : // temporary document for printing text of selection / multi selection
100 : // in PDF export.
101 : SfxObjectShellLock xTmpSelDocSh;
102 :
103 : SwView* pView;
104 : SwScannerEventListener* pScanEvtLstnr;
105 : SwClipboardChangeListener* pClipEvtLstnr;
106 : ShellModes eShellMode;
107 :
108 : #if HAVE_FEATURE_DBCONNECTIVITY
109 : SwMailMergeConfigItem* pConfigItem;
110 : sal_uInt16 nMailMergeRestartPage;
111 : bool bMailMergeSourceView;
112 : #endif
113 :
114 : sfx2::DocumentInserter* m_pDocInserter;
115 : SfxRequest* m_pRequest;
116 : sal_Int16 m_nParam;
117 :
118 : Point m_aEditingPosition;
119 : bool m_bSelectObject;
120 : bool m_bEditingPositionSet;
121 :
122 : public:
123 : SwView_Impl(SwView* pShell);
124 : ~SwView_Impl();
125 :
126 : void SetShellMode(ShellModes eSet);
127 :
128 : ::com::sun::star::view::XSelectionSupplier* GetUNOObject();
129 : SwXTextView* GetUNOObject_Impl();
130 : void Invalidate();
131 :
132 8308 : ShellModes GetShellMode() {return eShellMode;}
133 :
134 : void ExecuteScan(SfxRequest& rReq);
135 : SwScannerEventListener& GetScannerEventListener();
136 :
137 : void AddClipboardListener();
138 :
139 : SfxObjectShellLock& GetTmpSelectionDoc() { return xTmpSelDocSh; }
140 :
141 : void AddTransferable(SwTransferable& rTransferable);
142 :
143 : #if HAVE_FEATURE_DBCONNECTIVITY
144 0 : void SetMailMergeConfigItem(SwMailMergeConfigItem* pItem,
145 : sal_uInt16 nRestart, bool bIsSource)
146 0 : { pConfigItem = pItem;
147 0 : nMailMergeRestartPage = nRestart;
148 0 : bMailMergeSourceView = bIsSource;
149 0 : }
150 10274 : SwMailMergeConfigItem* GetMailMergeConfigItem() {return pConfigItem;}
151 0 : sal_uInt16 GetMailMergeRestartPage() const {return nMailMergeRestartPage;}
152 0 : bool IsMailMergeSourceView() const { return bMailMergeSourceView; }
153 : #endif
154 :
155 : //#i33307# restore editing position
156 1684 : void SetRestorePosition(const Point& rCrsrPos, bool bSelectObj)
157 : {
158 1684 : m_aEditingPosition = rCrsrPos;
159 1684 : m_bSelectObject = bSelectObj;
160 1684 : m_bEditingPositionSet = true;
161 1684 : }
162 0 : bool GetRestorePosition(Point& rCrsrPos, bool& rbSelectObj)
163 : {
164 0 : rCrsrPos = m_aEditingPosition;
165 0 : rbSelectObj = m_bSelectObject;
166 0 : return m_bEditingPositionSet;
167 : }
168 :
169 : void StartDocumentInserter( const OUString& rFactory, const Link& rEndDialogHdl );
170 : SfxMedium* CreateMedium();
171 : void InitRequest( const SfxRequest& rRequest );
172 :
173 0 : inline SfxRequest* GetRequest() const { return m_pRequest; }
174 0 : inline sal_Int16 GetParam() const { return m_nParam; }
175 0 : inline void SetParam( sal_Int16 nParam ) { m_nParam = nParam; }
176 : };
177 : #endif
178 :
179 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|