ooo-build r13031 - in trunk: . patches/dev300 patches/vba



Author: jiaojh
Date: Wed Jul  2 22:02:30 2008
New Revision: 13031
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13031&view=rev

Log:
    * patches/vba/vba-listbox-removeitem.diff:
    * patches/dev300/apply:
      support ListBox.removeItem.


Added:
   trunk/patches/vba/vba-listbox-removeitem.diff
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/apply

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Wed Jul  2 22:02:30 2008
@@ -1502,6 +1502,8 @@
 vba-empty-comparison-fix.diff, n#397438, Fong
 # support Range.MergeArea, Range.ShowDetail
 vba-range-missing-api.diff, Fong
+# ListBox.removeItem
+vba-listbox-removeitem.diff, n#405306, Jianhua
 [ VBAUntested ]
 SectionOwner => noelpwer
 vba-basic-null.diff i#85349, jjiao

Added: trunk/patches/vba/vba-listbox-removeitem.diff
==============================================================================
--- (empty file)
+++ trunk/patches/vba/vba-listbox-removeitem.diff	Wed Jul  2 22:02:30 2008
@@ -0,0 +1,78 @@
+--- oovbaapi/org/openoffice/msforms/XListBox.idl.bak	2008-07-03 05:58:56.000000000 +0800
++++ oovbaapi/org/openoffice/msforms/XListBox.idl	2008-07-03 01:02:40.000000000 +0800
+@@ -47,6 +47,7 @@ interface XListBox: com::sun::star::uno:
+ 	[attribute] any ListIndex;
+ 	//[attribute] sequence< boolean > Selected;
+ 	void AddItem( [in] any pvargItem, [in] any pvargIndex );
++	void removeItem( [in] any index );
+ 	void Clear();
+     any Selected( [in] long index );
+ };
+--- sc/source/ui/vba/vbalistbox.hxx.bak	2008-07-03 01:08:08.000000000 +0800
++++ sc/source/ui/vba/vbalistbox.hxx	2008-07-03 01:08:50.000000000 +0800
+@@ -64,6 +64,7 @@ public:
+ 
+ 	// Methods
+ 	virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
++    virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException);
+ 	virtual void SAL_CALL Clear(  ) throw (css::uno::RuntimeException);
+ 
+ 
+--- sc/source/ui/vba/vbalistbox.cxx.bak	2008-07-03 01:09:10.000000000 +0800
++++ sc/source/ui/vba/vbalistbox.cxx	2008-07-03 04:32:19.000000000 +0800
+@@ -214,6 +214,55 @@ ScVbaListBox::AddItem( const uno::Any& p
+ }
+ 
+ void SAL_CALL 
++ScVbaListBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
++{
++    sal_Int32 nIndex = 0;
++    // for int index
++	if ( index >>= nIndex  )
++	{
++		uno::Sequence< rtl::OUString > sList;
++		m_xProps->getPropertyValue( ITEMS ) >>= sList;
++        if( nIndex < 0 || nIndex > ( sList.getLength() - 1 ) )
++            throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid index" ), uno::Reference< uno::XInterface > () );
++        if( sList.hasElements() )
++        {
++            if( sList.getLength() == 1 )
++            {
++                Clear();
++                return;
++            }
++			// just copy those elements above the one to be inserted
++			std::vector< rtl::OUString > sVec;
++			// reserve just the amount we need to copy
++			sVec.reserve( sList.getLength() - nIndex );
++
++			// point at first element to copy
++			rtl::OUString* pString = sList.getArray() + nIndex + 1;
++			const rtl::OUString* pEndString = sList.getArray() + sList.getLength();
++			// copy elements	
++			for ( ; pString != pEndString; ++pString )
++            {
++				sVec.push_back( *pString );
++            }
++		
++			// point at first element to be overwritten
++			pString = sList.getArray() + nIndex;
++			std::vector< rtl::OUString >::iterator it = sVec.begin();
++			while( it != sVec.end() )
++            {
++			    *pString = *it;	
++                ++pString;
++                ++it;
++            }
++			sList.realloc(  sList.getLength() - 1 );
++		}
++
++		m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
++		
++	}
++}
++
++void SAL_CALL 
+ ScVbaListBox::Clear(  ) throw (uno::RuntimeException)
+ {
+ 	// urk, setValue doesn't seem to work !!



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]