xref: /AOO41X/main/chart2/source/controller/inc/ChartDocumentWrapper.hxx (revision de7b3f825c374d9f7270d1282e9d92876f197200)
1*de7b3f82SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*de7b3f82SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*de7b3f82SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*de7b3f82SAndrew Rist  * distributed with this work for additional information
6*de7b3f82SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*de7b3f82SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*de7b3f82SAndrew Rist  * "License"); you may not use this file except in compliance
9*de7b3f82SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*de7b3f82SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*de7b3f82SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*de7b3f82SAndrew Rist  * software distributed under the License is distributed on an
15*de7b3f82SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*de7b3f82SAndrew Rist  * KIND, either express or implied.  See the License for the
17*de7b3f82SAndrew Rist  * specific language governing permissions and limitations
18*de7b3f82SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*de7b3f82SAndrew Rist  *************************************************************/
21*de7b3f82SAndrew Rist 
22*de7b3f82SAndrew Rist 
23cdf0e10cSrcweir #ifndef CHART_CHARTDOCUMENTWRAPPER_HXX
24cdf0e10cSrcweir #define CHART_CHARTDOCUMENTWRAPPER_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "WrappedPropertySet.hxx"
27cdf0e10cSrcweir //#include "OPropertySet.hxx"
28cdf0e10cSrcweir #include "ServiceMacros.hxx"
29cdf0e10cSrcweir #include <com/sun/star/chart2/XChartDocument.hpp>
30cdf0e10cSrcweir #include <com/sun/star/chart/XChartDocument.hpp>
31cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
32cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
33cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34cdf0e10cSrcweir #include <com/sun/star/uno/XAggregation.hpp>
35cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
36cdf0e10cSrcweir #include <com/sun/star/util/XRefreshable.hpp>
37cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx>
38cdf0e10cSrcweir #include <osl/mutex.hxx>
39cdf0e10cSrcweir #include <unotools/eventlisteneradapter.hxx>
40cdf0e10cSrcweir #include <comphelper/uno3.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir namespace chart
45cdf0e10cSrcweir {
46cdf0e10cSrcweir 
47cdf0e10cSrcweir namespace wrapper
48cdf0e10cSrcweir {
49cdf0e10cSrcweir 
50cdf0e10cSrcweir class Chart2ModelContact;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir class ChartDocumentWrapper_Base : public ::cppu::ImplInheritanceHelper5
53cdf0e10cSrcweir                                 < WrappedPropertySet
54cdf0e10cSrcweir                                 , ::com::sun::star::chart::XChartDocument
55cdf0e10cSrcweir                                 , ::com::sun::star::drawing::XDrawPageSupplier
56cdf0e10cSrcweir                                 , ::com::sun::star::lang::XMultiServiceFactory
57cdf0e10cSrcweir                                 , ::com::sun::star::lang::XServiceInfo
58cdf0e10cSrcweir                                 , ::com::sun::star::uno::XAggregation
59cdf0e10cSrcweir                                 >
60cdf0e10cSrcweir {
61cdf0e10cSrcweir };
62cdf0e10cSrcweir 
63cdf0e10cSrcweir class ChartDocumentWrapper : public ChartDocumentWrapper_Base
64cdf0e10cSrcweir                            , public ::utl::OEventListenerAdapter
65cdf0e10cSrcweir {
66cdf0e10cSrcweir public:
67cdf0e10cSrcweir 	explicit ChartDocumentWrapper(
68cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
69cdf0e10cSrcweir             ::com::sun::star::uno::XComponentContext > & xContext );
70cdf0e10cSrcweir 	virtual ~ChartDocumentWrapper();
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     /// XServiceInfo declarations
73cdf0e10cSrcweir     APPHELPER_XSERVICEINFO_DECL()
74cdf0e10cSrcweir     APPHELPER_SERVICE_FACTORY_HELPER(ChartDocumentWrapper)
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     void setAddIn( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshable >& xAddIn );
77cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshable > getAddIn() const;
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     void setUpdateAddIn( sal_Bool bUpdateAddIn );
80cdf0e10cSrcweir     sal_Bool getUpdateAddIn() const;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     void setBaseDiagram( const rtl::OUString& rBaseDiagram );
83cdf0e10cSrcweir     rtl::OUString getBaseDiagram() const;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > getAdditionalShapes() const;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
88cdf0e10cSrcweir             ::com::sun::star::drawing::XDrawPage > impl_getDrawPage() const
89cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
90cdf0e10cSrcweir 
91cdf0e10cSrcweir protected:
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     // ____ chart::XChartDocument ____
94cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
95cdf0e10cSrcweir         ::com::sun::star::drawing::XShape > SAL_CALL getTitle()
96cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
97cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
98cdf0e10cSrcweir         ::com::sun::star::drawing::XShape > SAL_CALL getSubTitle()
99cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
100cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
101cdf0e10cSrcweir         ::com::sun::star::drawing::XShape > SAL_CALL getLegend()
102cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
103cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
104cdf0e10cSrcweir         ::com::sun::star::beans::XPropertySet > SAL_CALL getArea()
105cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
106cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
107cdf0e10cSrcweir         ::com::sun::star::chart::XDiagram > SAL_CALL getDiagram()
108cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
109cdf0e10cSrcweir     virtual void SAL_CALL setDiagram( const ::com::sun::star::uno::Reference<
110cdf0e10cSrcweir                                       ::com::sun::star::chart::XDiagram >& xDiagram )
111cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
112cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
113cdf0e10cSrcweir         ::com::sun::star::chart::XChartData > SAL_CALL getData()
114cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
115cdf0e10cSrcweir     virtual void SAL_CALL attachData( const ::com::sun::star::uno::Reference<
116cdf0e10cSrcweir                                       ::com::sun::star::chart::XChartData >& xData )
117cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     // ____ XModel ____
120cdf0e10cSrcweir     virtual sal_Bool SAL_CALL attachResource( const ::rtl::OUString& URL, const ::com::sun::star::uno::Sequence<
121cdf0e10cSrcweir                                               ::com::sun::star::beans::PropertyValue >& Arguments )
122cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
123cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getURL()
124cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
125cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence<
126cdf0e10cSrcweir         ::com::sun::star::beans::PropertyValue > SAL_CALL getArgs()
127cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
128cdf0e10cSrcweir     virtual void SAL_CALL connectController( const ::com::sun::star::uno::Reference<
129cdf0e10cSrcweir                                              ::com::sun::star::frame::XController >& Controller )
130cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
131cdf0e10cSrcweir     virtual void SAL_CALL disconnectController( const ::com::sun::star::uno::Reference<
132cdf0e10cSrcweir                                                 ::com::sun::star::frame::XController >& Controller )
133cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
134cdf0e10cSrcweir     virtual void SAL_CALL lockControllers()
135cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
136cdf0e10cSrcweir     virtual void SAL_CALL unlockControllers()
137cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
138cdf0e10cSrcweir     virtual sal_Bool SAL_CALL hasControllersLocked()
139cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
140cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
141cdf0e10cSrcweir         ::com::sun::star::frame::XController > SAL_CALL getCurrentController()
142cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
143cdf0e10cSrcweir     virtual void SAL_CALL setCurrentController( const ::com::sun::star::uno::Reference<
144cdf0e10cSrcweir                                                 ::com::sun::star::frame::XController >& Controller )
145cdf0e10cSrcweir         throw (::com::sun::star::container::NoSuchElementException,
146cdf0e10cSrcweir                ::com::sun::star::uno::RuntimeException);
147cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
148cdf0e10cSrcweir         ::com::sun::star::uno::XInterface > SAL_CALL getCurrentSelection()
149cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     // ____ XComponent ____
152cdf0e10cSrcweir     virtual void SAL_CALL dispose()
153cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
154cdf0e10cSrcweir     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
155cdf0e10cSrcweir                                             ::com::sun::star::lang::XEventListener >& xListener )
156cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
157cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
158cdf0e10cSrcweir                                                ::com::sun::star::lang::XEventListener >& aListener )
159cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
160cdf0e10cSrcweir 
161cdf0e10cSrcweir     // ____ XInterface (for new interfaces) ____
162cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
163cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
164cdf0e10cSrcweir 
165cdf0e10cSrcweir     // ____ ::utl::OEventListenerAdapter ____
166cdf0e10cSrcweir     virtual void _disposing( const ::com::sun::star::lang::EventObject& rSource );
167cdf0e10cSrcweir 
168cdf0e10cSrcweir     // ____ XDrawPageSupplier ____
169cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
170cdf0e10cSrcweir             ::com::sun::star::drawing::XDrawPage > SAL_CALL getDrawPage()
171cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
172cdf0e10cSrcweir 
173cdf0e10cSrcweir     // ____ XMultiServiceFactory ____
174cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
175cdf0e10cSrcweir             ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier )
176cdf0e10cSrcweir         throw (::com::sun::star::uno::Exception,
177cdf0e10cSrcweir                ::com::sun::star::uno::RuntimeException);
178cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
179cdf0e10cSrcweir             ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments(
180cdf0e10cSrcweir                 const ::rtl::OUString& ServiceSpecifier,
181cdf0e10cSrcweir                 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments )
182cdf0e10cSrcweir         throw (::com::sun::star::uno::Exception,
183cdf0e10cSrcweir                ::com::sun::star::uno::RuntimeException);
184cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence<
185cdf0e10cSrcweir             ::rtl::OUString > SAL_CALL getAvailableServiceNames()
186cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
187cdf0e10cSrcweir 
188cdf0e10cSrcweir     // ____ XAggregation ____
189cdf0e10cSrcweir     virtual void SAL_CALL setDelegator(
190cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
191cdf0e10cSrcweir             ::com::sun::star::uno::XInterface >& rDelegator )
192cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
193cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& aType )
194cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
195cdf0e10cSrcweir 
196cdf0e10cSrcweir     // ____ WrappedPropertySet ____
197cdf0e10cSrcweir     virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
198cdf0e10cSrcweir     virtual const std::vector< WrappedProperty* > createWrappedProperties();
199cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
200cdf0e10cSrcweir 
201cdf0e10cSrcweir private: //methods
202cdf0e10cSrcweir     void impl_resetAddIn();
203cdf0e10cSrcweir 
204cdf0e10cSrcweir private: //member
205cdf0e10cSrcweir     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
206cdf0e10cSrcweir 
207cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >   m_xDelegator;
208cdf0e10cSrcweir 
209cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >   m_xTitle;
210cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >   m_xSubTitle;
211cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >   m_xLegend;
212cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartData > m_xChartData;
213cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::chart::XDiagram >   m_xDiagram;
214cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xArea;
215cdf0e10cSrcweir 
216cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshable > m_xAddIn;
217cdf0e10cSrcweir     rtl::OUString   m_aBaseDiagram;
218cdf0e10cSrcweir     sal_Bool        m_bUpdateAddIn;
219cdf0e10cSrcweir 
220cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >   m_xChartView;
221cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>
222cdf0e10cSrcweir 			                                                                m_xShapeFactory;
223cdf0e10cSrcweir 
224cdf0e10cSrcweir     bool                                                                    m_bIsDisposed;
225cdf0e10cSrcweir };
226cdf0e10cSrcweir 
227cdf0e10cSrcweir } //  namespace wrapper
228cdf0e10cSrcweir } //  namespace chart
229cdf0e10cSrcweir 
230cdf0e10cSrcweir // CHART_CHARTDOCUMENT_HXX
231cdf0e10cSrcweir #endif
232