ooo-build r13910 - in trunk: . patches/dev300
- From: noelpwer svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r13910 - in trunk: . patches/dev300
- Date: Wed, 17 Sep 2008 09:16:50 +0000 (UTC)
Author: noelpwer
Date: Wed Sep 17 09:16:49 2008
New Revision: 13910
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13910&view=rev
Log:
2008-09-17 Noel Power <noel power novell com>
* patches/dev300/cws-npower11.diff: some listbox, combobox refactoring
Modified:
trunk/ChangeLog
trunk/patches/dev300/cws-npower11.diff
Modified: trunk/patches/dev300/cws-npower11.diff
==============================================================================
--- trunk/patches/dev300/cws-npower11.diff (original)
+++ trunk/patches/dev300/cws-npower11.diff Wed Sep 17 09:16:49 2008
@@ -96,19 +96,22 @@
===================================================================
RCS file: /cvs/sc/sc/source/ui/vba/makefile.mk,v
retrieving revision 1.6
-retrieving revision 1.5.42.8
-diff -u -p -u -p -b -w -B -r1.6 -r1.5.42.8
+retrieving revision 1.5.42.9
+diff -u -p -u -p -b -w -B -r1.6 -r1.5.42.9
--- sc/source/ui/vba/makefile.mk 11 Apr 2008 00:46:57 -0000 1.6
-+++ sc/source/ui/vba/makefile.mk 5 Sep 2008 14:04:18 -0000 1.5.42.8
-@@ -88,6 +88,7 @@ SLOFILES= \
++++ sc/source/ui/vba/makefile.mk 16 Sep 2008 17:55:19 -0000 1.5.42.9
+@@ -88,8 +88,10 @@ SLOFILES= \
$(SLO)$/vbabutton.obj \
$(SLO)$/vbalabel.obj \
$(SLO)$/vbatextbox.obj \
+ $(SLO)$/vbatextboxshape.obj \
$(SLO)$/vbaradiobutton.obj \
$(SLO)$/vbalistbox.obj \
++ $(SLO)$/vbalistcontrolhelper.obj \
$(SLO)$/vbapropvalue.obj \
-@@ -111,8 +112,26 @@ SLOFILES= \
+ $(SLO)$/vbapane.obj \
+ $(SLO)$/vbashape.obj \
+@@ -111,8 +113,26 @@ SLOFILES= \
$(SLO)$/vbaformatconditions.obj \
$(SLO)$/vbastyle.obj \
$(SLO)$/vbastyles.obj \
@@ -964,11 +967,11 @@
===================================================================
RCS file: /cvs/sc/sc/source/ui/vba/vbacombobox.cxx,v
retrieving revision 1.4
-retrieving revision 1.3.42.4
-diff -u -p -u -p -b -w -B -r1.4 -r1.3.42.4
+retrieving revision 1.3.42.5
+diff -u -p -u -p -b -w -B -r1.4 -r1.3.42.5
--- sc/source/ui/vba/vbacombobox.cxx 11 Apr 2008 00:55:28 -0000 1.4
-+++ sc/source/ui/vba/vbacombobox.cxx 15 Sep 2008 19:20:01 -0000 1.3.42.4
-@@ -34,34 +34,93 @@ using namespace com::sun::star;
++++ sc/source/ui/vba/vbacombobox.cxx 16 Sep 2008 17:55:19 -0000 1.3.42.5
+@@ -34,22 +34,25 @@ using namespace com::sun::star;
using namespace org::openoffice;
@@ -984,7 +987,6 @@
-ScVbaComboBox::ScVbaComboBox( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::drawing::XControlShape >& xControlShape ) : ComboBoxImpl_BASE( xContext, xControlShape )
+ScVbaComboBox::ScVbaComboBox( const uno::Reference< vba::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialogType ) : ComboBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialogType( bDialogType )
{
-+ if ( !mbDialogType )
// grab the default value property name
m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName;
}
@@ -1002,30 +1004,15 @@
uno::Any SAL_CALL
ScVbaComboBox::getValue() throw (uno::RuntimeException)
{
-+ if ( mbDialogType )
-+ return m_xProps->getPropertyValue( TEXT );
-+ else
- return m_xProps->getPropertyValue( sSourceName );
+@@ -57,11 +60,48 @@ ScVbaComboBox::getValue() throw (uno::Ru
}
void SAL_CALL
+ScVbaComboBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException)
+{
-+// #TODO Test me please
-+ uno::Sequence< rtl::OUString > sItems;
-+ m_xProps->getPropertyValue( ITEMS ) >>= sItems;
+ uno::Sequence< sal_Int16 > sSelection(1);
+ _value >>= sSelection[ 0 ];
-+ if ( mbDialogType )
-+ {
-+ if ( sItems.getLength() == 0 || sSelection[0] < 0 || sSelection[ 0 ] >= sItems.getLength() )
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Illegal index"), uno::Reference< uno::XInterface >() );
-+ setValue( uno::makeAny( sItems[ sSelection[ 0 ] ] ) );
-+ }
-+ else
-+ {
-+ m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( sSelection ) );
-+ }
++ m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( sSelection ) );
+}
+
+uno::Any SAL_CALL
@@ -1058,9 +1045,6 @@
+void SAL_CALL
ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
-+ if ( mbDialogType )
-+ m_xProps->setPropertyValue( TEXT, _value );
-+ else
m_xProps->setPropertyValue( sSourceName, _value );
}
@@ -1069,43 +1053,100 @@
::rtl::OUString SAL_CALL
ScVbaComboBox::getText() throw (uno::RuntimeException)
{
-@@ -140,3 +199,44 @@ ScVbaComboBox::Clear( ) throw (uno::Run
- setValue( uno::makeAny( rtl::OUString() ) );
- m_xProps->setPropertyValue( ITEMS, uno::makeAny( uno::Sequence< rtl::OUString >() ) );
- }
-+
+@@ -80,63 +120,55 @@ ScVbaComboBox::setText( const ::rtl::OUS
+ void SAL_CALL
+ ScVbaComboBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
+ {
++ mpListHelper->AddItem( pvargItem, pvargIndex );
++}
+
+- if ( pvargItem.hasValue() )
++void SAL_CALL
++ScVbaComboBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
+ {
+- uno::Sequence< rtl::OUString > sList;
+- m_xProps->getPropertyValue( ITEMS ) >>= sList;
+-
+- sal_Int32 nIndex = sList.getLength();
+-
+- if ( pvargIndex.hasValue() )
+- pvargIndex >>= nIndex;
+-
+- rtl::OUString sString;
+- pvargItem >>= sString;
++ mpListHelper->removeItem( index );
++}
+
+- // if no index specified or item is to be appended to end of
+- // list just realloc the array and set the last item
+- if ( nIndex == sList.getLength() )
++void SAL_CALL
++ScVbaComboBox::Clear( ) throw (uno::RuntimeException)
+ {
+- sal_Int32 nOldSize = sList.getLength();
+- sList.realloc( nOldSize + 1 );
+- sList[ nOldSize ] = sString;
++ mpListHelper->Clear();
+ }
+- else
+- {
+- // 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;
+- const rtl::OUString* pEndString = sList.getArray() + sList.getLength();
+- // insert the new element
+- sVec.push_back( sString );
+- // copy elements
+- for ( ; pString != pEndString; ++pString )
+- sVec.push_back( *pString );
+-
+- sList.realloc( sList.getLength() + 1 );
+-
+- // point at first element to be overwritten
+- pString = sList.getArray() + nIndex;
+- pEndString = sList.getArray() + sList.getLength();
+- std::vector< rtl::OUString >::iterator it = sVec.begin();
+- for ( ; pString != pEndString; ++pString, ++it)
+- *pString = *it;
+- //
+void SAL_CALL
+ScVbaComboBox::setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException)
+{
+ ScVbaControl::setRowSource( _rowsource );
-+ if ( _rowsource.getLength() == 0 )
-+ Clear();
-+}
-+
++ mpListHelper->setRowSource( _rowsource );
+ }
+
+- m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
+sal_Int32 SAL_CALL
+ScVbaComboBox::getListCount() throw (uno::RuntimeException)
+{
-+ uno::Sequence< rtl::OUString > sList;
-+ m_xProps->getPropertyValue( ITEMS ) >>= sList;
-+ return sList.getLength();
++ return mpListHelper->getListCount();
+}
-+
+
+uno::Any SAL_CALL
+ScVbaComboBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
+{
-+ return uno::Any();
-+}
++ return mpListHelper->List( pvargIndex, pvarColumn );
+ }
+
+rtl::OUString&
+ScVbaComboBox::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaComboBox") );
+ return sImplName;
-+}
-+
+ }
+
+-void SAL_CALL
+-ScVbaComboBox::Clear( ) throw (uno::RuntimeException)
+uno::Sequence< rtl::OUString >
+ScVbaComboBox::getServiceNames()
-+{
+ {
+- setValue( uno::makeAny( rtl::OUString() ) );
+- m_xProps->setPropertyValue( ITEMS, uno::makeAny( uno::Sequence< rtl::OUString >() ) );
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
@@ -1113,22 +1154,29 @@
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.msforms.ComboBox" ) );
+ }
+ return aServiceNames;
-+}
+ }
Index: sc/source/ui/vba/vbacombobox.hxx
===================================================================
RCS file: /cvs/sc/sc/source/ui/vba/vbacombobox.hxx,v
retrieving revision 1.4
-retrieving revision 1.3.42.4
-diff -u -p -u -p -b -w -B -r1.4 -r1.3.42.4
+retrieving revision 1.3.42.5
+diff -u -p -u -p -b -w -B -r1.4 -r1.3.42.5
--- sc/source/ui/vba/vbacombobox.hxx 11 Apr 2008 00:55:42 -0000 1.4
-+++ sc/source/ui/vba/vbacombobox.hxx 15 Sep 2008 19:20:01 -0000 1.3.42.4
-@@ -44,22 +44,17 @@
++++ sc/source/ui/vba/vbacombobox.hxx 16 Sep 2008 17:55:19 -0000 1.3.42.5
+@@ -39,27 +39,24 @@
+ #include <com/sun/star/beans/PropertyAttribute.hpp>
+
+ #include "vbacontrol.hxx"
++#include "vbalistcontrolhelper.hxx"
+ #include "vbahelper.hxx"
+
typedef cppu::ImplInheritanceHelper2<ScVbaControl, oo::msforms::XComboBox, css::script::XDefaultProperty > ComboBoxImpl_BASE;
class ScVbaComboBox : public ComboBoxImpl_BASE
{
-
- //css::uno::Reference< css::uno::XComponentContext > m_xContext;
- //css::uno::Reference< css::beans::XPropertySet > m_xProps;
++ std::auto_ptr< ListControlHelper > mpListHelper;
rtl::OUString sSourceName;
rtl::OUString msDftPropName;
-
@@ -1150,9 +1198,11 @@
virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
-@@ -68,9 +63,15 @@ public:
+@@ -67,10 +64,17 @@ 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);
+ virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException);
+ // XControl
@@ -4754,10 +4804,10 @@
===================================================================
RCS file: /cvs/sc/sc/source/ui/vba/vbalistbox.cxx,v
retrieving revision 1.4
-retrieving revision 1.3.42.5
-diff -u -p -u -p -b -w -B -r1.4 -r1.3.42.5
+retrieving revision 1.3.42.6
+diff -u -p -u -p -b -w -B -r1.4 -r1.3.42.6
--- sc/source/ui/vba/vbalistbox.cxx 11 Apr 2008 01:05:34 -0000 1.4
-+++ sc/source/ui/vba/vbalistbox.cxx 15 Sep 2008 19:20:02 -0000 1.3.42.5
++++ sc/source/ui/vba/vbalistbox.cxx 16 Sep 2008 17:55:19 -0000 1.3.42.6
@@ -33,35 +33,54 @@
#include "vbapropvalue.hxx"
#include <vector>
@@ -4778,6 +4828,7 @@
{
- // grab the default value property name
- m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName;
++ mpListHelper.reset( new ListControlHelper( m_xProps ) );
}
-ScVbaListBox::ScVbaListBox( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< beans::XPropertySet >& xPropSet, const css::uno::Reference< css::drawing::XControlShape > xControlShape ) : ListBoxImpl_BASE( xContext, xPropSet, xControlShape )
@@ -4812,7 +4863,7 @@
if( getMultiSelect() )
throw uno::RuntimeException( rtl::OUString::createFromAscii(
"Attribute use invalid." ), uno::Reference< uno::XInterface >() );
- uno::Reference< form::validation::XValidatableFormComponent > xValidatableFormComponent( m_xProps, uno::UNO_QUERY_THROW );
+- uno::Reference< form::validation::XValidatableFormComponent > xValidatableFormComponent( m_xProps, uno::UNO_QUERY_THROW );
- return xValidatableFormComponent->getCurrentValue();
+ uno::Any aRet;
+ if ( sSelection.getLength() )
@@ -4885,44 +4936,74 @@
throw uno::RuntimeException( rtl::OUString::createFromAscii(
"Error Number." ), uno::Reference< uno::XInterface >() );
m_nIndex = static_cast< sal_Int16 >( index );
-@@ -219,12 +215,45 @@ ScVbaListBox::AddItem( const uno::Any& p
- }
-
+@@ -166,65 +162,24 @@ ScVbaListBox::Selected( sal_Int32 index
void SAL_CALL
+ ScVbaListBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
+ {
+- if ( pvargItem.hasValue() )
+- {
+- uno::Sequence< rtl::OUString > sList;
+- m_xProps->getPropertyValue( ITEMS ) >>= sList;
+-
+- sal_Int32 nIndex = sList.getLength();
+-
+- if ( pvargIndex.hasValue() )
+- pvargIndex >>= nIndex;
+-
+- rtl::OUString sString = getAnyAsString( pvargItem );
+-
+- // if no index specified or item is to be appended to end of
+- // list just realloc the array and set the last item
+- if ( nIndex == sList.getLength() )
+- {
+- sal_Int32 nOldSize = sList.getLength();
+- sList.realloc( nOldSize + 1 );
+- sList[ nOldSize ] = sString;
+- }
+- else
+- {
+- // 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;
+- const rtl::OUString* pEndString = sList.getArray() + sList.getLength();
+- // insert the new element
+- sVec.push_back( sString );
+- // copy elements
+- for ( ; pString != pEndString; ++pString )
+- sVec.push_back( *pString );
+-
+- sList.realloc( sList.getLength() + 1 );
+-
+- // point at first element to be overwritten
+- pString = sList.getArray() + nIndex;
+- pEndString = sList.getArray() + sList.getLength();
+- std::vector< rtl::OUString >::iterator it = sVec.begin();
+- for ( ; pString != pEndString; ++pString, ++it)
+- *pString = *it;
+- //
++ mpListHelper->AddItem( pvargItem, pvargIndex );
+ }
+
+- m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
+-
+- }
++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;
-+ }
-+ for( sal_Int32 i = nIndex; i < ( sList.getLength()-1 ); i++ )
-+ {
-+ sList[i] = sList[i+1];
-+ }
-+ sList.realloc( sList.getLength() - 1 );
-+ }
-+
-+ m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
-+ }
-+}
-+
-+void SAL_CALL
++ mpListHelper->removeItem( index );
+ }
+
+ void SAL_CALL
ScVbaListBox::Clear( ) throw (uno::RuntimeException)
{
- // urk, setValue doesn't seem to work !!
- //setValue( uno::makeAny( sal_Int16() ) );
- m_xProps->setPropertyValue( ITEMS, uno::makeAny( uno::Sequence< rtl::OUString >() ) );
+- // urk, setValue doesn't seem to work !!
+- //setValue( uno::makeAny( sal_Int16() ) );
+- m_xProps->setPropertyValue( ITEMS, uno::makeAny( uno::Sequence< rtl::OUString >() ) );
++ mpListHelper->Clear();
}
+
+// this is called when something like the following vba code is used
@@ -4931,7 +5012,7 @@
//PropListener
void
ScVbaListBox::setValueEvent( const uno::Any& value )
-@@ -234,7 +263,7 @@ ScVbaListBox::setValueEvent( const uno::
+@@ -234,7 +189,7 @@ ScVbaListBox::setValueEvent( const uno::
throw uno::RuntimeException( rtl::OUString::createFromAscii(
"Invalid type\n. need boolean." ), uno::Reference< uno::XInterface >() );
uno::Sequence< sal_Int16 > nList;
@@ -4940,7 +5021,7 @@
sal_Int16 nLength = static_cast<sal_Int16>( nList.getLength() );
sal_Int16 nIndex = m_nIndex;
for( sal_Int16 i = 0; i < nLength; i++ )
-@@ -250,7 +279,8 @@ ScVbaListBox::setValueEvent( const uno::
+@@ -250,7 +205,8 @@ ScVbaListBox::setValueEvent( const uno::
nList[i] = nList[i + 1];
}
nList.realloc( nLength - 1 );
@@ -4950,7 +5031,7 @@
return;
}
}
-@@ -271,6 +301,10 @@ ScVbaListBox::setValueEvent( const uno::
+@@ -271,6 +227,10 @@ ScVbaListBox::setValueEvent( const uno::
}
}
@@ -4961,7 +5042,7 @@
css::uno::Any
ScVbaListBox::getValueEvent()
{
-@@ -287,3 +321,70 @@ ScVbaListBox::getValueEvent()
+@@ -287,3 +247,41 @@ ScVbaListBox::getValueEvent()
return uno::makeAny( sal_False );
}
@@ -4970,48 +5051,19 @@
+ScVbaListBox::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
+{
+ ScVbaControl::setRowSource( _rowsource );
-+ if ( _rowsource.getLength() == 0 )
-+ Clear();
++ mpListHelper->setRowSource( _rowsource );
+}
+
+sal_Int32 SAL_CALL
+ScVbaListBox::getListCount() throw (uno::RuntimeException)
+{
-+ uno::Sequence< rtl::OUString > sList;
-+ m_xProps->getPropertyValue( ITEMS ) >>= sList;
-+ return sList.getLength();
++ return mpListHelper->getListCount();
+}
+
+uno::Any SAL_CALL
+ScVbaListBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
+{
-+ uno::Sequence< rtl::OUString > sList;
-+ m_xProps->getPropertyValue( ITEMS ) >>= sList;
-+ sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
-+ uno::Any aRet;
-+ if ( pvargIndex.hasValue() )
-+ {
-+ sal_Int16 nIndex = -1;
-+ pvargIndex >>= nIndex;
-+ if( nIndex < 0 || nIndex >= nLength )
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii(
-+ "Bad row Index" ), uno::Reference< uno::XInterface >() );
-+ aRet <<= sList[ nIndex ];
-+ }
-+ else if ( pvarColumn.hasValue() ) // pvarColumn on its own would be bad
-+ throw uno::RuntimeException( rtl::OUString::createFromAscii(
-+ "Bad column Index" ), uno::Reference< uno::XInterface >() );
-+ else // List() ( e.g. no args )
-+ {
-+ uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength );
-+ for ( sal_Int32 i = 0; i < nLength; ++i )
-+ {
-+ sReturnArray[ i ].realloc( 10 );
-+ sReturnArray[ i ][ 0 ] = sList[ i ];
-+ }
-+ aRet = uno::makeAny( sReturnArray );
-+ }
-+ return aRet;
++ return mpListHelper->List( pvargIndex, pvarColumn );
+}
+
+rtl::OUString&
@@ -5036,11 +5088,25 @@
===================================================================
RCS file: /cvs/sc/sc/source/ui/vba/vbalistbox.hxx,v
retrieving revision 1.3
-retrieving revision 1.2.42.5
-diff -u -p -u -p -b -w -B -r1.3 -r1.2.42.5
+retrieving revision 1.2.42.6
+diff -u -p -u -p -b -w -B -r1.3 -r1.2.42.6
--- sc/source/ui/vba/vbalistbox.hxx 11 Apr 2008 01:05:48 -0000 1.3
-+++ sc/source/ui/vba/vbalistbox.hxx 15 Sep 2008 19:20:02 -0000 1.2.42.5
-@@ -49,14 +49,12 @@ class ScVbaListBox : public ListBoxImpl_
++++ sc/source/ui/vba/vbalistbox.hxx 16 Sep 2008 17:55:20 -0000 1.2.42.6
+@@ -37,26 +37,26 @@
+
+ #include "vbacontrol.hxx"
+ #include "vbapropvalue.hxx"
++#include "vbalistcontrolhelper.hxx"
+ #include "vbahelper.hxx"
+
+ typedef cppu::ImplInheritanceHelper2<ScVbaControl, oo::msforms::XListBox, css::script::XDefaultProperty > ListBoxImpl_BASE;
+ class ScVbaListBox : public ListBoxImpl_BASE
+ ,public PropListener
+ {
++ std::auto_ptr< ListControlHelper > mpListHelper;
+ rtl::OUString sSourceName;
+ rtl::OUString msDftPropName;
+
sal_Int16 m_nIndex;
public:
@@ -5059,7 +5125,7 @@
virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
-@@ -67,12 +65,19 @@ public:
+@@ -67,12 +67,19 @@ public:
// Methods
virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
@@ -5080,6 +5146,185 @@
//PropListener
virtual void setValueEvent( const css::uno::Any& value );
virtual css::uno::Any getValueEvent();
+Index: sc/source/ui/vba/vbalistcontrolhelper.cxx
+===================================================================
+RCS file: sc/source/ui/vba/vbalistcontrolhelper.cxx
+diff -N sc/source/ui/vba/vbalistcontrolhelper.cxx
+--- /dev/null 1 Jan 1970 00:00:00 -0000
++++ sc/source/ui/vba/vbalistcontrolhelper.cxx 16 Sep 2008 17:55:20 -0000 1.1.2.1
+@@ -0,0 +1,145 @@
++#include <vbalistcontrolhelper.hxx>
++
++using namespace com::sun::star;
++using namespace org::openoffice;
++
++const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
++
++void SAL_CALL
++ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
++{
++ if ( pvargItem.hasValue() )
++ {
++ uno::Sequence< rtl::OUString > sList;
++ m_xProps->getPropertyValue( ITEMS ) >>= sList;
++
++ sal_Int32 nIndex = sList.getLength();
++
++ if ( pvargIndex.hasValue() )
++ pvargIndex >>= nIndex;
++
++ rtl::OUString sString = getAnyAsString( pvargItem );
++
++ // if no index specified or item is to be appended to end of
++ // list just realloc the array and set the last item
++ if ( nIndex == sList.getLength() )
++ {
++ sal_Int32 nOldSize = sList.getLength();
++ sList.realloc( nOldSize + 1 );
++ sList[ nOldSize ] = sString;
++ }
++ else
++ {
++ // 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;
++ const rtl::OUString* pEndString = sList.getArray() + sList.getLength();
++ // insert the new element
++ sVec.push_back( sString );
++ // copy elements
++ for ( ; pString != pEndString; ++pString )
++ sVec.push_back( *pString );
++
++ sList.realloc( sList.getLength() + 1 );
++
++ // point at first element to be overwritten
++ pString = sList.getArray() + nIndex;
++ pEndString = sList.getArray() + sList.getLength();
++ std::vector< rtl::OUString >::iterator it = sVec.begin();
++ for ( ; pString != pEndString; ++pString, ++it)
++ *pString = *it;
++ //
++ }
++
++ m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
++
++ }
++}
++
++void SAL_CALL
++ListControlHelper::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;
++ }
++ for( sal_Int32 i = nIndex; i < ( sList.getLength()-1 ); i++ )
++ {
++ sList[i] = sList[i+1];
++ }
++ sList.realloc( sList.getLength() - 1 );
++ }
++
++ m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
++ }
++}
++
++void SAL_CALL
++ListControlHelper::Clear( ) throw (uno::RuntimeException)
++{
++ // urk, setValue doesn't seem to work !!
++ //setValue( uno::makeAny( sal_Int16() ) );
++ m_xProps->setPropertyValue( ITEMS, uno::makeAny( uno::Sequence< rtl::OUString >() ) );
++}
++
++void SAL_CALL
++ListControlHelper::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
++{
++ if ( _rowsource.getLength() == 0 )
++ Clear();
++}
++
++sal_Int32 SAL_CALL
++ListControlHelper::getListCount() throw (uno::RuntimeException)
++{
++ uno::Sequence< rtl::OUString > sList;
++ m_xProps->getPropertyValue( ITEMS ) >>= sList;
++ return sList.getLength();
++}
++
++uno::Any SAL_CALL
++ListControlHelper::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
++{
++ uno::Sequence< rtl::OUString > sList;
++ m_xProps->getPropertyValue( ITEMS ) >>= sList;
++ sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
++ uno::Any aRet;
++ if ( pvargIndex.hasValue() )
++ {
++ sal_Int16 nIndex = -1;
++ pvargIndex >>= nIndex;
++ if( nIndex < 0 || nIndex >= nLength )
++ throw uno::RuntimeException( rtl::OUString::createFromAscii(
++ "Bad row Index" ), uno::Reference< uno::XInterface >() );
++ aRet <<= sList[ nIndex ];
++ }
++ else if ( pvarColumn.hasValue() ) // pvarColumn on its own would be bad
++ throw uno::RuntimeException( rtl::OUString::createFromAscii(
++ "Bad column Index" ), uno::Reference< uno::XInterface >() );
++ else // List() ( e.g. no args )
++ {
++ uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength );
++ for ( sal_Int32 i = 0; i < nLength; ++i )
++ {
++ sReturnArray[ i ].realloc( 10 );
++ sReturnArray[ i ][ 0 ] = sList[ i ];
++ }
++ aRet = uno::makeAny( sReturnArray );
++ }
++ return aRet;
++}
+Index: sc/source/ui/vba/vbalistcontrolhelper.hxx
+===================================================================
+RCS file: sc/source/ui/vba/vbalistcontrolhelper.hxx
+diff -N sc/source/ui/vba/vbalistcontrolhelper.hxx
+--- /dev/null 1 Jan 1970 00:00:00 -0000
++++ sc/source/ui/vba/vbalistcontrolhelper.hxx 16 Sep 2008 17:55:20 -0000 1.1.2.1
+@@ -0,0 +1,20 @@
++#ifndef SC_VBA_LISTCONTROLHELPER
++#define SC_VBA_LISTCONTROLHELPER
++
++#include "vbahelper.hxx"
++
++class ListControlHelper
++{
++ css::uno::Reference< css::beans::XPropertySet > m_xProps;
++
++public:
++ ListControlHelper( const css::uno::Reference< css::beans::XPropertySet >& rxControl ) : m_xProps( rxControl ){}
++
++ 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 setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
++ virtual ::sal_Int32 SAL_CALL getListCount() throw (css::uno::RuntimeException);
++ virtual css::uno::Any SAL_CALL List( const css::uno::Any& pvargIndex, const css::uno::Any& pvarColumn ) throw (css::uno::RuntimeException);
++ virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException);
++};
++#endif
Index: sc/source/ui/vba/vbamultipage.cxx
===================================================================
RCS file: sc/source/ui/vba/vbamultipage.cxx
@@ -7460,10 +7705,10 @@
===================================================================
RCS file: /cvs/sc/sc/source/ui/vba/vbarange.cxx,v
retrieving revision 1.9
-retrieving revision 1.5.34.14
-diff -u -p -u -p -b -w -B -r1.9 -r1.5.34.14
+retrieving revision 1.5.34.15
+diff -u -p -u -p -b -w -B -r1.9 -r1.5.34.15
--- sc/source/ui/vba/vbarange.cxx 14 May 2008 10:03:31 -0000 1.9
-+++ sc/source/ui/vba/vbarange.cxx 5 Sep 2008 14:04:22 -0000 1.5.34.14
++++ sc/source/ui/vba/vbarange.cxx 16 Sep 2008 13:50:23 -0000 1.5.34.15
@@ -115,6 +115,7 @@
#include <org/openoffice/excel/XlCellType.hpp>
#include <org/openoffice/excel/XlSpecialCellsValue.hpp>
@@ -7823,7 +8068,7 @@
return new CellsEnumeration( mxContext, m_Areas );
}
-@@ -3363,7 +3613,7 @@ ScVbaRange::getRowHeight() throw (uno::R
+@@ -3363,26 +3613,32 @@ ScVbaRange::getRowHeight() throw (uno::R
return xRange->getRowHeight();
}
@@ -7832,17 +8077,36 @@
// range is different from any other then return NULL
RangeHelper thisRange( mxRange );
table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
-@@ -3373,7 +3623,8 @@ ScVbaRange::getRowHeight() throw (uno::R
- double nHeight = getCalcRowHeight( thisAddress );
+
+ sal_Int32 nStartRow = thisAddress.StartRow;
+ sal_Int32 nEndRow = thisAddress.EndRow;
+- double nHeight = getCalcRowHeight( thisAddress );
++ USHORT nRowTwips = 0;
// #TODO probably possible to use the SfxItemSet ( and see if
// SFX_ITEM_DONTCARE is set ) to improve performance
- if ( mbIsRows )
+// #CHECKME looks like this is general behaviour not just row Range specific
+// if ( mbIsRows )
++ ScDocShell* pShell = getScDocShell();
++ if ( pShell )
{
for ( sal_Int32 nRow = nStartRow ; nRow <= nEndRow; ++nRow )
{
-@@ -4119,7 +4370,7 @@ ScVbaRange::Autofit() throw (uno::Runtim
+ thisAddress.StartRow = nRow;
+- double nCurHeight = getCalcRowHeight( thisAddress );
+- if ( nHeight != nCurHeight )
++ USHORT nCurTwips = pShell->GetDocument()->GetOriginalHeight( thisAddress.StartRow, thisAddress.Sheet );
++ if ( nRow == nStartRow )
++ nRowTwips = nCurTwips;
++ if ( nRowTwips != nCurTwips )
+ return aNULL();
+ }
+ }
++ double nHeight = lcl_Round2DecPlaces( lcl_TwipsToPoints( nRowTwips ) );
+ return uno::makeAny( nHeight );
+ }
+
+@@ -4119,7 +4375,7 @@ ScVbaRange::Autofit() throw (uno::Runtim
// if the range is a not a row or column range autofit will
// throw an error
@@ -7851,7 +8115,7 @@
DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
ScDocShell* pDocShell = getDocShellFromRange( mxRange );
if ( pDocShell )
-@@ -4298,6 +4549,113 @@ void ScVbaRange::setFormulaHidden(const
+@@ -4298,6 +4554,113 @@ void ScVbaRange::setFormulaHidden(const
xProps->setPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLPRO)), uno::makeAny(rCellAttr));
}
@@ -7965,7 +8229,7 @@
void SAL_CALL
ScVbaRange::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& ActivePrinter, const uno::Any& PrintToFile, const uno::Any& Collate, const uno::Any& PrToFileName ) throw (uno::RuntimeException)
-@@ -4516,7 +4874,7 @@ ScVbaRange::AutoOutline( ) throw (scrip
+@@ -4516,7 +4879,7 @@ ScVbaRange::AutoOutline( ) throw (scrip
{
// #TODO #FIXME needs to check for summary row/col ( whatever they are )
// not valid for multi Area Addresses
@@ -7974,7 +8238,7 @@
DebugHelper::exception(SbERR_METHOD_FAILED, STR_ERRORMESSAGE_APPLIESTOSINGLERANGEONLY);
// So needs to either span an entire Row or a just be a single cell
// ( that contains a summary RowColumn )
-@@ -4734,6 +5092,7 @@ ScVbaRange::SpecialCells( const uno::Any
+@@ -4734,6 +5097,7 @@ ScVbaRange::SpecialCells( const uno::Any
case excel::XlCellType::xlCellTypeConstants:
case excel::XlCellType::xlCellTypeFormulas:
case excel::XlCellType::xlCellTypeVisible:
@@ -10822,117 +11086,117 @@
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/AutoFilter.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/AutoFilter.xls
-Binary files /dev/null and /tmp/cvsiSaGlj differ
+Binary files /dev/null and /tmp/cvsyUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/MiscRangeTests.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/MiscRangeTests.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/MiscRangeTests.xls
-Binary files /dev/null and /tmp/cvsjSaGlj differ
+Binary files /dev/null and /tmp/cvszUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/PageBreaks.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/PageBreaks.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/PageBreaks.xls
-Binary files /dev/null and /tmp/cvskSaGlj differ
+Binary files /dev/null and /tmp/cvsAUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/PageSetup.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/PageSetup.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/PageSetup.xls
-Binary files /dev/null and /tmp/cvslSaGlj differ
+Binary files /dev/null and /tmp/cvsBUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/Ranges-2.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/Ranges-2.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/Ranges-2.xls
-Binary files /dev/null and /tmp/cvsmSaGlj differ
+Binary files /dev/null and /tmp/cvsCUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/Ranges-3.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/Ranges-3.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/Ranges-3.xls
-Binary files /dev/null and /tmp/cvsnSaGlj differ
+Binary files /dev/null and /tmp/cvsDUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/Ranges.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/Ranges.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/Ranges.xls
-Binary files /dev/null and /tmp/cvsoSaGlj differ
+Binary files /dev/null and /tmp/cvsEUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/Shapes.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/Shapes.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/Shapes.xls
-Binary files /dev/null and /tmp/cvspSaGlj differ
+Binary files /dev/null and /tmp/cvsFUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/StrConv-test.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/StrConv-test.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/StrConv-test.xls
-Binary files /dev/null and /tmp/cvsqSaGlj differ
+Binary files /dev/null and /tmp/cvsGUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/Template.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/Template.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/Template.xls
-Binary files /dev/null and /tmp/cvsrSaGlj differ
+Binary files /dev/null and /tmp/cvsHUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/TestAddress.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/TestAddress.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/TestAddress.xls
-Binary files /dev/null and /tmp/cvssSaGlj differ
+Binary files /dev/null and /tmp/cvsIUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/TestCalc_Rangetest.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/TestCalc_Rangetest.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/TestCalc_Rangetest.xls
-Binary files /dev/null and /tmp/cvstSaGlj differ
+Binary files /dev/null and /tmp/cvsJUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/TestCalc_Rangetest2.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/TestCalc_Rangetest2.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/TestCalc_Rangetest2.xls
-Binary files /dev/null and /tmp/cvsuSaGlj differ
+Binary files /dev/null and /tmp/cvsKUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/Window.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/Window.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/Window.xls
-Binary files /dev/null and /tmp/cvsvSaGlj differ
+Binary files /dev/null and /tmp/cvsLUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/bytearraystring.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/bytearraystring.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/bytearraystring.xls
-Binary files /dev/null and /tmp/cvswSaGlj differ
+Binary files /dev/null and /tmp/cvsMUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/dateserial.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/dateserial.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/dateserial.xls
-Binary files /dev/null and /tmp/cvsxSaGlj differ
+Binary files /dev/null and /tmp/cvsNUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/datevalue.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/datevalue.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/datevalue.xls
-Binary files /dev/null and /tmp/cvsySaGlj differ
+Binary files /dev/null and /tmp/cvsOUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/format.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/format.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/format.xls
-Binary files /dev/null and /tmp/cvszSaGlj differ
+Binary files /dev/null and /tmp/cvsPUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/partition.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/partition.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/partition.xls
-Binary files /dev/null and /tmp/cvsASaGlj differ
+Binary files /dev/null and /tmp/cvsQUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/range-4.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/range-4.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/range-4.xls
-Binary files /dev/null and /tmp/cvsBSaGlj differ
+Binary files /dev/null and /tmp/cvsRUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/replace.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/replace.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/replace.xls
-Binary files /dev/null and /tmp/cvsCSaGlj differ
+Binary files /dev/null and /tmp/cvsSUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/stringplusdouble.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/stringplusdouble.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/stringplusdouble.xls
-Binary files /dev/null and /tmp/cvsDSaGlj differ
+Binary files /dev/null and /tmp/cvsTUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/window2.xls
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/window2.xls
diff -N sc/source/ui/vba/testvba/TestDocuments/window2.xls
-Binary files /dev/null and /tmp/cvsESaGlj differ
+Binary files /dev/null and /tmp/cvsUUa4nl differ
Index: sc/source/ui/vba/testvba/TestDocuments/logs/excel/AutoFilter.log
===================================================================
RCS file: sc/source/ui/vba/testvba/TestDocuments/logs/excel/AutoFilter.log
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]