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