no need for those static strings

This commit is contained in:
Thomas Arnhold 2014-04-06 17:05:12 +02:00
parent 532b69fbc4
commit 18c7992d7f
12 changed files with 62 additions and 101 deletions

View File

@ -23,8 +23,6 @@
using namespace com::sun::star; using namespace com::sun::star;
using namespace ooo::vba; using namespace ooo::vba;
const static OUString LABEL( "Label" );
VbaButton::VbaButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) VbaButton::VbaButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
{ {
} }
@ -34,14 +32,14 @@ OUString SAL_CALL
VbaButton::getCaption() throw (css::uno::RuntimeException, std::exception) VbaButton::getCaption() throw (css::uno::RuntimeException, std::exception)
{ {
OUString Label; OUString Label;
m_xProps->getPropertyValue( LABEL ) >>= Label; m_xProps->getPropertyValue( "Label" ) >>= Label;
return Label; return Label;
} }
void SAL_CALL void SAL_CALL
VbaButton::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException, std::exception) VbaButton::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{ {
m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); m_xProps->setPropertyValue( "Label", uno::makeAny( _caption ) );
} }
sal_Bool SAL_CALL VbaButton::getAutoSize() throw (uno::RuntimeException, std::exception) sal_Bool SAL_CALL VbaButton::getAutoSize() throw (uno::RuntimeException, std::exception)

View File

@ -24,9 +24,6 @@
using namespace com::sun::star; using namespace com::sun::star;
using namespace ooo::vba; using namespace ooo::vba;
const static OUString LABEL( "Label" );
const static OUString STATE( "State" );
ScVbaCheckbox::ScVbaCheckbox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : CheckBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) ScVbaCheckbox::ScVbaCheckbox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : CheckBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
{ {
} }
@ -36,21 +33,21 @@ OUString SAL_CALL
ScVbaCheckbox::getCaption() throw (css::uno::RuntimeException, std::exception) ScVbaCheckbox::getCaption() throw (css::uno::RuntimeException, std::exception)
{ {
OUString Label; OUString Label;
m_xProps->getPropertyValue( LABEL ) >>= Label; m_xProps->getPropertyValue( "Label" ) >>= Label;
return Label; return Label;
} }
void SAL_CALL void SAL_CALL
ScVbaCheckbox::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException, std::exception) ScVbaCheckbox::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{ {
m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); m_xProps->setPropertyValue( "Label", uno::makeAny( _caption ) );
} }
uno::Any SAL_CALL uno::Any SAL_CALL
ScVbaCheckbox::getValue() throw (css::uno::RuntimeException, std::exception) ScVbaCheckbox::getValue() throw (css::uno::RuntimeException, std::exception)
{ {
sal_Int16 nValue = -1; sal_Int16 nValue = -1;
m_xProps->getPropertyValue( STATE ) >>= nValue; m_xProps->getPropertyValue( "State" ) >>= nValue;
if( nValue != 0 ) if( nValue != 0 )
nValue = -1; nValue = -1;
// return uno::makeAny( nValue ); // return uno::makeAny( nValue );
@ -64,7 +61,7 @@ ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeExcept
{ {
sal_Int16 nValue = 0; sal_Int16 nValue = 0;
sal_Int16 nOldValue = 0; sal_Int16 nOldValue = 0;
m_xProps->getPropertyValue( STATE ) >>= nOldValue; m_xProps->getPropertyValue( "State" ) >>= nOldValue;
if( !( _value >>= nValue ) ) if( !( _value >>= nValue ) )
{ {
sal_Bool bValue = false; sal_Bool bValue = false;
@ -75,7 +72,7 @@ ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeExcept
if( nValue == -1) if( nValue == -1)
nValue = 1; nValue = 1;
m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) ); m_xProps->setPropertyValue( "State", uno::makeAny( nValue ) );
if ( nValue != nOldValue ) if ( nValue != nOldValue )
fireClickEvent(); fireClickEvent();
} }

View File

@ -37,17 +37,13 @@ using namespace ooo::vba;
//SelectedItems list of integer indexes //SelectedItems list of integer indexes
//StringItemList list of items //StringItemList list of items
const static OUString TEXT( "Text" );
const static OUString ITEMS( "StringItemList" );
const static OUString CONTROLSOURCEPROP( "DataFieldProperty" );
ScVbaComboBox::ScVbaComboBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ComboBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) ScVbaComboBox::ScVbaComboBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ComboBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
{ {
mpListHelper.reset( new ListControlHelper( m_xProps ) ); mpListHelper.reset( new ListControlHelper( m_xProps ) );
try try
{ {
// grab the default value property name // grab the default value property name
m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName; m_xProps->getPropertyValue( "DataFieldProperty" ) >>= sSourceName;
} }
catch( uno::Exception& ) catch( uno::Exception& )
{ {
@ -76,11 +72,11 @@ ScVbaComboBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeExcepti
sal_Int32 nOldIndex = -1; sal_Int32 nOldIndex = -1;
getListIndex() >>= nOldIndex; getListIndex() >>= nOldIndex;
uno::Sequence< OUString > sItems; uno::Sequence< OUString > sItems;
m_xProps->getPropertyValue( ITEMS ) >>= sItems; m_xProps->getPropertyValue( "StringItemList" ) >>= sItems;
if( ( nIndex >= 0 ) && ( sItems.getLength() > nIndex ) ) if( ( nIndex >= 0 ) && ( sItems.getLength() > nIndex ) )
{ {
OUString sText = sItems[ nIndex ]; OUString sText = sItems[ nIndex ];
m_xProps->setPropertyValue( TEXT, uno::makeAny( sText ) ); m_xProps->setPropertyValue( "Text", uno::makeAny( sText ) );
// fire the _Change event // fire the _Change event
if( nOldIndex != nIndex ) if( nOldIndex != nIndex )
@ -93,7 +89,7 @@ uno::Any SAL_CALL
ScVbaComboBox::getListIndex() throw (uno::RuntimeException, std::exception) ScVbaComboBox::getListIndex() throw (uno::RuntimeException, std::exception)
{ {
uno::Sequence< OUString > sItems; uno::Sequence< OUString > sItems;
m_xProps->getPropertyValue( ITEMS ) >>= sItems; m_xProps->getPropertyValue( "StringItemList" ) >>= sItems;
// should really return the item that has focus regardless of // should really return the item that has focus regardless of
// it been selected // it been selected
if ( sItems.getLength() > 0 ) if ( sItems.getLength() > 0 )

View File

@ -608,8 +608,7 @@ void SAL_CALL ScVbaControl::setTabIndex( sal_Int32 /*nTabIndex*/ ) throw (uno::R
{ {
uno::Reference< beans::XPropertySet > xProps( xControlShape->getControl(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xProps( xControlShape->getControl(), uno::UNO_QUERY_THROW );
sal_Int32 nClassId = -1; sal_Int32 nClassId = -1;
const static OUString sClassId( "ClassId" ); xProps->getPropertyValue( "ClassId" ) >>= nClassId;
xProps->getPropertyValue( sClassId ) >>= nClassId;
uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
uno::Reference< drawing::XShape > xShape( xControlShape, uno::UNO_QUERY_THROW ); uno::Reference< drawing::XShape > xShape( xControlShape, uno::UNO_QUERY_THROW );
::std::auto_ptr< ConcreteXShapeGeometryAttributes > xGeoHelper( new ConcreteXShapeGeometryAttributes( xContext, xShape ) ); ::std::auto_ptr< ConcreteXShapeGeometryAttributes > xGeoHelper( new ConcreteXShapeGeometryAttributes( xContext, xShape ) );

View File

@ -26,9 +26,6 @@
using namespace com::sun::star; using namespace com::sun::star;
using namespace ooo::vba; using namespace ooo::vba;
const static OUString LABEL( "Label" );
ScVbaFrame::ScVbaFrame( ScVbaFrame::ScVbaFrame(
const uno::Reference< XHelperInterface >& xParent, const uno::Reference< XHelperInterface >& xParent,
const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XComponentContext >& xContext,
@ -46,13 +43,13 @@ ScVbaFrame::ScVbaFrame(
OUString SAL_CALL ScVbaFrame::getCaption() throw (css::uno::RuntimeException, std::exception) OUString SAL_CALL ScVbaFrame::getCaption() throw (css::uno::RuntimeException, std::exception)
{ {
OUString Label; OUString Label;
m_xProps->getPropertyValue( LABEL ) >>= Label; m_xProps->getPropertyValue( "Label" ) >>= Label;
return Label; return Label;
} }
void SAL_CALL ScVbaFrame::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException, std::exception) void SAL_CALL ScVbaFrame::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{ {
m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); m_xProps->setPropertyValue( "Label", uno::makeAny( _caption ) );
} }
sal_Int32 SAL_CALL ScVbaFrame::getSpecialEffect() throw (uno::RuntimeException, std::exception) sal_Int32 SAL_CALL ScVbaFrame::getSpecialEffect() throw (uno::RuntimeException, std::exception)

View File

@ -23,8 +23,6 @@
using namespace com::sun::star; using namespace com::sun::star;
using namespace ooo::vba; using namespace ooo::vba;
const static OUString LABEL( "Label" );
ScVbaLabel::ScVbaLabel( const css::uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : LabelImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) ScVbaLabel::ScVbaLabel( const css::uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : LabelImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
{ {
} }
@ -34,14 +32,14 @@ OUString SAL_CALL
ScVbaLabel::getCaption() throw (css::uno::RuntimeException, std::exception) ScVbaLabel::getCaption() throw (css::uno::RuntimeException, std::exception)
{ {
OUString Label; OUString Label;
m_xProps->getPropertyValue( LABEL ) >>= Label; m_xProps->getPropertyValue( "Label" ) >>= Label;
return Label; return Label;
} }
void SAL_CALL void SAL_CALL
ScVbaLabel::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException, std::exception) ScVbaLabel::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{ {
m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); m_xProps->setPropertyValue( "Label", uno::makeAny( _caption ) );
} }
uno::Any SAL_CALL uno::Any SAL_CALL
ScVbaLabel::getValue() throw (css::uno::RuntimeException, std::exception) ScVbaLabel::getValue() throw (css::uno::RuntimeException, std::exception)

View File

@ -27,11 +27,6 @@
using namespace com::sun::star; using namespace com::sun::star;
using namespace ooo::vba; using namespace ooo::vba;
const static OUString TEXT( "Text" );
const static OUString SELECTEDITEMS( "SelectedItems" );
const static OUString ITEMS( "StringItemList" );
ScVbaListBox::ScVbaListBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) ScVbaListBox::ScVbaListBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper )
: ListBoxImpl_BASE(xParent, xContext, xControl, xModel, pGeomHelper) : ListBoxImpl_BASE(xParent, xContext, xControl, xModel, pGeomHelper)
, m_nIndex(0) , m_nIndex(0)
@ -53,7 +48,7 @@ uno::Any SAL_CALL
ScVbaListBox::getListIndex() throw (uno::RuntimeException, std::exception) ScVbaListBox::getListIndex() throw (uno::RuntimeException, std::exception)
{ {
uno::Sequence< sal_Int16 > sSelection; uno::Sequence< sal_Int16 > sSelection;
m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection; m_xProps->getPropertyValue( "SelectedItems" ) >>= sSelection;
if ( sSelection.getLength() == 0 ) if ( sSelection.getLength() == 0 )
return uno::Any( sal_Int32( -1 ) ); return uno::Any( sal_Int32( -1 ) );
return uno::Any( sSelection[ 0 ] ); return uno::Any( sSelection[ 0 ] );
@ -64,8 +59,8 @@ ScVbaListBox::getValue() throw (uno::RuntimeException, std::exception)
{ {
uno::Sequence< sal_Int16 > sSelection; uno::Sequence< sal_Int16 > sSelection;
uno::Sequence< OUString > sItems; uno::Sequence< OUString > sItems;
m_xProps->getPropertyValue( SELECTEDITEMS ) >>= sSelection; m_xProps->getPropertyValue( "SelectedItems" ) >>= sSelection;
m_xProps->getPropertyValue( ITEMS ) >>= sItems; m_xProps->getPropertyValue( "StringItemList" ) >>= sItems;
if( getMultiSelect() ) if( getMultiSelect() )
throw uno::RuntimeException( "Attribute use invalid." , uno::Reference< uno::XInterface >() ); throw uno::RuntimeException( "Attribute use invalid." , uno::Reference< uno::XInterface >() );
uno::Any aRet; uno::Any aRet;
@ -83,7 +78,7 @@ ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException, s
} }
OUString sValue = getAnyAsString( _value ); OUString sValue = getAnyAsString( _value );
uno::Sequence< OUString > sList; uno::Sequence< OUString > sList;
m_xProps->getPropertyValue( ITEMS ) >>= sList; m_xProps->getPropertyValue( "StringItemList" ) >>= sList;
sal_Int16 nLength = static_cast<sal_Int16>( sList.getLength() ); sal_Int16 nLength = static_cast<sal_Int16>( sList.getLength() );
sal_Int16 nValue = -1; sal_Int16 nValue = -1;
sal_Int16 i = 0; sal_Int16 i = 0;
@ -100,9 +95,9 @@ ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException, s
uno::Sequence< sal_Int16 > nSelectedIndices(1); uno::Sequence< sal_Int16 > nSelectedIndices(1);
uno::Sequence< sal_Int16 > nOldSelectedIndices; uno::Sequence< sal_Int16 > nOldSelectedIndices;
m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nOldSelectedIndices; m_xProps->getPropertyValue( "SelectedItems" ) >>= nOldSelectedIndices;
nSelectedIndices[ 0 ] = nValue; nSelectedIndices[ 0 ] = nValue;
m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) ); m_xProps->setPropertyValue( "SelectedItems", uno::makeAny( nSelectedIndices ) );
if ( nSelectedIndices != nOldSelectedIndices ) if ( nSelectedIndices != nOldSelectedIndices )
fireClickEvent(); fireClickEvent();
} }
@ -155,7 +150,7 @@ css::uno::Any SAL_CALL
ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException, std::exception) ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException, std::exception)
{ {
uno::Sequence< OUString > sList; uno::Sequence< OUString > sList;
m_xProps->getPropertyValue( ITEMS ) >>= sList; m_xProps->getPropertyValue( "StringItemList" ) >>= sList;
sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() ); sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
// no choice but to do a horror cast as internally // no choice but to do a horror cast as internally
// the indices are but sal_Int16 // the indices are but sal_Int16
@ -196,7 +191,7 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
if( !(value >>= bValue) ) if( !(value >>= bValue) )
throw uno::RuntimeException( "Invalid type\n. need boolean." , uno::Reference< uno::XInterface >() ); throw uno::RuntimeException( "Invalid type\n. need boolean." , uno::Reference< uno::XInterface >() );
uno::Sequence< sal_Int16 > nList; uno::Sequence< sal_Int16 > nList;
m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nList; m_xProps->getPropertyValue( "SelectedItems" ) >>= nList;
sal_Int16 nLength = static_cast<sal_Int16>( nList.getLength() ); sal_Int16 nLength = static_cast<sal_Int16>( nList.getLength() );
sal_Int16 nIndex = m_nIndex; sal_Int16 nIndex = m_nIndex;
for( sal_Int16 i = 0; i < nLength; i++ ) for( sal_Int16 i = 0; i < nLength; i++ )
@ -214,7 +209,7 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
nList.realloc( nLength - 1 ); nList.realloc( nLength - 1 );
//m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) ); //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
fireClickEvent(); fireClickEvent();
m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) ); m_xProps->setPropertyValue( "SelectedItems", uno::makeAny( nList ) );
return; return;
} }
} }
@ -233,7 +228,7 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
} }
//m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) ); //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
fireClickEvent(); fireClickEvent();
m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) ); m_xProps->setPropertyValue( "SelectedItems", uno::makeAny( nList ) );
} }
} }

View File

@ -24,8 +24,6 @@
using namespace com::sun::star; using namespace com::sun::star;
using namespace ooo::vba; using namespace ooo::vba;
const static OUString ITEMS( "StringItemList" );
class ListPropListener : public PropListener class ListPropListener : public PropListener
{ {
private: private:
@ -49,13 +47,13 @@ void ListPropListener::setValueEvent( const uno::Any& value )
if( m_pvargIndex.hasValue() || m_pvarColumn.hasValue() ) if( m_pvargIndex.hasValue() || m_pvarColumn.hasValue() )
throw uno::RuntimeException( "Bad argument" , uno::Reference< uno::XInterface >() ); throw uno::RuntimeException( "Bad argument" , uno::Reference< uno::XInterface >() );
m_xProps->setPropertyValue( ITEMS, value ); m_xProps->setPropertyValue( "StringItemList", value );
} }
uno::Any ListPropListener::getValueEvent() uno::Any ListPropListener::getValueEvent()
{ {
uno::Sequence< OUString > sList; uno::Sequence< OUString > sList;
m_xProps->getPropertyValue( ITEMS ) >>= sList; m_xProps->getPropertyValue( "StringItemList" ) >>= sList;
sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() ); sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
uno::Any aRet; uno::Any aRet;
if ( m_pvargIndex.hasValue() ) if ( m_pvargIndex.hasValue() )
@ -87,7 +85,7 @@ ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargInde
if ( pvargItem.hasValue() ) if ( pvargItem.hasValue() )
{ {
uno::Sequence< OUString > sList; uno::Sequence< OUString > sList;
m_xProps->getPropertyValue( ITEMS ) >>= sList; m_xProps->getPropertyValue( "StringItemList" ) >>= sList;
sal_Int32 nIndex = sList.getLength(); sal_Int32 nIndex = sList.getLength();
@ -131,7 +129,7 @@ ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargInde
} }
m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) ); m_xProps->setPropertyValue( "StringItemList", uno::makeAny( sList ) );
} }
} }
@ -144,7 +142,7 @@ ListControlHelper::removeItem( const uno::Any& index ) throw (uno::RuntimeExcept
if ( index >>= nIndex ) if ( index >>= nIndex )
{ {
uno::Sequence< OUString > sList; uno::Sequence< OUString > sList;
m_xProps->getPropertyValue( ITEMS ) >>= sList; m_xProps->getPropertyValue( "StringItemList" ) >>= sList;
if( nIndex < 0 || nIndex > ( sList.getLength() - 1 ) ) if( nIndex < 0 || nIndex > ( sList.getLength() - 1 ) )
throw uno::RuntimeException( "Invalid index" , uno::Reference< uno::XInterface > () ); throw uno::RuntimeException( "Invalid index" , uno::Reference< uno::XInterface > () );
if( sList.hasElements() ) if( sList.hasElements() )
@ -161,7 +159,7 @@ ListControlHelper::removeItem( const uno::Any& index ) throw (uno::RuntimeExcept
sList.realloc( sList.getLength() - 1 ); sList.realloc( sList.getLength() - 1 );
} }
m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) ); m_xProps->setPropertyValue( "StringItemList", uno::makeAny( sList ) );
} }
} }
@ -170,7 +168,7 @@ ListControlHelper::Clear( ) throw (uno::RuntimeException)
{ {
// urk, setValue doesn't seem to work !! // urk, setValue doesn't seem to work !!
//setValue( uno::makeAny( sal_Int16() ) ); //setValue( uno::makeAny( sal_Int16() ) );
m_xProps->setPropertyValue( ITEMS, uno::makeAny( uno::Sequence< OUString >() ) ); m_xProps->setPropertyValue( "StringItemList", uno::makeAny( uno::Sequence< OUString >() ) );
} }
void SAL_CALL void SAL_CALL
@ -184,7 +182,7 @@ sal_Int32 SAL_CALL
ListControlHelper::getListCount() throw (uno::RuntimeException) ListControlHelper::getListCount() throw (uno::RuntimeException)
{ {
uno::Sequence< OUString > sList; uno::Sequence< OUString > sList;
m_xProps->getPropertyValue( ITEMS ) >>= sList; m_xProps->getPropertyValue( "StringItemList" ) >>= sList;
return sList.getLength(); return sList.getLength();
} }

View File

@ -23,9 +23,6 @@
using namespace com::sun::star; using namespace com::sun::star;
using namespace ooo::vba; using namespace ooo::vba;
const static OUString LABEL( "Label" );
const static OUString STATE( "State" );
ScVbaRadioButton::ScVbaRadioButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : RadioButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) ScVbaRadioButton::ScVbaRadioButton( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : RadioButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
{ {
} }
@ -35,21 +32,21 @@ OUString SAL_CALL
ScVbaRadioButton::getCaption() throw (css::uno::RuntimeException, std::exception) ScVbaRadioButton::getCaption() throw (css::uno::RuntimeException, std::exception)
{ {
OUString Label; OUString Label;
m_xProps->getPropertyValue( LABEL ) >>= Label; m_xProps->getPropertyValue( "Label" ) >>= Label;
return Label; return Label;
} }
void SAL_CALL void SAL_CALL
ScVbaRadioButton::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException, std::exception) ScVbaRadioButton::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{ {
m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); m_xProps->setPropertyValue( "Label", uno::makeAny( _caption ) );
} }
uno::Any SAL_CALL uno::Any SAL_CALL
ScVbaRadioButton::getValue() throw (css::uno::RuntimeException, std::exception) ScVbaRadioButton::getValue() throw (css::uno::RuntimeException, std::exception)
{ {
sal_Int16 nValue = -1; sal_Int16 nValue = -1;
m_xProps->getPropertyValue( STATE ) >>= nValue; m_xProps->getPropertyValue( "State" ) >>= nValue;
if( nValue != 0 ) if( nValue != 0 )
nValue = -1; nValue = -1;
// return uno::makeAny( nValue ); // return uno::makeAny( nValue );
@ -64,7 +61,7 @@ ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExceptio
{ {
sal_Int16 nValue = 0; sal_Int16 nValue = 0;
sal_Int16 nOldValue = 0; sal_Int16 nOldValue = 0;
m_xProps->getPropertyValue( STATE ) >>= nOldValue; m_xProps->getPropertyValue( "State" ) >>= nOldValue;
if( !( _value >>= nValue ) ) if( !( _value >>= nValue ) )
{ {
@ -76,7 +73,7 @@ ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExceptio
if( nValue == -1) if( nValue == -1)
nValue = 1; nValue = 1;
m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) ); m_xProps->setPropertyValue( "State", uno::makeAny( nValue ) );
if ( nValue != nOldValue ) if ( nValue != nOldValue )
{ {
fireChangeEvent(); fireChangeEvent();

View File

@ -16,19 +16,13 @@
* except in compliance with the License. You may obtain a copy of * except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include "vbascrollbar.hxx" #include "vbascrollbar.hxx"
#include <vector> #include <vector>
using namespace com::sun::star; using namespace com::sun::star;
using namespace ooo::vba; using namespace ooo::vba;
const static OUString LARGECHANGE( "BlockIncrement");
const static OUString SMALLCHANGE( "LineIncrement");
const static OUString SCROLLVALUE( "ScrollValue");
const static OUString SCROLLMAX( "ScrollValueMax");
const static OUString SCROLLMIN( "ScrollValueMin");
ScVbaScrollBar::ScVbaScrollBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ScrollBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) ScVbaScrollBar::ScVbaScrollBar( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ScrollBarImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
{ {
} }
@ -37,54 +31,54 @@ ScVbaScrollBar::ScVbaScrollBar( const css::uno::Reference< ov::XHelperInterface
uno::Any SAL_CALL uno::Any SAL_CALL
ScVbaScrollBar::getValue() throw (css::uno::RuntimeException, std::exception) ScVbaScrollBar::getValue() throw (css::uno::RuntimeException, std::exception)
{ {
return m_xProps->getPropertyValue( SCROLLVALUE ); return m_xProps->getPropertyValue( "ScrollValue" );
} }
void SAL_CALL void SAL_CALL
ScVbaScrollBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException, std::exception) ScVbaScrollBar::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{ {
m_xProps->setPropertyValue( SCROLLVALUE, _value ); m_xProps->setPropertyValue( "ScrollValue", _value );
} }
::sal_Int32 SAL_CALL ::sal_Int32 SAL_CALL
ScVbaScrollBar::getMax() throw (uno::RuntimeException, std::exception) ScVbaScrollBar::getMax() throw (uno::RuntimeException, std::exception)
{ {
sal_Int32 nMax = 0; sal_Int32 nMax = 0;
m_xProps->getPropertyValue( SCROLLMAX ) >>= nMax; m_xProps->getPropertyValue( "ScrollValueMax" ) >>= nMax;
return nMax; return nMax;
} }
void SAL_CALL void SAL_CALL
ScVbaScrollBar::setMax( sal_Int32 nVal ) throw (uno::RuntimeException, std::exception) ScVbaScrollBar::setMax( sal_Int32 nVal ) throw (uno::RuntimeException, std::exception)
{ {
m_xProps->setPropertyValue( SCROLLMAX, uno::makeAny( nVal ) ); m_xProps->setPropertyValue( "ScrollValueMax", uno::makeAny( nVal ) );
} }
::sal_Int32 SAL_CALL ::sal_Int32 SAL_CALL
ScVbaScrollBar::getMin() throw (uno::RuntimeException, std::exception) ScVbaScrollBar::getMin() throw (uno::RuntimeException, std::exception)
{ {
sal_Int32 nVal = 0; sal_Int32 nVal = 0;
m_xProps->getPropertyValue( SCROLLMIN ) >>= nVal; m_xProps->getPropertyValue( "ScrollValueMin" ) >>= nVal;
return nVal; return nVal;
} }
void SAL_CALL void SAL_CALL
ScVbaScrollBar::setMin( sal_Int32 nVal ) throw (uno::RuntimeException, std::exception) ScVbaScrollBar::setMin( sal_Int32 nVal ) throw (uno::RuntimeException, std::exception)
{ {
m_xProps->setPropertyValue( SCROLLMIN, uno::makeAny( nVal ) ); m_xProps->setPropertyValue( "ScrollValueMin", uno::makeAny( nVal ) );
} }
void SAL_CALL void SAL_CALL
ScVbaScrollBar::setLargeChange( ::sal_Int32 _largechange ) throw (uno::RuntimeException, std::exception) ScVbaScrollBar::setLargeChange( ::sal_Int32 _largechange ) throw (uno::RuntimeException, std::exception)
{ {
m_xProps->setPropertyValue( LARGECHANGE, uno::makeAny( _largechange ) ); m_xProps->setPropertyValue( "BlockIncrement", uno::makeAny( _largechange ) );
} }
::sal_Int32 SAL_CALL ::sal_Int32 SAL_CALL
ScVbaScrollBar::getLargeChange() throw (uno::RuntimeException, std::exception) ScVbaScrollBar::getLargeChange() throw (uno::RuntimeException, std::exception)
{ {
sal_Int32 nVal = 0; sal_Int32 nVal = 0;
m_xProps->getPropertyValue( LARGECHANGE ) >>= nVal; m_xProps->getPropertyValue( "BlockIncrement" ) >>= nVal;
return nVal; return nVal;
} }
@ -92,14 +86,14 @@ ScVbaScrollBar::getLargeChange() throw (uno::RuntimeException, std::exception)
ScVbaScrollBar::getSmallChange() throw (uno::RuntimeException, std::exception) ScVbaScrollBar::getSmallChange() throw (uno::RuntimeException, std::exception)
{ {
sal_Int32 nSmallChange = 0; sal_Int32 nSmallChange = 0;
m_xProps->getPropertyValue( SMALLCHANGE ) >>= nSmallChange; m_xProps->getPropertyValue( "LineIncrement" ) >>= nSmallChange;
return nSmallChange; return nSmallChange;
} }
void SAL_CALL void SAL_CALL
ScVbaScrollBar::setSmallChange( ::sal_Int32 _smallchange ) throw (uno::RuntimeException, std::exception) ScVbaScrollBar::setSmallChange( ::sal_Int32 _smallchange ) throw (uno::RuntimeException, std::exception)
{ {
m_xProps->setPropertyValue( SMALLCHANGE, uno::makeAny( _smallchange ) ); m_xProps->setPropertyValue( "LineIncrement", uno::makeAny( _smallchange ) );
} }
OUString OUString

View File

@ -16,17 +16,13 @@
* except in compliance with the License. You may obtain a copy of * except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include "vbaspinbutton.hxx" #include "vbaspinbutton.hxx"
#include <vector> #include <vector>
using namespace com::sun::star; using namespace com::sun::star;
using namespace ooo::vba; using namespace ooo::vba;
const static OUString SPINVALUE( "SpinValue" );
const static OUString SPINMAX( "SpinValueMax" );
const static OUString SPINMIN( "SpinValueMin" );
ScVbaSpinButton::ScVbaSpinButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : SpinButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) ScVbaSpinButton::ScVbaSpinButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : SpinButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
{ {
} }
@ -35,41 +31,41 @@ ScVbaSpinButton::ScVbaSpinButton( const css::uno::Reference< ov::XHelperInterfa
uno::Any SAL_CALL uno::Any SAL_CALL
ScVbaSpinButton::getValue() throw (css::uno::RuntimeException, std::exception) ScVbaSpinButton::getValue() throw (css::uno::RuntimeException, std::exception)
{ {
return m_xProps->getPropertyValue( SPINVALUE ); return m_xProps->getPropertyValue( "SpinValue" );
} }
void SAL_CALL void SAL_CALL
ScVbaSpinButton::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException, std::exception) ScVbaSpinButton::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{ {
m_xProps->setPropertyValue( SPINVALUE, _value ); m_xProps->setPropertyValue( "SpinValue", _value );
} }
::sal_Int32 SAL_CALL ::sal_Int32 SAL_CALL
ScVbaSpinButton::getMax() throw (uno::RuntimeException, std::exception) ScVbaSpinButton::getMax() throw (uno::RuntimeException, std::exception)
{ {
sal_Int32 nMax = 0; sal_Int32 nMax = 0;
m_xProps->getPropertyValue( SPINMAX ) >>= nMax; m_xProps->getPropertyValue( "SpinValueMax" ) >>= nMax;
return nMax; return nMax;
} }
void SAL_CALL void SAL_CALL
ScVbaSpinButton::setMax( sal_Int32 nVal ) throw (uno::RuntimeException, std::exception) ScVbaSpinButton::setMax( sal_Int32 nVal ) throw (uno::RuntimeException, std::exception)
{ {
m_xProps->setPropertyValue( SPINMAX, uno::makeAny( nVal ) ); m_xProps->setPropertyValue( "SpinValueMax", uno::makeAny( nVal ) );
} }
::sal_Int32 SAL_CALL ::sal_Int32 SAL_CALL
ScVbaSpinButton::getMin() throw (uno::RuntimeException, std::exception) ScVbaSpinButton::getMin() throw (uno::RuntimeException, std::exception)
{ {
sal_Int32 nVal = 0; sal_Int32 nVal = 0;
m_xProps->getPropertyValue( SPINMIN ) >>= nVal; m_xProps->getPropertyValue( "SpinValueMin" ) >>= nVal;
return nVal; return nVal;
} }
void SAL_CALL void SAL_CALL
ScVbaSpinButton::setMin( sal_Int32 nVal ) throw (uno::RuntimeException, std::exception) ScVbaSpinButton::setMin( sal_Int32 nVal ) throw (uno::RuntimeException, std::exception)
{ {
m_xProps->setPropertyValue( SPINMIN, uno::makeAny( nVal ) ); m_xProps->setPropertyValue( "SpinValueMin", uno::makeAny( nVal ) );
} }
OUString OUString

View File

@ -23,14 +23,10 @@
using namespace com::sun::star; using namespace com::sun::star;
using namespace ooo::vba; using namespace ooo::vba;
const static OUString LABEL( "Label" );
const static OUString TOGGLE( "Toggle" );
const static OUString STATE( "State" );
ScVbaToggleButton::ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : ToggleButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ) ScVbaToggleButton::ScVbaToggleButton( const css::uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : ToggleButtonImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
{ {
SAL_INFO("vbahelper", "ScVbaToggleButton(ctor)"); SAL_INFO("vbahelper", "ScVbaToggleButton(ctor)");
m_xProps->setPropertyValue( TOGGLE, uno::makeAny( sal_True ) ); m_xProps->setPropertyValue( "Toggle", uno::makeAny( sal_True ) );
} }
ScVbaToggleButton::~ScVbaToggleButton() ScVbaToggleButton::~ScVbaToggleButton()
@ -43,21 +39,21 @@ OUString SAL_CALL
ScVbaToggleButton::getCaption() throw (css::uno::RuntimeException, std::exception) ScVbaToggleButton::getCaption() throw (css::uno::RuntimeException, std::exception)
{ {
OUString Label; OUString Label;
m_xProps->getPropertyValue( LABEL ) >>= Label; m_xProps->getPropertyValue( "Label" ) >>= Label;
return Label; return Label;
} }
void SAL_CALL void SAL_CALL
ScVbaToggleButton::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException, std::exception) ScVbaToggleButton::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{ {
m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); m_xProps->setPropertyValue( "Label", uno::makeAny( _caption ) );
} }
uno::Any SAL_CALL uno::Any SAL_CALL
ScVbaToggleButton::getValue() throw (uno::RuntimeException, std::exception) ScVbaToggleButton::getValue() throw (uno::RuntimeException, std::exception)
{ {
sal_Int16 nState = 0; sal_Int16 nState = 0;
m_xProps->getPropertyValue( STATE ) >>= nState; m_xProps->getPropertyValue( "State" ) >>= nState;
return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) ); return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) );
} }
@ -76,7 +72,7 @@ ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExcepti
SAL_INFO("vbahelper", "nState - " << nState ); SAL_INFO("vbahelper", "nState - " << nState );
nState = ( nState == -1 ) ? 1 : 0; nState = ( nState == -1 ) ? 1 : 0;
SAL_INFO("vbahelper", "nState - " << nState ); SAL_INFO("vbahelper", "nState - " << nState );
m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) ); m_xProps->setPropertyValue( "State", uno::makeAny( nState ) );
} }
sal_Bool SAL_CALL ScVbaToggleButton::getAutoSize() throw (uno::RuntimeException, std::exception) sal_Bool SAL_CALL ScVbaToggleButton::getAutoSize() throw (uno::RuntimeException, std::exception)