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:
parent
98352eda9b
commit
f8aa78379c
4 changed files with 11 additions and 211 deletions
|
@ -51,7 +51,7 @@ constexpr OUStringLiteral DEFAULT_BUTTONLABEL = u"Abbrechen";
|
||||||
namespace unocontrols {
|
namespace unocontrols {
|
||||||
|
|
||||||
ProgressMonitor::ProgressMonitor( const css::uno::Reference< XComponentContext >& rxContext )
|
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 !!!)
|
// It's not allowed to work with member in this method (refcounter !!!)
|
||||||
// But with a HACK (++refcount) its "OK" :-(
|
// But with a HACK (++refcount) its "OK" :-(
|
||||||
|
@ -109,58 +109,6 @@ ProgressMonitor::~ProgressMonitor()
|
||||||
impl_cleanMemory ();
|
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
|
// XProgressMonitor
|
||||||
void SAL_CALL ProgressMonitor::addText(
|
void SAL_CALL ProgressMonitor::addText(
|
||||||
const OUString& rTopic,
|
const OUString& rTopic,
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace unocontrols {
|
||||||
// construct/destruct
|
// construct/destruct
|
||||||
|
|
||||||
StatusIndicator::StatusIndicator( const css::uno::Reference< XComponentContext >& rxContext )
|
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 !!!)
|
// It's not allowed to work with member in this method (refcounter !!!)
|
||||||
// But with a HACK (++refcount) its "OK" :-(
|
// But with a HACK (++refcount) its "OK" :-(
|
||||||
|
@ -72,62 +72,6 @@ StatusIndicator::StatusIndicator( const css::uno::Reference< XComponentContext >
|
||||||
|
|
||||||
StatusIndicator::~StatusIndicator() {}
|
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
|
// XStatusIndicator
|
||||||
|
|
||||||
void SAL_CALL StatusIndicator::start( const OUString& sText, sal_Int32 nRange )
|
void SAL_CALL StatusIndicator::start( const OUString& sText, sal_Int32 nRange )
|
||||||
|
|
|
@ -50,63 +50,17 @@ struct IMPL_TextlistItem
|
||||||
OUString sText; /// Right site of textline in dialog
|
OUString sText; /// Right site of textline in dialog
|
||||||
};
|
};
|
||||||
|
|
||||||
class ProgressMonitor final : public css::awt::XLayoutConstrains
|
using ProgressMonitor_BASE = cppu::ImplInheritanceHelper<BaseContainerControl,
|
||||||
, public css::awt::XButton
|
css::awt::XLayoutConstrains,
|
||||||
, public css::awt::XProgressMonitor
|
css::awt::XButton,
|
||||||
, public BaseContainerControl
|
css::awt::XProgressMonitor>;
|
||||||
|
class ProgressMonitor final : public ProgressMonitor_BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ProgressMonitor( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
|
ProgressMonitor( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
|
||||||
|
|
||||||
virtual ~ProgressMonitor() override;
|
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
|
// XProgressMonitor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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_BRIGHT = sal_Int32(COL_WHITE);
|
||||||
constexpr sal_Int32 STATUSINDICATOR_LINECOLOR_SHADOW = sal_Int32(COL_BLACK);
|
constexpr sal_Int32 STATUSINDICATOR_LINECOLOR_SHADOW = sal_Int32(COL_BLACK);
|
||||||
|
|
||||||
class StatusIndicator final : public css::awt::XLayoutConstrains
|
using StatusIndicator_BASE = cppu::ImplInheritanceHelper<BaseContainerControl,
|
||||||
, public css::task::XStatusIndicator
|
css::awt::XLayoutConstrains,
|
||||||
, public BaseContainerControl
|
css::task::XStatusIndicator>;
|
||||||
|
class StatusIndicator final : public StatusIndicator_BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StatusIndicator( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
|
StatusIndicator( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
|
||||||
|
|
||||||
virtual ~StatusIndicator() override;
|
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
|
// XStatusIndicator
|
||||||
|
|
||||||
virtual void SAL_CALL start(
|
virtual void SAL_CALL start(
|
||||||
|
|
Loading…
Reference in a new issue