diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-08-30 20:15:17 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-08-31 13:12:35 +0200 |
commit | d688a8a5a59f9a152229f005964697218b31c621 (patch) | |
tree | 6a3ed37bc81f51e917491b11db8d71e272d7cf8e /svtools | |
parent | 58bed4f3c03098e72cd05cd298136a7029c05a6d (diff) |
move SVTXRoadmap to toolkit
Change-Id: If1ef35fe778b67ab028fdadb3804f437e127aa67
Reviewed-on: https://gerrit.libreoffice.org/78322
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.hxx | 63 | ||||
-rw-r--r-- | svtools/source/uno/unoiface.cxx | 257 |
2 files changed, 0 insertions, 320 deletions
diff --git a/svtools/source/inc/unoiface.hxx b/svtools/source/inc/unoiface.hxx index 1cccc09369cc..41d47405fb4e 100644 --- a/svtools/source/inc/unoiface.hxx +++ b/svtools/source/inc/unoiface.hxx @@ -30,7 +30,6 @@ #include <com/sun/star/awt/XTextArea.hpp> #include <com/sun/star/awt/XTextComponent.hpp> #include <com/sun/star/awt/XTextLayoutConstrains.hpp> -#include <com/sun/star/beans/XPropertyChangeListener.hpp> #include <tools/lineend.hxx> #include <vcl/fmtfield.hxx> @@ -212,68 +211,6 @@ protected: }; -// class SVTXRoadmap - - -namespace vcl -{ - class ORoadmap; -} - -struct RMItemData -{ - bool b_Enabled; - sal_Int32 n_ID; - OUString Label; -}; - -typedef ::cppu::ImplInheritanceHelper < VCLXGraphicControl - , css::container::XContainerListener - , css::beans::XPropertyChangeListener - , css::awt::XItemEventBroadcaster - > SVTXRoadmap_Base; -class SVTXRoadmap final : public SVTXRoadmap_Base -{ -public: - SVTXRoadmap(); - - void SAL_CALL disposing( const css::lang::EventObject& Source ) override { VCLXWindow::disposing( Source ); } - - // css::awt::XVclWindowPeer - void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; - - css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; - - // XContainerListener - void SAL_CALL elementInserted( const css::container::ContainerEvent& rEvent ) override; - void SAL_CALL elementRemoved( const css::container::ContainerEvent& rEvent ) override; - void SAL_CALL elementReplaced( const css::container::ContainerEvent& rEvent ) override; - - // XItemEventBroadcaster - virtual void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; - virtual void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; - - // XPropertyChangeListener - virtual void SAL_CALL propertyChange( const css::beans::PropertyChangeEvent& evt ) override; - -private: - - // VCLXGraphicControl overridables - virtual void ImplSetNewImage() override; - - static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); - virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } - - static RMItemData GetRMItemData( const css::container::ContainerEvent& _rEvent ); - - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; - - virtual ~SVTXRoadmap() override; - - ItemListenerMultiplexer maItemListeners; -}; - - // class SVTXNumericField class SVTXNumericField : public css::awt::XNumericField, public SVTXFormattedField diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index 39b95fbee5b0..5d45cb8362e9 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -26,7 +26,6 @@ #include <svtools/svmedit.hxx> #include <unoiface.hxx> #include <svtools/filectrl.hxx> -#include <vcl/roadmap.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/awt/LineEndFormat.hpp> @@ -116,11 +115,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("roadmap") ) - { - pWindow = VclPtr< ::vcl::ORoadmap>::Create( pParent, WB_TABSTOP ); - *ppNewComp = new SVTXRoadmap; - } else if ( aServiceName.equalsIgnoreAsciiCase( "ProgressBar" ) ) { if ( pParent ) @@ -1397,257 +1391,6 @@ void SVTXFormattedField::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds ) } -// class SVTXRoadmap - -using namespace svt; - -SVTXRoadmap::SVTXRoadmap() : maItemListeners( *this ) -{ -} - -SVTXRoadmap::~SVTXRoadmap() -{ -} - -void SVTXRoadmap::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) -{ - switch ( rVclWindowEvent.GetId() ) - { - case VclEventId::RoadmapItemSelected: - { - SolarMutexGuard aGuard; - VclPtr<::vcl::ORoadmap> pField = GetAs< vcl::ORoadmap >(); - if ( pField ) - { - sal_Int16 CurItemID = pField->GetCurrentRoadmapItemID(); - css::awt::ItemEvent aEvent; - aEvent.Selected = CurItemID; - aEvent.Highlighted = CurItemID; - aEvent.ItemId = CurItemID; - maItemListeners.itemStateChanged( aEvent ); - } - } - break; - default: - SVTXRoadmap_Base::ProcessWindowEvent( rVclWindowEvent ); - break; - } -} - - -void SVTXRoadmap::propertyChange( const css::beans::PropertyChangeEvent& evt ) -{ - SolarMutexGuard aGuard; - VclPtr<::vcl::ORoadmap> pField = GetAs< vcl::ORoadmap >(); - if ( !pField ) - return; - - css::uno::Reference< css::uno::XInterface > xRoadmapItem = evt.Source; - sal_Int32 nID = 0; - css::uno::Reference< css::beans::XPropertySet > xPropertySet( xRoadmapItem, css::uno::UNO_QUERY ); - css::uno::Any aValue = xPropertySet->getPropertyValue("ID"); - aValue >>= nID; - - OUString sPropertyName = evt.PropertyName; - if ( sPropertyName == "Enabled" ) - { - bool bEnable = false; - evt.NewValue >>= bEnable; - pField->EnableRoadmapItem( static_cast<vcl::RoadmapTypes::ItemId>(nID) , bEnable ); - } - else if ( sPropertyName == "Label" ) - { - OUString sLabel; - evt.NewValue >>= sLabel; - pField->ChangeRoadmapItemLabel( static_cast<vcl::RoadmapTypes::ItemId>(nID) , sLabel ); - } - else if ( sPropertyName == "ID" ) - { - sal_Int32 nNewID = 0; - evt.NewValue >>= nNewID; - evt.OldValue >>= nID; - pField->ChangeRoadmapItemID( static_cast<vcl::RoadmapTypes::ItemId>(nID), static_cast<vcl::RoadmapTypes::ItemId>(nNewID) ); - } -// else - // TODO handle Interactive appropriately -} - - -void SVTXRoadmap::addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) -{ - maItemListeners.addInterface( l ); -} - -void SVTXRoadmap::removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) -{ - maItemListeners.removeInterface( l ); -} - -RMItemData SVTXRoadmap::GetRMItemData( const css::container::ContainerEvent& _rEvent ) -{ - RMItemData aCurRMItemData; - css::uno::Reference< css::uno::XInterface > xRoadmapItem; - _rEvent.Element >>= xRoadmapItem; - css::uno::Reference< css::beans::XPropertySet > xPropertySet( xRoadmapItem, css::uno::UNO_QUERY ); - if ( xPropertySet.is() ) - { - css::uno::Any aValue = xPropertySet->getPropertyValue("Label"); - aValue >>= aCurRMItemData.Label; - aValue = xPropertySet->getPropertyValue("ID"); - aValue >>= aCurRMItemData.n_ID; - aValue = xPropertySet->getPropertyValue("Enabled"); - aValue >>= aCurRMItemData.b_Enabled; - } - else - { - aCurRMItemData.b_Enabled = false; - aCurRMItemData.n_ID = 0; - } - return aCurRMItemData; -} - -void SVTXRoadmap::elementInserted( const css::container::ContainerEvent& _rEvent ) -{ - SolarMutexGuard aGuard; - VclPtr<::vcl::ORoadmap> pField = GetAs< vcl::ORoadmap >(); - if ( pField ) - { - RMItemData CurItemData = GetRMItemData( _rEvent ); - sal_Int32 InsertIndex = 0; - _rEvent.Accessor >>= InsertIndex; - pField->InsertRoadmapItem( InsertIndex, CurItemData.Label, static_cast<vcl::RoadmapTypes::ItemId>(CurItemData.n_ID), CurItemData.b_Enabled ); - } -} - -void SVTXRoadmap::elementRemoved( const css::container::ContainerEvent& _rEvent ) -{ - SolarMutexGuard aGuard; - VclPtr<::vcl::ORoadmap> pField = GetAs< vcl::ORoadmap >(); - if ( pField ) - { - sal_Int32 DelIndex = 0; - _rEvent.Accessor >>= DelIndex; - pField->DeleteRoadmapItem(DelIndex); - } -} - -void SVTXRoadmap::elementReplaced( const css::container::ContainerEvent& _rEvent ) -{ - SolarMutexGuard aGuard; - VclPtr<::vcl::ORoadmap> pField = GetAs< vcl::ORoadmap >(); - if ( pField ) - { - RMItemData CurItemData = GetRMItemData( _rEvent ); - sal_Int32 ReplaceIndex = 0; - _rEvent.Accessor >>= ReplaceIndex; - pField->ReplaceRoadmapItem( ReplaceIndex, CurItemData.Label, static_cast<vcl::RoadmapTypes::ItemId>(CurItemData.n_ID), CurItemData.b_Enabled ); - } -} - - -void SVTXRoadmap::setProperty( const OUString& PropertyName, const css::uno::Any& Value) -{ - SolarMutexGuard aGuard; - - VclPtr<::vcl::ORoadmap> pField = GetAs< vcl::ORoadmap >(); - if ( pField ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch (nPropType) - { - case BASEPROPERTY_COMPLETE: - { - bool b = false; - Value >>= b; - pField->SetRoadmapComplete( b); - } - break; - - case BASEPROPERTY_ACTIVATED: - { - bool b = false; - Value >>= b; - pField->SetRoadmapInteractive( b); - } - break; - - case BASEPROPERTY_CURRENTITEMID: - { - sal_Int32 nId = 0; - Value >>= nId; - pField->SelectRoadmapItemByID( static_cast<vcl::RoadmapTypes::ItemId>(nId) ); - } - break; - - case BASEPROPERTY_TEXT: - { - OUString aStr; - Value >>= aStr; - pField->SetText( aStr ); - pField->Invalidate(); - } - break; - - default: - SVTXRoadmap_Base::setProperty( PropertyName, Value ); - break; - } - - } - else - SVTXRoadmap_Base::setProperty( PropertyName, Value ); -} - - -css::uno::Any SVTXRoadmap::getProperty( const OUString& PropertyName ) -{ - SolarMutexGuard aGuard; - - css::uno::Any aReturn; - - VclPtr<::vcl::ORoadmap> pField = GetAs< vcl::ORoadmap >(); - if ( pField ) - { - sal_uInt16 nPropType = GetPropertyId( PropertyName ); - switch (nPropType) - { - case BASEPROPERTY_COMPLETE: - aReturn <<= pField->IsRoadmapComplete(); - break; - case BASEPROPERTY_ACTIVATED: - aReturn <<= pField->IsRoadmapInteractive(); - break; - case BASEPROPERTY_CURRENTITEMID: - aReturn <<= pField->GetCurrentRoadmapItemID(); - break; - default: - aReturn = SVTXRoadmap_Base::getProperty(PropertyName); - break; - } - } - return aReturn; -} - -void SVTXRoadmap::ImplSetNewImage() -{ - OSL_PRECOND( GetWindow(), "SVTXRoadmap::ImplSetNewImage: window is required to be not-NULL!" ); - VclPtr< ::vcl::ORoadmap > pButton = GetAs< ::vcl::ORoadmap >(); - pButton->SetRoadmapBitmap( GetImage().GetBitmapEx() ); -} - -void SVTXRoadmap::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_COMPLETE, - BASEPROPERTY_ACTIVATED, - BASEPROPERTY_CURRENTITEMID, - BASEPROPERTY_TEXT, - 0); - VCLXWindow::ImplGetPropertyIds( rIds, true ); - VCLXGraphicControl::ImplGetPropertyIds( rIds ); -} - - // class SVTXNumericField SVTXNumericField::SVTXNumericField() |