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