1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: CachedDataSequence.hxx,v $
10 * $Revision: 1.6.44.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _CHART_CACHEDDATASEQUENCE_HXX
31 #define _CHART_CACHEDDATASEQUENCE_HXX
34 #include <cppuhelper/compbase7.hxx>
35 #include <comphelper/uno3.hxx>
36 #include <comphelper/broadcasthelper.hxx>
37 #include <comphelper/propertycontainer.hxx>
38 #include <comphelper/proparrhlp.hxx>
39 #include "ServiceMacros.hxx"
41 // interfaces and types
42 #include <com/sun/star/lang/XServiceInfo.hpp>
43 #include <com/sun/star/lang/XInitialization.hpp>
44 #include <com/sun/star/beans/XPropertySet.hpp>
45 #include <com/sun/star/uno/XComponentContext.hpp>
46 #include <com/sun/star/chart2/data/XDataSequence.hpp>
47 #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
48 #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
49 #include <com/sun/star/util/XCloneable.hpp>
50 #include <com/sun/star/util/XModifyBroadcaster.hpp>
54 // ____________________
60 typedef ::cppu::WeakComponentImplHelper7
<
61 ::com::sun::star::chart2::data::XDataSequence
,
62 ::com::sun::star::chart2::data::XNumericalDataSequence
,
63 ::com::sun::star::chart2::data::XTextualDataSequence
,
64 ::com::sun::star::util::XCloneable
,
65 ::com::sun::star::util::XModifyBroadcaster
,
66 ::com::sun::star::lang::XInitialization
,
67 ::com::sun::star::lang::XServiceInfo
>
68 CachedDataSequence_Base
;
71 class CachedDataSequence
:
72 public ::comphelper::OMutexAndBroadcastHelper
,
73 public ::comphelper::OPropertyContainer
,
74 public ::comphelper::OPropertyArrayUsageHelper
< CachedDataSequence
>,
75 public impl::CachedDataSequence_Base
78 /** constructs an empty sequence
82 explicit CachedDataSequence(
83 const ::com::sun::star::uno::Reference
<
84 ::com::sun::star::uno::XComponentContext
> & xContext
);
86 /** creates a sequence and initializes it with the given string. This is
87 especially useful for labels, which only have one element.
89 explicit CachedDataSequence( const ::rtl::OUString
& rSingleText
);
92 explicit CachedDataSequence( const CachedDataSequence
& rSource
);
94 virtual ~CachedDataSequence();
96 /// establish methods for factory instatiation
97 APPHELPER_SERVICE_FACTORY_HELPER( CachedDataSequence
)
98 /// declare XServiceInfo methods
99 APPHELPER_XSERVICEINFO_DECL()
101 /// merge XInterface implementations
103 /// merge XTypeProvider implementations
104 DECLARE_XTYPEPROVIDER()
107 // ____ XPropertySet ____
108 /// @see ::com::sun::star::beans::XPropertySet
109 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo()
110 throw (::com::sun::star::uno::RuntimeException
);
111 /// @see ::comphelper::OPropertySetHelper
112 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
113 /// @see ::comphelper::OPropertyArrayUsageHelper
114 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper() const;
116 // ____ XDataSequence ____
117 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> SAL_CALL
getData()
118 throw (::com::sun::star::uno::RuntimeException
);
119 virtual ::rtl::OUString SAL_CALL
getSourceRangeRepresentation()
120 throw (::com::sun::star::uno::RuntimeException
);
121 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
generateLabel(
122 ::com::sun::star::chart2::data::LabelOrigin nLabelOrigin
)
123 throw (::com::sun::star::uno::RuntimeException
);
124 virtual ::sal_Int32 SAL_CALL
getNumberFormatKeyByIndex( ::sal_Int32 nIndex
)
125 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
126 ::com::sun::star::uno::RuntimeException
);
128 // ____ XNumericalDataSequence ____
129 /// @see ::com::sun::star::chart::data::XNumericalDataSequence
130 virtual ::com::sun::star::uno::Sequence
< double > SAL_CALL
getNumericalData() throw (::com::sun::star::uno::RuntimeException
);
132 // ____ XTextualDataSequence ____
133 /// @see ::com::sun::star::chart::data::XTextualDataSequence
134 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getTextualData() throw (::com::sun::star::uno::RuntimeException
);
136 // ____ XCloneable ____
137 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::util::XCloneable
> SAL_CALL
createClone()
138 throw (::com::sun::star::uno::RuntimeException
);
140 // ____ XModifyBroadcaster ____
141 virtual void SAL_CALL
addModifyListener(
142 const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
)
143 throw (::com::sun::star::uno::RuntimeException
);
144 virtual void SAL_CALL
removeModifyListener(
145 const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
)
146 throw (::com::sun::star::uno::RuntimeException
);
148 // ::com::sun::star::lang::XInitialization:
149 virtual void SAL_CALL
initialize(const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> & aArguments
)
150 throw (::com::sun::star::uno::RuntimeException
, ::com::sun::star::uno::Exception
);
153 sal_Int32 m_nNumberFormatKey
;
154 ::rtl::OUString m_sRole
;
164 /** This method registers all properties. It should be called by all
167 void registerProperties();
170 /** is used by interface method getNumericalData().
172 ::com::sun::star::uno::Sequence
< double > Impl_getNumericalData() const;
173 /** is used by interface method getTextualData().
175 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> Impl_getTextualData() const;
176 /** is used by interface method getData().
178 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> Impl_getMixedData() const;
181 enum DataType m_eCurrentDataType
;
183 ::com::sun::star::uno::Sequence
< double > m_aNumericalSequence
;
184 ::com::sun::star::uno::Sequence
< ::rtl::OUString
> m_aTextualSequence
;
185 ::com::sun::star::uno::Sequence
<
186 ::com::sun::star::uno::Any
> m_aMixedSequence
;
187 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>
188 m_xModifyEventForwarder
;
194 // _CHART_CACHEDDATASEQUENCE_HXX