summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-11-04 12:04:59 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-11-04 16:13:56 +0100
commitfe2c63e494ea66042406ad71234ebe076dec07dc (patch)
tree9587506e667c9cac621fd8c98267b74b571d73b9 /svtools
parent060a96e765dce66c7b1d2c77888ce212a944acf6 (diff)
move VCLXProgressBar to toolkit
Change-Id: I3aa21aff97346a9a43ad7b25621e8a8733fc4041 Reviewed-on: https://gerrit.libreoffice.org/82004 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/inc/unoiface.hxx42
-rw-r--r--svtools/source/uno/unoiface.cxx267
2 files changed, 0 insertions, 309 deletions
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()