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