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>
This commit is contained in:
parent
44e1f09f7e
commit
d0b71f167c
@ -193,7 +193,7 @@ public:
|
|||||||
|
|
||||||
class VBAHELPER_DLLPUBLIC ConcreteXShapeGeometryAttributes final : public AbstractGeometryAttributes
|
class VBAHELPER_DLLPUBLIC ConcreteXShapeGeometryAttributes final : public AbstractGeometryAttributes
|
||||||
{
|
{
|
||||||
std::unique_ptr< ShapeHelper > m_pShapeHelper;
|
ShapeHelper m_aShapeHelper;
|
||||||
public:
|
public:
|
||||||
ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::drawing::XShape >& xShape );
|
ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::drawing::XShape >& xShape );
|
||||||
virtual double getLeft() const override;
|
virtual double getLeft() const override;
|
||||||
|
@ -60,7 +60,7 @@ typedef InheritedHelperInterfaceImpl< ListeningShape > ScVbaShape_BASE;
|
|||||||
class VBAHELPER_DLLPUBLIC ScVbaShape : public ScVbaShape_BASE
|
class VBAHELPER_DLLPUBLIC ScVbaShape : public ScVbaShape_BASE
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
std::unique_ptr< ov::ShapeHelper > m_pShapeHelper;
|
ov::ShapeHelper m_aShapeHelper;
|
||||||
css::uno::Reference< css::drawing::XShape > m_xShape;
|
css::uno::Reference< css::drawing::XShape > m_xShape;
|
||||||
css::uno::Reference< css::drawing::XShapes > m_xShapes;
|
css::uno::Reference< css::drawing::XShapes > m_xShapes;
|
||||||
css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
|
css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
|
||||||
|
@ -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 )
|
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) )
|
: ComboBoxImpl_BASE( xParent, xContext, xControl, xModel, std::move(pGeomHelper) )
|
||||||
|
, maListHelper( m_xProps )
|
||||||
{
|
{
|
||||||
mpListHelper.reset( new ListControlHelper( m_xProps ) );
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// grab the default value property name
|
// grab the default value property name
|
||||||
@ -149,38 +149,38 @@ ScVbaComboBox::setText( const OUString& _text )
|
|||||||
void SAL_CALL
|
void SAL_CALL
|
||||||
ScVbaComboBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex )
|
ScVbaComboBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex )
|
||||||
{
|
{
|
||||||
mpListHelper->AddItem( pvargItem, pvargIndex );
|
maListHelper.AddItem( pvargItem, pvargIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAL_CALL
|
void SAL_CALL
|
||||||
ScVbaComboBox::removeItem( const uno::Any& index )
|
ScVbaComboBox::removeItem( const uno::Any& index )
|
||||||
{
|
{
|
||||||
mpListHelper->removeItem( index );
|
maListHelper.removeItem( index );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAL_CALL
|
void SAL_CALL
|
||||||
ScVbaComboBox::Clear( )
|
ScVbaComboBox::Clear( )
|
||||||
{
|
{
|
||||||
mpListHelper->Clear();
|
maListHelper.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAL_CALL
|
void SAL_CALL
|
||||||
ScVbaComboBox::setRowSource( const OUString& _rowsource )
|
ScVbaComboBox::setRowSource( const OUString& _rowsource )
|
||||||
{
|
{
|
||||||
ScVbaControl::setRowSource( _rowsource );
|
ScVbaControl::setRowSource( _rowsource );
|
||||||
mpListHelper->setRowSource( _rowsource );
|
maListHelper.setRowSource( _rowsource );
|
||||||
}
|
}
|
||||||
|
|
||||||
sal_Int32 SAL_CALL
|
sal_Int32 SAL_CALL
|
||||||
ScVbaComboBox::getListCount()
|
ScVbaComboBox::getListCount()
|
||||||
{
|
{
|
||||||
return mpListHelper->getListCount();
|
return maListHelper.getListCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Any SAL_CALL
|
uno::Any SAL_CALL
|
||||||
ScVbaComboBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn )
|
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()
|
sal_Int32 SAL_CALL ScVbaComboBox::getStyle()
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#ifndef INCLUDED_VBAHELPER_SOURCE_MSFORMS_VBACOMBOBOX_HXX
|
#ifndef INCLUDED_VBAHELPER_SOURCE_MSFORMS_VBACOMBOBOX_HXX
|
||||||
#define INCLUDED_VBAHELPER_SOURCE_MSFORMS_VBACOMBOBOX_HXX
|
#define INCLUDED_VBAHELPER_SOURCE_MSFORMS_VBACOMBOBOX_HXX
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <cppuhelper/implbase.hxx>
|
#include <cppuhelper/implbase.hxx>
|
||||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||||
@ -33,7 +34,7 @@
|
|||||||
typedef cppu::ImplInheritanceHelper<ScVbaControl, ov::msforms::XComboBox, css::script::XDefaultProperty > ComboBoxImpl_BASE;
|
typedef cppu::ImplInheritanceHelper<ScVbaControl, ov::msforms::XComboBox, css::script::XDefaultProperty > ComboBoxImpl_BASE;
|
||||||
class ScVbaComboBox : public ComboBoxImpl_BASE
|
class ScVbaComboBox : public ComboBoxImpl_BASE
|
||||||
{
|
{
|
||||||
std::unique_ptr< ListControlHelper > mpListHelper;
|
ListControlHelper maListHelper;
|
||||||
OUString sSourceName;
|
OUString sSourceName;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -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 )
|
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))
|
: ListBoxImpl_BASE(xParent, xContext, xControl, xModel, std::move(pGeomHelper))
|
||||||
|
, maListHelper( m_xProps )
|
||||||
, m_nIndex(0)
|
, m_nIndex(0)
|
||||||
{
|
{
|
||||||
mpListHelper.reset( new ListControlHelper( m_xProps ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes
|
// Attributes
|
||||||
@ -152,19 +152,19 @@ ScVbaListBox::Selected( sal_Int32 index )
|
|||||||
void SAL_CALL
|
void SAL_CALL
|
||||||
ScVbaListBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex )
|
ScVbaListBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex )
|
||||||
{
|
{
|
||||||
mpListHelper->AddItem( pvargItem, pvargIndex );
|
maListHelper.AddItem( pvargItem, pvargIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAL_CALL
|
void SAL_CALL
|
||||||
ScVbaListBox::removeItem( const uno::Any& index )
|
ScVbaListBox::removeItem( const uno::Any& index )
|
||||||
{
|
{
|
||||||
mpListHelper->removeItem( index );
|
maListHelper.removeItem( index );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAL_CALL
|
void SAL_CALL
|
||||||
ScVbaListBox::Clear( )
|
ScVbaListBox::Clear( )
|
||||||
{
|
{
|
||||||
mpListHelper->Clear();
|
maListHelper.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is called when something like the following vba code is used
|
// this is called when something like the following vba code is used
|
||||||
@ -236,19 +236,19 @@ void SAL_CALL
|
|||||||
ScVbaListBox::setRowSource( const OUString& _rowsource )
|
ScVbaListBox::setRowSource( const OUString& _rowsource )
|
||||||
{
|
{
|
||||||
ScVbaControl::setRowSource( _rowsource );
|
ScVbaControl::setRowSource( _rowsource );
|
||||||
mpListHelper->setRowSource( _rowsource );
|
maListHelper.setRowSource( _rowsource );
|
||||||
}
|
}
|
||||||
|
|
||||||
sal_Int32 SAL_CALL
|
sal_Int32 SAL_CALL
|
||||||
ScVbaListBox::getListCount()
|
ScVbaListBox::getListCount()
|
||||||
{
|
{
|
||||||
return mpListHelper->getListCount();
|
return maListHelper.getListCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Any SAL_CALL
|
uno::Any SAL_CALL
|
||||||
ScVbaListBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn )
|
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()
|
uno::Reference< msforms::XNewFont > SAL_CALL ScVbaListBox::getFont()
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#ifndef INCLUDED_VBAHELPER_SOURCE_MSFORMS_VBALISTBOX_HXX
|
#ifndef INCLUDED_VBAHELPER_SOURCE_MSFORMS_VBALISTBOX_HXX
|
||||||
#define INCLUDED_VBAHELPER_SOURCE_MSFORMS_VBALISTBOX_HXX
|
#define INCLUDED_VBAHELPER_SOURCE_MSFORMS_VBALISTBOX_HXX
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <cppuhelper/implbase.hxx>
|
#include <cppuhelper/implbase.hxx>
|
||||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||||
#include <com/sun/star/script/XDefaultProperty.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
|
class ScVbaListBox : public ListBoxImpl_BASE
|
||||||
,public PropListener
|
,public PropListener
|
||||||
{
|
{
|
||||||
std::unique_ptr< ListControlHelper > mpListHelper;
|
ListControlHelper maListHelper;
|
||||||
|
|
||||||
sal_Int16 m_nIndex;
|
sal_Int16 m_nIndex;
|
||||||
|
|
||||||
|
@ -625,8 +625,8 @@ double PixelsToPoints( const css::uno::Reference< css::awt::XDevice >& xDevice,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::drawing::XShape >& xShape )
|
ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::drawing::XShape >& xShape )
|
||||||
|
: m_aShapeHelper( xShape )
|
||||||
{
|
{
|
||||||
m_pShapeHelper.reset( new ShapeHelper( xShape ) );
|
|
||||||
}
|
}
|
||||||
ConcreteXShapeGeometryAttributes::~ConcreteXShapeGeometryAttributes()
|
ConcreteXShapeGeometryAttributes::~ConcreteXShapeGeometryAttributes()
|
||||||
{
|
{
|
||||||
@ -935,36 +935,36 @@ void UserFormGeometryHelper::implSetSize( double fSize, bool bHeight, bool bOute
|
|||||||
|
|
||||||
double ConcreteXShapeGeometryAttributes::getLeft() const
|
double ConcreteXShapeGeometryAttributes::getLeft() const
|
||||||
{
|
{
|
||||||
return m_pShapeHelper->getLeft();
|
return m_aShapeHelper.getLeft();
|
||||||
}
|
}
|
||||||
void ConcreteXShapeGeometryAttributes::setLeft( double nLeft )
|
void ConcreteXShapeGeometryAttributes::setLeft( double nLeft )
|
||||||
{
|
{
|
||||||
m_pShapeHelper->setLeft( nLeft );
|
m_aShapeHelper.setLeft( nLeft );
|
||||||
}
|
}
|
||||||
double ConcreteXShapeGeometryAttributes::getTop() const
|
double ConcreteXShapeGeometryAttributes::getTop() const
|
||||||
{
|
{
|
||||||
return m_pShapeHelper->getTop();
|
return m_aShapeHelper.getTop();
|
||||||
}
|
}
|
||||||
void ConcreteXShapeGeometryAttributes::setTop( double nTop )
|
void ConcreteXShapeGeometryAttributes::setTop( double nTop )
|
||||||
{
|
{
|
||||||
m_pShapeHelper->setTop( nTop );
|
m_aShapeHelper.setTop( nTop );
|
||||||
}
|
}
|
||||||
|
|
||||||
double ConcreteXShapeGeometryAttributes::getHeight() const
|
double ConcreteXShapeGeometryAttributes::getHeight() const
|
||||||
{
|
{
|
||||||
return m_pShapeHelper->getHeight();
|
return m_aShapeHelper.getHeight();
|
||||||
}
|
}
|
||||||
void ConcreteXShapeGeometryAttributes::setHeight( double nHeight )
|
void ConcreteXShapeGeometryAttributes::setHeight( double nHeight )
|
||||||
{
|
{
|
||||||
m_pShapeHelper->setHeight( nHeight );
|
m_aShapeHelper.setHeight( nHeight );
|
||||||
}
|
}
|
||||||
double ConcreteXShapeGeometryAttributes::getWidth() const
|
double ConcreteXShapeGeometryAttributes::getWidth() const
|
||||||
{
|
{
|
||||||
return m_pShapeHelper->getWidth();
|
return m_aShapeHelper.getWidth();
|
||||||
}
|
}
|
||||||
void ConcreteXShapeGeometryAttributes::setWidth( double nWidth)
|
void ConcreteXShapeGeometryAttributes::setWidth( double nWidth)
|
||||||
{
|
{
|
||||||
m_pShapeHelper->setWidth( nWidth );
|
m_aShapeHelper.setWidth( nWidth );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,10 +50,14 @@ using namespace ::ooo::vba;
|
|||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
|
|
||||||
ScVbaShape::ScVbaShape( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< drawing::XShape > xShape, uno::Reference< drawing::XShapes > xShapes, uno::Reference< frame::XModel > xModel, sal_Int32 nType )
|
ScVbaShape::ScVbaShape( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< drawing::XShape > xShape, uno::Reference< drawing::XShapes > xShapes, uno::Reference< frame::XModel > xModel, sal_Int32 nType )
|
||||||
: ScVbaShape_BASE( xParent, xContext ), m_xShape(std::move( xShape )), m_xShapes(std::move( xShapes )), m_nType( nType ), m_xModel(std::move( xModel ))
|
: ScVbaShape_BASE( xParent, xContext )
|
||||||
|
, m_aShapeHelper( xShape )
|
||||||
|
, m_xShape(std::move( xShape ))
|
||||||
|
, m_xShapes(std::move( xShapes ))
|
||||||
|
, m_nType( nType )
|
||||||
|
, m_xModel(std::move( xModel ))
|
||||||
{
|
{
|
||||||
m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW );
|
m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW );
|
||||||
m_pShapeHelper.reset( new ShapeHelper( m_xShape ) );
|
|
||||||
addListeners();
|
addListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,25 +236,25 @@ ScVbaShape::setAlternativeText( const OUString& sAltText )
|
|||||||
double SAL_CALL
|
double SAL_CALL
|
||||||
ScVbaShape::getHeight()
|
ScVbaShape::getHeight()
|
||||||
{
|
{
|
||||||
return m_pShapeHelper->getHeight();
|
return m_aShapeHelper.getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAL_CALL
|
void SAL_CALL
|
||||||
ScVbaShape::setHeight(double _height)
|
ScVbaShape::setHeight(double _height)
|
||||||
{
|
{
|
||||||
m_pShapeHelper->setHeight( _height );
|
m_aShapeHelper.setHeight( _height );
|
||||||
}
|
}
|
||||||
|
|
||||||
double SAL_CALL
|
double SAL_CALL
|
||||||
ScVbaShape::getWidth()
|
ScVbaShape::getWidth()
|
||||||
{
|
{
|
||||||
return m_pShapeHelper->getWidth();
|
return m_aShapeHelper.getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SAL_CALL
|
void SAL_CALL
|
||||||
ScVbaShape::setWidth(double _width)
|
ScVbaShape::setWidth(double _width)
|
||||||
{
|
{
|
||||||
m_pShapeHelper->setWidth( _width );
|
m_aShapeHelper.setWidth( _width );
|
||||||
}
|
}
|
||||||
|
|
||||||
double SAL_CALL
|
double SAL_CALL
|
||||||
@ -259,7 +263,7 @@ ScVbaShape::getLeft()
|
|||||||
double left = 0;
|
double left = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
left = m_pShapeHelper->getLeft();
|
left = m_aShapeHelper.getLeft();
|
||||||
}
|
}
|
||||||
catch( uno::Exception& )
|
catch( uno::Exception& )
|
||||||
{
|
{
|
||||||
@ -276,7 +280,7 @@ ScVbaShape::setLeft( double _left )
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_pShapeHelper->setLeft( _left );
|
m_aShapeHelper.setLeft( _left );
|
||||||
}
|
}
|
||||||
catch( uno::Exception& )
|
catch( uno::Exception& )
|
||||||
{
|
{
|
||||||
@ -291,7 +295,7 @@ ScVbaShape::getTop()
|
|||||||
double top = 0;
|
double top = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
top = m_pShapeHelper->getTop();
|
top = m_aShapeHelper.getTop();
|
||||||
}
|
}
|
||||||
catch( uno::Exception& )
|
catch( uno::Exception& )
|
||||||
{
|
{
|
||||||
@ -307,7 +311,7 @@ ScVbaShape::setTop( double _top )
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_pShapeHelper->setTop( _top );
|
m_aShapeHelper.setTop( _top );
|
||||||
}
|
}
|
||||||
catch( uno::Exception& )
|
catch( uno::Exception& )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user