Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / chartuno.hxx
blob1dd16cf7a22443b2e7e0ca2455c96e694e9250fd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "rangelst.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/compbase.hxx>
36 #include <cppuhelper/implbase.hxx>
38 class ScDocShell;
39 class ScChartObj;
41 class ScChartsObj : public cppu::WeakImplHelper<
42 css::table::XTableCharts,
43 css::container::XEnumerationAccess,
44 css::container::XIndexAccess,
45 css::lang::XServiceInfo >,
46 public SfxListener
48 private:
49 ScDocShell* pDocShell;
50 SCTAB nTab; // Charts are per sheet
52 ScChartObj* GetObjectByIndex_Impl(long nIndex) const;
53 ScChartObj* GetObjectByName_Impl(const OUString& aName) const;
55 public:
56 ScChartsObj(ScDocShell* pDocSh, SCTAB nT);
57 virtual ~ScChartsObj() override;
59 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
61 // XTableCharts
62 virtual void SAL_CALL addNewByName( const OUString& aName,
63 const css::awt::Rectangle& aRect,
64 const css::uno::Sequence< css::table::CellRangeAddress >& aRanges,
65 sal_Bool bColumnHeaders, sal_Bool bRowHeaders ) override;
66 virtual void SAL_CALL removeByName( const OUString& aName ) override;
68 // XNameAccess
69 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
70 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
71 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
73 // XIndexAccess
74 virtual sal_Int32 SAL_CALL getCount() override;
75 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
77 // XEnumerationAccess
78 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
79 createEnumeration() override;
81 // XElementAccess
82 virtual css::uno::Type SAL_CALL getElementType() override;
83 virtual sal_Bool SAL_CALL hasElements() override;
85 // XServiceInfo
86 virtual OUString SAL_CALL getImplementationName() override;
87 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
88 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
91 typedef ::cppu::WeakComponentImplHelper<
92 css::table::XTableChart,
93 css::document::XEmbeddedObjectSupplier,
94 css::container::XNamed,
95 css::lang::XServiceInfo > ScChartObj_Base;
97 typedef ::comphelper::OPropertyContainer ScChartObj_PBase;
98 typedef ::comphelper::OPropertyArrayUsageHelper< ScChartObj > ScChartObj_PABase;
100 class ScChartObj : public ::cppu::BaseMutex
101 ,public ScChartObj_Base
102 ,public ScChartObj_PBase
103 ,public ScChartObj_PABase
104 ,public SfxListener
106 private:
107 ScDocShell* pDocShell;
108 SCTAB nTab; // Charts are per sheet
109 OUString aChartName;
111 void Update_Impl( const ScRangeListRef& rRanges, bool bColHeaders, bool bRowHeaders );
112 void GetData_Impl( ScRangeListRef& rRanges, bool& rColHeaders, bool& rRowHeaders ) const;
114 protected:
115 // ::comphelper::OPropertySetHelper
116 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
117 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
118 using ::cppu::OPropertySetHelper::getFastPropertyValue;
119 virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const override;
121 // ::comphelper::OPropertyArrayUsageHelper
122 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
124 public:
125 ScChartObj(ScDocShell* pDocSh, SCTAB nT, const OUString& rN);
126 virtual ~ScChartObj() override;
128 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
130 // XInterface
131 DECLARE_XINTERFACE()
133 // XTypeProvider
134 DECLARE_XTYPEPROVIDER()
136 // XComponent
137 using ScChartObj_Base::disposing;
139 // XTableChart
140 virtual sal_Bool SAL_CALL getHasColumnHeaders() override;
141 virtual void SAL_CALL setHasColumnHeaders( sal_Bool bHasColumnHeaders ) override;
142 virtual sal_Bool SAL_CALL getHasRowHeaders() override;
143 virtual void SAL_CALL setHasRowHeaders( sal_Bool bHasRowHeaders ) override;
144 virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
145 getRanges( ) override;
146 virtual void SAL_CALL setRanges( const css::uno::Sequence< css::table::CellRangeAddress >& aRanges ) override;
148 // XEmbeddedObjectSupplier
149 virtual css::uno::Reference< css::lang::XComponent > SAL_CALL
150 getEmbeddedObject() override;
152 // XNamed
153 virtual OUString SAL_CALL getName() override;
154 virtual void SAL_CALL setName( const OUString& aName ) override;
156 // XServiceInfo
157 virtual OUString SAL_CALL getImplementationName() override;
158 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
159 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
161 // XPropertySet
162 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
165 #endif
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */