summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/toolkit/awt/vclxwindows.hxx43
-rw-r--r--svtools/source/inc/unoiface.hxx42
-rw-r--r--svtools/source/uno/unoiface.cxx267
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx6
-rw-r--r--toolkit/source/awt/vclxwindows.cxx251
5 files changed, 300 insertions, 309 deletions
diff --git a/include/toolkit/awt/vclxwindows.hxx b/include/toolkit/awt/vclxwindows.hxx
index 6dd518296356..0a5d0a7b79b2 100644
--- a/include/toolkit/awt/vclxwindows.hxx
+++ b/include/toolkit/awt/vclxwindows.hxx
@@ -26,6 +26,7 @@
#include <com/sun/star/awt/XListBox.hpp>
#include <com/sun/star/awt/XScrollBar.hpp>
#include <com/sun/star/awt/XMessageBox.hpp>
+#include <com/sun/star/awt/XProgressBar.hpp>
#include <com/sun/star/awt/XTextEditField.hpp>
#include <com/sun/star/awt/XTimeField.hpp>
#include <com/sun/star/awt/XSpinField.hpp>
@@ -1186,6 +1187,48 @@ public:
};
+// class VCLXProgressBar
+class VCLXProgressBar final : public css::awt::XProgressBar
+ , public VCLXWindow
+{
+private:
+ sal_Int32 m_nValue;
+ sal_Int32 m_nValueMin;
+ sal_Int32 m_nValueMax;
+
+ void ImplUpdateValue();
+
+public:
+ VCLXProgressBar();
+ virtual ~VCLXProgressBar() override;
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() throw() override { VCLXWindow::acquire(); }
+ void SAL_CALL release() throw() override { VCLXWindow::release(); }
+
+ // css::lang::XTypeProvider
+ css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
+ css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
+
+ // css::awt::XProgressBar
+ void SAL_CALL setForegroundColor( sal_Int32 nColor ) override;
+ void SAL_CALL setBackgroundColor( sal_Int32 nColor ) override;
+ void SAL_CALL setValue( sal_Int32 nValue ) override;
+ void SAL_CALL setRange( sal_Int32 nMin, sal_Int32 nMax ) override;
+ sal_Int32 SAL_CALL getValue() override;
+
+ // css::awt::VclWindowPeer
+ void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
+ css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
+
+ static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
+};
+
+
+
+
#endif // INCLUDED_TOOLKIT_AWT_VCLXWINDOWS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/inc/unoiface.hxx b/svtools/source/inc/unoiface.hxx
index 079c68af4394..01a70610cd04 100644
--- a/svtools/source/inc/unoiface.hxx
+++ b/svtools/source/inc/unoiface.hxx
@@ -24,7 +24,6 @@
#include <toolkit/awt/vclxwindows.hxx>
#include <toolkit/helper/listenermultiplexer.hxx>
-#include <com/sun/star/awt/XProgressBar.hpp>
#include <com/sun/star/awt/XTextArea.hpp>
#include <com/sun/star/awt/XTextComponent.hpp>
#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
@@ -289,47 +288,6 @@ public:
};
-// class VCLXProgressBar
-
-class VCLXProgressBar final : public css::awt::XProgressBar,
- public VCLXWindow
-{
-private:
- sal_Int32 m_nValue;
- sal_Int32 m_nValueMin;
- sal_Int32 m_nValueMax;
-
- void ImplUpdateValue();
-
-public:
- VCLXProgressBar();
- virtual ~VCLXProgressBar() override;
-
- // css::uno::XInterface
- css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- void SAL_CALL acquire() throw() override { VCLXWindow::acquire(); }
- void SAL_CALL release() throw() override { VCLXWindow::release(); }
-
- // css::lang::XTypeProvider
- css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
- css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
-
- // css::awt::XProgressBar
- void SAL_CALL setForegroundColor( sal_Int32 nColor ) override;
- void SAL_CALL setBackgroundColor( sal_Int32 nColor ) override;
- void SAL_CALL setValue( sal_Int32 nValue ) override;
- void SAL_CALL setRange( sal_Int32 nMin, sal_Int32 nMax ) override;
- sal_Int32 SAL_CALL getValue() override;
-
- // css::awt::VclWindowPeer
- void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
- css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
-
- static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
- virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
-};
-
-
// class SVTXDateField
class SVTXDateField : public VCLXDateField
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index 0a1344feac92..6814e69bd50b 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -19,7 +19,6 @@
#include <tools/debug.hxx>
-#include <vcl/prgsbar.hxx>
#include <vcl/svapp.hxx>
#include <svl/zforlist.hxx>
#include <svtools/svmedit.hxx>
@@ -112,19 +111,6 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const cs
*ppNewComp = newComp;
newComp->SetFormatter( static_cast<FormatterBase*>(static_cast<DateField*>(pWindow)) );
}
- else if ( aServiceName.equalsIgnoreAsciiCase( "ProgressBar" ) )
- {
- if ( pParent )
- {
- pWindow = VclPtr<ProgressBar>::Create( pParent, nWinBits );
- *ppNewComp = new VCLXProgressBar;
- }
- else
- {
- *ppNewComp = nullptr;
- return nullptr;
- }
- }
else if ( aServiceName.equalsIgnoreAsciiCase( "Tree" ) )
{
TreeControlPeer* pPeer = new TreeControlPeer;
@@ -1788,259 +1774,6 @@ void SVTXCurrencyField::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds )
}
-// class VCLXProgressBar
-
-
-VCLXProgressBar::VCLXProgressBar()
- :m_nValue(0)
- ,m_nValueMin(0)
- ,m_nValueMax(100)
-{
-}
-
-VCLXProgressBar::~VCLXProgressBar()
-{
-}
-
-void VCLXProgressBar::ImplUpdateValue()
-{
- VclPtr< ProgressBar > pProgressBar = GetAs< ProgressBar >();
- if ( !pProgressBar )
- return;
-
- sal_Int32 nVal;
- sal_Int32 nValMin;
- sal_Int32 nValMax;
-
- // check min and max
- if (m_nValueMin < m_nValueMax)
- {
- nValMin = m_nValueMin;
- nValMax = m_nValueMax;
- }
- else
- {
- nValMin = m_nValueMax;
- nValMax = m_nValueMin;
- }
-
- // check value
- if (m_nValue < nValMin)
- {
- nVal = nValMin;
- }
- else if (m_nValue > nValMax)
- {
- nVal = nValMax;
- }
- else
- {
- nVal = m_nValue;
- }
-
- // calculate percent
- sal_Int32 nPercent;
- if (nValMin != nValMax)
- {
- nPercent = 100 * (nVal - nValMin) / (nValMax - nValMin);
- }
- else
- {
- nPercent = 0;
- }
-
- // set progressbar value
- pProgressBar->SetValue( static_cast<sal_uInt16>(nPercent) );
-}
-
-// css::uno::XInterface
-css::uno::Any VCLXProgressBar::queryInterface( const css::uno::Type & rType )
-{
- css::uno::Any aRet = ::cppu::queryInterface( rType,
- static_cast< css::awt::XProgressBar* >(this),
- static_cast< css::lang::XTypeProvider* >(this) );
- return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
-}
-
-IMPL_IMPLEMENTATION_ID( VCLXProgressBar )
-
-// css::lang::XTypeProvider
-css::uno::Sequence< css::uno::Type > VCLXProgressBar::getTypes()
-{
- static const ::cppu::OTypeCollection aTypeList(
- cppu::UnoType<css::lang::XTypeProvider>::get(),
- cppu::UnoType<css::awt::XProgressBar>::get(),
- VCLXWindow::getTypes()
- );
- return aTypeList.getTypes();
-}
-
-// css::awt::XProgressBar
-void VCLXProgressBar::setForegroundColor( sal_Int32 nColor )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<vcl::Window> pWindow = GetWindow();
- if ( pWindow )
- {
- pWindow->SetControlForeground( Color(nColor) );
- }
-}
-
-void VCLXProgressBar::setBackgroundColor( sal_Int32 nColor )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<vcl::Window> pWindow = GetWindow();
- if ( pWindow )
- {
- Color aColor( nColor );
- pWindow->SetBackground( aColor );
- pWindow->SetControlBackground( aColor );
- pWindow->Invalidate();
- }
-}
-
-void VCLXProgressBar::setValue( sal_Int32 nValue )
-{
- SolarMutexGuard aGuard;
-
- m_nValue = nValue;
- ImplUpdateValue();
-}
-
-void VCLXProgressBar::setRange( sal_Int32 nMin, sal_Int32 nMax )
-{
- SolarMutexGuard aGuard;
-
- if ( nMin < nMax )
- {
- // take correct min and max
- m_nValueMin = nMin;
- m_nValueMax = nMax;
- }
- else
- {
- // change min and max
- m_nValueMin = nMax;
- m_nValueMax = nMin;
- }
-
- ImplUpdateValue();
-}
-
-sal_Int32 VCLXProgressBar::getValue()
-{
- SolarMutexGuard aGuard;
-
- return m_nValue;
-}
-
-// css::awt::VclWindowPeer
-void VCLXProgressBar::setProperty( const OUString& PropertyName, const css::uno::Any& Value)
-{
- SolarMutexGuard aGuard;
-
- VclPtr< ProgressBar > pProgressBar = GetAs< ProgressBar >();
- if ( !pProgressBar )
- return;
-
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
- {
- case BASEPROPERTY_PROGRESSVALUE:
- {
- if ( Value >>= m_nValue )
- ImplUpdateValue();
- }
- break;
- case BASEPROPERTY_PROGRESSVALUE_MIN:
- {
- if ( Value >>= m_nValueMin )
- ImplUpdateValue();
- }
- break;
- case BASEPROPERTY_PROGRESSVALUE_MAX:
- {
- if ( Value >>= m_nValueMax )
- ImplUpdateValue();
- }
- break;
- case BASEPROPERTY_FILLCOLOR:
- {
- VclPtr<vcl::Window> pWindow = GetWindow();
- if ( pWindow )
- {
- bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
-
- if ( bVoid )
- {
- pWindow->SetControlForeground();
- }
- else
- {
- sal_Int32 nColor = 0;
- if ( Value >>= nColor )
- {
- Color aColor( nColor );
- pWindow->SetControlForeground( aColor );
- }
- }
- }
- }
- break;
- default:
- VCLXWindow::setProperty( PropertyName, Value );
- break;
- }
-}
-
-css::uno::Any VCLXProgressBar::getProperty( const OUString& PropertyName )
-{
- SolarMutexGuard aGuard;
-
- css::uno::Any aProp;
- VclPtr< ProgressBar > pProgressBar = GetAs< ProgressBar >();
- if ( pProgressBar )
- {
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch ( nPropType )
- {
- case BASEPROPERTY_PROGRESSVALUE:
- {
- aProp <<= m_nValue;
- }
- break;
- case BASEPROPERTY_PROGRESSVALUE_MIN:
- {
- aProp <<= m_nValueMin;
- }
- break;
- case BASEPROPERTY_PROGRESSVALUE_MAX:
- {
- aProp <<= m_nValueMax;
- }
- break;
- default:
- aProp = VCLXWindow::getProperty( PropertyName );
- break;
- }
- }
- return aProp;
-}
-
-void VCLXProgressBar::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds )
-{
- PushPropertyIds( rIds,
- BASEPROPERTY_PROGRESSVALUE,
- BASEPROPERTY_PROGRESSVALUE_MIN,
- BASEPROPERTY_PROGRESSVALUE_MAX,
- BASEPROPERTY_FILLCOLOR,
- 0);
- VCLXWindow::ImplGetPropertyIds( rIds, true );
-}
-
-
// class SVTXDateField
SVTXDateField::SVTXDateField()
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 2c3a6d81e1e3..a32c26cc5765 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -90,6 +90,7 @@
#include <vcl/fixed.hxx>
#include <vcl/toolkit/fixedhyper.hxx>
#include <vcl/floatwin.hxx>
+#include <vcl/prgsbar.hxx>
#include <vcl/scheduler.hxx>
#include <vcl/longcurr.hxx>
#include <vcl/lstbox.hxx>
@@ -1796,6 +1797,11 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
pNewWindow = VclPtr<FixedHyperlink>::Create( pParent, nWinBits );
*ppNewComp = new VCLXFixedHyperlink;
}
+ else if (aServiceName == "ProgressBar")
+ {
+ pNewWindow = VclPtr<ProgressBar>::Create( pParent, nWinBits );
+ *ppNewComp = new VCLXProgressBar;
+ }
break;
default:
OSL_ENSURE( false, "VCLXToolkit::ImplCreateWindow: unknown window type!" );
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 65e24830862d..69f391824723 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -49,6 +49,7 @@
#include <vcl/longcurr.hxx>
#include <vcl/toolkit/imgctrl.hxx>
#include <vcl/dialog.hxx>
+#include <vcl/prgsbar.hxx>
#include <vcl/scrbar.hxx>
#include <vcl/svapp.hxx>
#include <vcl/tabpage.hxx>
@@ -6646,4 +6647,254 @@ void VCLXFrame::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
VCLXContainer::ProcessWindowEvent( rVclWindowEvent );
}
+// class VCLXProgressBar
+VCLXProgressBar::VCLXProgressBar()
+ :m_nValue(0)
+ ,m_nValueMin(0)
+ ,m_nValueMax(100)
+{
+}
+
+VCLXProgressBar::~VCLXProgressBar()
+{
+}
+
+void VCLXProgressBar::ImplUpdateValue()
+{
+ VclPtr< ProgressBar > pProgressBar = GetAs< ProgressBar >();
+ if ( !pProgressBar )
+ return;
+
+ sal_Int32 nVal;
+ sal_Int32 nValMin;
+ sal_Int32 nValMax;
+
+ // check min and max
+ if (m_nValueMin < m_nValueMax)
+ {
+ nValMin = m_nValueMin;
+ nValMax = m_nValueMax;
+ }
+ else
+ {
+ nValMin = m_nValueMax;
+ nValMax = m_nValueMin;
+ }
+
+ // check value
+ if (m_nValue < nValMin)
+ {
+ nVal = nValMin;
+ }
+ else if (m_nValue > nValMax)
+ {
+ nVal = nValMax;
+ }
+ else
+ {
+ nVal = m_nValue;
+ }
+
+ // calculate percent
+ sal_Int32 nPercent;
+ if (nValMin != nValMax)
+ {
+ nPercent = 100 * (nVal - nValMin) / (nValMax - nValMin);
+ }
+ else
+ {
+ nPercent = 0;
+ }
+
+ // set progressbar value
+ pProgressBar->SetValue( static_cast<sal_uInt16>(nPercent) );
+}
+
+// css::uno::XInterface
+css::uno::Any VCLXProgressBar::queryInterface( const css::uno::Type & rType )
+{
+ css::uno::Any aRet = ::cppu::queryInterface( rType,
+ static_cast< css::awt::XProgressBar* >(this),
+ static_cast< css::lang::XTypeProvider* >(this) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+IMPL_IMPLEMENTATION_ID( VCLXProgressBar )
+
+// css::lang::XTypeProvider
+css::uno::Sequence< css::uno::Type > VCLXProgressBar::getTypes()
+{
+ static const ::cppu::OTypeCollection aTypeList(
+ cppu::UnoType<css::lang::XTypeProvider>::get(),
+ cppu::UnoType<css::awt::XProgressBar>::get(),
+ VCLXWindow::getTypes()
+ );
+ return aTypeList.getTypes();
+}
+
+// css::awt::XProgressBar
+void VCLXProgressBar::setForegroundColor( sal_Int32 nColor )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<vcl::Window> pWindow = GetWindow();
+ if ( pWindow )
+ {
+ pWindow->SetControlForeground( Color(nColor) );
+ }
+}
+
+void VCLXProgressBar::setBackgroundColor( sal_Int32 nColor )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<vcl::Window> pWindow = GetWindow();
+ if ( pWindow )
+ {
+ Color aColor( nColor );
+ pWindow->SetBackground( aColor );
+ pWindow->SetControlBackground( aColor );
+ pWindow->Invalidate();
+ }
+}
+
+void VCLXProgressBar::setValue( sal_Int32 nValue )
+{
+ SolarMutexGuard aGuard;
+
+ m_nValue = nValue;
+ ImplUpdateValue();
+}
+
+void VCLXProgressBar::setRange( sal_Int32 nMin, sal_Int32 nMax )
+{
+ SolarMutexGuard aGuard;
+
+ if ( nMin < nMax )
+ {
+ // take correct min and max
+ m_nValueMin = nMin;
+ m_nValueMax = nMax;
+ }
+ else
+ {
+ // change min and max
+ m_nValueMin = nMax;
+ m_nValueMax = nMin;
+ }
+
+ ImplUpdateValue();
+}
+
+sal_Int32 VCLXProgressBar::getValue()
+{
+ SolarMutexGuard aGuard;
+
+ return m_nValue;
+}
+
+// css::awt::VclWindowPeer
+void VCLXProgressBar::setProperty( const OUString& PropertyName, const css::uno::Any& Value)
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr< ProgressBar > pProgressBar = GetAs< ProgressBar >();
+ if ( !pProgressBar )
+ return;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_PROGRESSVALUE:
+ {
+ if ( Value >>= m_nValue )
+ ImplUpdateValue();
+ }
+ break;
+ case BASEPROPERTY_PROGRESSVALUE_MIN:
+ {
+ if ( Value >>= m_nValueMin )
+ ImplUpdateValue();
+ }
+ break;
+ case BASEPROPERTY_PROGRESSVALUE_MAX:
+ {
+ if ( Value >>= m_nValueMax )
+ ImplUpdateValue();
+ }
+ break;
+ case BASEPROPERTY_FILLCOLOR:
+ {
+ VclPtr<vcl::Window> pWindow = GetWindow();
+ if ( pWindow )
+ {
+ bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
+
+ if ( bVoid )
+ {
+ pWindow->SetControlForeground();
+ }
+ else
+ {
+ sal_Int32 nColor = 0;
+ if ( Value >>= nColor )
+ {
+ Color aColor( nColor );
+ pWindow->SetControlForeground( aColor );
+ }
+ }
+ }
+ }
+ break;
+ default:
+ VCLXWindow::setProperty( PropertyName, Value );
+ break;
+ }
+}
+
+css::uno::Any VCLXProgressBar::getProperty( const OUString& PropertyName )
+{
+ SolarMutexGuard aGuard;
+
+ css::uno::Any aProp;
+ VclPtr< ProgressBar > pProgressBar = GetAs< ProgressBar >();
+ if ( pProgressBar )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_PROGRESSVALUE:
+ {
+ aProp <<= m_nValue;
+ }
+ break;
+ case BASEPROPERTY_PROGRESSVALUE_MIN:
+ {
+ aProp <<= m_nValueMin;
+ }
+ break;
+ case BASEPROPERTY_PROGRESSVALUE_MAX:
+ {
+ aProp <<= m_nValueMax;
+ }
+ break;
+ default:
+ aProp = VCLXWindow::getProperty( PropertyName );
+ break;
+ }
+ }
+ return aProp;
+}
+
+void VCLXProgressBar::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_PROGRESSVALUE,
+ BASEPROPERTY_PROGRESSVALUE_MIN,
+ BASEPROPERTY_PROGRESSVALUE_MAX,
+ BASEPROPERTY_FILLCOLOR,
+ 0);
+ VCLXWindow::ImplGetPropertyIds( rIds, true );
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */