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 SC_CHARTUNO_HXX
21 #define SC_CHARTUNO_HXX
23 #include "address.hxx"
24 #include <svl/lstner.hxx>
25 #include <comphelper/proparrhlp.hxx>
26 #include <comphelper/propertycontainer.hxx>
28 #include <com/sun/star/table/XTableChart.hpp>
29 #include <com/sun/star/table/XTableCharts.hpp>
30 #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/container/XEnumerationAccess.hpp>
33 #include <com/sun/star/container/XIndexAccess.hpp>
34 #include <com/sun/star/container/XNamed.hpp>
35 #include <cppuhelper/compbase4.hxx>
36 #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
);
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 virtual void SAL_CALL
removeByName( const OUString
& aName
)
72 throw(::com::sun::star::uno::RuntimeException
);
75 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
76 throw(::com::sun::star::container::NoSuchElementException
,
77 ::com::sun::star::lang::WrappedTargetException
,
78 ::com::sun::star::uno::RuntimeException
);
79 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
80 throw(::com::sun::star::uno::RuntimeException
);
81 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
82 throw(::com::sun::star::uno::RuntimeException
);
85 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
);
86 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
)
87 throw(::com::sun::star::lang::IndexOutOfBoundsException
,
88 ::com::sun::star::lang::WrappedTargetException
,
89 ::com::sun::star::uno::RuntimeException
);
92 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XEnumeration
> SAL_CALL
93 createEnumeration() throw(::com::sun::star::uno::RuntimeException
);
96 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
97 throw(::com::sun::star::uno::RuntimeException
);
98 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
101 virtual OUString SAL_CALL
getImplementationName()
102 throw(::com::sun::star::uno::RuntimeException
);
103 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
104 throw(::com::sun::star::uno::RuntimeException
);
105 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
106 throw(::com::sun::star::uno::RuntimeException
);
110 typedef ::cppu::WeakComponentImplHelper4
<
111 ::com::sun::star::table::XTableChart
,
112 ::com::sun::star::document::XEmbeddedObjectSupplier
,
113 ::com::sun::star::container::XNamed
,
114 ::com::sun::star::lang::XServiceInfo
> ScChartObj_Base
;
116 typedef ::comphelper::OPropertyContainer ScChartObj_PBase
;
117 typedef ::comphelper::OPropertyArrayUsageHelper
< ScChartObj
> ScChartObj_PABase
;
119 class ScChartObj
: public ::comphelper::OBaseMutex
120 ,public ScChartObj_Base
121 ,public ScChartObj_PBase
122 ,public ScChartObj_PABase
126 ScDocShell
* pDocShell
;
127 SCTAB nTab
; // Charts are per sheet
130 void Update_Impl( const ScRangeListRef
& rRanges
, bool bColHeaders
, bool bRowHeaders
);
131 void GetData_Impl( ScRangeListRef
& rRanges
, bool& rColHeaders
, bool& rRowHeaders
) const;
134 // ::comphelper::OPropertySetHelper
135 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
136 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast( sal_Int32 nHandle
, const ::com::sun::star::uno::Any
& rValue
)
137 throw (::com::sun::star::uno::Exception
);
138 using ::cppu::OPropertySetHelper::getFastPropertyValue
;
139 virtual void SAL_CALL
getFastPropertyValue( ::com::sun::star::uno::Any
& rValue
, sal_Int32 nHandle
) const;
141 // ::comphelper::OPropertyArrayUsageHelper
142 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper() const;
145 ScChartObj(ScDocShell
* pDocSh
, SCTAB nT
, const OUString
& rN
);
146 virtual ~ScChartObj();
148 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
154 DECLARE_XTYPEPROVIDER()
157 virtual void SAL_CALL
disposing();
160 virtual sal_Bool SAL_CALL
getHasColumnHeaders() throw(::com::sun::star::uno::RuntimeException
);
161 virtual void SAL_CALL
setHasColumnHeaders( sal_Bool bHasColumnHeaders
)
162 throw(::com::sun::star::uno::RuntimeException
);
163 virtual sal_Bool SAL_CALL
getHasRowHeaders() throw(::com::sun::star::uno::RuntimeException
);
164 virtual void SAL_CALL
setHasRowHeaders( sal_Bool bHasRowHeaders
)
165 throw(::com::sun::star::uno::RuntimeException
);
166 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::table::CellRangeAddress
> SAL_CALL
167 getRanges( ) throw(::com::sun::star::uno::RuntimeException
);
168 virtual void SAL_CALL
setRanges( const ::com::sun::star::uno::Sequence
<
169 ::com::sun::star::table::CellRangeAddress
>& aRanges
)
170 throw(::com::sun::star::uno::RuntimeException
);
172 // XEmbeddedObjectSupplier
173 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> SAL_CALL
174 getEmbeddedObject() throw(::com::sun::star::uno::RuntimeException
);
177 virtual OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
);
178 virtual void SAL_CALL
setName( const OUString
& aName
)
179 throw(::com::sun::star::uno::RuntimeException
);
182 virtual OUString SAL_CALL
getImplementationName()
183 throw(::com::sun::star::uno::RuntimeException
);
184 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
185 throw(::com::sun::star::uno::RuntimeException
);
186 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
187 throw(::com::sun::star::uno::RuntimeException
);
190 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo()
191 throw (::com::sun::star::uno::RuntimeException
);
196 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */