1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_INC_CHARTUNO_HXX
21 #define INCLUDED_SC_INC_CHARTUNO_HXX
23 #include "address.hxx"
24 #include "rangelst.hxx"
25 #include <svl/lstner.hxx>
26 #include <comphelper/proparrhlp.hxx>
27 #include <comphelper/propertycontainer.hxx>
29 #include <com/sun/star/table/XTableChart.hpp>
30 #include <com/sun/star/table/XTableCharts.hpp>
31 #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <com/sun/star/container/XEnumerationAccess.hpp>
34 #include <com/sun/star/container/XIndexAccess.hpp>
35 #include <com/sun/star/container/XNamed.hpp>
36 #include <cppuhelper/compbase4.hxx>
37 #include <cppuhelper/implbase4.hxx>
44 class ScChartsObj
: public cppu::WeakImplHelper4
<
45 com::sun::star::table::XTableCharts
,
46 com::sun::star::container::XEnumerationAccess
,
47 com::sun::star::container::XIndexAccess
,
48 com::sun::star::lang::XServiceInfo
>,
52 ScDocShell
* pDocShell
;
53 SCTAB nTab
; // Charts are per sheet
55 ScChartObj
* GetObjectByIndex_Impl(long nIndex
) const;
56 ScChartObj
* GetObjectByName_Impl(const OUString
& aName
) const;
59 ScChartsObj(ScDocShell
* pDocSh
, SCTAB nT
);
60 virtual ~ScChartsObj();
62 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
65 virtual void SAL_CALL
addNewByName( const OUString
& aName
,
66 const ::com::sun::star::awt::Rectangle
& aRect
,
67 const ::com::sun::star::uno::Sequence
<
68 ::com::sun::star::table::CellRangeAddress
>& aRanges
,
69 sal_Bool bColumnHeaders
, sal_Bool bRowHeaders
)
70 throw(::com::sun::star::uno::RuntimeException
,
71 std::exception
) SAL_OVERRIDE
;
72 virtual void SAL_CALL
removeByName( const OUString
& aName
)
73 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
76 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
77 throw(::com::sun::star::container::NoSuchElementException
,
78 ::com::sun::star::lang::WrappedTargetException
,
79 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
80 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
81 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
82 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
83 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
86 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
87 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
)
88 throw(::com::sun::star::lang::IndexOutOfBoundsException
,
89 ::com::sun::star::lang::WrappedTargetException
,
90 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
93 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XEnumeration
> SAL_CALL
94 createEnumeration() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
97 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
98 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
99 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
102 virtual OUString SAL_CALL
getImplementationName()
103 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
104 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
105 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
106 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
107 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
111 typedef ::cppu::WeakComponentImplHelper4
<
112 ::com::sun::star::table::XTableChart
,
113 ::com::sun::star::document::XEmbeddedObjectSupplier
,
114 ::com::sun::star::container::XNamed
,
115 ::com::sun::star::lang::XServiceInfo
> ScChartObj_Base
;
117 typedef ::comphelper::OPropertyContainer ScChartObj_PBase
;
118 typedef ::comphelper::OPropertyArrayUsageHelper
< ScChartObj
> ScChartObj_PABase
;
120 class ScChartObj
: public ::comphelper::OBaseMutex
121 ,public ScChartObj_Base
122 ,public ScChartObj_PBase
123 ,public ScChartObj_PABase
127 ScDocShell
* pDocShell
;
128 SCTAB nTab
; // Charts are per sheet
131 void Update_Impl( const ScRangeListRef
& rRanges
, bool bColHeaders
, bool bRowHeaders
);
132 void GetData_Impl( ScRangeListRef
& rRanges
, bool& rColHeaders
, bool& rRowHeaders
) const;
135 // ::comphelper::OPropertySetHelper
136 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() SAL_OVERRIDE
;
137 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast( sal_Int32 nHandle
, const ::com::sun::star::uno::Any
& rValue
)
138 throw (::com::sun::star::uno::Exception
,
139 std::exception
) SAL_OVERRIDE
;
140 using ::cppu::OPropertySetHelper::getFastPropertyValue
;
141 virtual void SAL_CALL
getFastPropertyValue( ::com::sun::star::uno::Any
& rValue
, sal_Int32 nHandle
) const SAL_OVERRIDE
;
143 // ::comphelper::OPropertyArrayUsageHelper
144 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper() const SAL_OVERRIDE
;
147 ScChartObj(ScDocShell
* pDocSh
, SCTAB nT
, const OUString
& rN
);
148 virtual ~ScChartObj();
150 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
156 DECLARE_XTYPEPROVIDER()
159 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
162 virtual sal_Bool SAL_CALL
getHasColumnHeaders() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
163 virtual void SAL_CALL
setHasColumnHeaders( sal_Bool bHasColumnHeaders
)
164 throw(::com::sun::star::uno::RuntimeException
,
165 std::exception
) SAL_OVERRIDE
;
166 virtual sal_Bool SAL_CALL
getHasRowHeaders() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
167 virtual void SAL_CALL
setHasRowHeaders( sal_Bool bHasRowHeaders
)
168 throw(::com::sun::star::uno::RuntimeException
,
169 std::exception
) SAL_OVERRIDE
;
170 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::table::CellRangeAddress
> SAL_CALL
171 getRanges( ) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
172 virtual void SAL_CALL
setRanges( const ::com::sun::star::uno::Sequence
<
173 ::com::sun::star::table::CellRangeAddress
>& aRanges
)
174 throw(::com::sun::star::uno::RuntimeException
,
175 std::exception
) SAL_OVERRIDE
;
177 // XEmbeddedObjectSupplier
178 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> SAL_CALL
179 getEmbeddedObject() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
182 virtual OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
183 virtual void SAL_CALL
setName( const OUString
& aName
)
184 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
187 virtual OUString SAL_CALL
getImplementationName()
188 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
189 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
190 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
191 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
192 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
195 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo()
196 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
201 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */