diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-02-28 09:46:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-02-28 10:53:39 +0000 |
commit | d0b71f167cd4c03d574decb7b78ed1ecdab1c424 (patch) | |
tree | 78301958eeee4d6ef5e9ff0fd359e115175d82d9 /vbahelper/source/msforms | |
parent | 44e1f09f7e658b87c3e2eda9e4929cdf6967d2f3 (diff) |
flatten some vba classes
no need to allocate ShapeHelper separately, it is only one pointer big
Change-Id: Ie4981ca81ac1dd430f22ba32357fcabbbd47bd09
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147944
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vbahelper/source/msforms')
-rw-r--r-- | vbahelper/source/msforms/vbacombobox.cxx | 14 | ||||
-rw-r--r-- | vbahelper/source/msforms/vbacombobox.hxx | 3 | ||||
-rw-r--r-- | vbahelper/source/msforms/vbalistbox.cxx | 14 | ||||
-rw-r--r-- | vbahelper/source/msforms/vbalistbox.hxx | 3 |
4 files changed, 18 insertions, 16 deletions
diff --git a/vbahelper/source/msforms/vbacombobox.cxx b/vbahelper/source/msforms/vbacombobox.cxx index 16abb6d985d3..9f1d8dc81309 100644 --- a/vbahelper/source/msforms/vbacombobox.cxx +++ b/vbahelper/source/msforms/vbacombobox.cxx @@ -37,8 +37,8 @@ using namespace ooo::vba; 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, std::unique_ptr<ov::AbstractGeometryAttributes> pGeomHelper ) : ComboBoxImpl_BASE( xParent, xContext, xControl, xModel, std::move(pGeomHelper) ) + , maListHelper( m_xProps ) { - mpListHelper.reset( new ListControlHelper( m_xProps ) ); try { // grab the default value property name @@ -149,38 +149,38 @@ ScVbaComboBox::setText( const OUString& _text ) void SAL_CALL ScVbaComboBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) { - mpListHelper->AddItem( pvargItem, pvargIndex ); + maListHelper.AddItem( pvargItem, pvargIndex ); } void SAL_CALL ScVbaComboBox::removeItem( const uno::Any& index ) { - mpListHelper->removeItem( index ); + maListHelper.removeItem( index ); } void SAL_CALL ScVbaComboBox::Clear( ) { - mpListHelper->Clear(); + maListHelper.Clear(); } void SAL_CALL ScVbaComboBox::setRowSource( const OUString& _rowsource ) { ScVbaControl::setRowSource( _rowsource ); - mpListHelper->setRowSource( _rowsource ); + maListHelper.setRowSource( _rowsource ); } sal_Int32 SAL_CALL ScVbaComboBox::getListCount() { - return mpListHelper->getListCount(); + return maListHelper.getListCount(); } uno::Any SAL_CALL ScVbaComboBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) { - return mpListHelper->List( pvargIndex, pvarColumn ); + return maListHelper.List( pvargIndex, pvarColumn ); } sal_Int32 SAL_CALL ScVbaComboBox::getStyle() diff --git a/vbahelper/source/msforms/vbacombobox.hxx b/vbahelper/source/msforms/vbacombobox.hxx index feea8e52c504..4f682fc31648 100644 --- a/vbahelper/source/msforms/vbacombobox.hxx +++ b/vbahelper/source/msforms/vbacombobox.hxx @@ -19,6 +19,7 @@ #ifndef INCLUDED_VBAHELPER_SOURCE_MSFORMS_VBACOMBOBOX_HXX #define INCLUDED_VBAHELPER_SOURCE_MSFORMS_VBACOMBOBOX_HXX #include <memory> +#include <optional> #include <cppuhelper/implbase.hxx> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -33,7 +34,7 @@ typedef cppu::ImplInheritanceHelper<ScVbaControl, ov::msforms::XComboBox, css::script::XDefaultProperty > ComboBoxImpl_BASE; class ScVbaComboBox : public ComboBoxImpl_BASE { - std::unique_ptr< ListControlHelper > mpListHelper; + ListControlHelper maListHelper; OUString sSourceName; public: diff --git a/vbahelper/source/msforms/vbalistbox.cxx b/vbahelper/source/msforms/vbalistbox.cxx index 40e4445f675b..b7c1fc0097db 100644 --- a/vbahelper/source/msforms/vbalistbox.cxx +++ b/vbahelper/source/msforms/vbalistbox.cxx @@ -27,9 +27,9 @@ using namespace ooo::vba; 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, std::unique_ptr<ov::AbstractGeometryAttributes> pGeomHelper ) : ListBoxImpl_BASE(xParent, xContext, xControl, xModel, std::move(pGeomHelper)) + , maListHelper( m_xProps ) , m_nIndex(0) { - mpListHelper.reset( new ListControlHelper( m_xProps ) ); } // Attributes @@ -152,19 +152,19 @@ ScVbaListBox::Selected( sal_Int32 index ) void SAL_CALL ScVbaListBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) { - mpListHelper->AddItem( pvargItem, pvargIndex ); + maListHelper.AddItem( pvargItem, pvargIndex ); } void SAL_CALL ScVbaListBox::removeItem( const uno::Any& index ) { - mpListHelper->removeItem( index ); + maListHelper.removeItem( index ); } void SAL_CALL ScVbaListBox::Clear( ) { - mpListHelper->Clear(); + maListHelper.Clear(); } // this is called when something like the following vba code is used @@ -236,19 +236,19 @@ void SAL_CALL ScVbaListBox::setRowSource( const OUString& _rowsource ) { ScVbaControl::setRowSource( _rowsource ); - mpListHelper->setRowSource( _rowsource ); + maListHelper.setRowSource( _rowsource ); } sal_Int32 SAL_CALL ScVbaListBox::getListCount() { - return mpListHelper->getListCount(); + return maListHelper.getListCount(); } uno::Any SAL_CALL ScVbaListBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) { - return mpListHelper->List( pvargIndex, pvarColumn ); + return maListHelper.List( pvargIndex, pvarColumn ); } uno::Reference< msforms::XNewFont > SAL_CALL ScVbaListBox::getFont() diff --git a/vbahelper/source/msforms/vbalistbox.hxx b/vbahelper/source/msforms/vbalistbox.hxx index b87f9e74f7dd..b5dde46ebad3 100644 --- a/vbahelper/source/msforms/vbalistbox.hxx +++ b/vbahelper/source/msforms/vbalistbox.hxx @@ -19,6 +19,7 @@ #ifndef INCLUDED_VBAHELPER_SOURCE_MSFORMS_VBALISTBOX_HXX #define INCLUDED_VBAHELPER_SOURCE_MSFORMS_VBALISTBOX_HXX #include <memory> +#include <optional> #include <cppuhelper/implbase.hxx> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/script/XDefaultProperty.hpp> @@ -34,7 +35,7 @@ typedef cppu::ImplInheritanceHelper<ScVbaControl, ov::msforms::XListBox, css::sc class ScVbaListBox : public ListBoxImpl_BASE ,public PropListener { - std::unique_ptr< ListControlHelper > mpListHelper; + ListControlHelper maListHelper; sal_Int16 m_nIndex; |