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