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 _CHART2_DRAW_VIEW_WRAPPER_HXX
28 #define _CHART2_DRAW_VIEW_WRAPPER_HXX
29 
30 #include <svx/view3d.hxx>
31 #include <com/sun/star/drawing/XShape.hpp>
32 #include <com/sun/star/frame/XModel.hpp>
33 
34 class SdrModel;
35 
36 //.............................................................................
37 namespace chart
38 {
39 //.............................................................................
40 
41 //-----------------------------------------------------------------------------
42 /** The DrawViewWrapper should help us to reduce effort if the underlying DrawingLayer changes.
43 Another task is to hide functionality we do not need, for example more than one page.
44 */
45 
46 class MarkHandleProvider
47 {
48 public:
49     virtual bool getMarkHandles( SdrHdlList& rHdlList ) =0;
50     virtual bool getFrameDragSingles() =0;
51 };
52 
53 class DrawViewWrapper : public E3dView
54 {
55 public:
56 	DrawViewWrapper(SdrModel* pModel, OutputDevice* pOut, bool bPaintPageForEditMode);
57 	virtual ~DrawViewWrapper();
58 
59     //triggers the use of an updated first page
60     void    ReInit();
61 
62     /// tries to get an OutputDevice from the XParent of the model to use as reference device
63     void attachParentReferenceDevice(
64         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel );
65 
66     //fill list of selection handles 'aHdl'
67     virtual void SetMarkHandles();
68 
69     SdrPageView*    GetPageView() const;
70 
71     SdrObject* getHitObject( const Point& rPnt ) const;
72     //sal_Bool PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uLong nOptions, SdrObject** ppRootObj, sal_uLong* pnMarkNum=NULL, sal_uInt16* pnPassNum=NULL) const;
73     //sal_Bool PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uLong nOptions=0) const;
74     //sal_Bool PickObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uLong nOptions=0) const { return PickObj(rPnt,nHitTolLog,rpObj,rpPV,nOptions); }
75 
76     //void MarkObj(SdrObject* pObj, SdrPageView* pPV, sal_Bool bUnmark=sal_False, sal_Bool bImpNoSetMarkHdl=sal_False);
77     void MarkObject( SdrObject* pObj );
78 
79     //----------------------
80     //pMarkHandleProvider can be NULL; ownership is not taken
81     void setMarkHandleProvider( MarkHandleProvider* pMarkHandleProvider );
82     void CompleteRedraw(OutputDevice* pOut, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0);
83 
84     SdrObject*   getSelectedObject() const;
85     SdrObject*   getTextEditObject() const;
86     SdrOutliner* getOutliner() const;
87 
88     SfxItemSet   getPositionAndSizeItemSetFromMarkedObject() const;
89 
90     SdrObject* getNamedSdrObject( const rtl::OUString& rName ) const;
91     bool IsObjectHit( SdrObject* pObj, const Point& rPnt ) const;
92 
93     virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
94 
95     static SdrObject* getSdrObject( const ::com::sun::star::uno::Reference<
96                     ::com::sun::star::drawing::XShape >& xShape );
97 
98 private:
99     mutable MarkHandleProvider*     m_pMarkHandleProvider;
100 
101     ::std::auto_ptr< SdrOutliner >  m_apOutliner;
102 
103     // #i79965# scroll back view when ending text edit
104     bool m_bRestoreMapMode;
105     MapMode m_aMapModeToRestore;
106 };
107 
108 //.............................................................................
109 } //namespace chart
110 //.............................................................................
111 #endif
112 
113