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 "ServiceMacros.hxx"
24 : #include <com/sun/star/chart2/XChartDocument.hpp>
25 : #include <com/sun/star/chart/XChartDocument.hpp>
26 : #include <com/sun/star/uno/XComponentContext.hpp>
27 : #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
28 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 : #include <com/sun/star/uno/XAggregation.hpp>
30 : #include <com/sun/star/lang/XServiceInfo.hpp>
31 : #include <com/sun/star/util/XRefreshable.hpp>
32 : #include <cppuhelper/implbase5.hxx>
33 : #include <osl/mutex.hxx>
34 : #include <unotools/eventlisteneradapter.hxx>
35 : #include <comphelper/uno3.hxx>
36 :
37 : #include <boost/shared_ptr.hpp>
38 :
39 : namespace chart
40 : {
41 :
42 : namespace wrapper
43 : {
44 :
45 : class Chart2ModelContact;
46 :
47 0 : class ChartDocumentWrapper_Base : public ::cppu::ImplInheritanceHelper5
48 : < WrappedPropertySet
49 : , ::com::sun::star::chart::XChartDocument
50 : , ::com::sun::star::drawing::XDrawPageSupplier
51 : , ::com::sun::star::lang::XMultiServiceFactory
52 : , ::com::sun::star::lang::XServiceInfo
53 : , ::com::sun::star::uno::XAggregation
54 : >
55 : {
56 : };
57 :
58 : class ChartDocumentWrapper : public ChartDocumentWrapper_Base
59 : , public ::utl::OEventListenerAdapter
60 : {
61 : public:
62 : explicit ChartDocumentWrapper(
63 : const ::com::sun::star::uno::Reference<
64 : ::com::sun::star::uno::XComponentContext > & xContext );
65 : virtual ~ChartDocumentWrapper();
66 :
67 : /// XServiceInfo declarations
68 : APPHELPER_XSERVICEINFO_DECL()
69 0 : APPHELPER_SERVICE_FACTORY_HELPER(ChartDocumentWrapper)
70 :
71 : void setAddIn( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshable >& xAddIn );
72 : ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshable > getAddIn() const;
73 :
74 : void setUpdateAddIn( sal_Bool bUpdateAddIn );
75 : sal_Bool getUpdateAddIn() const;
76 :
77 : void setBaseDiagram( const OUString& rBaseDiagram );
78 : OUString getBaseDiagram() const;
79 :
80 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > getAdditionalShapes() const;
81 :
82 : ::com::sun::star::uno::Reference<
83 : ::com::sun::star::drawing::XDrawPage > impl_getDrawPage() const
84 : throw (::com::sun::star::uno::RuntimeException);
85 :
86 : protected:
87 :
88 : // ____ chart::XChartDocument ____
89 : virtual ::com::sun::star::uno::Reference<
90 : ::com::sun::star::drawing::XShape > SAL_CALL getTitle()
91 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
92 : virtual ::com::sun::star::uno::Reference<
93 : ::com::sun::star::drawing::XShape > SAL_CALL getSubTitle()
94 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 : virtual ::com::sun::star::uno::Reference<
96 : ::com::sun::star::drawing::XShape > SAL_CALL getLegend()
97 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
98 : virtual ::com::sun::star::uno::Reference<
99 : ::com::sun::star::beans::XPropertySet > SAL_CALL getArea()
100 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
101 : virtual ::com::sun::star::uno::Reference<
102 : ::com::sun::star::chart::XDiagram > SAL_CALL getDiagram()
103 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 : virtual void SAL_CALL setDiagram( const ::com::sun::star::uno::Reference<
105 : ::com::sun::star::chart::XDiagram >& xDiagram )
106 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 : virtual ::com::sun::star::uno::Reference<
108 : ::com::sun::star::chart::XChartData > SAL_CALL getData()
109 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
110 : virtual void SAL_CALL attachData( const ::com::sun::star::uno::Reference<
111 : ::com::sun::star::chart::XChartData >& xData )
112 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
113 :
114 : // ____ XModel ____
115 : virtual sal_Bool SAL_CALL attachResource( const OUString& URL, const ::com::sun::star::uno::Sequence<
116 : ::com::sun::star::beans::PropertyValue >& Arguments )
117 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
118 : virtual OUString SAL_CALL getURL()
119 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 : virtual ::com::sun::star::uno::Sequence<
121 : ::com::sun::star::beans::PropertyValue > SAL_CALL getArgs()
122 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 : virtual void SAL_CALL connectController( const ::com::sun::star::uno::Reference<
124 : ::com::sun::star::frame::XController >& Controller )
125 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 : virtual void SAL_CALL disconnectController( const ::com::sun::star::uno::Reference<
127 : ::com::sun::star::frame::XController >& Controller )
128 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
129 : virtual void SAL_CALL lockControllers()
130 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
131 : virtual void SAL_CALL unlockControllers()
132 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
133 : virtual sal_Bool SAL_CALL hasControllersLocked()
134 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
135 : virtual ::com::sun::star::uno::Reference<
136 : ::com::sun::star::frame::XController > SAL_CALL getCurrentController()
137 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
138 : virtual void SAL_CALL setCurrentController( const ::com::sun::star::uno::Reference<
139 : ::com::sun::star::frame::XController >& Controller )
140 : throw (::com::sun::star::container::NoSuchElementException,
141 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
142 : virtual ::com::sun::star::uno::Reference<
143 : ::com::sun::star::uno::XInterface > SAL_CALL getCurrentSelection()
144 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
145 :
146 : // ____ XComponent ____
147 : virtual void SAL_CALL dispose()
148 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
149 : virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
150 : ::com::sun::star::lang::XEventListener >& xListener )
151 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
152 : virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
153 : ::com::sun::star::lang::XEventListener >& aListener )
154 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
155 :
156 : // ____ XInterface (for new interfaces) ____
157 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
158 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
159 :
160 : // ____ ::utl::OEventListenerAdapter ____
161 : virtual void _disposing( const ::com::sun::star::lang::EventObject& rSource ) SAL_OVERRIDE;
162 :
163 : // ____ XDrawPageSupplier ____
164 : virtual ::com::sun::star::uno::Reference<
165 : ::com::sun::star::drawing::XDrawPage > SAL_CALL getDrawPage()
166 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
167 :
168 : // ____ XMultiServiceFactory ____
169 : virtual ::com::sun::star::uno::Reference<
170 : ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier )
171 : throw (::com::sun::star::uno::Exception,
172 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
173 : virtual ::com::sun::star::uno::Reference<
174 : ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments(
175 : const OUString& ServiceSpecifier,
176 : const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments )
177 : throw (::com::sun::star::uno::Exception,
178 : ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
179 : virtual ::com::sun::star::uno::Sequence<
180 : OUString > SAL_CALL getAvailableServiceNames()
181 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
182 :
183 : // ____ XAggregation ____
184 : virtual void SAL_CALL setDelegator(
185 : const ::com::sun::star::uno::Reference<
186 : ::com::sun::star::uno::XInterface >& rDelegator )
187 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
188 : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& aType )
189 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
190 :
191 : // ____ WrappedPropertySet ____
192 : virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence() SAL_OVERRIDE;
193 : virtual const std::vector< WrappedProperty* > createWrappedProperties() SAL_OVERRIDE;
194 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet() SAL_OVERRIDE;
195 :
196 : private: //methods
197 : void impl_resetAddIn();
198 :
199 : private: //member
200 : ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
201 :
202 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xDelegator;
203 :
204 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xTitle;
205 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xSubTitle;
206 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xLegend;
207 : ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartData > m_xChartData;
208 : ::com::sun::star::uno::Reference< ::com::sun::star::chart::XDiagram > m_xDiagram;
209 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xArea;
210 :
211 : ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshable > m_xAddIn;
212 : OUString m_aBaseDiagram;
213 : sal_Bool m_bUpdateAddIn;
214 :
215 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xChartView;
216 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>
217 : m_xShapeFactory;
218 :
219 : bool m_bIsDisposed;
220 : };
221 :
222 : } // namespace wrapper
223 : } // namespace chart
224 :
225 : // CHART_CHARTDOCUMENT_HXX
226 : #endif
227 :
228 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|