diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-07-15 11:54:52 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-07-15 15:02:27 +0200 |
commit | c8fed68b953e5c1b3101758413fac4809ff3380e (patch) | |
tree | c288041f51e02ed9f2d03255a2dc9e7c3a14c871 /toolkit | |
parent | db9d871b2dc89ac1a09e17ec08a1570dae546025 (diff) |
move SVTXDateField to toolkit
and svtools CalendarField to vcl
Change-Id: I6f3e9a71f21ac7ca70f8172d4f8be4804f3b1c7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98818
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/awt/vclxtoolkit.cxx | 11 | ||||
-rw-r--r-- | toolkit/source/awt/vclxwindows.cxx | 42 |
2 files changed, 53 insertions, 0 deletions
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 3671963c4234..eb5273cde27d 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -81,6 +81,7 @@ #include <controls/filectrl.hxx> #include <controls/treecontrolpeer.hxx> #include <vcl/toolkit/button.hxx> +#include <vcl/calendar.hxx> #include <vcl/toolkit/combobox.hxx> #include <vcl/ctrl.hxx> #include <vcl/toolkit/dialog.hxx> @@ -1815,6 +1816,16 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp, pNewWindow = VclPtr<DoubleCurrencyField>::Create( pParent, nWinBits ); *ppNewComp = new SVTXCurrencyField; } + else if (aServiceName == "datefield") + { + pNewWindow = VclPtr<CalendarField>::Create(pParent, nWinBits); + static_cast<CalendarField*>(pNewWindow.get())->EnableToday(); + static_cast<CalendarField*>(pNewWindow.get())->EnableNone(); + static_cast<CalendarField*>(pNewWindow.get())->EnableEmptyFieldValue( true ); + SVTXDateField * newComp = new SVTXDateField; + *ppNewComp = newComp; + newComp->SetFormatter( static_cast<FormatterBase*>(static_cast<DateField*>(pNewWindow.get())) ); + } 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 964cdf0dd3a3..396fa5dade35 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -8153,4 +8153,46 @@ void SVTXNumericField::GetPropertyIds( std::vector< sal_uInt16 > &rIds ) SVTXFormattedField::ImplGetPropertyIds( rIds ); } +SVTXDateField::SVTXDateField() + :VCLXDateField() +{ +} + +SVTXDateField::~SVTXDateField() +{ +} + +void SAL_CALL SVTXDateField::setProperty( const OUString& PropertyName, const css::uno::Any& Value ) +{ + VCLXDateField::setProperty( PropertyName, Value ); + + // some properties need to be forwarded to the sub edit, too + SolarMutexGuard g; + VclPtr< Edit > pSubEdit = GetWindow() ? static_cast< Edit* >( GetWindow().get() )->GetSubEdit() : nullptr; + if ( !pSubEdit ) + return; + + switch ( GetPropertyId( PropertyName ) ) + { + case BASEPROPERTY_TEXTLINECOLOR: + if ( !Value.hasValue() ) + pSubEdit->SetTextLineColor(); + else + { + sal_Int32 nColor = 0; + if ( Value >>= nColor ) + pSubEdit->SetTextLineColor( Color( nColor ) ); + } + break; + } +} + +void SVTXDateField::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds ) +{ + PushPropertyIds( rIds, + BASEPROPERTY_TEXTLINECOLOR, + 0); + VCLXDateField::ImplGetPropertyIds( rIds ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |