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 <tools/string.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>
45 class ScChartsObj
: public cppu::WeakImplHelper4
<
46 com::sun::star::table::XTableCharts
,
47 com::sun::star::container::XEnumerationAccess
,
48 com::sun::star::container::XIndexAccess
,
49 com::sun::star::lang::XServiceInfo
>,
53 ScDocShell
* pDocShell
;
54 SCTAB nTab
; // Charts are per sheet
56 ScChartObj
* GetObjectByIndex_Impl(long nIndex
) const;
57 ScChartObj
* GetObjectByName_Impl(const OUString
& aName
) const;
60 ScChartsObj(ScDocShell
* pDocSh
, SCTAB nT
);
61 virtual ~ScChartsObj();
63 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
66 virtual void SAL_CALL
addNewByName( const OUString
& aName
,
67 const ::com::sun::star::awt::Rectangle
& aRect
,
68 const ::com::sun::star::uno::Sequence
<
69 ::com::sun::star::table::CellRangeAddress
>& aRanges
,
70 sal_Bool bColumnHeaders
, sal_Bool bRowHeaders
)
71 throw(::com::sun::star::uno::RuntimeException
);
72 virtual void SAL_CALL
removeByName( const OUString
& aName
)
73 throw(::com::sun::star::uno::RuntimeException
);
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
);
80 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
81 throw(::com::sun::star::uno::RuntimeException
);
82 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
83 throw(::com::sun::star::uno::RuntimeException
);
86 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
);
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
);
93 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XEnumeration
> SAL_CALL
94 createEnumeration() throw(::com::sun::star::uno::RuntimeException
);
97 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
98 throw(::com::sun::star::uno::RuntimeException
);
99 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
102 virtual OUString SAL_CALL
getImplementationName()
103 throw(::com::sun::star::uno::RuntimeException
);
104 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
105 throw(::com::sun::star::uno::RuntimeException
);
106 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
107 throw(::com::sun::star::uno::RuntimeException
);
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();
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 using ::cppu::OPropertySetHelper::getFastPropertyValue
;
140 virtual void SAL_CALL
getFastPropertyValue( ::com::sun::star::uno::Any
& rValue
, sal_Int32 nHandle
) const;
142 // ::comphelper::OPropertyArrayUsageHelper
143 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper() const;
146 ScChartObj(ScDocShell
* pDocSh
, SCTAB nT
, const String
& rN
);
147 virtual ~ScChartObj();
149 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
155 DECLARE_XTYPEPROVIDER()
158 virtual void SAL_CALL
disposing();
161 virtual sal_Bool SAL_CALL
getHasColumnHeaders() throw(::com::sun::star::uno::RuntimeException
);
162 virtual void SAL_CALL
setHasColumnHeaders( sal_Bool bHasColumnHeaders
)
163 throw(::com::sun::star::uno::RuntimeException
);
164 virtual sal_Bool SAL_CALL
getHasRowHeaders() throw(::com::sun::star::uno::RuntimeException
);
165 virtual void SAL_CALL
setHasRowHeaders( sal_Bool bHasRowHeaders
)
166 throw(::com::sun::star::uno::RuntimeException
);
167 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::table::CellRangeAddress
> SAL_CALL
168 getRanges( ) throw(::com::sun::star::uno::RuntimeException
);
169 virtual void SAL_CALL
setRanges( const ::com::sun::star::uno::Sequence
<
170 ::com::sun::star::table::CellRangeAddress
>& aRanges
)
171 throw(::com::sun::star::uno::RuntimeException
);
173 // XEmbeddedObjectSupplier
174 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> SAL_CALL
175 getEmbeddedObject() throw(::com::sun::star::uno::RuntimeException
);
178 virtual OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
);
179 virtual void SAL_CALL
setName( const OUString
& aName
)
180 throw(::com::sun::star::uno::RuntimeException
);
183 virtual OUString SAL_CALL
getImplementationName()
184 throw(::com::sun::star::uno::RuntimeException
);
185 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
186 throw(::com::sun::star::uno::RuntimeException
);
187 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
188 throw(::com::sun::star::uno::RuntimeException
);
191 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo()
192 throw (::com::sun::star::uno::RuntimeException
);
197 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */