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_CELLLISTSOURCE_HXX
21 #define SC_CELLLISTSOURCE_HXX
23 #include <com/sun/star/form/binding/XListEntrySource.hpp>
24 #include <cppuhelper/compbase4.hxx>
25 #include <comphelper/propertycontainer.hxx>
26 #include <comphelper/uno3.hxx>
27 #include <comphelper/broadcasthelper.hxx>
28 #include <comphelper/proparrhlp.hxx>
29 #include <com/sun/star/table/XCellRange.hpp>
30 #include <com/sun/star/table/CellRangeAddress.hpp>
31 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
32 #include <com/sun/star/lang/DisposedException.hpp>
33 #include <com/sun/star/lang/XServiceInfo.hpp>
34 #include <com/sun/star/lang/XInitialization.hpp>
35 #include <com/sun/star/util/XModifyListener.hpp>
38 //.........................................................................
41 //.........................................................................
43 //=====================================================================
45 //=====================================================================
46 class OCellListSource
;
47 // the base for our interfaces
48 typedef ::cppu::WeakAggComponentImplHelper4
< ::com::sun::star::form::binding::XListEntrySource
49 , ::com::sun::star::util::XModifyListener
50 , ::com::sun::star::lang::XServiceInfo
51 , ::com::sun::star::lang::XInitialization
52 > OCellListSource_Base
;
53 // the base for the property handling
54 typedef ::comphelper::OPropertyContainer OCellListSource_PBase
;
55 // the second base for property handling
56 typedef ::comphelper::OPropertyArrayUsageHelper
< OCellListSource
>
57 OCellListSource_PABase
;
59 class OCellListSource
:public ::comphelper::OBaseMutex
60 ,public OCellListSource_Base
// order matters! before OCellListSource_PBase, so rBHelper gets initialized
61 ,public OCellListSource_PBase
62 ,public OCellListSource_PABase
65 ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XSpreadsheetDocument
>
66 m_xDocument
; /// the document where our cell lives
67 ::com::sun::star::uno::Reference
< ::com::sun::star::table::XCellRange
>
68 m_xRange
; /// the range of cells we're bound to
69 ::cppu::OInterfaceContainerHelper
70 m_aListEntryListeners
; /// our listeners
71 sal_Bool m_bInitialized
; /// has XInitialization::initialize been called?
75 const ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XSpreadsheetDocument
>& _rxDocument
78 using OCellListSource_PBase::getFastPropertyValue
;
88 DECLARE_XTYPEPROVIDER()
91 virtual sal_Int32 SAL_CALL
getListEntryCount( ) throw (::com::sun::star::uno::RuntimeException
);
92 virtual OUString SAL_CALL
getListEntry( sal_Int32 Position
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
93 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getAllListEntries( ) throw (::com::sun::star::uno::RuntimeException
);
94 virtual void SAL_CALL
addListEntryListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::form::binding::XListEntryListener
>& Listener
) throw (::com::sun::star::lang::NullPointerException
, ::com::sun::star::uno::RuntimeException
);
95 virtual void SAL_CALL
removeListEntryListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::form::binding::XListEntryListener
>& Listener
) throw (::com::sun::star::lang::NullPointerException
, ::com::sun::star::uno::RuntimeException
);
97 // OComponentHelper/XComponent
98 virtual void SAL_CALL
disposing();
101 virtual OUString SAL_CALL
getImplementationName( ) throw (::com::sun::star::uno::RuntimeException
);
102 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
);
103 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException
);
106 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
);
108 // OPropertySetHelper
109 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
110 virtual void SAL_CALL
getFastPropertyValue( ::com::sun::star::uno::Any
& _rValue
, sal_Int32 _nHandle
) const;
112 // ::comphelper::OPropertyArrayUsageHelper
113 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( ) const;
116 virtual void SAL_CALL
modified( const ::com::sun::star::lang::EventObject
& aEvent
) throw (::com::sun::star::uno::RuntimeException
);
117 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw (::com::sun::star::uno::RuntimeException
);
120 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
);
123 void checkDisposed( ) const
124 SAL_THROW( ( ::com::sun::star::lang::DisposedException
) );
125 void checkInitialized()
126 SAL_THROW( ( ::com::sun::star::uno::RuntimeException
) );
128 /** retrieves the actual address of our cell range
130 our m_xRange is not <NULL/>
132 ::com::sun::star::table::CellRangeAddress
133 getRangeAddress( ) const;
135 /** retrievs the text of a cell within our range
136 @param _nRangeRelativeColumn
137 the relative column index of the cell within our range
138 @param _nRangeRelativeRow
139 the relative row index of the cell within our range
141 our m_xRange is not <NULL/>
144 getCellTextContent_noCheck(
145 sal_Int32 _nRangeRelativeColumn
,
146 sal_Int32 _nRangeRelativeRow
149 void notifyModified();
152 OCellListSource(); // never implemented
153 OCellListSource( const OCellListSource
& ); // never implemented
154 OCellListSource
& operator=( const OCellListSource
& ); // never implemented
158 static const char* checkConsistency_static( const void* _pThis
);
159 const char* checkConsistency( ) const;
163 //.........................................................................
165 //.........................................................................
167 #endif // SC_CELLLISTSOURCE_HXX
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */