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 ); 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 81 // XClipboardListener 82 virtual void SAL_CALL changedContents( const CLIP_NMSPC::ClipboardEvent& rEventObject ); 83 84 public: SwClipboardChangeListener(SwView & rView)85 SwClipboardChangeListener( SwView& rView ) : pView( &rView ) {} 86 virtual ~SwClipboardChangeListener(); 87 ViewDestroyed()88 void ViewDestroyed() { pView = 0; } 89 90 void AddRemoveListener( sal_Bool bAdd ); 91 }; 92 93 94 /* --------------------------------------------------------------------------- 95 96 ---------------------------------------------------------------------------*/ 97 class SwMailMergeConfigItem; 98 class SwView_Impl 99 { 100 STAR_REFERENCE( lang::XEventListener ) xScanEvtLstnr; 101 STAR_REFERENCE( lang::XEventListener ) xClipEvtLstnr; 102 STAR_REFERENCE( frame::XDispatchProviderInterceptor ) xDisProvInterceptor; 103 STAR_REFERENCE( view::XSelectionSupplier ) *pxXTextView; // UNO object 104 com::sun::star::uno::WeakReference< com::sun::star::lang::XUnoTunnel > xTransferable; 105 106 // temporary document for printing text of selection / multi selection 107 // in PDF export. 108 SfxObjectShellLock xTmpSelDocSh; 109 110 SwView* pView; 111 SwScannerEventListener* pScanEvtLstnr; 112 SwClipboardChangeListener* pClipEvtLstnr; 113 ShellModes eShellMode; 114 115 SwMailMergeConfigItem* pConfigItem; 116 sal_uInt16 nMailMergeRestartPage; 117 sal_Bool bMailMergeSourceView; 118 119 sfx2::DocumentInserter* m_pDocInserter; 120 SfxRequest* m_pRequest; 121 sal_Int16 m_nParam; 122 123 Point m_aEditingPosition; 124 bool m_bSelectObject; 125 bool m_bEditingPositionSet; 126 127 public: 128 SwView_Impl(SwView* pShell); 129 ~SwView_Impl(); 130 131 void SetShellMode(ShellModes eSet); 132 133 ::com::sun::star::view::XSelectionSupplier* GetUNOObject(); 134 SwXTextView* GetUNOObject_Impl(); 135 void Invalidate(); 136 GetShellMode()137 ShellModes GetShellMode() {return eShellMode;} 138 139 void ExecuteScan(SfxRequest& rReq); 140 SwScannerEventListener& GetScannerEventListener(); 141 142 void AddClipboardListener(); 143 GetTmpSelectionDoc()144 SfxObjectShellLock& GetTmpSelectionDoc() { return xTmpSelDocSh; } 145 146 void AddTransferable(SwTransferable& rTransferable); 147 SetMailMergeConfigItem(SwMailMergeConfigItem * pItem,sal_uInt16 nRestart,sal_Bool bIsSource)148 void SetMailMergeConfigItem(SwMailMergeConfigItem* pItem, 149 sal_uInt16 nRestart, sal_Bool bIsSource) 150 { pConfigItem = pItem; 151 nMailMergeRestartPage = nRestart; 152 bMailMergeSourceView = bIsSource; 153 } GetMailMergeConfigItem()154 SwMailMergeConfigItem* GetMailMergeConfigItem() {return pConfigItem;} GetMailMergeRestartPage() const155 sal_uInt16 GetMailMergeRestartPage() const {return nMailMergeRestartPage;} IsMailMergeSourceView() const156 sal_Bool IsMailMergeSourceView() const { return bMailMergeSourceView; } 157 158 //#i33307# restore editing position SetRestorePosition(const Point & rCrsrPos,bool bSelectObj)159 void SetRestorePosition(const Point& rCrsrPos, bool bSelectObj) 160 { 161 m_aEditingPosition = rCrsrPos; 162 m_bSelectObject = bSelectObj; 163 m_bEditingPositionSet = true; 164 } GetRestorePosition(Point & rCrsrPos,bool & rbSelectObj)165 bool GetRestorePosition(Point& rCrsrPos, bool& rbSelectObj) 166 { 167 rCrsrPos = m_aEditingPosition; 168 rbSelectObj = m_bSelectObject; 169 return m_bEditingPositionSet; 170 } 171 172 173 void StartDocumentInserter( const String& rFactory, const Link& rEndDialogHdl ); 174 SfxMedium* CreateMedium(); 175 void InitRequest( const SfxRequest& rRequest ); 176 GetRequest() const177 inline SfxRequest* GetRequest() const { return m_pRequest; } GetParam() const178 inline sal_Int16 GetParam() const { return m_nParam; } SetParam(sal_Int16 nParam)179 inline void SetParam( sal_Int16 nParam ) { m_nParam = nParam; } 180 }; 181 #endif 182