LibreOffice Module sc (master) 1
celllistsource.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#pragma once
21
22#include <com/sun/star/form/binding/XListEntryTypedSource.hpp>
27#include <comphelper/uno3.hxx>
29#include <com/sun/star/table/CellRangeAddress.hpp>
30#include <com/sun/star/lang/XServiceInfo.hpp>
31#include <com/sun/star/lang/XInitialization.hpp>
32#include <com/sun/star/util/XModifyListener.hpp>
33
34namespace com::sun::star::sheet { class XSpreadsheetDocument; }
35namespace com::sun::star::table { class XCellRange; }
36
37namespace calc
38{
39
40 //= OCellListSource
41
42 class OCellListSource;
43 // the base for our interfaces
44 typedef ::cppu::WeakAggComponentImplHelper4 < css::form::binding::XListEntryTypedSource
45 , css::util::XModifyListener
46 , css::lang::XServiceInfo
47 , css::lang::XInitialization
49 // the base for the property handling
51 // the second base for property handling
52 typedef ::comphelper::OPropertyArrayUsageHelper< OCellListSource >
54
56 ,public OCellListSource_Base // order matters! before OCellListSource_PBase, so rBHelper gets initialized
59 {
60 private:
61 css::uno::Reference< css::sheet::XSpreadsheetDocument >
63 css::uno::Reference< css::table::XCellRange >
68
69 public:
71 const css::uno::Reference< css::sheet::XSpreadsheetDocument >& _rxDocument
72 );
73
75
76 protected:
77 virtual ~OCellListSource( ) override;
78
79 protected:
80 // XInterface
82
83 // XTypeProvider
84 DECLARE_XTYPEPROVIDER()
85
86 // XListEntrySource
87 virtual sal_Int32 SAL_CALL getListEntryCount( ) override;
88 virtual OUString SAL_CALL getListEntry( sal_Int32 Position ) override;
89 virtual css::uno::Sequence< OUString > SAL_CALL getAllListEntries( ) override;
90 virtual void SAL_CALL addListEntryListener( const css::uno::Reference< css::form::binding::XListEntryListener >& Listener ) override;
91 virtual void SAL_CALL removeListEntryListener( const css::uno::Reference< css::form::binding::XListEntryListener >& Listener ) override;
92
93 // XListEntryTypedSource
94 virtual css::uno::Sequence< OUString > SAL_CALL getAllListEntriesTyped( css::uno::Sequence< css::uno::Any >& rDataValues ) override;
95
96 // OComponentHelper/XComponent
97 virtual void SAL_CALL disposing() override;
98
99 // XServiceInfo
100 virtual OUString SAL_CALL getImplementationName( ) override;
101 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
102 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
103
104 // XPropertySet
105 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
106
107 // OPropertySetHelper
108 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
109 virtual void SAL_CALL getFastPropertyValue( css::uno::Any& _rValue, sal_Int32 _nHandle ) const override;
110
111 // ::comphelper::OPropertyArrayUsageHelper
112 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
113
114 // XModifyListener
115 virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override;
116 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
117
118 // XInitialization
119 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
120
121 private:
122 void checkDisposed( ) const;
123 void checkInitialized();
124
129 css::table::CellRangeAddress
130 getRangeAddress( ) const;
131
140 OUString
142 sal_Int32 _nRangeRelativeRow,
143 css::uno::Any* pAny
144 );
145
146 void notifyModified();
147
148 private:
150 OCellListSource& operator=( const OCellListSource& ) = delete;
151 };
152
153} // namespace calc
154
155/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString SAL_CALL getListEntry(sal_Int32 Position) override
virtual void SAL_CALL disposing() override
virtual void SAL_CALL addListEntryListener(const css::uno::Reference< css::form::binding::XListEntryListener > &Listener) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
OCellListSource(const css::uno::Reference< css::sheet::XSpreadsheetDocument > &_rxDocument)
has XInitialization::initialize been called?
virtual css::uno::Sequence< OUString > SAL_CALL getAllListEntries() override
OUString getCellTextContent_noCheck(sal_Int32 _nRangeRelativeRow, css::uno::Any *pAny)
retrieves the text of a cell within our range
css::uno::Reference< css::table::XCellRange > m_xRange
the document where our cell lives
css::table::CellRangeAddress getRangeAddress() const
retrieves the actual address of our cell range @precond our m_xRange is not <NULL>
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &_rValue, sal_Int32 _nHandle) const override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL removeListEntryListener(const css::uno::Reference< css::form::binding::XListEntryListener > &Listener) override
::comphelper::OInterfaceContainerHelper3< css::form::binding::XListEntryListener > m_aListEntryListeners
the range of cells we're bound to
virtual void SAL_CALL modified(const css::lang::EventObject &aEvent) override
css::uno::Reference< css::sheet::XSpreadsheetDocument > m_xDocument
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
bool m_bInitialized
our listeners
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
virtual ~OCellListSource() override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< OUString > SAL_CALL getAllListEntriesTyped(css::uno::Sequence< css::uno::Any > &rDataValues) override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
virtual sal_Int32 SAL_CALL getListEntryCount() override
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
::comphelper::OPropertyContainer OCellListSource_PBase
::cppu::WeakAggComponentImplHelper4< css::form::binding::XListEntryTypedSource, css::util::XModifyListener, css::lang::XServiceInfo, css::lang::XInitialization > OCellListSource_Base
::comphelper::OPropertyArrayUsageHelper< OCellListSource > OCellListSource_PABase
unsigned char sal_Bool
#define DECLARE_XINTERFACE()