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