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