LibreOffice Module sc (master)  1
chartuno.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_SC_INC_CHARTUNO_HXX
21 #define INCLUDED_SC_INC_CHARTUNO_HXX
22 
23 #include "rangelst.hxx"
24 #include <svl/lstner.hxx>
27 
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/basemutex.hxx>
36 #include <cppuhelper/compbase.hxx>
37 #include <cppuhelper/implbase.hxx>
38 
39 class ScDocShell;
40 class ScChartObj;
41 
42 class ScChartsObj final : public cppu::WeakImplHelper<
43  css::table::XTableCharts,
44  css::container::XEnumerationAccess,
45  css::container::XIndexAccess,
46  css::lang::XServiceInfo >,
47  public SfxListener
48 {
49 private:
51  SCTAB nTab; // Charts are per sheet
52 
54  ScChartObj* GetObjectByName_Impl(const OUString& aName) const;
55 
56 public:
57  ScChartsObj(ScDocShell* pDocSh, SCTAB nT);
58  virtual ~ScChartsObj() override;
59 
60  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
61 
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 ) override;
67  virtual void SAL_CALL removeByName( const OUString& aName ) override;
68 
69  // XNameAccess
70  virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
71  virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
72  virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
73 
74  // XIndexAccess
75  virtual sal_Int32 SAL_CALL getCount() override;
76  virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
77 
78  // XEnumerationAccess
79  virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
80  createEnumeration() override;
81 
82  // XElementAccess
83  virtual css::uno::Type SAL_CALL getElementType() override;
84  virtual sal_Bool SAL_CALL hasElements() override;
85 
86  // XServiceInfo
87  virtual OUString SAL_CALL getImplementationName() override;
88  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
89  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
90 };
91 
92 typedef ::cppu::WeakComponentImplHelper<
93  css::table::XTableChart,
94  css::document::XEmbeddedObjectSupplier,
95  css::container::XNamed,
96  css::lang::XServiceInfo > ScChartObj_Base;
97 
98 typedef ::comphelper::OPropertyContainer ScChartObj_PBase;
99 typedef ::comphelper::OPropertyArrayUsageHelper< ScChartObj > ScChartObj_PABase;
100 
102  ,public ScChartObj_Base
103  ,public ScChartObj_PBase
104  ,public ScChartObj_PABase
105  ,public SfxListener
106 {
107 private:
109  SCTAB nTab; // Charts are per sheet
110  OUString aChartName;
111 
112  void Update_Impl( const ScRangeListRef& rRanges, bool bColHeaders, bool bRowHeaders );
113  void GetData_Impl( ScRangeListRef& rRanges, bool& rColHeaders, bool& rRowHeaders ) const;
114 
115 protected:
116  // ::comphelper::OPropertySetHelper
117  virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
118  virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override;
119  using ::cppu::OPropertySetHelper::getFastPropertyValue;
120  virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const override;
121 
122  // ::comphelper::OPropertyArrayUsageHelper
123  virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
124 
125 public:
126  ScChartObj(ScDocShell* pDocSh, SCTAB nT, const OUString& rN);
127  virtual ~ScChartObj() override;
128 
129  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
130 
131  // XInterface
133 
134  // XTypeProvider
135  DECLARE_XTYPEPROVIDER()
136 
137  // XComponent
138  using ScChartObj_Base::disposing;
139 
140  // XTableChart
141  virtual sal_Bool SAL_CALL getHasColumnHeaders() override;
142  virtual void SAL_CALL setHasColumnHeaders( sal_Bool bHasColumnHeaders ) override;
143  virtual sal_Bool SAL_CALL getHasRowHeaders() override;
144  virtual void SAL_CALL setHasRowHeaders( sal_Bool bHasRowHeaders ) override;
145  virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL
146  getRanges( ) override;
147  virtual void SAL_CALL setRanges( const css::uno::Sequence< css::table::CellRangeAddress >& aRanges ) override;
148 
149  // XEmbeddedObjectSupplier
150  virtual css::uno::Reference< css::lang::XComponent > SAL_CALL
151  getEmbeddedObject() override;
152 
153  // XNamed
154  virtual OUString SAL_CALL getName() override;
155  virtual void SAL_CALL setName( const OUString& aName ) override;
156 
157  // XServiceInfo
158  virtual OUString SAL_CALL getImplementationName() override;
159  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
160  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
161 
162  // XPropertySet
163  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
164 };
165 
166 #endif
167 
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~ScChartObj() override
Definition: chartuno.cxx:417
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: chartuno.cxx:318
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL setHasColumnHeaders(sal_Bool bHasColumnHeaders) override
Definition: chartuno.cxx:615
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: chartuno.cxx:728
virtual OUString SAL_CALL getName() override
Definition: chartuno.cxx:714
::comphelper::OPropertyArrayUsageHelper< ScChartObj > ScChartObj_PABase
Definition: chartuno.hxx:99
virtual ~ScChartsObj() override
Definition: chartuno.cxx:66
long Long
ScChartsObj(ScDocShell *pDocSh, SCTAB nT)
Definition: chartuno.cxx:59
virtual void SAL_CALL setHasRowHeaders(sal_Bool bHasRowHeaders) override
Definition: chartuno.cxx:634
virtual sal_Bool SAL_CALL hasElements() override
Definition: chartuno.cxx:334
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
Definition: chartuno.cxx:547
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL addNewByName(const OUString &aName, const css::awt::Rectangle &aRect, const css::uno::Sequence< css::table::CellRangeAddress > &aRanges, sal_Bool bColumnHeaders, sal_Bool bRowHeaders) override
Definition: chartuno.cxx:133
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
Definition: chartuno.cxx:515
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL setName(const OUString &aName) override
Definition: chartuno.cxx:720
virtual sal_Bool SAL_CALL getHasRowHeaders() override
Definition: chartuno.cxx:625
ScChartObj(ScDocShell *pDocSh, SCTAB nT, const OUString &rN)
Definition: chartuno.cxx:402
::cppu::WeakComponentImplHelper< css::table::XTableChart, css::document::XEmbeddedObjectSupplier, css::container::XNamed, css::lang::XServiceInfo > ScChartObj_Base
Definition: chartuno.hxx:96
virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL getRanges() override
Definition: chartuno.cxx:644
void GetData_Impl(ScRangeListRef &rRanges, bool &rColHeaders, bool &rRowHeaders) const
Definition: chartuno.cxx:435
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
::comphelper::OPropertyContainer ScChartObj_PBase
Definition: chartuno.hxx:98
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: chartuno.cxx:394
virtual sal_Bool SAL_CALL getHasColumnHeaders() override
Definition: chartuno.cxx:606
unsigned char sal_Bool
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: chartuno.cxx:350
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: chartuno.cxx:282
ScChartObj * GetObjectByIndex_Impl(tools::Long nIndex) const
Definition: chartuno.cxx:84
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
Definition: chartuno.cxx:589
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: chartuno.cxx:340
SCTAB nTab
Definition: chartuno.hxx:51
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: chartuno.cxx:74
ScDocShell * pDocShell
Definition: chartuno.hxx:50
void Update_Impl(const ScRangeListRef &rRanges, bool bColHeaders, bool bRowHeaders)
Definition: chartuno.cxx:492
ScDocShell * pDocShell
Definition: chartuno.hxx:108
SCTAB nTab
Definition: chartuno.hxx:109
virtual void SAL_CALL setRanges(const css::uno::Sequence< css::table::CellRangeAddress > &aRanges) override
Definition: chartuno.cxx:676
virtual css::uno::Type SAL_CALL getElementType() override
Definition: chartuno.cxx:328
virtual void SAL_CALL removeByName(const OUString &aName) override
Definition: chartuno.cxx:262
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: chartuno.cxx:425
ScChartObj * GetObjectByName_Impl(const OUString &aName) const
Definition: chartuno.cxx:124
virtual sal_Int32 SAL_CALL getCount() override
Definition: chartuno.cxx:290
OUString aChartName
Definition: chartuno.hxx:110
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
Definition: chartuno.cxx:510
struct _ADOIndex Index
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Reference< css::lang::XComponent > SAL_CALL getEmbeddedObject() override
Definition: chartuno.cxx:698
sal_Int16 SCTAB
Definition: types.hxx:23
#define DECLARE_XINTERFACE()