calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / sc / source / ui / unoobj / celllistsource.hxx
blob7a5f72c02bd7654c89d59cd54a9124767d724993
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 #pragma once
22 #include <com/sun/star/form/binding/XListEntryTypedSource.hpp>
23 #include <cppuhelper/compbase4.hxx>
24 #include <cppuhelper/basemutex.hxx>
25 #include <comphelper/interfacecontainer3.hxx>
26 #include <comphelper/propertycontainer.hxx>
27 #include <comphelper/uno3.hxx>
28 #include <comphelper/proparrhlp.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>
34 namespace com::sun::star::sheet { class XSpreadsheetDocument; }
35 namespace com::sun::star::table { class XCellRange; }
37 namespace calc
40 //= OCellListSource
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
48 > OCellListSource_Base;
49 // the base for the property handling
50 typedef ::comphelper::OPropertyContainer OCellListSource_PBase;
51 // the second base for property handling
52 typedef ::comphelper::OPropertyArrayUsageHelper< OCellListSource >
53 OCellListSource_PABase;
55 class OCellListSource :public ::cppu::BaseMutex
56 ,public OCellListSource_Base // order matters! before OCellListSource_PBase, so rBHelper gets initialized
57 ,public OCellListSource_PBase
58 ,public OCellListSource_PABase
60 private:
61 css::uno::Reference< css::sheet::XSpreadsheetDocument >
62 m_xDocument; /// the document where our cell lives
63 css::uno::Reference< css::table::XCellRange >
64 m_xRange; /// the range of cells we're bound to
65 ::comphelper::OInterfaceContainerHelper3<css::form::binding::XListEntryListener>
66 m_aListEntryListeners; /// our listeners
67 bool m_bInitialized; /// has XInitialization::initialize been called?
69 public:
70 explicit OCellListSource(
71 const css::uno::Reference< css::sheet::XSpreadsheetDocument >& _rxDocument
74 using OCellListSource_PBase::getFastPropertyValue;
76 protected:
77 virtual ~OCellListSource( ) override;
79 protected:
80 // XInterface
81 DECLARE_XINTERFACE()
83 // XTypeProvider
84 DECLARE_XTYPEPROVIDER()
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;
93 // XListEntryTypedSource
94 virtual css::uno::Sequence< OUString > SAL_CALL getAllListEntriesTyped( css::uno::Sequence< css::uno::Any >& rDataValues ) override;
96 // OComponentHelper/XComponent
97 virtual void SAL_CALL disposing() override;
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;
104 // XPropertySet
105 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
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;
111 // ::comphelper::OPropertyArrayUsageHelper
112 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
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;
118 // XInitialization
119 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
121 private:
122 void checkDisposed( ) const;
123 void checkInitialized();
125 /** retrieves the actual address of our cell range
126 @precond
127 our m_xRange is not <NULL/>
129 css::table::CellRangeAddress
130 getRangeAddress( ) const;
132 /** retrieves the text of a cell within our range
133 @param _nRangeRelativeRow
134 the relative row index of the cell within our range
135 @param pAny
136 if not <NULL/> then the underlying data value is returned in the Any
137 @precond
138 our m_xRange is not <NULL/>
140 OUString
141 getCellTextContent_noCheck(
142 sal_Int32 _nRangeRelativeRow,
143 css::uno::Any* pAny
146 void notifyModified();
148 private:
149 OCellListSource( const OCellListSource& ) = delete;
150 OCellListSource& operator=( const OCellListSource& ) = delete;
153 } // namespace calc
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */