1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: uivwimp.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #include <com/sun/star/embed/XEmbeddedObject.hpp>
36 #include <sfx2/objsh.hxx>
37 #include <com/sun/star/view/XSelectionSupplier.hpp>
38 #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
39 #include <cppuhelper/implbase1.hxx> // helper for implementations
40 #include <swunodef.hxx>
41 #include <cppuhelper/weakref.hxx>
48 namespace sfx2
{ class DocumentInserter
; }
49 namespace com
{ namespace sun
{ namespace star
{
51 class XDispatchProviderInterceptor
;
58 /* -----------------------------29.05.00 08:22--------------------------------
60 ---------------------------------------------------------------------------*/
61 class SwScannerEventListener
: public ::cppu::WeakImplHelper1
<
62 STAR_NMSPC::lang::XEventListener
>
68 SwScannerEventListener( SwView
& rView
) : pView( &rView
) {}
69 virtual ~SwScannerEventListener();
72 virtual void SAL_CALL
disposing(
73 const ::com::sun::star::lang::EventObject
& rEventObject
) throw(::com::sun::star::uno::RuntimeException
);
75 void ViewDestroyed() { pView
= 0; }
78 // --------------------------- Clipboard EventListener ------------------
80 class SwClipboardChangeListener
: public ::cppu::WeakImplHelper1
<
81 CLIP_NMSPC::XClipboardListener
>
86 virtual void SAL_CALL
disposing( const STAR_NMSPC::lang::EventObject
& rEventObject
)
87 throw ( com::sun::star::uno::RuntimeException
);
90 virtual void SAL_CALL
changedContents( const CLIP_NMSPC::ClipboardEvent
& rEventObject
)
91 throw ( com::sun::star::uno::RuntimeException
);
94 SwClipboardChangeListener( SwView
& rView
) : pView( &rView
) {}
95 virtual ~SwClipboardChangeListener();
97 void ViewDestroyed() { pView
= 0; }
99 void AddRemoveListener( BOOL bAdd
);
103 /* ---------------------------------------------------------------------------
105 ---------------------------------------------------------------------------*/
106 class SwMailMergeConfigItem
;
109 STAR_REFERENCE( lang::XEventListener
) xScanEvtLstnr
;
110 STAR_REFERENCE( lang::XEventListener
) xClipEvtLstnr
;
111 STAR_REFERENCE( frame::XDispatchProviderInterceptor
) xDisProvInterceptor
;
112 STAR_REFERENCE( view::XSelectionSupplier
) *pxXTextView
; // UNO object
113 com::sun::star::uno::WeakReference
< com::sun::star::lang::XUnoTunnel
> xTransferable
;
115 // temporary document for printing text of selection / multi selection
117 SfxObjectShellRef xTmpSelDocSh
;
118 SfxObjectShellRef aEmbeddedObjRef
;
121 SwScannerEventListener
* pScanEvtLstnr
;
122 SwClipboardChangeListener
* pClipEvtLstnr
;
123 ShellModes eShellMode
;
125 SwMailMergeConfigItem
* pConfigItem
;
126 sal_uInt16 nMailMergeRestartPage
;
127 sal_Bool bMailMergeSourceView
;
129 sfx2::DocumentInserter
* m_pDocInserter
;
130 SfxRequest
* m_pRequest
;
133 Point m_aEditingPosition
;
134 bool m_bSelectObject
;
135 bool m_bEditingPositionSet
;
138 SwView_Impl(SwView
* pShell
);
141 void SetShellMode(ShellModes eSet
);
143 ::com::sun::star::view::XSelectionSupplier
* GetUNOObject();
144 SwXTextView
* GetUNOObject_Impl();
147 ShellModes
GetShellMode() {return eShellMode
;}
149 void ExecuteScan(SfxRequest
& rReq
);
150 SwScannerEventListener
& GetScannerEventListener();
152 void AddClipboardListener();
154 SfxObjectShellRef
& GetTmpSelectionDoc() { return xTmpSelDocSh
; }
156 SfxObjectShellRef
& GetEmbeddedObjRef() { return *boost::addressof(aEmbeddedObjRef
); }
158 void AddTransferable(SwTransferable
& rTransferable
);
160 void SetMailMergeConfigItem(SwMailMergeConfigItem
* pItem
,
161 sal_uInt16 nRestart
, sal_Bool bIsSource
)
162 { pConfigItem
= pItem
;
163 nMailMergeRestartPage
= nRestart
;
164 bMailMergeSourceView
= bIsSource
;
166 SwMailMergeConfigItem
* GetMailMergeConfigItem() {return pConfigItem
;}
167 sal_uInt16
GetMailMergeRestartPage() const {return nMailMergeRestartPage
;}
168 sal_Bool
IsMailMergeSourceView() const { return bMailMergeSourceView
; }
170 //#i33307# restore editing position
171 void SetRestorePosition(const Point
& rCrsrPos
, bool bSelectObj
)
173 m_aEditingPosition
= rCrsrPos
;
174 m_bSelectObject
= bSelectObj
;
175 m_bEditingPositionSet
= true;
177 bool GetRestorePosition(Point
& rCrsrPos
, bool& rbSelectObj
)
179 rCrsrPos
= m_aEditingPosition
;
180 rbSelectObj
= m_bSelectObject
;
181 return m_bEditingPositionSet
;
185 void StartDocumentInserter( const String
& rFactory
, const Link
& rEndDialogHdl
);
186 SfxMedium
* CreateMedium();
187 void InitRequest( const SfxRequest
& rRequest
);
189 inline SfxRequest
* GetRequest() const { return m_pRequest
; }
190 inline sal_Int16
GetParam() const { return m_nParam
; }
191 inline void SetParam( sal_Int16 nParam
) { m_nParam
= nParam
; }