Simplify ProgressMonitor, StatusIndicator

Change-Id: I1c17fa54e865c2750407783adbb2f73c095dbbfd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178094
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Mike Kaganski 2024-12-08 20:32:36 +05:00
parent 98352eda9b
commit f8aa78379c
4 changed files with 11 additions and 211 deletions

View file

@ -51,7 +51,7 @@ constexpr OUStringLiteral DEFAULT_BUTTONLABEL = u"Abbrechen";
namespace unocontrols {
ProgressMonitor::ProgressMonitor( const css::uno::Reference< XComponentContext >& rxContext )
: BaseContainerControl ( rxContext )
: ProgressMonitor_BASE(rxContext)
{
// It's not allowed to work with member in this method (refcounter !!!)
// But with a HACK (++refcount) its "OK" :-(
@ -109,58 +109,6 @@ ProgressMonitor::~ProgressMonitor()
impl_cleanMemory ();
}
// XInterface
Any SAL_CALL ProgressMonitor::queryInterface( const Type& rType )
{
// Ask for my own supported interfaces ...
// Attention: XTypeProvider and XInterface are supported by WeakComponentImplHelper!
Any aReturn ( ::cppu::queryInterface( rType ,
static_cast< XLayoutConstrains* > ( this ) ,
static_cast< XButton* > ( this ) ,
static_cast< XProgressMonitor* > ( this )
)
);
if (aReturn.hasValue())
return aReturn;
// If searched interface not supported by this class ...
// ... ask baseclasses.
return BaseControl::queryInterface(rType);
}
// XInterface
void SAL_CALL ProgressMonitor::acquire() noexcept
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Forward to baseclass
BaseControl::acquire();
}
// XInterface
void SAL_CALL ProgressMonitor::release() noexcept
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Forward to baseclass
BaseControl::release();
}
// XTypeProvider
Sequence< Type > SAL_CALL ProgressMonitor::getTypes()
{
static OTypeCollection ourTypeCollection(
cppu::UnoType<XLayoutConstrains>::get(),
cppu::UnoType<XButton>::get(),
cppu::UnoType<XProgressMonitor>::get(),
BaseContainerControl::getTypes() );
return ourTypeCollection.getTypes();
}
// XProgressMonitor
void SAL_CALL ProgressMonitor::addText(
const OUString& rTopic,

View file

@ -44,7 +44,7 @@ namespace unocontrols {
// construct/destruct
StatusIndicator::StatusIndicator( const css::uno::Reference< XComponentContext >& rxContext )
: BaseContainerControl ( rxContext )
: StatusIndicator_BASE(rxContext)
{
// It's not allowed to work with member in this method (refcounter !!!)
// But with a HACK (++refcount) its "OK" :-(
@ -72,62 +72,6 @@ StatusIndicator::StatusIndicator( const css::uno::Reference< XComponentContext >
StatusIndicator::~StatusIndicator() {}
// XInterface
Any SAL_CALL StatusIndicator::queryInterface( const Type& rType )
{
// Ask for my own supported interfaces ...
// Attention: XTypeProvider and XInterface are supported by WeakComponentImplHelper!
Any aReturn ( ::cppu::queryInterface( rType ,
static_cast< XLayoutConstrains* > ( this ) ,
static_cast< XStatusIndicator* > ( this )
)
);
// If searched interface not supported by this class ...
if ( !aReturn.hasValue() )
{
// ... ask baseclasses.
aReturn = BaseControl::queryInterface( rType );
}
return aReturn;
}
// XInterface
void SAL_CALL StatusIndicator::acquire() noexcept
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Forward to baseclass
BaseControl::acquire();
}
// XInterface
void SAL_CALL StatusIndicator::release() noexcept
{
// Attention:
// Don't use mutex or guard in this method!!! Is a method of XInterface.
// Forward to baseclass
BaseControl::release();
}
// XTypeProvider
Sequence< Type > SAL_CALL StatusIndicator::getTypes()
{
static OTypeCollection ourTypeCollection(
cppu::UnoType<XLayoutConstrains>::get(),
cppu::UnoType<XStatusIndicator>::get(),
BaseContainerControl::getTypes() );
return ourTypeCollection.getTypes();
}
// XStatusIndicator
void SAL_CALL StatusIndicator::start( const OUString& sText, sal_Int32 nRange )

View file

@ -50,63 +50,17 @@ struct IMPL_TextlistItem
OUString sText; /// Right site of textline in dialog
};
class ProgressMonitor final : public css::awt::XLayoutConstrains
, public css::awt::XButton
, public css::awt::XProgressMonitor
, public BaseContainerControl
using ProgressMonitor_BASE = cppu::ImplInheritanceHelper<BaseContainerControl,
css::awt::XLayoutConstrains,
css::awt::XButton,
css::awt::XProgressMonitor>;
class ProgressMonitor final : public ProgressMonitor_BASE
{
public:
ProgressMonitor( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
virtual ~ProgressMonitor() override;
// XInterface
/**
@short give answer, if interface is supported
@descr The interfaces are searched by type.
@seealso XInterface
@param "rType" is the type of searched interface.
@return Any information about found interface
@onerror A RuntimeException is thrown.
*/
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
/**
@short increment refcount
@seealso XInterface
@seealso release()
@onerror A RuntimeException is thrown.
*/
virtual void SAL_CALL acquire() noexcept override;
/**
@short decrement refcount
@seealso XInterface
@seealso acquire()
@onerror A RuntimeException is thrown.
*/
virtual void SAL_CALL release() noexcept override;
// XTypeProvider
/**
@short get information about supported interfaces
@seealso XTypeProvider
@return Sequence of types of all supported interfaces
@onerror A RuntimeException is thrown.
*/
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
// XProgressMonitor
/**

View file

@ -42,62 +42,16 @@ constexpr sal_Int32 STATUSINDICATOR_BACKGROUNDCOLOR = sal_Int32(COL_LIGHTGRAY);
constexpr sal_Int32 STATUSINDICATOR_LINECOLOR_BRIGHT = sal_Int32(COL_WHITE);
constexpr sal_Int32 STATUSINDICATOR_LINECOLOR_SHADOW = sal_Int32(COL_BLACK);
class StatusIndicator final : public css::awt::XLayoutConstrains
, public css::task::XStatusIndicator
, public BaseContainerControl
using StatusIndicator_BASE = cppu::ImplInheritanceHelper<BaseContainerControl,
css::awt::XLayoutConstrains,
css::task::XStatusIndicator>;
class StatusIndicator final : public StatusIndicator_BASE
{
public:
StatusIndicator( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
virtual ~StatusIndicator() override;
// XInterface
/**
@short give answer, if interface is supported
@descr The interfaces are searched by type.
@seealso XInterface
@param "rType" is the type of searched interface.
@return Any information about found interface
@onerror A RuntimeException is thrown.
*/
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
/**
@short increment refcount
@seealso XInterface
@seealso release()
@onerror A RuntimeException is thrown.
*/
virtual void SAL_CALL acquire() noexcept override;
/**
@short decrement refcount
@seealso XInterface
@seealso acquire()
@onerror A RuntimeException is thrown.
*/
virtual void SAL_CALL release() noexcept override;
// XTypeProvider
/**
@short get information about supported interfaces
@seealso XTypeProvider
@return Sequence of types of all supported interfaces
@onerror A RuntimeException is thrown.
*/
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
// XStatusIndicator
virtual void SAL_CALL start(