xref: /aoo41x/main/sw/source/ui/inc/uivwimp.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _UIVWIMP_HXX
24 #define _UIVWIMP_HXX
25 
26 #include <com/sun/star/embed/XEmbeddedObject.hpp>
27 #include <view.hxx>
28 
29 #include <sfx2/objsh.hxx>
30 #include <com/sun/star/view/XSelectionSupplier.hpp>
31 #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
32 #include <cppuhelper/implbase1.hxx>	// helper for implementations
33 #include <swunodef.hxx>
34 #include <cppuhelper/weakref.hxx>
35 
36 class SwXTextView;
37 class SfxRequest;
38 class SwTransferable;
39 class SfxRequest;
40 
41 namespace sfx2 { class DocumentInserter; }
42 namespace com{ namespace sun{ namespace star {
43 	namespace frame {
44 		class XDispatchProviderInterceptor;
45 	}
46     namespace lang {
47         class XUnoTunnel;
48     }
49 }}}
50 
51 /* -----------------------------29.05.00 08:22--------------------------------
52 
53  ---------------------------------------------------------------------------*/
54 class SwScannerEventListener : public ::cppu::WeakImplHelper1<
55 	STAR_NMSPC::lang::XEventListener >
56 {
57 	SwView*	pView;
58 
59 public:
60 
SwScannerEventListener(SwView & rView)61 	SwScannerEventListener( SwView& rView ) : pView( &rView )  {}
62 	virtual ~SwScannerEventListener();
63 
64 	// XEventListener
65 	virtual void SAL_CALL disposing(
66 					const ::com::sun::star::lang::EventObject& rEventObject ) throw(::com::sun::star::uno::RuntimeException);
67 
ViewDestroyed()68 	void ViewDestroyed() { pView = 0; }
69 };
70 
71 // --------------------------- Clipboard EventListener ------------------
72 
73 class SwClipboardChangeListener : public ::cppu::WeakImplHelper1<
74 	CLIP_NMSPC::XClipboardListener >
75 {
76 	SwView*	pView;
77 
78 	// XEventListener
79 	virtual void SAL_CALL disposing( const STAR_NMSPC::lang::EventObject& rEventObject )
80 		throw ( com::sun::star::uno::RuntimeException );
81 
82 	// XClipboardListener
83 	virtual void SAL_CALL changedContents( const CLIP_NMSPC::ClipboardEvent& rEventObject )
84 		throw ( com::sun::star::uno::RuntimeException );
85 
86 public:
SwClipboardChangeListener(SwView & rView)87 	SwClipboardChangeListener( SwView& rView ) : pView( &rView ) {}
88 	virtual	~SwClipboardChangeListener();
89 
ViewDestroyed()90 	void ViewDestroyed() { pView = 0; }
91 
92 	void AddRemoveListener( sal_Bool bAdd );
93 };
94 
95 
96 /* ---------------------------------------------------------------------------
97 
98  ---------------------------------------------------------------------------*/
99 class SwMailMergeConfigItem;
100 class SwView_Impl
101 {
102 	STAR_REFERENCE( lang::XEventListener ) 	xScanEvtLstnr;
103 	STAR_REFERENCE( lang::XEventListener ) 	xClipEvtLstnr;
104 	STAR_REFERENCE( frame::XDispatchProviderInterceptor )	xDisProvInterceptor;
105 	STAR_REFERENCE( view::XSelectionSupplier ) 				*pxXTextView;		// UNO object
106     com::sun::star::uno::WeakReference< com::sun::star::lang::XUnoTunnel > xTransferable;
107 
108     // temporary document for printing text of selection / multi selection
109     // in PDF export.
110     SfxObjectShellLock           xTmpSelDocSh;
111 
112     SwView* pView;
113 	SwScannerEventListener* 	pScanEvtLstnr;
114 	SwClipboardChangeListener*	pClipEvtLstnr;
115 	ShellModes 					eShellMode;
116 
117     SwMailMergeConfigItem*      pConfigItem;
118     sal_uInt16                  nMailMergeRestartPage;
119     sal_Bool                    bMailMergeSourceView;
120 
121     sfx2::DocumentInserter*     m_pDocInserter;
122     SfxRequest*                 m_pRequest;
123     sal_Int16                   m_nParam;
124 
125     Point                       m_aEditingPosition;
126     bool                        m_bSelectObject;
127     bool                        m_bEditingPositionSet;
128 
129 public:
130 	SwView_Impl(SwView* pShell);
131 	~SwView_Impl();
132 
133 	void							SetShellMode(ShellModes eSet);
134 
135 	::com::sun::star::view::XSelectionSupplier* GetUNOObject();
136 	SwXTextView*					GetUNOObject_Impl();
137     void                            Invalidate();
138 
GetShellMode()139 	ShellModes						GetShellMode() {return eShellMode;}
140 
141     void                            ExecuteScan(SfxRequest& rReq);
142 	SwScannerEventListener& 		GetScannerEventListener();
143 
144 	void 							AddClipboardListener();
145 
GetTmpSelectionDoc()146     SfxObjectShellLock&             GetTmpSelectionDoc()    { return xTmpSelDocSh; }
147 
148     void                            AddTransferable(SwTransferable& rTransferable);
149 
SetMailMergeConfigItem(SwMailMergeConfigItem * pItem,sal_uInt16 nRestart,sal_Bool bIsSource)150     void   SetMailMergeConfigItem(SwMailMergeConfigItem*  pItem,
151                                                 sal_uInt16 nRestart, sal_Bool bIsSource)
152                             {   pConfigItem = pItem;
153                                 nMailMergeRestartPage = nRestart;
154                                 bMailMergeSourceView = bIsSource;
155                             }
GetMailMergeConfigItem()156     SwMailMergeConfigItem*  GetMailMergeConfigItem() {return pConfigItem;}
GetMailMergeRestartPage() const157     sal_uInt16              GetMailMergeRestartPage() const {return nMailMergeRestartPage;}
IsMailMergeSourceView() const158     sal_Bool                IsMailMergeSourceView() const { return bMailMergeSourceView;  }
159 
160     //#i33307# restore editing position
SetRestorePosition(const Point & rCrsrPos,bool bSelectObj)161     void                    SetRestorePosition(const Point& rCrsrPos, bool bSelectObj)
162                             {
163                                 m_aEditingPosition = rCrsrPos;
164                                 m_bSelectObject = bSelectObj;
165                                 m_bEditingPositionSet = true;
166                             }
GetRestorePosition(Point & rCrsrPos,bool & rbSelectObj)167     bool                    GetRestorePosition(Point& rCrsrPos, bool& rbSelectObj)
168                             {
169                                 rCrsrPos = m_aEditingPosition;
170                                 rbSelectObj = m_bSelectObject;
171                                 return m_bEditingPositionSet;
172                             }
173 
174 
175     void                    StartDocumentInserter( const String& rFactory, const Link& rEndDialogHdl );
176     SfxMedium*              CreateMedium();
177     void                    InitRequest( const SfxRequest& rRequest );
178 
GetRequest() const179     inline SfxRequest*      GetRequest() const { return m_pRequest; }
GetParam() const180     inline sal_Int16        GetParam() const { return m_nParam; }
SetParam(sal_Int16 nParam)181     inline void             SetParam( sal_Int16 nParam ) { m_nParam = nParam; }
182 };
183 #endif
184 
185