1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef SC_VBA_LISTBOX_HXX 24 #define SC_VBA_LISTBOX_HXX 25 #include <cppuhelper/implbase2.hxx> 26 #include <com/sun/star/uno/XComponentContext.hpp> 27 #include <com/sun/star/script/XDefaultProperty.hpp> 28 #include <ooo/vba/msforms/XListBox.hpp> 29 #include <com/sun/star/beans/PropertyAttribute.hpp> 30 31 #include "vbacontrol.hxx" 32 #include <vbahelper/vbapropvalue.hxx> 33 #include "vbalistcontrolhelper.hxx" 34 #include <vbahelper/vbahelper.hxx> 35 36 typedef cppu::ImplInheritanceHelper2<ScVbaControl, ov::msforms::XListBox, css::script::XDefaultProperty > ListBoxImpl_BASE; 37 class ScVbaListBox : public ListBoxImpl_BASE 38 ,public PropListener 39 { 40 std::auto_ptr< ListControlHelper > mpListHelper; 41 rtl::OUString sSourceName; 42 rtl::OUString msDftPropName; 43 44 sal_Int16 m_nIndex; 45 46 public: 47 ScVbaListBox( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ); 48 49 // Attributes 50 virtual css::uno::Any SAL_CALL getListIndex() throw (css::uno::RuntimeException); 51 virtual void SAL_CALL setListIndex( const css::uno::Any& _value ) throw (css::uno::RuntimeException); 52 virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException); 53 virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); 54 virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException); 55 virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); 56 virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException); 57 virtual sal_Bool SAL_CALL getMultiSelect() throw (css::uno::RuntimeException); 58 virtual void SAL_CALL setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException); 59 virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException); 60 61 // Methods 62 virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException); 63 virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException); 64 virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException); 65 virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException); 66 virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException); 67 // XControl 68 virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException); 69 70 // XDefaultProperty getDefaultPropertyName()71 rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } 72 73 //XHelperInterface 74 virtual rtl::OUString& getServiceImplName(); 75 virtual css::uno::Sequence<rtl::OUString> getServiceNames(); 76 77 //PropListener 78 virtual void setValueEvent( const css::uno::Any& value ); 79 virtual css::uno::Any getValueEvent(); 80 81 82 }; 83 84 #endif // 85