summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@libreoffice.org>2020-12-31 16:05:46 +0100
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-01-02 15:29:53 +0100
commit60ac2acd4cd1722fe12c3a7753db9b0519a8b7db (patch)
tree80bacac95986dae0db78641a962e91c0cbfb7efc
parentedc7a8a372a689802a583092ff0da0f60b6dbf97 (diff)
BASIC : simplify SbxVariable constructors and remove impl class
Change-Id: Iff37e71389594b313a3a3d12998dbbdbf0c85d05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108539 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--basic/source/sbx/sbxvar.cxx83
-rw-r--r--include/basic/sbxvar.hxx16
2 files changed, 26 insertions, 73 deletions
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 34ab5bc24a4b..a79a617af3dd 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -36,47 +36,24 @@ using namespace com::sun::star::uno;
// SbxVariable
-
-// SbxVariableImpl
-
-class SbxVariableImpl
-{
- friend class SbxVariable;
- OUString m_aDeclareClassName;
- Reference< XInterface > m_xComListener;
- StarBASIC* m_pComListenerParentBasic;
-
- SbxVariableImpl()
- : m_pComListenerParentBasic( nullptr )
- {}
-};
-
-
-// Constructors
-
SbxVariable::SbxVariable() : SbxValue()
{
- pParent = nullptr;
- nUserData = 0;
- nHash = 0;
}
SbxVariable::SbxVariable( const SbxVariable& r )
: SvRefBase( r ),
SbxValue( r ),
+ m_aDeclareClassName( r.m_aDeclareClassName ),
+ m_xComListener( r.m_xComListener),
mpPar( r.mpPar ),
pInfo( r.pInfo )
{
- if( r.mpImpl != nullptr )
- {
- mpImpl.reset( new SbxVariableImpl( *r.mpImpl ) );
#if HAVE_FEATURE_SCRIPTING
- if( mpImpl->m_xComListener.is() )
- {
- registerComListenerVariableForBasic( this, mpImpl->m_pComListenerParentBasic );
- }
-#endif
+ if( r.m_xComListener.is() )
+ {
+ registerComListenerVariableForBasic( this, r.m_pComListenerParentBasic );
}
+#endif
if( r.CanRead() )
{
pParent = r.pParent;
@@ -84,12 +61,6 @@ SbxVariable::SbxVariable( const SbxVariable& r )
maName = r.maName;
nHash = r.nHash;
}
- else
- {
- pParent = nullptr;
- nUserData = 0;
- nHash = 0;
- }
}
SbxEnsureParentVariable::SbxEnsureParentVariable(const SbxVariable& r)
@@ -109,9 +80,6 @@ void SbxEnsureParentVariable::SetParent(SbxObject* p)
SbxVariable::SbxVariable( SbxDataType t ) : SbxValue( t )
{
- pParent = nullptr;
- nUserData = 0;
- nHash = 0;
}
SbxVariable::~SbxVariable()
@@ -312,17 +280,15 @@ SbxVariable& SbxVariable::operator=( const SbxVariable& r )
if (this != &r)
{
SbxValue::operator=( r );
- mpImpl.reset();
- if( r.mpImpl != nullptr )
- {
- mpImpl.reset( new SbxVariableImpl( *r.mpImpl ) );
+ m_aDeclareClassName = r.m_aDeclareClassName;
+ m_xComListener = r.m_xComListener;
+ m_pComListenerParentBasic = r.m_pComListenerParentBasic;
#if HAVE_FEATURE_SCRIPTING
- if( mpImpl->m_xComListener.is() )
- {
- registerComListenerVariableForBasic( this, mpImpl->m_pComListenerParentBasic );
- }
-#endif
+ if( m_xComListener.is() )
+ {
+ registerComListenerVariableForBasic( this, m_pComListenerParentBasic );
}
+#endif
}
return *this;
}
@@ -389,33 +355,21 @@ void SbxVariable::SetParent( SbxObject* p )
pParent = p;
}
-SbxVariableImpl* SbxVariable::getImpl()
-{
- if(!mpImpl)
- {
- mpImpl.reset(new SbxVariableImpl);
- }
- return mpImpl.get();
-}
-
const OUString& SbxVariable::GetDeclareClassName()
{
- SbxVariableImpl* pImpl = getImpl();
- return pImpl->m_aDeclareClassName;
+ return m_aDeclareClassName;
}
void SbxVariable::SetDeclareClassName( const OUString& rDeclareClassName )
{
- SbxVariableImpl* pImpl = getImpl();
- pImpl->m_aDeclareClassName = rDeclareClassName;
+ m_aDeclareClassName = rDeclareClassName;
}
void SbxVariable::SetComListener( const css::uno::Reference< css::uno::XInterface >& xComListener,
StarBASIC* pParentBasic )
{
- SbxVariableImpl* pImpl = getImpl();
- pImpl->m_xComListener = xComListener;
- pImpl->m_pComListenerParentBasic = pParentBasic;
+ m_xComListener = xComListener;
+ m_pComListenerParentBasic = pParentBasic;
#if HAVE_FEATURE_SCRIPTING
registerComListenerVariableForBasic( this, pParentBasic );
#endif
@@ -423,8 +377,7 @@ void SbxVariable::SetComListener( const css::uno::Reference< css::uno::XInterfac
void SbxVariable::ClearComListener()
{
- SbxVariableImpl* pImpl = getImpl();
- pImpl->m_xComListener.clear();
+ m_xComListener.clear();
}
diff --git a/include/basic/sbxvar.hxx b/include/basic/sbxvar.hxx
index 487b910aac84..342ba8c33583 100644
--- a/include/basic/sbxvar.hxx
+++ b/include/basic/sbxvar.hxx
@@ -24,6 +24,8 @@
#include <rtl/ustring.hxx>
#include <basic/sbxcore.hxx>
#include <basic/basicdllapi.h>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
#include <algorithm>
#include <cstddef>
@@ -32,8 +34,6 @@
namespace com::sun::star::bridge::oleautomation { struct Decimal; }
-namespace com::sun::star::uno { class XInterface; }
-namespace com::sun::star::uno { template <typename > class Reference; }
class SbxDecimal;
enum class SfxHintId;
@@ -243,18 +243,18 @@ class BASIC_DLLPUBLIC SbxVariable : public SbxValue
{
friend class SbMethod;
- std::unique_ptr<SbxVariableImpl> mpImpl; // Impl data
+ OUString m_aDeclareClassName;
+ css::uno::Reference< css::uno::XInterface > m_xComListener;
+ StarBASIC* m_pComListenerParentBasic = nullptr;
std::unique_ptr<SfxBroadcaster> mpBroadcaster; // Broadcaster, if needed
OUString maName; // Name, if available
SbxArrayRef mpPar; // Parameter-Array, if set
- sal_uInt16 nHash; // Hash-ID for search
-
- BASIC_DLLPRIVATE SbxVariableImpl* getImpl();
+ sal_uInt16 nHash = 0; // Hash-ID for search
protected:
SbxInfoRef pInfo; // Probably called information
- sal_uInt32 nUserData; // User data for Call()
- SbxObject* pParent; // Currently attached object
+ sal_uInt32 nUserData= 0; // User data for Call()
+ SbxObject* pParent = nullptr; // Currently attached object
virtual ~SbxVariable() override;
virtual bool LoadData( SvStream&, sal_uInt16 ) override;
virtual bool StoreData( SvStream& ) const override;