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