1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <com/sun/star/embed/XEmbeddedObject.hpp>
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>
36 namespace sfx2
{ class DocumentInserter
; }
37 namespace com
{ namespace sun
{ namespace star
{
39 class XDispatchProviderInterceptor
;
46 class SwScannerEventListener
: public ::cppu::WeakImplHelper1
<
47 ::com::sun::star::lang::XEventListener
>
53 SwScannerEventListener( SwView
& rView
) : pView( &rView
) {}
54 virtual ~SwScannerEventListener();
57 virtual void SAL_CALL
disposing(
58 const ::com::sun::star::lang::EventObject
& rEventObject
) throw(::com::sun::star::uno::RuntimeException
);
60 void ViewDestroyed() { pView
= 0; }
63 // --------------------------- Clipboard EventListener ------------------
64 class SwClipboardChangeListener
: public ::cppu::WeakImplHelper1
<
65 ::com::sun::star::datatransfer::clipboard::XClipboardListener
>
70 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& rEventObject
)
71 throw ( com::sun::star::uno::RuntimeException
);
74 virtual void SAL_CALL
changedContents( const ::com::sun::star::datatransfer::clipboard::ClipboardEvent
& rEventObject
)
75 throw ( com::sun::star::uno::RuntimeException
);
78 SwClipboardChangeListener( SwView
& rView
) : pView( &rView
) {}
79 virtual ~SwClipboardChangeListener();
81 void ViewDestroyed() { pView
= 0; }
83 void AddRemoveListener( sal_Bool bAdd
);
86 class SwMailMergeConfigItem
;
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
;
96 // temporary document for printing text of selection / multi selection
98 SfxObjectShellLock xTmpSelDocSh
;
101 SwScannerEventListener
* pScanEvtLstnr
;
102 SwClipboardChangeListener
* pClipEvtLstnr
;
103 ShellModes eShellMode
;
105 SwMailMergeConfigItem
* pConfigItem
;
106 sal_uInt16 nMailMergeRestartPage
;
107 sal_Bool bMailMergeSourceView
;
109 sfx2::DocumentInserter
* m_pDocInserter
;
110 SfxRequest
* m_pRequest
;
113 Point m_aEditingPosition
;
114 bool m_bSelectObject
;
115 bool m_bEditingPositionSet
;
118 SwView_Impl(SwView
* pShell
);
121 void SetShellMode(ShellModes eSet
);
123 ::com::sun::star::view::XSelectionSupplier
* GetUNOObject();
124 SwXTextView
* GetUNOObject_Impl();
127 ShellModes
GetShellMode() {return eShellMode
;}
129 void ExecuteScan(SfxRequest
& rReq
);
130 SwScannerEventListener
& GetScannerEventListener();
132 void AddClipboardListener();
134 SfxObjectShellLock
& GetTmpSelectionDoc() { return xTmpSelDocSh
; }
136 void AddTransferable(SwTransferable
& rTransferable
);
138 void SetMailMergeConfigItem(SwMailMergeConfigItem
* pItem
,
139 sal_uInt16 nRestart
, sal_Bool bIsSource
)
140 { pConfigItem
= pItem
;
141 nMailMergeRestartPage
= nRestart
;
142 bMailMergeSourceView
= bIsSource
;
144 SwMailMergeConfigItem
* GetMailMergeConfigItem() {return pConfigItem
;}
145 sal_uInt16
GetMailMergeRestartPage() const {return nMailMergeRestartPage
;}
146 sal_Bool
IsMailMergeSourceView() const { return bMailMergeSourceView
; }
148 //#i33307# restore editing position
149 void SetRestorePosition(const Point
& rCrsrPos
, bool bSelectObj
)
151 m_aEditingPosition
= rCrsrPos
;
152 m_bSelectObject
= bSelectObj
;
153 m_bEditingPositionSet
= true;
155 bool GetRestorePosition(Point
& rCrsrPos
, bool& rbSelectObj
)
157 rCrsrPos
= m_aEditingPosition
;
158 rbSelectObj
= m_bSelectObject
;
159 return m_bEditingPositionSet
;
163 void StartDocumentInserter( const String
& rFactory
, const Link
& rEndDialogHdl
);
164 SfxMedium
* CreateMedium();
165 void InitRequest( const SfxRequest
& rRequest
);
167 inline SfxRequest
* GetRequest() const { return m_pRequest
; }
168 inline sal_Int16
GetParam() const { return m_nParam
; }
169 inline void SetParam( sal_Int16 nParam
) { m_nParam
= nParam
; }
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */