1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: celllistsource.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_CELLLISTSOURCE_HXX
32 #define SC_CELLLISTSOURCE_HXX
34 #include <com/sun/star/form/binding/XListEntrySource.hpp>
35 #include <cppuhelper/compbase4.hxx>
36 #include <comphelper/propertycontainer.hxx>
37 #include <comphelper/uno3.hxx>
38 #include <comphelper/broadcasthelper.hxx>
39 #include <comphelper/proparrhlp.hxx>
40 #include <com/sun/star/table/XCellRange.hpp>
41 #include <com/sun/star/table/CellRangeAddress.hpp>
42 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
43 #include <com/sun/star/lang/DisposedException.hpp>
44 #include <com/sun/star/lang/XServiceInfo.hpp>
45 #include <com/sun/star/lang/XInitialization.hpp>
46 #include <com/sun/star/util/XModifyListener.hpp>
49 //.........................................................................
52 //.........................................................................
54 //=====================================================================
56 //=====================================================================
57 class OCellListSource
;
58 // the base for our interfaces
59 typedef ::cppu::WeakAggComponentImplHelper4
< ::com::sun::star::form::binding::XListEntrySource
60 , ::com::sun::star::util::XModifyListener
61 , ::com::sun::star::lang::XServiceInfo
62 , ::com::sun::star::lang::XInitialization
63 > OCellListSource_Base
;
64 // the base for the property handling
65 typedef ::comphelper::OPropertyContainer OCellListSource_PBase
;
66 // the second base for property handling
67 typedef ::comphelper::OPropertyArrayUsageHelper
< OCellListSource
>
68 OCellListSource_PABase
;
70 class OCellListSource
:public ::comphelper::OBaseMutex
71 ,public OCellListSource_Base
// order matters! before OCellListSource_PBase, so rBHelper gets initialized
72 ,public OCellListSource_PBase
73 ,public OCellListSource_PABase
76 ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XSpreadsheetDocument
>
77 m_xDocument
; /// the document where our cell lives
78 ::com::sun::star::uno::Reference
< ::com::sun::star::table::XCellRange
>
79 m_xRange
; /// the range of cells we're bound to
80 ::cppu::OInterfaceContainerHelper
81 m_aListEntryListeners
; /// our listeners
82 sal_Bool m_bInitialized
; /// has XInitialization::initialize been called?
86 const ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XSpreadsheetDocument
>& _rxDocument
89 using OCellListSource_PBase::getFastPropertyValue
;
99 DECLARE_XTYPEPROVIDER()
102 virtual sal_Int32 SAL_CALL
getListEntryCount( ) throw (::com::sun::star::uno::RuntimeException
);
103 virtual ::rtl::OUString SAL_CALL
getListEntry( sal_Int32 Position
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
104 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getAllListEntries( ) throw (::com::sun::star::uno::RuntimeException
);
105 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
);
106 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
);
108 // OComponentHelper/XComponent
109 virtual void SAL_CALL
disposing();
112 virtual ::rtl::OUString SAL_CALL
getImplementationName( ) throw (::com::sun::star::uno::RuntimeException
);
113 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
) throw (::com::sun::star::uno::RuntimeException
);
114 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException
);
117 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException
);
119 // OPropertySetHelper
120 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
121 virtual void SAL_CALL
getFastPropertyValue( ::com::sun::star::uno::Any
& _rValue
, sal_Int32 _nHandle
) const;
123 // ::comphelper::OPropertyArrayUsageHelper
124 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( ) const;
127 virtual void SAL_CALL
modified( const ::com::sun::star::lang::EventObject
& aEvent
) throw (::com::sun::star::uno::RuntimeException
);
128 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw (::com::sun::star::uno::RuntimeException
);
131 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
);
134 void checkDisposed( ) const
135 SAL_THROW( ( ::com::sun::star::lang::DisposedException
) );
136 void checkInitialized()
137 SAL_THROW( ( ::com::sun::star::uno::RuntimeException
) );
139 /** retrieves the actual address of our cell range
141 our m_xRange is not <NULL/>
143 ::com::sun::star::table::CellRangeAddress
144 getRangeAddress( ) const;
146 /** retrievs the text of a cell within our range
147 @param _nRangeRelativeColumn
148 the relative column index of the cell within our range
149 @param _nRangeRelativeRow
150 the relative row index of the cell within our range
152 our m_xRange is not <NULL/>
155 getCellTextContent_noCheck(
156 sal_Int32 _nRangeRelativeColumn
,
157 sal_Int32 _nRangeRelativeRow
160 void notifyModified();
163 OCellListSource(); // never implemented
164 OCellListSource( const OCellListSource
& ); // never implemented
165 OCellListSource
& operator=( const OCellListSource
& ); // never implemented
169 static const char* checkConsistency_static( const void* _pThis
);
170 const char* checkConsistency( ) const;
174 //.........................................................................
176 //.........................................................................
178 #endif // SC_CELLLISTSOURCE_HXX