22#include <com/sun/star/awt/XFixedText.hpp>
23#include <com/sun/star/awt/XGraphics.hpp>
24#include <com/sun/star/awt/PosSize.hpp>
25#include <com/sun/star/uno/XComponentContext.hpp>
28#include <rtl/ustrbuf.hxx>
32#include <progressbar.hxx>
34using namespace ::
cppu;
70 css::uno::Reference< XControl > xRef_Topic_Top (
m_xTopic_Top , UNO_QUERY );
71 css::uno::Reference< XControl > xRef_Text_Top (
m_xText_Top , UNO_QUERY );
72 css::uno::Reference< XControl > xRef_Topic_Bottom (
m_xTopic_Bottom , UNO_QUERY );
73 css::uno::Reference< XControl > xRef_Text_Bottom (
m_xText_Bottom , UNO_QUERY );
74 css::uno::Reference< XControl > xRef_Button (
m_xButton , UNO_QUERY );
77 xRef_Topic_Top->setModel ( css::uno::Reference< XControlModel > ( rxContext->getServiceManager()->createInstanceWithContext(
FIXEDTEXT_MODELNAME, rxContext ), UNO_QUERY ) );
78 xRef_Text_Top->setModel ( css::uno::Reference< XControlModel > ( rxContext->getServiceManager()->createInstanceWithContext(
FIXEDTEXT_MODELNAME, rxContext ), UNO_QUERY ) );
79 xRef_Topic_Bottom->setModel ( css::uno::Reference< XControlModel > ( rxContext->getServiceManager()->createInstanceWithContext(
FIXEDTEXT_MODELNAME, rxContext ), UNO_QUERY ) );
80 xRef_Text_Bottom->setModel ( css::uno::Reference< XControlModel > ( rxContext->getServiceManager()->createInstanceWithContext(
FIXEDTEXT_MODELNAME, rxContext ), UNO_QUERY ) );
81 xRef_Button->setModel ( css::uno::Reference< XControlModel > ( rxContext->getServiceManager()->createInstanceWithContext(
BUTTON_MODELNAME, rxContext ), UNO_QUERY ) );
117 Any aReturn ( ::cppu::queryInterface( rType ,
118 static_cast< XLayoutConstrains*
> (
this ) ,
119 static_cast< XButton*
> (
this ) ,
120 static_cast< XProgressMonitor*
> (
this )
125 if ( !aReturn.hasValue() )
157 static OTypeCollection ourTypeCollection(
163 return ourTypeCollection.getTypes();
168 const OUString& rTopic,
169 const OUString& rText,
179 DBG_ASSERT ( !(
impl_searchTopic ( rTopic, bbeforeProgress ) !=
nullptr ),
"ProgressMonitor::addText()\nThe text already exist.\n" );
191 aTextItem.
sTopic = rTopic;
192 aTextItem.
sText = rText;
195 if ( bbeforeProgress )
222 if ( pSearchItem ==
nullptr )
226 if ( bbeforeProgress )
230 { return &p == pSearchItem; } );
238 { return &p == pSearchItem; } );
250 const OUString& rTopic,
251 const OUString& rText,
265 if ( pSearchItem !=
nullptr )
268 pSearchItem->
sText = rText;
329 m_xButton->addActionListener ( rListener );
341 m_xButton->removeActionListener ( rListener );
365 m_xButton->setActionCommand ( rCommand );
379 ClearableMutexGuard aGuard (
m_aMutex );
382 css::uno::Reference< XLayoutConstrains > xTopicLayout_Top (
m_xTopic_Top , UNO_QUERY );
383 css::uno::Reference< XLayoutConstrains > xTopicLayout_Bottom (
m_xTopic_Bottom , UNO_QUERY );
384 css::uno::Reference< XLayoutConstrains > xButtonLayout (
m_xButton , UNO_QUERY );
386 Size aTopicSize_Top = xTopicLayout_Top->getPreferredSize ();
387 Size aTopicSize_Bottom = xTopicLayout_Bottom->getPreferredSize ();
388 Size aButtonSize = xButtonLayout->getPreferredSize ();
390 Size aProgressBarSize( aTempRectangle.Width, aTempRectangle.Height );
396 nWidth += aProgressBarSize.
Width;
399 nHeight += aTopicSize_Top.
Height;
400 nHeight += aProgressBarSize.
Height;
401 nHeight += aTopicSize_Bottom.
Height;
403 nHeight += aButtonSize.
Height;
416 return Size ( nWidth, nHeight );
452 return css::uno::Reference< XControlModel > ();
462 css::uno::Reference< XControl > xRef_Topic_Top (
m_xTopic_Top , UNO_QUERY );
463 css::uno::Reference< XControl > xRef_Text_Top (
m_xText_Top , UNO_QUERY );
464 css::uno::Reference< XControl > xRef_Topic_Bottom (
m_xTopic_Bottom , UNO_QUERY );
465 css::uno::Reference< XControl > xRef_Text_Bottom (
m_xText_Bottom , UNO_QUERY );
466 css::uno::Reference< XControl > xRef_Button (
m_xButton , UNO_QUERY );
477 xRef_Topic_Top->dispose ();
478 xRef_Text_Top->dispose ();
479 xRef_Topic_Bottom->dispose ();
480 xRef_Text_Bottom->dispose ();
481 xRef_Button->dispose ();
495 ( nWidth != aBasePosSize.Width ) ||
496 ( nHeight != aBasePosSize.Height)
540 sal_Int32 nWidth_Button;
541 sal_Int32 nHeight_Button;
543 sal_Int32 nX_ProgressBar;
544 sal_Int32 nY_ProgressBar;
545 sal_Int32 nWidth_ProgressBar;
546 sal_Int32 nHeight_ProgressBar;
548 sal_Int32 nX_Text_Top;
549 sal_Int32 nY_Text_Top;
550 sal_Int32 nWidth_Text_Top;
551 sal_Int32 nHeight_Text_Top;
553 sal_Int32 nX_Topic_Top;
554 sal_Int32 nY_Topic_Top;
555 sal_Int32 nWidth_Topic_Top;
556 sal_Int32 nHeight_Topic_Top;
558 sal_Int32 nX_Text_Bottom;
559 sal_Int32 nY_Text_Bottom;
560 sal_Int32 nWidth_Text_Bottom;
561 sal_Int32 nHeight_Text_Bottom;
563 sal_Int32 nX_Topic_Bottom;
564 sal_Int32 nY_Topic_Bottom;
565 sal_Int32 nWidth_Topic_Bottom;
566 sal_Int32 nHeight_Topic_Bottom;
572 css::uno::Reference< XLayoutConstrains > xTopicLayout_Top (
m_xTopic_Top , UNO_QUERY );
573 css::uno::Reference< XLayoutConstrains > xTextLayout_Top (
m_xText_Top , UNO_QUERY );
574 css::uno::Reference< XLayoutConstrains > xTopicLayout_Bottom (
m_xTopic_Bottom , UNO_QUERY );
575 css::uno::Reference< XLayoutConstrains > xTextLayout_Bottom (
m_xText_Bottom , UNO_QUERY );
576 css::uno::Reference< XLayoutConstrains > xButtonLayout (
m_xButton , UNO_QUERY );
578 Size aTopicSize_Top = xTopicLayout_Top->getPreferredSize ();
579 Size aTextSize_Top = xTextLayout_Top->getPreferredSize ();
580 Size aTopicSize_Bottom = xTopicLayout_Bottom->getPreferredSize ();
581 Size aTextSize_Bottom = xTextLayout_Bottom->getPreferredSize ();
582 Size aButtonSize = xButtonLayout->getPreferredSize ();
586 nWidth_Button = aButtonSize.
Width;
587 nHeight_Button = aButtonSize.
Height;
593 nWidth_Topic_Top = std::max( aTopicSize_Top.
Width, aTopicSize_Bottom.
Width );
594 nHeight_Topic_Top = aTopicSize_Top.
Height;
599 nY_Text_Top = nY_Topic_Top;
600 nWidth_Text_Top = std::max ( aTextSize_Top.
Width, aTextSize_Bottom.
Width );
608 nHeight_Text_Top = nHeight_Topic_Top;
613 nX_ProgressBar = nX_Topic_Top;
616 nHeight_ProgressBar = nHeight_Button;
619 nX_Topic_Bottom = nX_Topic_Top;
621 nWidth_Topic_Bottom = nWidth_Topic_Top;
622 nHeight_Topic_Bottom = aTopicSize_Bottom.
Height;
626 nY_Text_Bottom = nY_Topic_Bottom;
627 nWidth_Text_Bottom = nWidth_Text_Top;
628 nHeight_Text_Bottom = nHeight_Topic_Bottom;
631 nX_Button = nX_ProgressBar+nWidth_ProgressBar-nWidth_Button;
655 css::uno::Reference< XWindow > xRef_Topic_Top (
m_xTopic_Top , UNO_QUERY );
656 css::uno::Reference< XWindow > xRef_Text_Top (
m_xText_Top , UNO_QUERY );
657 css::uno::Reference< XWindow > xRef_Topic_Bottom (
m_xTopic_Bottom , UNO_QUERY );
658 css::uno::Reference< XWindow > xRef_Text_Bottom (
m_xText_Bottom , UNO_QUERY );
659 css::uno::Reference< XWindow > xRef_Button (
m_xButton , UNO_QUERY );
661 xRef_Topic_Top->setPosSize ( nDx+nX_Topic_Top , nDy+nY_Topic_Top , nWidth_Topic_Top , nHeight_Topic_Top , 15 );
662 xRef_Text_Top->setPosSize ( nDx+nX_Text_Top , nDy+nY_Text_Top , nWidth_Text_Top , nHeight_Text_Top , 15 );
663 xRef_Topic_Bottom->setPosSize ( nDx+nX_Topic_Bottom , nDy+nY_Topic_Bottom , nWidth_Topic_Bottom , nHeight_Topic_Bottom , 15 );
664 xRef_Text_Bottom->setPosSize ( nDx+nX_Text_Bottom , nDy+nY_Text_Bottom , nWidth_Text_Bottom , nHeight_Text_Bottom , 15 );
665 xRef_Button->setPosSize ( nDx+nX_Button , nDy+nY_Button , nWidth_Button , nHeight_Button , 15 );
666 m_xProgressBar->setPosSize( nDx+nX_ProgressBar, nDy+nY_ProgressBar, nWidth_ProgressBar, nHeight_ProgressBar, 15 );
695 OUStringBuffer aCollectString;
701 aCollectString.append(rSearchItem.sTopic +
"\n");
704 m_xTopic_Top->setText ( aCollectString.makeStringAndClear() );
710 OUStringBuffer aCollectString;
716 aCollectString.append(rSearchItem.sText +
"\n");
719 m_xText_Top->setText ( aCollectString.makeStringAndClear() );
727 OUStringBuffer aCollectString;
733 aCollectString.append(rSearchItem.sTopic +
"\n");
743 OUStringBuffer aCollectString;
749 aCollectString.append(rSearchItem.sText +
"\n");
770 ::std::vector< IMPL_TextlistItem >* pTextList;
782 size_t nPosition = 0;
783 size_t nCount = pTextList->size();
785 for ( nPosition = 0; nPosition <
nCount; ++nPosition )
787 auto& rSearchItem = pTextList->at( nPosition );
789 if ( rSearchItem.sTopic == rTopic )
804 std::u16string_view rTopic,
805 std::u16string_view rText
807 if ( rTopic.empty() )
return false;
809 if ( rText.empty() )
return false;
818 if ( rTopic.empty() )
return false;
826extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
828 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const&)
constexpr tools::Long Height() const
constexpr tools::Long Width() const
mutable::osl::Mutex m_aMutex
virtual void SAL_CALL dispose() override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
get information about supported interfaces @seealso XTypeProvider
virtual void SAL_CALL createPeer(const css::uno::Reference< css::awt::XToolkit > &xToolkit, const css::uno::Reference< css::awt::XWindowPeer > &xParent) override
virtual void SAL_CALL removeControl(const css::uno::Reference< css::awt::XControl > &xControl) override
virtual void SAL_CALL addControl(const OUString &sName, const css::uno::Reference< css::awt::XControl > &xControl) override
sal_Int32 impl_getWidth() const
virtual void SAL_CALL setPosSize(sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nFlags) override
sal_Int32 impl_getHeight() const
const css::uno::Reference< css::awt::XGraphics > & impl_getGraphicsPeer() const
virtual void SAL_CALL release() noexcept override
decrement refcount @seealso XInterface @seealso acquire() @onerror A RuntimeException is thrown.
virtual css::uno::Reference< css::awt::XWindowPeer > SAL_CALL getPeer() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
give answer, if interface is supported @descr The interfaces are searched by type.
virtual css::awt::Rectangle SAL_CALL getPosSize() override
virtual void SAL_CALL acquire() noexcept override
increment refcount @seealso XInterface @seealso release() @onerror A RuntimeException is thrown.
virtual void SAL_CALL setBackgroundColor(sal_Int32 nColor) override
css::uno::Reference< css::awt::XFixedText > m_xTopic_Top
virtual css::awt::Size SAL_CALL getMinimumSize() override
css::awt::Rectangle m_a3DLine
virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() override
virtual void SAL_CALL release() noexcept override
decrement refcount @seealso XInterface @seealso acquire() @onerror A RuntimeException is thrown.
virtual css::awt::Size SAL_CALL calcAdjustedSize(const css::awt::Size &aNewSize) override
void impl_rebuildFixedText()
virtual ~ProgressMonitor() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
give answer, if interface is supported @descr The interfaces are searched by type.
ProgressMonitor(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
get information about supported interfaces @seealso XTypeProvider
virtual void SAL_CALL removeText(const OUString &sTopic, sal_Bool bbeforeProgress) override
virtual sal_Bool SAL_CALL setModel(const css::uno::Reference< css::awt::XControlModel > &xModel) override
virtual void SAL_CALL setPosSize(sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nFlags) override
::std::vector< IMPL_TextlistItem > maTextlist_Bottom
virtual css::awt::Size SAL_CALL getPreferredSize() override
virtual void SAL_CALL setForegroundColor(sal_Int32 nColor) override
virtual void SAL_CALL removeActionListener(const css::uno::Reference< css::awt::XActionListener > &xListener) override
css::uno::Reference< css::awt::XFixedText > m_xText_Bottom
virtual void SAL_CALL addText(const OUString &sTopic, const OUString &sText, sal_Bool bbeforeProgress) override
add topic to dialog @descr Add a topic with a text in right textlist (used for FixedText-member).
virtual void SAL_CALL addActionListener(const css::uno::Reference< css::awt::XActionListener > &xListener) override
virtual void SAL_CALL dispose() override
::std::vector< IMPL_TextlistItem > maTextlist_Top
virtual void SAL_CALL createPeer(const css::uno::Reference< css::awt::XToolkit > &xToolkit, const css::uno::Reference< css::awt::XWindowPeer > &xParent) override
virtual sal_Int32 SAL_CALL getValue() override
virtual void impl_paint(sal_Int32 nX, sal_Int32 nY, const css::uno::Reference< css::awt::XGraphics > &xGraphics) override
virtual void SAL_CALL setRange(sal_Int32 nMin, sal_Int32 nMax) override
css::uno::Reference< css::awt::XFixedText > m_xTopic_Bottom
css::uno::Reference< css::awt::XButton > m_xButton
virtual void SAL_CALL setActionCommand(const OUString &sCommand) override
css::uno::Reference< css::awt::XFixedText > m_xText_Top
virtual void SAL_CALL setLabel(const OUString &sLabel) override
IMPL_TextlistItem * impl_searchTopic(std::u16string_view sTopic, bool bbeforeProgress)
virtual void SAL_CALL setValue(sal_Int32 nValue) override
static bool impl_debug_checkParameter(std::u16string_view sTopic, std::u16string_view sText)
rtl::Reference< ProgressBar > m_xProgressBar
virtual void SAL_CALL updateText(const OUString &sTopic, const OUString &sText, sal_Bool bbeforeProgress) override
virtual void SAL_CALL acquire() noexcept override
increment refcount @seealso XInterface @seealso release() @onerror A RuntimeException is thrown.
#define DBG_ASSERT(sCon, aError)
constexpr OUStringLiteral PROGRESSMONITOR_DEFAULT_TEXT
constexpr OUStringLiteral PROGRESSMONITOR_DEFAULT_TOPIC
constexpr OUStringLiteral FIXEDTEXT_SERVICENAME
constexpr OUStringLiteral CONTROLNAME_PROGRESSBAR
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * stardiv_UnoControls_ProgressMonitor_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
constexpr OUStringLiteral FIXEDTEXT_MODELNAME
constexpr OUStringLiteral BUTTON_SERVICENAME
constexpr OUStringLiteral DEFAULT_BUTTONLABEL
constexpr OUStringLiteral CONTROLNAME_TEXT
constexpr OUStringLiteral CONTROLNAME_BUTTON
constexpr OUStringLiteral BUTTON_MODELNAME
#define PROGRESSMONITOR_DEFAULT_HEIGHT
#define PROGRESSMONITOR_DEFAULT_WIDTH
#define PROGRESSMONITOR_LINECOLOR_SHADOW
#define PROGRESSMONITOR_FREEBORDER
#define PROGRESSMONITOR_LINECOLOR_BRIGHT
OUString sText
Left site of textline in dialog.