build fix
[LibreOffice.git] / sc / inc / chartuno.hxx
blob0cc5e50eb89bf1b6f5f7ff19fa043fe59f9c279e
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 "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/compbase.hxx>
37 #include <cppuhelper/implbase.hxx>
39 class ScDocShell;
40 class ScChartObj;
42 class ScChartsObj : public cppu::WeakImplHelper<
43 css::table::XTableCharts,
44 css::container::XEnumerationAccess,
45 css::container::XIndexAccess,
46 css::lang::XServiceInfo >,
47 public SfxListener
49 private:
50 ScDocShell* pDocShell;
51 SCTAB nTab; // Charts are per sheet
53 ScChartObj* GetObjectByIndex_Impl(long nIndex) const;
54 ScChartObj* GetObjectByName_Impl(const OUString& aName) const;
56 public:
57 ScChartsObj(ScDocShell* pDocSh, SCTAB nT);
58 virtual ~ScChartsObj() override;
60 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
62 // XTableCharts
63 virtual void SAL_CALL addNewByName( const OUString& aName,
64 const css::awt::Rectangle& aRect,
65 const css::uno::Sequence< css::table::CellRangeAddress >& aRanges,
66 sal_Bool bColumnHeaders, sal_Bool bRowHeaders )
67 throw(css::uno::RuntimeException,
68 std::exception) override;
69 virtual void SAL_CALL removeByName( const OUString& aName )
70 throw(css::uno::RuntimeException, std::exception) override;
72 // XNameAccess
73 virtual css::uno::Any SAL_CALL getByName( const OUString& aName )
74 throw(css::container::NoSuchElementException,
75 css::lang::WrappedTargetException,
76 css::uno::RuntimeException, std::exception) override;
77 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames()
78 throw(css::uno::RuntimeException, std::exception) override;
79 virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
80 throw(css::uno::RuntimeException, std::exception) override;
82 // XIndexAccess
83 virtual sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException, std::exception) override;
84 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
85 throw(css::lang::IndexOutOfBoundsException,
86 css::lang::WrappedTargetException,
87 css::uno::RuntimeException, std::exception) override;
89 // XEnumerationAccess
90 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
91 createEnumeration() throw(css::uno::RuntimeException, std::exception) override;
93 // XElementAccess
94 virtual css::uno::Type SAL_CALL getElementType()
95 throw(css::uno::RuntimeException, std::exception) override;
96 virtual sal_Bool SAL_CALL hasElements() throw(css::uno::RuntimeException, std::exception) override;
98 // XServiceInfo
99 virtual OUString SAL_CALL getImplementationName()
100 throw(css::uno::RuntimeException, std::exception) override;
101 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
102 throw(css::uno::RuntimeException, std::exception) override;
103 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
104 throw(css::uno::RuntimeException, std::exception) override;
107 typedef ::cppu::WeakComponentImplHelper<
108 css::table::XTableChart,
109 css::document::XEmbeddedObjectSupplier,
110 css::container::XNamed,
111 css::lang::XServiceInfo > ScChartObj_Base;
113 typedef ::comphelper::OPropertyContainer ScChartObj_PBase;
114 typedef ::comphelper::OPropertyArrayUsageHelper< ScChartObj > ScChartObj_PABase;
116 class ScChartObj : public ::cppu::BaseMutex
117 ,public ScChartObj_Base
118 ,public ScChartObj_PBase
119 ,public ScChartObj_PABase
120 ,public SfxListener
122 private:
123 ScDocShell* pDocShell;
124 SCTAB nTab; // Charts are per sheet
125 OUString aChartName;
127 void Update_Impl( const ScRangeListRef& rRanges, bool bColHeaders, bool bRowHeaders );
128 void GetData_Impl( ScRangeListRef& rRanges, bool& rColHeaders, bool& rRowHeaders ) const;
130 protected:
131 // ::comphelper::OPropertySetHelper
132 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
133 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue )
134 throw (css::uno::Exception,
135 std::exception) override;
136 using ::cppu::OPropertySetHelper::getFastPropertyValue;
137 virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const override;
139 // ::comphelper::OPropertyArrayUsageHelper
140 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
142 public:
143 ScChartObj(ScDocShell* pDocSh, SCTAB nT, const OUString& rN);
144 virtual ~ScChartObj() override;
146 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
148 // XInterface
149 DECLARE_XINTERFACE()
151 // XTypeProvider
152 DECLARE_XTYPEPROVIDER()
154 // XComponent
155 using ScChartObj_Base::disposing;
157 // XTableChart
158 virtual sal_Bool SAL_CALL getHasColumnHeaders() throw(css::uno::RuntimeException, std::exception) override;
159 virtual void SAL_CALL setHasColumnHeaders( sal_Bool bHasColumnHeaders )
160 throw(css::uno::RuntimeException,
161 std::exception) override;
162 virtual sal_Bool SAL_CALL getHasRowHeaders() throw(css::uno::RuntimeException, std::exception) override;
163 virtual void SAL_CALL setHasRowHeaders( sal_Bool bHasRowHeaders )
164 throw(css::uno::RuntimeException,
165 std::exception) override;
166 virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
167 getRanges( ) throw(css::uno::RuntimeException, std::exception) override;
168 virtual void SAL_CALL setRanges( const css::uno::Sequence< css::table::CellRangeAddress >& aRanges )
169 throw(css::uno::RuntimeException,
170 std::exception) override;
172 // XEmbeddedObjectSupplier
173 virtual css::uno::Reference< css::lang::XComponent > SAL_CALL
174 getEmbeddedObject() throw(css::uno::RuntimeException, std::exception) override;
176 // XNamed
177 virtual OUString SAL_CALL getName() throw(css::uno::RuntimeException, std::exception) override;
178 virtual void SAL_CALL setName( const OUString& aName )
179 throw(css::uno::RuntimeException, std::exception) override;
181 // XServiceInfo
182 virtual OUString SAL_CALL getImplementationName()
183 throw(css::uno::RuntimeException, std::exception) override;
184 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
185 throw(css::uno::RuntimeException, std::exception) override;
186 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
187 throw(css::uno::RuntimeException, std::exception) override;
189 // XPropertySet
190 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
191 throw (css::uno::RuntimeException, std::exception) override;
194 #endif
196 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */