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_DRAWMODELWRAPPER_HXX
28 #define _CHART2_DRAWMODELWRAPPER_HXX
29 
30 //----
31 #include <svx/svdmodel.hxx>
32 // header for class SdrObject
33 #include <svx/svdobj.hxx>
34 
35 //----
36 #include <com/sun/star/frame/XModel.hpp>
37 #include <com/sun/star/uno/XComponentContext.hpp>
38 #include <com/sun/star/drawing/XDrawPage.hpp>
39 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
40 #include "chartviewdllapi.hxx"
41 
42 //.............................................................................
43 namespace chart
44 {
45 //.............................................................................
46 
47 class OOO_DLLPUBLIC_CHARTVIEW DrawModelWrapper : private SdrModel
48 {
49 private:
50 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > m_xMCF;
51     SfxItemPool* m_pChartItemPool;
52 
53     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > m_xMainDrawPage;
54     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > m_xHiddenDrawPage;
55 
56     std::auto_ptr< OutputDevice > m_apRefDevice;
57 
58 	//no default constructor
59 	DrawModelWrapper();
60 
61 public:
62     SAL_DLLPRIVATE DrawModelWrapper(::com::sun::star::uno::Reference<
63 			   ::com::sun::star::uno::XComponentContext > const & xContext );
64 	SAL_DLLPRIVATE virtual ~DrawModelWrapper();
65 
66     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getShapeFactory();
67 
68     // the main page will contain the normal view objects
69     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > getMainDrawPage();
70     SAL_DLLPRIVATE void clearMainDrawPage();
71 
72     // the extra page is not visible, but contains some extras like the symbols for data points
73     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > getHiddenDrawPage();
74 
75     static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
76          getChartRootShape( const ::com::sun::star::uno::Reference<
77             ::com::sun::star::drawing::XDrawPage>& xPage );
78 
79 
80     SAL_DLLPRIVATE void lockControllers();
81     SAL_DLLPRIVATE void unlockControllers();
82 
83     /// tries to get an OutputDevice from the XParent of the model to use as reference device
84     SAL_DLLPRIVATE void attachParentReferenceDevice(
85         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel );
86 
87 	OutputDevice* getReferenceDevice() const;
88 
89     SfxItemPool&            GetItemPool();
90     SAL_DLLPRIVATE const SfxItemPool&      GetItemPool() const;
91 
92     SAL_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
93 		createUnoModel();
94 	SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
95 		getUnoModel();
96     SdrModel& getSdrModel();
97 
98     XColorTable*    GetColorTable() const;
99     XDashList*      GetDashList() const;
100     XLineEndList*   GetLineEndList() const;
101     XGradientList*  GetGradientList() const;
102     XHatchList*     GetHatchList() const;
103     XBitmapList*    GetBitmapList() const;
104 
105     SdrObject* getNamedSdrObject( const rtl::OUString& rName );
106     static SdrObject* getNamedSdrObject( const String& rName, SdrObjList* pObjList );
107 
108     static bool removeShape( const ::com::sun::star::uno::Reference<
109                     ::com::sun::star::drawing::XShape >& xShape );
110 };
111 //.............................................................................
112 } //namespace chart
113 //.............................................................................
114 #endif
115