1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 SC_CELLVALUEBINDING_HXX
21 #define SC_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>
39 //.........................................................................
42 //.........................................................................
44 //=====================================================================
46 //=====================================================================
47 class OCellValueBinding
;
48 // the base for our interfaces
49 typedef ::cppu::WeakAggComponentImplHelper5
< ::com::sun::star::form::binding::XValueBinding
50 , ::com::sun::star::lang::XServiceInfo
51 , ::com::sun::star::util::XModifyBroadcaster
52 , ::com::sun::star::util::XModifyListener
53 , ::com::sun::star::lang::XInitialization
54 > OCellValueBinding_Base
;
55 // the base for the property handling
56 typedef ::comphelper::OPropertyContainer OCellValueBinding_PBase
;
57 // the second base for property handling
58 typedef ::comphelper::OPropertyArrayUsageHelper
< OCellValueBinding
>
59 OCellValueBinding_PABase
;
61 class OCellValueBinding
:public ::comphelper::OBaseMutex
62 ,public OCellValueBinding_Base
// order matters! before OCellValueBinding_PBase, so rBHelper gets initialized
63 ,public OCellValueBinding_PBase
64 ,public OCellValueBinding_PABase
67 ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XSpreadsheetDocument
>
68 m_xDocument
; /// the document where our cell lives
69 ::com::sun::star::uno::Reference
< ::com::sun::star::table::XCell
>
70 m_xCell
; /// the cell we're bound to, for double value access
71 ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextRange
>
72 m_xCellText
; /// the cell we're bound to, for text access
73 ::cppu::OInterfaceContainerHelper
74 m_aModifyListeners
; /// our modify listeners
75 sal_Bool m_bInitialized
; /// has XInitialization::initialize been called?
76 sal_Bool m_bListPos
; /// constructed as ListPositionCellBinding?
80 const ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XSpreadsheetDocument
>& _rxDocument
,
84 using OCellValueBinding_PBase::getFastPropertyValue
;
87 ~OCellValueBinding( );
94 DECLARE_XTYPEPROVIDER()
97 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getSupportedValueTypes( ) throw (::com::sun::star::uno::RuntimeException
);
98 virtual sal_Bool SAL_CALL
supportsType( const ::com::sun::star::uno::Type
& aType
) throw (::com::sun::star::uno::RuntimeException
);
99 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
);
100 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
);
102 // OComponentHelper/XComponent
103 virtual void SAL_CALL
disposing();
106 virtual OUString SAL_CALL
getImplementationName( ) throw (::com::sun::star::uno::RuntimeException
);
107 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
);
108 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException
);
111 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
);
113 // OPropertySetHelper
114 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
115 virtual void SAL_CALL
getFastPropertyValue( ::com::sun::star::uno::Any
& _rValue
, sal_Int32 _nHandle
) const;
117 // ::comphelper::OPropertyArrayUsageHelper
118 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( ) const;
120 // XModifyBroadcaster
121 virtual void SAL_CALL
addModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
122 virtual void SAL_CALL
removeModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
125 virtual void SAL_CALL
modified( const ::com::sun::star::lang::EventObject
& aEvent
) throw (::com::sun::star::uno::RuntimeException
);
126 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw (::com::sun::star::uno::RuntimeException
);
129 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
);
132 void checkDisposed( ) const
133 SAL_THROW( ( ::com::sun::star::lang::DisposedException
) );
134 void checkValueType( const ::com::sun::star::uno::Type
& _rType
) const
135 SAL_THROW( ( ::com::sun::star::form::binding::IncompatibleTypesException
) );
136 void checkInitialized()
137 SAL_THROW( ( ::com::sun::star::uno::RuntimeException
) );
139 /** notifies our modify listeners
141 our mutex is <em>not</em> locked
143 void notifyModified();
145 void setBooleanFormat();
148 OCellValueBinding(); // never implemented
149 OCellValueBinding( const OCellValueBinding
& ); // never implemented
150 OCellValueBinding
& operator=( const OCellValueBinding
& ); // never implemented
154 static const char* checkConsistency_static( const void* _pThis
);
155 const char* checkConsistency( ) const;
159 //.........................................................................
161 //.........................................................................
163 #endif // SC_CELLVALUEBINDING_HXX
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */