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_CHARTAPIWRAPPER_DATASERIESPOINTWRAPPER_HXX
20 : #define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_DATASERIESPOINTWRAPPER_HXX
21 :
22 : #include "WrappedPropertySet.hxx"
23 : #include "ReferenceSizePropertyProvider.hxx"
24 : #include <cppuhelper/implbase4.hxx>
25 : #include <comphelper/uno3.hxx>
26 : #include <cppuhelper/interfacecontainer.hxx>
27 : #include <com/sun/star/chart2/XDataSeries.hpp>
28 : #include <com/sun/star/frame/XModel.hpp>
29 : #include <com/sun/star/lang/XComponent.hpp>
30 : #include <com/sun/star/lang/XEventListener.hpp>
31 : #include <com/sun/star/lang/XInitialization.hpp>
32 : #include <com/sun/star/lang/XServiceInfo.hpp>
33 : #include <com/sun/star/uno/XComponentContext.hpp>
34 :
35 : #include <boost/shared_ptr.hpp>
36 :
37 : namespace chart
38 : {
39 :
40 : namespace wrapper
41 : {
42 :
43 : class Chart2ModelContact;
44 :
45 : class DataSeriesPointWrapper : public ::cppu::ImplInheritanceHelper4<
46 : WrappedPropertySet
47 : , com::sun::star::lang::XServiceInfo
48 : , com::sun::star::lang::XInitialization
49 : , com::sun::star::lang::XComponent
50 : , com::sun::star::lang::XEventListener
51 : >
52 : , public ReferenceSizePropertyProvider
53 :
54 : {
55 : public:
56 : enum eType
57 : {
58 : DATA_SERIES,
59 : DATA_POINT
60 : };
61 :
62 : //this constructor needs an initialize call afterwards
63 : explicit DataSeriesPointWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
64 :
65 : DataSeriesPointWrapper( eType eType
66 : , sal_Int32 nSeriesIndexInNewAPI
67 : , sal_Int32 nPointIndex //ignored for series
68 : , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
69 :
70 : virtual ~DataSeriesPointWrapper();
71 :
72 : bool isSupportingAreaProperties();
73 187 : bool isLinesForbidden() { return !m_bLinesAllowed;}
74 :
75 : /// XServiceInfo declarations
76 : virtual OUString SAL_CALL getImplementationName()
77 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
78 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
79 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
80 : virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
81 : throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
82 :
83 : static OUString getImplementationName_Static();
84 : static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
85 :
86 : // ___lang::XInitialization___
87 : virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
88 : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 :
90 : //ReferenceSizePropertyProvider
91 : virtual void updateReferenceSize() SAL_OVERRIDE;
92 : virtual ::com::sun::star::uno::Any getReferenceSize() SAL_OVERRIDE;
93 : virtual ::com::sun::star::awt::Size getCurrentSizeForReference() SAL_OVERRIDE;
94 :
95 : protected:
96 : // ____ XComponent ____
97 : virtual void SAL_CALL dispose()
98 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 : virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
100 : ::com::sun::star::lang::XEventListener >& xListener )
101 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 : virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
103 : ::com::sun::star::lang::XEventListener >& aListener )
104 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
105 :
106 : // ____ XEventListener ____
107 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
108 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 :
110 : protected:
111 : // ____ WrappedPropertySet ____
112 : virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence() SAL_OVERRIDE;
113 : virtual const std::vector< WrappedProperty* > createWrappedProperties() SAL_OVERRIDE;
114 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 : virtual ::com::sun::star::uno::Reference<
117 : ::com::sun::star::beans::XPropertySet > getInnerPropertySet() SAL_OVERRIDE;
118 :
119 : virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 : virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 :
123 : //own methods
124 : ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > getDataSeries();
125 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getDataPointProperties();
126 :
127 : private:
128 :
129 : void SAL_CALL getStatisticsPropertyValue
130 : ( ::com::sun::star::uno::Any& rValue,
131 : sal_Int32 nHandle ) const;
132 :
133 : void SAL_CALL setStatisticsPropertyValue_NoBroadcast(
134 : sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
135 : throw (::com::sun::star::uno::Exception);
136 :
137 : ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
138 : ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
139 :
140 : eType m_eType;
141 : sal_Int32 m_nSeriesIndexInNewAPI;
142 : sal_Int32 m_nPointIndex;
143 :
144 : bool m_bLinesAllowed;
145 :
146 : //this should only be used, if the DataSeriesPointWrapper is initialized via the XInitialize interface
147 : //because a big change in the chartmodel may lead to an dataseriespointer that is not connected to the model anymore
148 : //with the indices instead we can always get the new dataseries
149 : ::com::sun::star::uno::Reference<
150 : ::com::sun::star::chart2::XDataSeries > m_xDataSeries;
151 : };
152 :
153 : } // namespace wrapper
154 : } // namespace chart
155 :
156 : // INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_DATASERIESPOINTWRAPPER_HXX
157 : #endif
158 :
159 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|