Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _UIVWIMP_HXX
29 : : #define _UIVWIMP_HXX
30 : :
31 : : #include <com/sun/star/embed/XEmbeddedObject.hpp>
32 : : #include <view.hxx>
33 : :
34 : : #include <sfx2/objsh.hxx>
35 : : #include <com/sun/star/view/XSelectionSupplier.hpp>
36 : : #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
37 : : #include <cppuhelper/implbase1.hxx> // helper for implementations
38 : : #include <cppuhelper/weakref.hxx>
39 : :
40 : : class SwXTextView;
41 : : class SfxRequest;
42 : : class SwTransferable;
43 : : class SfxRequest;
44 : :
45 : : namespace sfx2 { class DocumentInserter; }
46 : : namespace com{ namespace sun{ namespace star {
47 : : namespace frame {
48 : : class XDispatchProviderInterceptor;
49 : : }
50 : : namespace lang {
51 : : class XUnoTunnel;
52 : : }
53 : : }}}
54 : :
55 : : class SwScannerEventListener : public ::cppu::WeakImplHelper1<
56 : : ::com::sun::star::lang::XEventListener >
57 : : {
58 : : SwView* pView;
59 : :
60 : : public:
61 : :
62 : 0 : SwScannerEventListener( SwView& rView ) : pView( &rView ) {}
63 : : virtual ~SwScannerEventListener();
64 : :
65 : : // XEventListener
66 : : virtual void SAL_CALL disposing(
67 : : const ::com::sun::star::lang::EventObject& rEventObject ) throw(::com::sun::star::uno::RuntimeException);
68 : :
69 : 0 : void ViewDestroyed() { pView = 0; }
70 : : };
71 : :
72 : : // --------------------------- Clipboard EventListener ------------------
73 : : class SwClipboardChangeListener : public ::cppu::WeakImplHelper1<
74 : : ::com::sun::star::datatransfer::clipboard::XClipboardListener >
75 : : {
76 : : SwView* pView;
77 : :
78 : : // XEventListener
79 : : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rEventObject )
80 : : throw ( com::sun::star::uno::RuntimeException );
81 : :
82 : : // XClipboardListener
83 : : virtual void SAL_CALL changedContents( const ::com::sun::star::datatransfer::clipboard::ClipboardEvent& rEventObject )
84 : : throw ( com::sun::star::uno::RuntimeException );
85 : :
86 : : public:
87 : 747 : SwClipboardChangeListener( SwView& rView ) : pView( &rView ) {}
88 : : virtual ~SwClipboardChangeListener();
89 : :
90 : 747 : void ViewDestroyed() { pView = 0; }
91 : :
92 : : void AddRemoveListener( sal_Bool bAdd );
93 : : };
94 : :
95 : : class SwMailMergeConfigItem;
96 : :
97 : : class SwView_Impl
98 : : {
99 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > xScanEvtLstnr;
100 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > xClipEvtLstnr;
101 : : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > xDisProvInterceptor;
102 : : ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier > *pxXTextView; // UNO object
103 : : com::sun::star::uno::WeakReference< com::sun::star::lang::XUnoTunnel > xTransferable;
104 : :
105 : : // temporary document for printing text of selection / multi selection
106 : : // in PDF export.
107 : : SfxObjectShellLock xTmpSelDocSh;
108 : :
109 : : SwView* pView;
110 : : SwScannerEventListener* pScanEvtLstnr;
111 : : SwClipboardChangeListener* pClipEvtLstnr;
112 : : ShellModes eShellMode;
113 : :
114 : : SwMailMergeConfigItem* pConfigItem;
115 : : sal_uInt16 nMailMergeRestartPage;
116 : : sal_Bool bMailMergeSourceView;
117 : :
118 : : sfx2::DocumentInserter* m_pDocInserter;
119 : : SfxRequest* m_pRequest;
120 : : sal_Int16 m_nParam;
121 : :
122 : : Point m_aEditingPosition;
123 : : bool m_bSelectObject;
124 : : bool m_bEditingPositionSet;
125 : :
126 : : public:
127 : : SwView_Impl(SwView* pShell);
128 : : ~SwView_Impl();
129 : :
130 : : void SetShellMode(ShellModes eSet);
131 : :
132 : : ::com::sun::star::view::XSelectionSupplier* GetUNOObject();
133 : : SwXTextView* GetUNOObject_Impl();
134 : : void Invalidate();
135 : :
136 : 9638 : ShellModes GetShellMode() {return eShellMode;}
137 : :
138 : : void ExecuteScan(SfxRequest& rReq);
139 : : SwScannerEventListener& GetScannerEventListener();
140 : :
141 : : void AddClipboardListener();
142 : :
143 : : SfxObjectShellLock& GetTmpSelectionDoc() { return xTmpSelDocSh; }
144 : :
145 : : void AddTransferable(SwTransferable& rTransferable);
146 : :
147 : 0 : void SetMailMergeConfigItem(SwMailMergeConfigItem* pItem,
148 : : sal_uInt16 nRestart, sal_Bool bIsSource)
149 : 0 : { pConfigItem = pItem;
150 : 0 : nMailMergeRestartPage = nRestart;
151 : 0 : bMailMergeSourceView = bIsSource;
152 : 0 : }
153 : 3673 : SwMailMergeConfigItem* GetMailMergeConfigItem() {return pConfigItem;}
154 : 0 : sal_uInt16 GetMailMergeRestartPage() const {return nMailMergeRestartPage;}
155 : 0 : sal_Bool IsMailMergeSourceView() const { return bMailMergeSourceView; }
156 : :
157 : : //#i33307# restore editing position
158 : 1061 : void SetRestorePosition(const Point& rCrsrPos, bool bSelectObj)
159 : : {
160 : 1061 : m_aEditingPosition = rCrsrPos;
161 : 1061 : m_bSelectObject = bSelectObj;
162 : 1061 : m_bEditingPositionSet = true;
163 : 1061 : }
164 : 0 : bool GetRestorePosition(Point& rCrsrPos, bool& rbSelectObj)
165 : : {
166 : 0 : rCrsrPos = m_aEditingPosition;
167 : 0 : rbSelectObj = m_bSelectObject;
168 : 0 : return m_bEditingPositionSet;
169 : : }
170 : :
171 : :
172 : : void StartDocumentInserter( const String& rFactory, const Link& rEndDialogHdl );
173 : : SfxMedium* CreateMedium();
174 : : void InitRequest( const SfxRequest& rRequest );
175 : :
176 : 0 : inline SfxRequest* GetRequest() const { return m_pRequest; }
177 : 0 : inline sal_Int16 GetParam() const { return m_nParam; }
178 : 0 : inline void SetParam( sal_Int16 nParam ) { m_nParam = nParam; }
179 : : };
180 : : #endif
181 : :
182 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|