fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / ui / unoobj / cellvaluebinding.hxx
blob612ad1c6dd6102083b0aeab90b68ec5aa309b8b8
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_SOURCE_UI_UNOOBJ_CELLVALUEBINDING_HXX
21 #define INCLUDED_SC_SOURCE_UI_UNOOBJ_CELLVALUEBINDING_HXX
23 #include <com/sun/star/form/binding/XValueBinding.hpp>
24 #include <com/sun/star/util/XModifyBroadcaster.hpp>
25 #include <cppuhelper/compbase5.hxx>
26 #include <comphelper/propertycontainer.hxx>
27 #include <comphelper/uno3.hxx>
28 #include <comphelper/broadcasthelper.hxx>
29 #include <comphelper/proparrhlp.hxx>
30 #include <com/sun/star/table/XCell.hpp>
31 #include <com/sun/star/table/CellAddress.hpp>
32 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
33 #include <com/sun/star/text/XTextRange.hpp>
34 #include <com/sun/star/lang/DisposedException.hpp>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <com/sun/star/lang/XInitialization.hpp>
38 namespace calc
41 //= OCellValueBinding
43 class OCellValueBinding;
44 // the base for our interfaces
45 typedef ::cppu::WeakAggComponentImplHelper5 < ::com::sun::star::form::binding::XValueBinding
46 , ::com::sun::star::lang::XServiceInfo
47 , ::com::sun::star::util::XModifyBroadcaster
48 , ::com::sun::star::util::XModifyListener
49 , ::com::sun::star::lang::XInitialization
50 > OCellValueBinding_Base;
51 // the base for the property handling
52 typedef ::comphelper::OPropertyContainer OCellValueBinding_PBase;
53 // the second base for property handling
54 typedef ::comphelper::OPropertyArrayUsageHelper< OCellValueBinding >
55 OCellValueBinding_PABase;
57 class OCellValueBinding :public ::comphelper::OBaseMutex
58 ,public OCellValueBinding_Base // order matters! before OCellValueBinding_PBase, so rBHelper gets initialized
59 ,public OCellValueBinding_PBase
60 ,public OCellValueBinding_PABase
62 private:
63 ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >
64 m_xDocument; /// the document where our cell lives
65 ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >
66 m_xCell; /// the cell we're bound to, for double value access
67 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >
68 m_xCellText; /// the cell we're bound to, for text access
69 ::cppu::OInterfaceContainerHelper
70 m_aModifyListeners; /// our modify listeners
71 bool m_bInitialized; /// has XInitialization::initialize been called?
72 bool m_bListPos; /// constructed as ListPositionCellBinding?
74 public:
75 OCellValueBinding(
76 const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >& _rxDocument,
77 bool _bListPos
80 using OCellValueBinding_PBase::getFastPropertyValue;
82 protected:
83 virtual ~OCellValueBinding( );
85 protected:
86 // XInterface
87 DECLARE_XINTERFACE()
89 // XTypeProvider
90 DECLARE_XTYPEPROVIDER()
92 // XValueBinding
93 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getSupportedValueTypes( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 virtual sal_Bool SAL_CALL supportsType( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 virtual ::com::sun::star::uno::Any SAL_CALL getValue( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::form::binding::IncompatibleTypesException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 virtual void SAL_CALL setValue( const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::form::binding::IncompatibleTypesException, ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
98 // OComponentHelper/XComponent
99 virtual void SAL_CALL disposing() SAL_OVERRIDE;
101 // XServiceInfo
102 virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
106 // XPropertySet
107 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 // OPropertySetHelper
110 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
111 virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& _rValue, sal_Int32 _nHandle ) const SAL_OVERRIDE;
113 // ::comphelper::OPropertyArrayUsageHelper
114 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
116 // XModifyBroadcaster
117 virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
118 virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 // XModifyListener
121 virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 // XInitialization
125 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 private:
128 void checkDisposed( ) const;
129 void checkValueType( const ::com::sun::star::uno::Type& _rType ) const;
130 void checkInitialized();
132 /** notifies our modify listeners
133 @precond
134 our mutex is <em>not</em> locked
136 void notifyModified();
138 void setBooleanFormat();
140 private:
141 OCellValueBinding( const OCellValueBinding& ) SAL_DELETED_FUNCTION;
142 OCellValueBinding& operator=( const OCellValueBinding& ) SAL_DELETED_FUNCTION;
145 } // namespace calc
147 #endif // INCLUDED_SC_SOURCE_UI_UNOOBJ_CELLVALUEBINDING_HXX
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */