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 _UIVWIMP_HXX
20 : #define _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> // helper for implementations
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);
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 );
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 :
77 : public:
78 0 : SwClipboardChangeListener( SwView& rView ) : pView( &rView ) {}
79 : virtual ~SwClipboardChangeListener();
80 :
81 0 : void ViewDestroyed() { pView = 0; }
82 :
83 : void AddRemoveListener( sal_Bool bAdd );
84 : };
85 :
86 : class SwMailMergeConfigItem;
87 :
88 : class SwView_Impl
89 : {
90 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > xScanEvtLstnr;
91 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > xClipEvtLstnr;
92 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > xDisProvInterceptor;
93 : ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier > *pxXTextView; // UNO object
94 : com::sun::star::uno::WeakReference< com::sun::star::lang::XUnoTunnel > xTransferable;
95 :
96 : // temporary document for printing text of selection / multi selection
97 : // in PDF export.
98 : SfxObjectShellLock xTmpSelDocSh;
99 :
100 : SwView* pView;
101 : SwScannerEventListener* pScanEvtLstnr;
102 : SwClipboardChangeListener* pClipEvtLstnr;
103 : ShellModes eShellMode;
104 :
105 : SwMailMergeConfigItem* pConfigItem;
106 : sal_uInt16 nMailMergeRestartPage;
107 : sal_Bool bMailMergeSourceView;
108 :
109 : sfx2::DocumentInserter* m_pDocInserter;
110 : SfxRequest* m_pRequest;
111 : sal_Int16 m_nParam;
112 :
113 : Point m_aEditingPosition;
114 : bool m_bSelectObject;
115 : bool m_bEditingPositionSet;
116 :
117 : public:
118 : SwView_Impl(SwView* pShell);
119 : ~SwView_Impl();
120 :
121 : void SetShellMode(ShellModes eSet);
122 :
123 : ::com::sun::star::view::XSelectionSupplier* GetUNOObject();
124 : SwXTextView* GetUNOObject_Impl();
125 : void Invalidate();
126 :
127 1 : ShellModes GetShellMode() {return eShellMode;}
128 :
129 : void ExecuteScan(SfxRequest& rReq);
130 : SwScannerEventListener& GetScannerEventListener();
131 :
132 : void AddClipboardListener();
133 :
134 : SfxObjectShellLock& GetTmpSelectionDoc() { return xTmpSelDocSh; }
135 :
136 : void AddTransferable(SwTransferable& rTransferable);
137 :
138 0 : void SetMailMergeConfigItem(SwMailMergeConfigItem* pItem,
139 : sal_uInt16 nRestart, sal_Bool bIsSource)
140 0 : { pConfigItem = pItem;
141 0 : nMailMergeRestartPage = nRestart;
142 0 : bMailMergeSourceView = bIsSource;
143 0 : }
144 594 : SwMailMergeConfigItem* GetMailMergeConfigItem() {return pConfigItem;}
145 0 : sal_uInt16 GetMailMergeRestartPage() const {return nMailMergeRestartPage;}
146 0 : sal_Bool IsMailMergeSourceView() const { return bMailMergeSourceView; }
147 :
148 : //#i33307# restore editing position
149 121 : void SetRestorePosition(const Point& rCrsrPos, bool bSelectObj)
150 : {
151 121 : m_aEditingPosition = rCrsrPos;
152 121 : m_bSelectObject = bSelectObj;
153 121 : m_bEditingPositionSet = true;
154 121 : }
155 0 : bool GetRestorePosition(Point& rCrsrPos, bool& rbSelectObj)
156 : {
157 0 : rCrsrPos = m_aEditingPosition;
158 0 : rbSelectObj = m_bSelectObject;
159 0 : return m_bEditingPositionSet;
160 : }
161 :
162 :
163 : void StartDocumentInserter( const String& 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: */
|