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