LibreOffice Module sc (master) 1
cellvaluebinding.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/XValueBinding.hpp>
23#include <com/sun/star/util/XModifyBroadcaster.hpp>
28#include <comphelper/uno3.hxx>
30#include <com/sun/star/lang/XServiceInfo.hpp>
31#include <com/sun/star/lang/XInitialization.hpp>
32
33namespace com::sun::star::table { class XCell; }
34namespace com::sun::star::sheet { class XSpreadsheetDocument; }
35namespace com::sun::star::text { class XTextRange; }
36
37namespace calc
38{
39
40 //= OCellValueBinding
41
42 class OCellValueBinding;
43 // the base for our interfaces
44 typedef ::cppu::WeakComponentImplHelper < css::form::binding::XValueBinding
45 , css::lang::XServiceInfo
46 , css::util::XModifyBroadcaster
47 , css::util::XModifyListener
48 , css::lang::XInitialization
50 // the base for the property handling
52 // the second base for property handling
53 typedef ::comphelper::OPropertyArrayUsageHelper< OCellValueBinding >
55
57 ,public OCellValueBinding_Base // order matters! before OCellValueBinding_PBase, so rBHelper gets initialized
60 {
61 private:
62 css::uno::Reference< css::sheet::XSpreadsheetDocument >
64 css::uno::Reference< css::table::XCell >
66 css::uno::Reference< css::text::XTextRange >
72
73 public:
75 const css::uno::Reference< css::sheet::XSpreadsheetDocument >& _rxDocument,
76 bool _bListPos
77 );
78
80
81 protected:
82 virtual ~OCellValueBinding( ) override;
83
84 protected:
85 // XInterface
87
88 // XTypeProvider
89 DECLARE_XTYPEPROVIDER()
90
91 // XValueBinding
92 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getSupportedValueTypes( ) override;
93 virtual sal_Bool SAL_CALL supportsType( const css::uno::Type& aType ) override;
94 virtual css::uno::Any SAL_CALL getValue( const css::uno::Type& aType ) override;
95 virtual void SAL_CALL setValue( const css::uno::Any& aValue ) override;
96
97 // OComponentHelper/XComponent
98 virtual void SAL_CALL disposing() override;
99
100 // XServiceInfo
101 virtual OUString SAL_CALL getImplementationName( ) override;
102 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
103 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
104
105 // XPropertySet
106 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
107
108 // OPropertySetHelper
109 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
110 virtual void SAL_CALL getFastPropertyValue( css::uno::Any& _rValue, sal_Int32 _nHandle ) const override;
111
112 // ::comphelper::OPropertyArrayUsageHelper
113 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
114
115 // XModifyBroadcaster
116 virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
117 virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
118
119 // XModifyListener
120 virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override;
121 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
122
123 // XInitialization
124 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
125
126 private:
127 void checkDisposed( ) const;
128 void checkValueType( const css::uno::Type& _rType ) const;
129 void checkInitialized();
130
135 void notifyModified();
136
137 void setBooleanFormat();
138
139 private:
141 OCellValueBinding& operator=( const OCellValueBinding& ) = delete;
142 };
143
144} // namespace calc
145
146/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void checkValueType(const css::uno::Type &_rType) const
void notifyModified()
notifies our modify listeners @precond our mutex is not locked
virtual void SAL_CALL modified(const css::lang::EventObject &aEvent) override
bool m_bListPos
has XInitialization::initialize been called?
css::uno::Reference< css::table::XCell > m_xCell
the document where our cell lives
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getSupportedValueTypes() override
virtual sal_Bool SAL_CALL supportsType(const css::uno::Type &aType) override
virtual css::uno::Any SAL_CALL getValue(const css::uno::Type &aType) override
virtual ~OCellValueBinding() override
bool m_bInitialized
our modify listeners
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &_rValue, sal_Int32 _nHandle) const override
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
::comphelper::OInterfaceContainerHelper3< css::util::XModifyListener > m_aModifyListeners
the cell we're bound to, for text access
OCellValueBinding(const css::uno::Reference< css::sheet::XSpreadsheetDocument > &_rxDocument, bool _bListPos)
constructed as ListPositionCellBinding?
virtual void SAL_CALL disposing() override
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
virtual void SAL_CALL setValue(const css::uno::Any &aValue) override
css::uno::Reference< css::sheet::XSpreadsheetDocument > m_xDocument
css::uno::Reference< css::text::XTextRange > m_xCellText
the cell we're bound to, for double value access
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
::comphelper::OPropertyArrayUsageHelper< OCellValueBinding > OCellValueBinding_PABase
::cppu::WeakComponentImplHelper< css::form::binding::XValueBinding, css::lang::XServiceInfo, css::util::XModifyBroadcaster, css::util::XModifyListener, css::lang::XInitialization > OCellValueBinding_Base
::comphelper::OPropertyContainer OCellValueBinding_PBase
Type
unsigned char sal_Bool
#define DECLARE_XINTERFACE()