summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-02-17 15:07:34 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-02-18 09:54:06 +0100
commit2c484d1f383970672f3062d84201109a064c5a36 (patch)
treeb27cb7370f96072d1dcc80965e4e63d222c625e4
parentmove NumericBox to vcl/toolkit (diff)
downloadcore-2c484d1f383970672f3062d84201109a064c5a36.tar.gz
core-2c484d1f383970672f3062d84201109a064c5a36.zip
move SVTXFormattedField, SVTXCurrencyField, SVTXNumericField to toolkit
Change-Id: If22200a4f342d4d779c612dbace61a4cf99471ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88866 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/toolkit/awt/vclxwindows.hxx125
-rw-r--r--svtools/inc/pch/precompiled_svt.hxx3
-rw-r--r--svtools/source/inc/unoiface.hxx128
-rw-r--r--svtools/source/uno/unoiface.cxx1003
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx37
-rw-r--r--toolkit/source/awt/vclxwindows.cxx987
6 files changed, 1135 insertions, 1148 deletions
diff --git a/include/toolkit/awt/vclxwindows.hxx b/include/toolkit/awt/vclxwindows.hxx
index e470b5e3a46e..dd03843c4908 100644
--- a/include/toolkit/awt/vclxwindows.hxx
+++ b/include/toolkit/awt/vclxwindows.hxx
@@ -51,10 +51,13 @@
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/weak.hxx>
+#include <svl/numuno.hxx>
+
#include <toolkit/awt/vclxwindow.hxx>
#include <toolkit/awt/vclxtopwindow.hxx>
#include <toolkit/helper/listenermultiplexer.hxx>
+#include <vcl/fmtfield.hxx>
#include <vcl/image.hxx>
class FormatterBase;
@@ -1276,6 +1279,128 @@ public:
virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
};
+class SVTXFormattedField : public VCLXSpinField
+{
+protected:
+ rtl::Reference<SvNumberFormatsSupplierObj> m_xCurrentSupplier;
+ bool bIsStandardSupplier;
+
+ sal_Int32 nKeyToSetDelayed;
+
+public:
+ SVTXFormattedField();
+ virtual ~SVTXFormattedField() override;
+
+ // 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;
+
+protected:
+ void setFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier > & xSupplier);
+ sal_Int32 getFormatKey() const;
+ void setFormatKey(sal_Int32 nKey);
+
+ void SetValue(const css::uno::Any& rValue);
+ css::uno::Any GetValue() const;
+
+ void SetTreatAsNumber(bool bSet);
+ bool GetTreatAsNumber() const;
+
+ void SetDefaultValue(const css::uno::Any& rValue);
+ css::uno::Any GetDefaultValue() const;
+
+ void SetMinValue(const css::uno::Any& rValue);
+ css::uno::Any GetMinValue() const;
+
+ void SetMaxValue(const css::uno::Any& rValue);
+ css::uno::Any GetMaxValue() const;
+
+ void NotifyTextListeners();
+ css::uno::Any convertEffectiveValue(const css::uno::Any& rValue);
+
+ virtual void SetWindow( const VclPtr< vcl::Window > &_pWindow) override;
+
+ static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
+};
+
+class SVTXCurrencyField : public css::awt::XCurrencyField, public SVTXFormattedField
+{
+public:
+ SVTXCurrencyField();
+ virtual ~SVTXCurrencyField() override;
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() throw() override { SVTXFormattedField::acquire(); }
+ void SAL_CALL release() throw() override { SVTXFormattedField::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::XVclWindowPeer
+ void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
+ css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
+
+ // css::awt::XCurrencyField
+ void SAL_CALL setValue( double Value ) override;
+ double SAL_CALL getValue( ) override;
+ void SAL_CALL setMin( double Value ) override;
+ double SAL_CALL getMin( ) override;
+ void SAL_CALL setMax( double Value ) override;
+ double SAL_CALL getMax( ) override;
+ void SAL_CALL setFirst( double Value ) override;
+ double SAL_CALL getFirst( ) override;
+ void SAL_CALL setLast( double Value ) override;
+ double SAL_CALL getLast( ) override;
+ void SAL_CALL setSpinSize( double Value ) override;
+ double SAL_CALL getSpinSize( ) override;
+ void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) override;
+ sal_Int16 SAL_CALL getDecimalDigits( ) override;
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) override;
+ sal_Bool SAL_CALL isStrictFormat( ) override;
+
+ static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
+};
+
+class SVTXNumericField : public css::awt::XNumericField, public SVTXFormattedField
+{
+public:
+ SVTXNumericField();
+ virtual ~SVTXNumericField() override;
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
+ void SAL_CALL acquire() throw() override { SVTXFormattedField::acquire(); }
+ void SAL_CALL release() throw() override { SVTXFormattedField::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::XNumericField
+ void SAL_CALL setValue( double Value ) override;
+ double SAL_CALL getValue( ) override;
+ void SAL_CALL setMin( double Value ) override;
+ double SAL_CALL getMin( ) override;
+ void SAL_CALL setMax( double Value ) override;
+ double SAL_CALL getMax( ) override;
+ void SAL_CALL setFirst( double Value ) override;
+ double SAL_CALL getFirst( ) override;
+ void SAL_CALL setLast( double Value ) override;
+ double SAL_CALL getLast( ) override;
+ void SAL_CALL setSpinSize( double Value ) override;
+ double SAL_CALL getSpinSize( ) override;
+ void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) override;
+ sal_Int16 SAL_CALL getDecimalDigits( ) override;
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) override;
+ sal_Bool SAL_CALL isStrictFormat( ) override;
+
+ virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override;
+};
+
#endif // INCLUDED_TOOLKIT_AWT_VCLXWINDOWS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/inc/pch/precompiled_svt.hxx b/svtools/inc/pch/precompiled_svt.hxx
index 9c26692d3ba7..c19910941278 100644
--- a/svtools/inc/pch/precompiled_svt.hxx
+++ b/svtools/inc/pch/precompiled_svt.hxx
@@ -13,7 +13,7 @@
manual changes will be rewritten by the next run of update_pch.sh (which presumably
also fixes all possible problems, so it's usually better to use it).
- Generated on 2020-02-17 12:25:57 using:
+ Generated on 2020-02-17 15:12:29 using:
./bin/update_pch svtools svt --cutoff=4 --exclude:system --include:module --exclude:local
If after updating build fails, use the following command to locate conflicting headers:
@@ -274,6 +274,7 @@
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/util/Time.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/view/PrintableState.hpp>
#include <com/sun/star/view/XSelectionChangeListener.hpp>
diff --git a/svtools/source/inc/unoiface.hxx b/svtools/source/inc/unoiface.hxx
index 7696d32fd5b9..069e62d0ccd8 100644
--- a/svtools/source/inc/unoiface.hxx
+++ b/svtools/source/inc/unoiface.hxx
@@ -98,134 +98,6 @@ public:
virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
};
-class SVTXFormattedField : public VCLXSpinField
-{
-protected:
- rtl::Reference<SvNumberFormatsSupplierObj> m_xCurrentSupplier;
- bool bIsStandardSupplier;
-
- sal_Int32 nKeyToSetDelayed;
-
-public:
- SVTXFormattedField();
- virtual ~SVTXFormattedField() override;
-
- // 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;
-
-protected:
- void setFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier > & xSupplier);
- sal_Int32 getFormatKey() const;
- void setFormatKey(sal_Int32 nKey);
-
- void SetValue(const css::uno::Any& rValue);
- css::uno::Any GetValue() const;
-
- void SetTreatAsNumber(bool bSet);
- bool GetTreatAsNumber() const;
-
- void SetDefaultValue(const css::uno::Any& rValue);
- css::uno::Any GetDefaultValue() const;
-
- void SetMinValue(const css::uno::Any& rValue);
- css::uno::Any GetMinValue() const;
-
- void SetMaxValue(const css::uno::Any& rValue);
- css::uno::Any GetMaxValue() const;
-
- void NotifyTextListeners();
- css::uno::Any convertEffectiveValue(const css::uno::Any& rValue);
-
- virtual void SetWindow( const VclPtr< vcl::Window > &_pWindow) override;
-
- static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
- virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
-};
-
-
-
-class SVTXNumericField : public css::awt::XNumericField, public SVTXFormattedField
-{
-public:
- SVTXNumericField();
- virtual ~SVTXNumericField() override;
-
- // css::uno::XInterface
- css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- void SAL_CALL acquire() throw() override { SVTXFormattedField::acquire(); }
- void SAL_CALL release() throw() override { SVTXFormattedField::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::XNumericField
- void SAL_CALL setValue( double Value ) override;
- double SAL_CALL getValue( ) override;
- void SAL_CALL setMin( double Value ) override;
- double SAL_CALL getMin( ) override;
- void SAL_CALL setMax( double Value ) override;
- double SAL_CALL getMax( ) override;
- void SAL_CALL setFirst( double Value ) override;
- double SAL_CALL getFirst( ) override;
- void SAL_CALL setLast( double Value ) override;
- double SAL_CALL getLast( ) override;
- void SAL_CALL setSpinSize( double Value ) override;
- double SAL_CALL getSpinSize( ) override;
- void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) override;
- sal_Int16 SAL_CALL getDecimalDigits( ) override;
- void SAL_CALL setStrictFormat( sal_Bool bStrict ) override;
- sal_Bool SAL_CALL isStrictFormat( ) override;
-
- virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override;
-};
-
-
-
-class SVTXCurrencyField : public css::awt::XCurrencyField, public SVTXFormattedField
-{
-public:
- SVTXCurrencyField();
- virtual ~SVTXCurrencyField() override;
-
- // css::uno::XInterface
- css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
- void SAL_CALL acquire() throw() override { SVTXFormattedField::acquire(); }
- void SAL_CALL release() throw() override { SVTXFormattedField::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::XVclWindowPeer
- void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
- css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
-
- // css::awt::XCurrencyField
- void SAL_CALL setValue( double Value ) override;
- double SAL_CALL getValue( ) override;
- void SAL_CALL setMin( double Value ) override;
- double SAL_CALL getMin( ) override;
- void SAL_CALL setMax( double Value ) override;
- double SAL_CALL getMax( ) override;
- void SAL_CALL setFirst( double Value ) override;
- double SAL_CALL getFirst( ) override;
- void SAL_CALL setLast( double Value ) override;
- double SAL_CALL getLast( ) override;
- void SAL_CALL setSpinSize( double Value ) override;
- double SAL_CALL getSpinSize( ) override;
- void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) override;
- sal_Int16 SAL_CALL getDecimalDigits( ) override;
- void SAL_CALL setStrictFormat( sal_Bool bStrict ) override;
- sal_Bool SAL_CALL isStrictFormat( ) override;
-
- static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds );
- virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); }
-};
-
-
-
class SVTXDateField : public VCLXDateField
{
public:
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index b7f80ff920f4..8dd0f390144e 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -28,7 +28,6 @@
#include <cppuhelper/typeprovider.hxx>
#include <toolkit/helper/convert.hxx>
#include <toolkit/helper/property.hxx>
-#include <vcl/fmtfield.hxx>
#include <svl/numuno.hxx>
#include <svtools/calendar.hxx>
#include "svtxgridcontrol.hxx"
@@ -71,21 +70,6 @@ SAL_DLLPUBLIC_EXPORT vcl::Window* CreateWindow( VCLXWindow** ppNewComp, const cs
return nullptr;
}
}
- else if (aServiceName.equalsIgnoreAsciiCase("FormattedField") )
- {
- pWindow = VclPtr<FormattedField>::Create( pParent, nWinBits );
- *ppNewComp = new SVTXFormattedField;
- }
- else if (aServiceName.equalsIgnoreAsciiCase("NumericField") )
- {
- pWindow = VclPtr<DoubleNumericField>::Create( pParent, nWinBits );
- *ppNewComp = new SVTXNumericField;
- }
- else if (aServiceName.equalsIgnoreAsciiCase("LongCurrencyField") )
- {
- pWindow = VclPtr<DoubleCurrencyField>::Create( pParent, nWinBits );
- *ppNewComp = new SVTXCurrencyField;
- }
else if (aServiceName.equalsIgnoreAsciiCase("datefield") )
{
pWindow = VclPtr<CalendarField>::Create( pParent, nWinBits);
@@ -483,993 +467,6 @@ void VCLXMultiLineEdit::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds )
VCLXWindow::ImplGetPropertyIds( rIds, true );
}
-SVTXFormattedField::SVTXFormattedField()
- :bIsStandardSupplier(true)
- ,nKeyToSetDelayed(-1)
-{
-}
-
-
-SVTXFormattedField::~SVTXFormattedField()
-{
-}
-
-
-void SVTXFormattedField::SetWindow( const VclPtr< vcl::Window > &_pWindow )
-{
- VCLXSpinField::SetWindow(_pWindow);
- if (GetAs< FormattedField >())
- GetAs< FormattedField >()->SetAutoColor(true);
-}
-
-
-void SVTXFormattedField::setProperty( const OUString& PropertyName, const css::uno::Any& Value)
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- {
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch (nPropType)
- {
- case BASEPROPERTY_ENFORCE_FORMAT:
- {
- bool bEnable( true );
- if ( Value >>= bEnable )
- pField->EnableNotANumber( !bEnable );
- }
- break;
-
- case BASEPROPERTY_EFFECTIVE_MIN:
- case BASEPROPERTY_VALUEMIN_DOUBLE:
- SetMinValue(Value);
- break;
-
- case BASEPROPERTY_EFFECTIVE_MAX:
- case BASEPROPERTY_VALUEMAX_DOUBLE:
- SetMaxValue(Value);
- break;
-
- case BASEPROPERTY_EFFECTIVE_DEFAULT:
- SetDefaultValue(Value);
- break;
-
- case BASEPROPERTY_TREATASNUMBER:
- {
- bool b;
- if ( Value >>= b )
- SetTreatAsNumber(b);
- }
- break;
-
- case BASEPROPERTY_FORMATSSUPPLIER:
- if (!Value.hasValue())
- setFormatsSupplier(css::uno::Reference< css::util::XNumberFormatsSupplier > (nullptr));
- else
- {
- css::uno::Reference< css::util::XNumberFormatsSupplier > xNFS;
- if ( Value >>= xNFS )
- setFormatsSupplier(xNFS);
- }
- break;
- case BASEPROPERTY_FORMATKEY:
- if (!Value.hasValue())
- setFormatKey(0);
- else
- {
- sal_Int32 n = 0;
- if ( Value >>= n )
- setFormatKey(n);
- }
- break;
-
- case BASEPROPERTY_EFFECTIVE_VALUE:
- case BASEPROPERTY_VALUE_DOUBLE:
- {
- const css::uno::TypeClass rTC = Value.getValueType().getTypeClass();
- if (rTC != css::uno::TypeClass_STRING)
- // no string
- if (rTC != css::uno::TypeClass_DOUBLE)
- // no double
- if (Value.hasValue())
- { // but a value
- // try if it is something convertible
- sal_Int32 nValue = 0;
- if (!(Value >>= nValue))
- throw css::lang::IllegalArgumentException();
- SetValue(css::uno::makeAny(static_cast<double>(nValue)));
- break;
- }
-
- SetValue(Value);
- }
- break;
- case BASEPROPERTY_VALUESTEP_DOUBLE:
- {
- double d = 0.0;
- if ( Value >>= d )
- pField->SetSpinSize( d );
- else
- {
- sal_Int32 n = 0;
- if ( Value >>= n )
- pField->SetSpinSize( n );
- }
- }
- break;
- case BASEPROPERTY_DECIMALACCURACY:
- {
- sal_Int32 n = 0;
- if ( Value >>= n )
- pField->SetDecimalDigits( static_cast<sal_uInt16>(n) );
- }
- break;
- case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
- {
- bool b;
- if ( Value >>= b )
- pField->SetThousandsSep( b );
- }
- break;
-
- default:
- VCLXSpinField::setProperty( PropertyName, Value );
- }
-
- if (BASEPROPERTY_TEXTCOLOR == nPropType)
- { // after setting a new text color, think again about the AutoColor flag of the control
- // 17.05.2001 - 86859 - frank.schoenheit@germany.sun.com
- pField->SetAutoColor(!Value.hasValue());
- }
- }
- else
- VCLXSpinField::setProperty( PropertyName, Value );
-}
-
-
-css::uno::Any SVTXFormattedField::getProperty( const OUString& PropertyName )
-{
- SolarMutexGuard aGuard;
-
- css::uno::Any aReturn;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- {
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch (nPropType)
- {
- case BASEPROPERTY_EFFECTIVE_MIN:
- case BASEPROPERTY_VALUEMIN_DOUBLE:
- aReturn = GetMinValue();
- break;
-
- case BASEPROPERTY_EFFECTIVE_MAX:
- case BASEPROPERTY_VALUEMAX_DOUBLE:
- aReturn = GetMaxValue();
- break;
-
- case BASEPROPERTY_EFFECTIVE_DEFAULT:
- aReturn = GetDefaultValue();
- break;
-
- case BASEPROPERTY_TREATASNUMBER:
- aReturn <<= GetTreatAsNumber();
- break;
-
- case BASEPROPERTY_EFFECTIVE_VALUE:
- case BASEPROPERTY_VALUE_DOUBLE:
- aReturn = GetValue();
- break;
-
- case BASEPROPERTY_VALUESTEP_DOUBLE:
- aReturn <<= pField->GetSpinSize();
- break;
-
- case BASEPROPERTY_DECIMALACCURACY:
- aReturn <<= pField->GetDecimalDigits();
- break;
-
- case BASEPROPERTY_FORMATSSUPPLIER:
- {
- if (!bIsStandardSupplier)
- { // ansonsten void
- css::uno::Reference< css::util::XNumberFormatsSupplier > xSupplier = m_xCurrentSupplier.get();
- aReturn <<= xSupplier;
- }
- }
- break;
-
- case BASEPROPERTY_FORMATKEY:
- {
- if (!bIsStandardSupplier)
- aReturn <<= getFormatKey();
- }
- break;
-
- default:
- aReturn = VCLXSpinField::getProperty(PropertyName);
- }
- }
- return aReturn;
-}
-
-css::uno::Any SVTXFormattedField::convertEffectiveValue(const css::uno::Any& rValue)
-{
- css::uno::Any aReturn;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if (!pField)
- return aReturn;
-
- switch (rValue.getValueType().getTypeClass())
- {
- case css::uno::TypeClass_DOUBLE:
- if (pField->TreatingAsNumber())
- {
- double d = 0.0;
- rValue >>= d;
- aReturn <<= d;
- }
- else
- {
- SvNumberFormatter* pFormatter = pField->GetFormatter();
- if (!pFormatter)
- pFormatter = pField->StandardFormatter();
- // should never fail
-
- Color* pDum;
- double d = 0.0;
- rValue >>= d;
- OUString sConverted;
- pFormatter->GetOutputString(d, 0, sConverted, &pDum);
- aReturn <<= sConverted;
- }
- break;
- case css::uno::TypeClass_STRING:
- {
- OUString aStr;
- rValue >>= aStr;
- if (pField->TreatingAsNumber())
- {
- SvNumberFormatter* pFormatter = pField->GetFormatter();
- if (!pFormatter)
- pFormatter = pField->StandardFormatter();
-
- double dVal;
- sal_uInt32 nTestFormat(0);
- if (!pFormatter->IsNumberFormat(aStr, nTestFormat, dVal))
- aReturn.clear();
- aReturn <<= dVal;
- }
- else
- aReturn <<= aStr;
- }
- break;
- default:
- aReturn.clear();
- break;
- }
- return aReturn;
-}
-
-
-void SVTXFormattedField::SetMinValue(const css::uno::Any& rValue)
-{
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if (!pField)
- return;
-
- switch (rValue.getValueType().getTypeClass())
-
- {
- case css::uno::TypeClass_DOUBLE:
- {
- double d = 0.0;
- rValue >>= d;
- pField->SetMinValue(d);
- }
- break;
- default:
- DBG_ASSERT(rValue.getValueType().getTypeClass() == css::uno::TypeClass_VOID, "SVTXFormattedField::SetMinValue : invalid argument (an exception will be thrown) !");
- if ( rValue.getValueType().getTypeClass() != css::uno::TypeClass_VOID )
-
- {
- throw css::lang::IllegalArgumentException();
- }
- pField->ClearMinValue();
- break;
- }
-}
-
-
-css::uno::Any SVTXFormattedField::GetMinValue() const
-{
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if (!pField || !pField->HasMinValue())
- return css::uno::Any();
-
- css::uno::Any aReturn;
- aReturn <<= pField->GetMinValue();
- return aReturn;
-}
-
-
-void SVTXFormattedField::SetMaxValue(const css::uno::Any& rValue)
-{
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if (!pField)
- return;
-
- switch (rValue.getValueType().getTypeClass())
-
- {
- case css::uno::TypeClass_DOUBLE:
- {
- double d = 0.0;
- rValue >>= d;
- pField->SetMaxValue(d);
- }
- break;
- default:
- if (rValue.getValueType().getTypeClass() != css::uno::TypeClass_VOID)
-
- {
- throw css::lang::IllegalArgumentException();
- }
- pField->ClearMaxValue();
- break;
- }
-}
-
-
-css::uno::Any SVTXFormattedField::GetMaxValue() const
-{
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if (!pField || !pField->HasMaxValue())
- return css::uno::Any();
-
- css::uno::Any aReturn;
- aReturn <<= pField->GetMaxValue();
- return aReturn;
-}
-
-
-void SVTXFormattedField::SetDefaultValue(const css::uno::Any& rValue)
-{
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if (!pField)
- return;
-
- css::uno::Any aConverted = convertEffectiveValue(rValue);
-
- switch (aConverted.getValueType().getTypeClass())
-
- {
- case css::uno::TypeClass_DOUBLE:
- {
- double d = 0.0;
- aConverted >>= d;
- pField->SetDefaultValue(d);
- }
- break;
- case css::uno::TypeClass_STRING:
- {
- OUString aStr;
- aConverted >>= aStr;
- pField->SetDefaultText( aStr );
- }
- break;
- default:
- pField->EnableEmptyField(true);
- // only void accepted
- break;
- }
-}
-
-
-css::uno::Any SVTXFormattedField::GetDefaultValue() const
-{
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if (!pField || pField->IsEmptyFieldEnabled())
- return css::uno::Any();
-
- css::uno::Any aReturn;
- if (pField->TreatingAsNumber())
- aReturn <<= pField->GetDefaultValue();
- else
- aReturn <<= pField->GetDefaultText();
- return aReturn;
-}
-
-
-bool SVTXFormattedField::GetTreatAsNumber() const
-{
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if (pField)
- return pField->TreatingAsNumber();
-
- return true;
-}
-
-
-void SVTXFormattedField::SetTreatAsNumber(bool bSet)
-{
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if (pField)
- pField->TreatAsNumber(bSet);
-}
-
-
-css::uno::Any SVTXFormattedField::GetValue() const
-{
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if (!pField)
- return css::uno::Any();
-
- css::uno::Any aReturn;
- if (!pField->TreatingAsNumber())
- {
- OUString sText = pField->GetTextValue();
- aReturn <<= sText;
- }
- else
- {
- if (!pField->GetText().isEmpty()) // empty is returned as void by default
- aReturn <<= pField->GetValue();
- }
-
- return aReturn;
-}
-
-
-void SVTXFormattedField::SetValue(const css::uno::Any& rValue)
-{
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if (!pField)
- return;
-
- if (!rValue.hasValue())
- {
- pField->SetText("");
- }
- else
- {
- if (rValue.getValueType().getTypeClass() == css::uno::TypeClass_DOUBLE )
- {
- double d = 0.0;
- rValue >>= d;
- pField->SetValue(d);
- }
- else
- {
- DBG_ASSERT(rValue.getValueType().getTypeClass() == css::uno::TypeClass_STRING, "SVTXFormattedField::SetValue : invalid argument !");
-
- OUString sText;
- rValue >>= sText;
- if (!pField->TreatingAsNumber())
- pField->SetTextFormatted(sText);
- else
- pField->SetTextValue(sText);
- }
- }
-// NotifyTextListeners();
-}
-
-
-void SVTXFormattedField::setFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier > & xSupplier)
-{
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
-
- SvNumberFormatsSupplierObj* pNew = nullptr;
- if (!xSupplier.is())
- {
- if (pField)
- {
- pNew = new SvNumberFormatsSupplierObj(pField->StandardFormatter());
- bIsStandardSupplier = true;
- }
- }
- else
- {
- pNew = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>(xSupplier);
- bIsStandardSupplier = false;
- }
-
- if (!pNew)
- return; // TODO : how to process ?
-
- m_xCurrentSupplier = pNew;
- if (!pField)
- return;
-
- // save the actual value
- css::uno::Any aCurrent = GetValue();
- pField->SetFormatter(m_xCurrentSupplier->GetNumberFormatter(), false);
- if (nKeyToSetDelayed != -1)
- {
- pField->SetFormatKey(nKeyToSetDelayed);
- nKeyToSetDelayed = -1;
- }
- SetValue(aCurrent);
- NotifyTextListeners();
-}
-
-
-sal_Int32 SVTXFormattedField::getFormatKey() const
-{
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField ? pField->GetFormatKey() : 0;
-}
-
-
-void SVTXFormattedField::setFormatKey(sal_Int32 nKey)
-{
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if (!pField)
- return;
-
- if (pField->GetFormatter())
- pField->SetFormatKey(nKey);
- else
- {
- // probably I am in a block, in which first the key and next the formatter will be set,
- // initially this happens quite certain, as the properties are set in alphabetic sequence,
- // and the FormatsSupplier is processed before the FormatKey
- nKeyToSetDelayed = nKey;
- }
- NotifyTextListeners();
-}
-
-
-void SVTXFormattedField::NotifyTextListeners()
-{
- if ( GetTextListeners().getLength() )
- {
- css::awt::TextEvent aEvent;
- aEvent.Source = static_cast<cppu::OWeakObject*>(this);
- GetTextListeners().textChanged( aEvent );
- }
-}
-
-void SVTXFormattedField::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds )
-{
- PushPropertyIds( rIds,
- // FIXME: elide duplication ?
- BASEPROPERTY_EFFECTIVE_MIN,
- BASEPROPERTY_VALUEMIN_DOUBLE,
- BASEPROPERTY_EFFECTIVE_MAX,
- BASEPROPERTY_VALUEMAX_DOUBLE,
- BASEPROPERTY_EFFECTIVE_DEFAULT,
- BASEPROPERTY_TREATASNUMBER,
- BASEPROPERTY_EFFECTIVE_VALUE,
- BASEPROPERTY_VALUE_DOUBLE,
- BASEPROPERTY_VALUESTEP_DOUBLE,
- BASEPROPERTY_DECIMALACCURACY,
- BASEPROPERTY_FORMATSSUPPLIER,
- BASEPROPERTY_NUMSHOWTHOUSANDSEP,
- BASEPROPERTY_FORMATKEY,
- BASEPROPERTY_TREATASNUMBER,
- BASEPROPERTY_ENFORCE_FORMAT,
- 0);
- VCLXWindow::ImplGetPropertyIds( rIds, true );
- VCLXSpinField::ImplGetPropertyIds( rIds );
-}
-
-
-
-SVTXNumericField::SVTXNumericField()
-{
-}
-
-SVTXNumericField::~SVTXNumericField()
-{
-}
-
-css::uno::Any SVTXNumericField::queryInterface( const css::uno::Type & rType )
-{
- css::uno::Any aRet = ::cppu::queryInterface( rType,
- static_cast< css::awt::XNumericField* >(this),
- static_cast< css::lang::XTypeProvider* >(this) );
- return (aRet.hasValue() ? aRet : SVTXFormattedField::queryInterface( rType ));
-}
-
-IMPL_IMPLEMENTATION_ID( SVTXNumericField )
-
-// css::lang::XTypeProvider
-css::uno::Sequence< css::uno::Type > SVTXNumericField::getTypes()
-{
- static const ::cppu::OTypeCollection aTypeList(
- cppu::UnoType<css::lang::XTypeProvider>::get(),
- cppu::UnoType<css::awt::XNumericField>::get(),
- SVTXFormattedField::getTypes()
- );
- return aTypeList.getTypes();
-}
-
-
-void SVTXNumericField::setValue( double Value )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- pField->SetValue( Value );
-}
-
-double SVTXNumericField::getValue()
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField ? pField->GetValue() : 0;
-}
-
-void SVTXNumericField::setMin( double Value )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- pField->SetMinValue( Value );
-}
-
-double SVTXNumericField::getMin()
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField ? pField->GetMinValue() : 0;
-}
-
-void SVTXNumericField::setMax( double Value )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- pField->SetMaxValue( Value );
-}
-
-double SVTXNumericField::getMax()
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField ? pField->GetMaxValue() : 0;
-}
-
-void SVTXNumericField::setFirst( double Value )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- pField->SetSpinFirst( Value );
-}
-
-double SVTXNumericField::getFirst()
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField ? pField->GetSpinFirst() : 0;
-}
-
-void SVTXNumericField::setLast( double Value )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- pField->SetSpinLast( Value );
-}
-
-double SVTXNumericField::getLast()
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField ? pField->GetSpinLast() : 0;
-}
-
-void SVTXNumericField::setSpinSize( double Value )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- pField->SetSpinSize( Value );
-}
-
-double SVTXNumericField::getSpinSize()
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField ? pField->GetSpinSize() : 0;
-}
-
-void SVTXNumericField::setDecimalDigits( sal_Int16 Value )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- pField->SetDecimalDigits( Value );
-}
-
-sal_Int16 SVTXNumericField::getDecimalDigits()
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField ? pField->GetDecimalDigits() : 0;
-}
-
-void SVTXNumericField::setStrictFormat( sal_Bool bStrict )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- pField->SetStrictFormat( bStrict );
-}
-
-sal_Bool SVTXNumericField::isStrictFormat()
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField && pField->IsStrictFormat();
-}
-
-void SVTXNumericField::GetPropertyIds( std::vector< sal_uInt16 > &rIds )
-{
- SVTXFormattedField::ImplGetPropertyIds( rIds );
-}
-
-
-
-SVTXCurrencyField::SVTXCurrencyField()
-{
-}
-
-SVTXCurrencyField::~SVTXCurrencyField()
-{
-}
-
-css::uno::Any SVTXCurrencyField::queryInterface( const css::uno::Type & rType )
-{
- css::uno::Any aRet = ::cppu::queryInterface( rType,
- static_cast< css::awt::XCurrencyField* >(this),
- static_cast< css::lang::XTypeProvider* >(this) );
- return (aRet.hasValue() ? aRet : SVTXFormattedField::queryInterface( rType ));
-}
-
-IMPL_IMPLEMENTATION_ID( SVTXCurrencyField )
-
-// css::lang::XTypeProvider
-css::uno::Sequence< css::uno::Type > SVTXCurrencyField::getTypes()
-{
- static const ::cppu::OTypeCollection aTypeList(
- cppu::UnoType<css::lang::XTypeProvider>::get(),
- cppu::UnoType<css::awt::XCurrencyField>::get(),
- SVTXFormattedField::getTypes()
- );
- return aTypeList.getTypes();
-}
-
-void SVTXCurrencyField::setValue( double Value )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- pField->SetValue( Value );
-}
-
-double SVTXCurrencyField::getValue()
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField ? pField->GetValue() : 0;
-}
-
-void SVTXCurrencyField::setMin( double Value )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- pField->SetMinValue( Value );
-}
-
-double SVTXCurrencyField::getMin()
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField ? pField->GetMinValue() : 0;
-}
-
-void SVTXCurrencyField::setMax( double Value )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- pField->SetMaxValue( Value );
-}
-
-double SVTXCurrencyField::getMax()
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField ? pField->GetMaxValue() : 0;
-}
-
-void SVTXCurrencyField::setFirst( double Value )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- pField->SetSpinFirst( Value );
-}
-
-double SVTXCurrencyField::getFirst()
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField ? pField->GetSpinFirst() : 0;
-}
-
-void SVTXCurrencyField::setLast( double Value )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- pField->SetSpinLast( Value );
-}
-
-double SVTXCurrencyField::getLast()
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField ? pField->GetSpinLast() : 0;
-}
-
-void SVTXCurrencyField::setSpinSize( double Value )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- pField->SetSpinSize( Value );
-}
-
-double SVTXCurrencyField::getSpinSize()
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField ? pField->GetSpinSize() : 0;
-}
-
-void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- pField->SetDecimalDigits( Value );
-}
-
-sal_Int16 SVTXCurrencyField::getDecimalDigits()
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField ? pField->GetDecimalDigits() : 0;
-}
-
-void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict )
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- if ( pField )
- pField->SetStrictFormat( bStrict );
-}
-
-sal_Bool SVTXCurrencyField::isStrictFormat()
-{
- SolarMutexGuard aGuard;
-
- VclPtr<FormattedField> pField = GetAs< FormattedField >();
- return pField && pField->IsStrictFormat();
-}
-
-void SVTXCurrencyField::setProperty( const OUString& PropertyName, const css::uno::Any& Value)
-{
- SolarMutexGuard aGuard;
-
- VclPtr< DoubleCurrencyField > pField = GetAs< DoubleCurrencyField >();
- if ( pField )
- {
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch (nPropType)
- {
- case BASEPROPERTY_CURRENCYSYMBOL:
- {
- OUString aStr;
- Value >>= aStr;
- pField->setCurrencySymbol( aStr );
- }
- break;
- case BASEPROPERTY_CURSYM_POSITION:
- {
- bool b = false;
- Value >>= b;
- pField->setPrependCurrSym(b);
- }
- break;
-
- default:
- SVTXFormattedField::setProperty(PropertyName, Value);
- }
- }
- else
- SVTXFormattedField::setProperty(PropertyName, Value);
-}
-
-css::uno::Any SVTXCurrencyField::getProperty( const OUString& PropertyName )
-{
- SolarMutexGuard aGuard;
-
- css::uno::Any aReturn;
-
- VclPtr< DoubleCurrencyField > pField = GetAs< DoubleCurrencyField >();
- if ( pField )
- {
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- switch (nPropType)
- {
- case BASEPROPERTY_CURRENCYSYMBOL:
- {
- aReturn <<= pField->getCurrencySymbol();
- }
- break;
- case BASEPROPERTY_CURSYM_POSITION:
- {
- aReturn <<= pField->getPrependCurrSym();
- }
- break;
- default:
- return SVTXFormattedField::getProperty(PropertyName);
- }
- }
- return SVTXFormattedField::getProperty(PropertyName);
-}
-
-void SVTXCurrencyField::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds )
-{
- PushPropertyIds( rIds,
- BASEPROPERTY_CURRENCYSYMBOL,
- BASEPROPERTY_CURSYM_POSITION,
- 0);
- SVTXFormattedField::ImplGetPropertyIds( rIds );
-}
-
-
-
SVTXDateField::SVTXDateField()
:VCLXDateField()
{
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 64b33e4de956..2f705433c3f3 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -92,6 +92,7 @@
#include <vcl/fixed.hxx>
#include <vcl/toolkit/fixedhyper.hxx>
#include <vcl/floatwin.hxx>
+#include <vcl/fmtfield.hxx>
#include <vcl/toolkit/prgsbar.hxx>
#include <vcl/scheduler.hxx>
#include <vcl/longcurr.hxx>
@@ -707,12 +708,14 @@ static ComponentInfo const aComponentInfos [] =
{ OUStringLiteral("dockingwindow"), WindowType::DOCKINGWINDOW },
{ OUStringLiteral("edit"), WindowType::EDIT },
{ OUStringLiteral("errorbox"), WindowType::ERRORBOX },
+ { OUStringLiteral("filecontrol"), WindowType::CONTROL },
{ OUStringLiteral("fixedbitmap"), WindowType::FIXEDBITMAP },
{ OUStringLiteral("fixedhyperlink"), WindowType::CONTROL },
{ OUStringLiteral("fixedimage"), WindowType::FIXEDIMAGE },
{ OUStringLiteral("fixedline"), WindowType::FIXEDLINE },
{ OUStringLiteral("fixedtext"), WindowType::FIXEDTEXT },
{ OUStringLiteral("floatingwindow"), WindowType::FLOATINGWINDOW },
+ { OUStringLiteral("formattedfield"), WindowType::CONTROL },
{ OUStringLiteral("frame"), WindowType::GROUPBOX },
{ OUStringLiteral("framewindow"), WindowType::TOOLKIT_FRAMEWINDOW },
{ OUStringLiteral("groupbox"), WindowType::GROUPBOX },
@@ -721,7 +724,7 @@ static ComponentInfo const aComponentInfos [] =
{ OUStringLiteral("infobox"), WindowType::INFOBOX },
{ OUStringLiteral("listbox"), WindowType::LISTBOX },
{ OUStringLiteral("longcurrencybox"), WindowType::LONGCURRENCYBOX },
- { OUStringLiteral("longcurrencyfield"), WindowType::LONGCURRENCYFIELD },
+ { OUStringLiteral("longcurrencyfield"), WindowType::CONTROL },
{ OUStringLiteral("menubutton"), WindowType::MENUBUTTON },
{ OUStringLiteral("messbox"), WindowType::MESSBOX },
{ OUStringLiteral("metricbox"), WindowType::METRICBOX },
@@ -732,7 +735,7 @@ static ComponentInfo const aComponentInfos [] =
{ OUStringLiteral("multilineedit"), WindowType::MULTILINEEDIT },
{ OUStringLiteral("multilistbox"), WindowType::MULTILISTBOX },
{ OUStringLiteral("numericbox"), WindowType::NUMERICBOX },
- { OUStringLiteral("numericfield"), WindowType::NUMERICFIELD },
+ { OUStringLiteral("numericfield"), WindowType::CONTROL },
{ OUStringLiteral("okbutton"), WindowType::OKBUTTON },
{ OUStringLiteral("patternbox"), WindowType::PATTERNBOX },
{ OUStringLiteral("patternfield"), WindowType::PATTERNFIELD },
@@ -757,6 +760,7 @@ static ComponentInfo const aComponentInfos [] =
{ OUStringLiteral("timebox"), WindowType::TIMEBOX },
{ OUStringLiteral("timefield"), WindowType::TIMEFIELD },
{ OUStringLiteral("toolbox"), WindowType::TOOLBOX },
+ { OUStringLiteral("tree"), WindowType::CONTROL },
{ OUStringLiteral("tristatebox"), WindowType::TRISTATEBOX },
{ OUStringLiteral("warningbox"), WindowType::WARNINGBOX },
{ OUStringLiteral("window"), WindowType::WINDOW },
@@ -1528,11 +1532,6 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
case WindowType::LONGCURRENCYBOX:
pNewWindow = VclPtr<LongCurrencyBox>::Create( pParent, nWinBits );
break;
- case WindowType::LONGCURRENCYFIELD:
- pNewWindow = VclPtr<LongCurrencyField>::Create( pParent, nWinBits );
- *ppNewComp = new VCLXCurrencyField;
- static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<LongCurrencyField*>(pNewWindow.get())) );
- break;
case WindowType::MENUBUTTON:
pNewWindow = VclPtr<MenuButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXButton;
@@ -1579,12 +1578,6 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
case WindowType::NUMERICBOX:
pNewWindow = VclPtr<NumericBox>::Create( pParent, nWinBits );
break;
- case WindowType::NUMERICFIELD:
- pNewWindow = VclPtr<NumericField>::Create( pParent, nWinBits );
- static_cast<NumericField*>(pNewWindow.get())->EnableEmptyFieldValue( true );
- *ppNewComp = new VCLXNumericField;
- static_cast<VCLXFormattedSpinField*>(*ppNewComp)->SetFormatter( static_cast<FormatterBase*>(static_cast<NumericField*>(pNewWindow.get())) );
- break;
case WindowType::OKBUTTON:
pNewWindow = VclPtr<OKButton>::Create( pParent, nWinBits );
*ppNewComp = new VCLXButton;
@@ -1815,6 +1808,21 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
*ppNewComp = pPeer;
pNewWindow = pPeer->createVclControl( pParent, nWinBits );
}
+ else if (aServiceName == "formattedfield")
+ {
+ pNewWindow = VclPtr<FormattedField>::Create( pParent, nWinBits );
+ *ppNewComp = new SVTXFormattedField;
+ }
+ else if (aServiceName == "numericfield")
+ {
+ pNewWindow = VclPtr<DoubleNumericField>::Create( pParent, nWinBits );
+ *ppNewComp = new SVTXNumericField;
+ }
+ else if (aServiceName == "longcurrencyfield")
+ {
+ pNewWindow = VclPtr<DoubleCurrencyField>::Create( pParent, nWinBits );
+ *ppNewComp = new SVTXCurrencyField;
+ }
break;
default:
OSL_ENSURE( false, "VCLXToolkit::ImplCreateWindow: unknown window type!" );
@@ -1898,9 +1906,6 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow(
if ( !pNewWindow )
pNewWindow = ImplCreateWindow( &pNewComp, rDescriptor, pParent, nWinBits, aPair.second );
- if (!pNewWindow)
- fprintf(stderr, "debug here\n");
-
DBG_ASSERT( pNewWindow, "createWindow: Unknown Component!" );
SAL_INFO_IF( !pNewComp, "toolkit", "createWindow: No special Interface!" );
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 35bda5bf4580..d22474f0e362 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -41,6 +41,7 @@
#include <sal/log.hxx>
#include <controls/filectrl.hxx>
+#include <svl/zforlist.hxx>
#include <vcl/button.hxx>
#include <vcl/graph.hxx>
#include <vcl/lstbox.hxx>
@@ -57,6 +58,7 @@
#include <vcl/tabctrl.hxx>
#include <vcl/settings.hxx>
#include <tools/diagnose_ex.h>
+#include <tools/debug.hxx>
#include <helper/imagealign.hxx>
#include <helper/msgbox.hxx>
@@ -7170,4 +7172,989 @@ void VCLXFileControl::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds )
VCLXWindow::ImplGetPropertyIds( rIds, true );
}
+SVTXFormattedField::SVTXFormattedField()
+ :bIsStandardSupplier(true)
+ ,nKeyToSetDelayed(-1)
+{
+}
+
+
+SVTXFormattedField::~SVTXFormattedField()
+{
+}
+
+
+void SVTXFormattedField::SetWindow( const VclPtr< vcl::Window > &_pWindow )
+{
+ VCLXSpinField::SetWindow(_pWindow);
+ if (GetAs< FormattedField >())
+ GetAs< FormattedField >()->SetAutoColor(true);
+}
+
+
+void SVTXFormattedField::setProperty( const OUString& PropertyName, const css::uno::Any& Value)
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch (nPropType)
+ {
+ case BASEPROPERTY_ENFORCE_FORMAT:
+ {
+ bool bEnable( true );
+ if ( Value >>= bEnable )
+ pField->EnableNotANumber( !bEnable );
+ }
+ break;
+
+ case BASEPROPERTY_EFFECTIVE_MIN:
+ case BASEPROPERTY_VALUEMIN_DOUBLE:
+ SetMinValue(Value);
+ break;
+
+ case BASEPROPERTY_EFFECTIVE_MAX:
+ case BASEPROPERTY_VALUEMAX_DOUBLE:
+ SetMaxValue(Value);
+ break;
+
+ case BASEPROPERTY_EFFECTIVE_DEFAULT:
+ SetDefaultValue(Value);
+ break;
+
+ case BASEPROPERTY_TREATASNUMBER:
+ {
+ bool b;
+ if ( Value >>= b )
+ SetTreatAsNumber(b);
+ }
+ break;
+
+ case BASEPROPERTY_FORMATSSUPPLIER:
+ if (!Value.hasValue())
+ setFormatsSupplier(css::uno::Reference< css::util::XNumberFormatsSupplier > (nullptr));
+ else
+ {
+ css::uno::Reference< css::util::XNumberFormatsSupplier > xNFS;
+ if ( Value >>= xNFS )
+ setFormatsSupplier(xNFS);
+ }
+ break;
+ case BASEPROPERTY_FORMATKEY:
+ if (!Value.hasValue())
+ setFormatKey(0);
+ else
+ {
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setFormatKey(n);
+ }
+ break;
+
+ case BASEPROPERTY_EFFECTIVE_VALUE:
+ case BASEPROPERTY_VALUE_DOUBLE:
+ {
+ const css::uno::TypeClass rTC = Value.getValueType().getTypeClass();
+ if (rTC != css::uno::TypeClass_STRING)
+ // no string
+ if (rTC != css::uno::TypeClass_DOUBLE)
+ // no double
+ if (Value.hasValue())
+ { // but a value
+ // try if it is something convertible
+ sal_Int32 nValue = 0;
+ if (!(Value >>= nValue))
+ throw css::lang::IllegalArgumentException();
+ SetValue(css::uno::makeAny(static_cast<double>(nValue)));
+ break;
+ }
+
+ SetValue(Value);
+ }
+ break;
+ case BASEPROPERTY_VALUESTEP_DOUBLE:
+ {
+ double d = 0.0;
+ if ( Value >>= d )
+ pField->SetSpinSize( d );
+ else
+ {
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ pField->SetSpinSize( n );
+ }
+ }
+ break;
+ case BASEPROPERTY_DECIMALACCURACY:
+ {
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ pField->SetDecimalDigits( static_cast<sal_uInt16>(n) );
+ }
+ break;
+ case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
+ {
+ bool b;
+ if ( Value >>= b )
+ pField->SetThousandsSep( b );
+ }
+ break;
+
+ default:
+ VCLXSpinField::setProperty( PropertyName, Value );
+ }
+
+ if (BASEPROPERTY_TEXTCOLOR == nPropType)
+ { // after setting a new text color, think again about the AutoColor flag of the control
+ // 17.05.2001 - 86859 - frank.schoenheit@germany.sun.com
+ pField->SetAutoColor(!Value.hasValue());
+ }
+ }
+ else
+ VCLXSpinField::setProperty( PropertyName, Value );
+}
+
+
+css::uno::Any SVTXFormattedField::getProperty( const OUString& PropertyName )
+{
+ SolarMutexGuard aGuard;
+
+ css::uno::Any aReturn;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch (nPropType)
+ {
+ case BASEPROPERTY_EFFECTIVE_MIN:
+ case BASEPROPERTY_VALUEMIN_DOUBLE:
+ aReturn = GetMinValue();
+ break;
+
+ case BASEPROPERTY_EFFECTIVE_MAX:
+ case BASEPROPERTY_VALUEMAX_DOUBLE:
+ aReturn = GetMaxValue();
+ break;
+
+ case BASEPROPERTY_EFFECTIVE_DEFAULT:
+ aReturn = GetDefaultValue();
+ break;
+
+ case BASEPROPERTY_TREATASNUMBER:
+ aReturn <<= GetTreatAsNumber();
+ break;
+
+ case BASEPROPERTY_EFFECTIVE_VALUE:
+ case BASEPROPERTY_VALUE_DOUBLE:
+ aReturn = GetValue();
+ break;
+
+ case BASEPROPERTY_VALUESTEP_DOUBLE:
+ aReturn <<= pField->GetSpinSize();
+ break;
+
+ case BASEPROPERTY_DECIMALACCURACY:
+ aReturn <<= pField->GetDecimalDigits();
+ break;
+
+ case BASEPROPERTY_FORMATSSUPPLIER:
+ {
+ if (!bIsStandardSupplier)
+ { // ansonsten void
+ css::uno::Reference< css::util::XNumberFormatsSupplier > xSupplier = m_xCurrentSupplier.get();
+ aReturn <<= xSupplier;
+ }
+ }
+ break;
+
+ case BASEPROPERTY_FORMATKEY:
+ {
+ if (!bIsStandardSupplier)
+ aReturn <<= getFormatKey();
+ }
+ break;
+
+ default:
+ aReturn = VCLXSpinField::getProperty(PropertyName);
+ }
+ }
+ return aReturn;
+}
+
+css::uno::Any SVTXFormattedField::convertEffectiveValue(const css::uno::Any& rValue)
+{
+ css::uno::Any aReturn;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if (!pField)
+ return aReturn;
+
+ switch (rValue.getValueType().getTypeClass())
+ {
+ case css::uno::TypeClass_DOUBLE:
+ if (pField->TreatingAsNumber())
+ {
+ double d = 0.0;
+ rValue >>= d;
+ aReturn <<= d;
+ }
+ else
+ {
+ SvNumberFormatter* pFormatter = pField->GetFormatter();
+ if (!pFormatter)
+ pFormatter = pField->StandardFormatter();
+ // should never fail
+
+ Color* pDum;
+ double d = 0.0;
+ rValue >>= d;
+ OUString sConverted;
+ pFormatter->GetOutputString(d, 0, sConverted, &pDum);
+ aReturn <<= sConverted;
+ }
+ break;
+ case css::uno::TypeClass_STRING:
+ {
+ OUString aStr;
+ rValue >>= aStr;
+ if (pField->TreatingAsNumber())
+ {
+ SvNumberFormatter* pFormatter = pField->GetFormatter();
+ if (!pFormatter)
+ pFormatter = pField->StandardFormatter();
+
+ double dVal;
+ sal_uInt32 nTestFormat(0);
+ if (!pFormatter->IsNumberFormat(aStr, nTestFormat, dVal))
+ aReturn.clear();
+ aReturn <<= dVal;
+ }
+ else
+ aReturn <<= aStr;
+ }
+ break;
+ default:
+ aReturn.clear();
+ break;
+ }
+ return aReturn;
+}
+
+
+void SVTXFormattedField::SetMinValue(const css::uno::Any& rValue)
+{
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if (!pField)
+ return;
+
+ switch (rValue.getValueType().getTypeClass())
+
+ {
+ case css::uno::TypeClass_DOUBLE:
+ {
+ double d = 0.0;
+ rValue >>= d;
+ pField->SetMinValue(d);
+ }
+ break;
+ default:
+ DBG_ASSERT(rValue.getValueType().getTypeClass() == css::uno::TypeClass_VOID, "SVTXFormattedField::SetMinValue : invalid argument (an exception will be thrown) !");
+ if ( rValue.getValueType().getTypeClass() != css::uno::TypeClass_VOID )
+
+ {
+ throw css::lang::IllegalArgumentException();
+ }
+ pField->ClearMinValue();
+ break;
+ }
+}
+
+
+css::uno::Any SVTXFormattedField::GetMinValue() const
+{
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if (!pField || !pField->HasMinValue())
+ return css::uno::Any();
+
+ css::uno::Any aReturn;
+ aReturn <<= pField->GetMinValue();
+ return aReturn;
+}
+
+
+void SVTXFormattedField::SetMaxValue(const css::uno::Any& rValue)
+{
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if (!pField)
+ return;
+
+ switch (rValue.getValueType().getTypeClass())
+
+ {
+ case css::uno::TypeClass_DOUBLE:
+ {
+ double d = 0.0;
+ rValue >>= d;
+ pField->SetMaxValue(d);
+ }
+ break;
+ default:
+ if (rValue.getValueType().getTypeClass() != css::uno::TypeClass_VOID)
+
+ {
+ throw css::lang::IllegalArgumentException();
+ }
+ pField->ClearMaxValue();
+ break;
+ }
+}
+
+
+css::uno::Any SVTXFormattedField::GetMaxValue() const
+{
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if (!pField || !pField->HasMaxValue())
+ return css::uno::Any();
+
+ css::uno::Any aReturn;
+ aReturn <<= pField->GetMaxValue();
+ return aReturn;
+}
+
+
+void SVTXFormattedField::SetDefaultValue(const css::uno::Any& rValue)
+{
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if (!pField)
+ return;
+
+ css::uno::Any aConverted = convertEffectiveValue(rValue);
+
+ switch (aConverted.getValueType().getTypeClass())
+
+ {
+ case css::uno::TypeClass_DOUBLE:
+ {
+ double d = 0.0;
+ aConverted >>= d;
+ pField->SetDefaultValue(d);
+ }
+ break;
+ case css::uno::TypeClass_STRING:
+ {
+ OUString aStr;
+ aConverted >>= aStr;
+ pField->SetDefaultText( aStr );
+ }
+ break;
+ default:
+ pField->EnableEmptyField(true);
+ // only void accepted
+ break;
+ }
+}
+
+
+css::uno::Any SVTXFormattedField::GetDefaultValue() const
+{
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if (!pField || pField->IsEmptyFieldEnabled())
+ return css::uno::Any();
+
+ css::uno::Any aReturn;
+ if (pField->TreatingAsNumber())
+ aReturn <<= pField->GetDefaultValue();
+ else
+ aReturn <<= pField->GetDefaultText();
+ return aReturn;
+}
+
+
+bool SVTXFormattedField::GetTreatAsNumber() const
+{
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if (pField)
+ return pField->TreatingAsNumber();
+
+ return true;
+}
+
+
+void SVTXFormattedField::SetTreatAsNumber(bool bSet)
+{
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if (pField)
+ pField->TreatAsNumber(bSet);
+}
+
+
+css::uno::Any SVTXFormattedField::GetValue() const
+{
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if (!pField)
+ return css::uno::Any();
+
+ css::uno::Any aReturn;
+ if (!pField->TreatingAsNumber())
+ {
+ OUString sText = pField->GetTextValue();
+ aReturn <<= sText;
+ }
+ else
+ {
+ if (!pField->GetText().isEmpty()) // empty is returned as void by default
+ aReturn <<= pField->GetValue();
+ }
+
+ return aReturn;
+}
+
+
+void SVTXFormattedField::SetValue(const css::uno::Any& rValue)
+{
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if (!pField)
+ return;
+
+ if (!rValue.hasValue())
+ {
+ pField->SetText("");
+ }
+ else
+ {
+ if (rValue.getValueType().getTypeClass() == css::uno::TypeClass_DOUBLE )
+ {
+ double d = 0.0;
+ rValue >>= d;
+ pField->SetValue(d);
+ }
+ else
+ {
+ DBG_ASSERT(rValue.getValueType().getTypeClass() == css::uno::TypeClass_STRING, "SVTXFormattedField::SetValue : invalid argument !");
+
+ OUString sText;
+ rValue >>= sText;
+ if (!pField->TreatingAsNumber())
+ pField->SetTextFormatted(sText);
+ else
+ pField->SetTextValue(sText);
+ }
+ }
+// NotifyTextListeners();
+}
+
+
+void SVTXFormattedField::setFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier > & xSupplier)
+{
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+
+ SvNumberFormatsSupplierObj* pNew = nullptr;
+ if (!xSupplier.is())
+ {
+ if (pField)
+ {
+ pNew = new SvNumberFormatsSupplierObj(pField->StandardFormatter());
+ bIsStandardSupplier = true;
+ }
+ }
+ else
+ {
+ pNew = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>(xSupplier);
+ bIsStandardSupplier = false;
+ }
+
+ if (!pNew)
+ return; // TODO : how to process ?
+
+ m_xCurrentSupplier = pNew;
+ if (!pField)
+ return;
+
+ // save the actual value
+ css::uno::Any aCurrent = GetValue();
+ pField->SetFormatter(m_xCurrentSupplier->GetNumberFormatter(), false);
+ if (nKeyToSetDelayed != -1)
+ {
+ pField->SetFormatKey(nKeyToSetDelayed);
+ nKeyToSetDelayed = -1;
+ }
+ SetValue(aCurrent);
+ NotifyTextListeners();
+}
+
+
+sal_Int32 SVTXFormattedField::getFormatKey() const
+{
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField ? pField->GetFormatKey() : 0;
+}
+
+
+void SVTXFormattedField::setFormatKey(sal_Int32 nKey)
+{
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if (!pField)
+ return;
+
+ if (pField->GetFormatter())
+ pField->SetFormatKey(nKey);
+ else
+ {
+ // probably I am in a block, in which first the key and next the formatter will be set,
+ // initially this happens quite certain, as the properties are set in alphabetic sequence,
+ // and the FormatsSupplier is processed before the FormatKey
+ nKeyToSetDelayed = nKey;
+ }
+ NotifyTextListeners();
+}
+
+
+void SVTXFormattedField::NotifyTextListeners()
+{
+ if ( GetTextListeners().getLength() )
+ {
+ css::awt::TextEvent aEvent;
+ aEvent.Source = static_cast<cppu::OWeakObject*>(this);
+ GetTextListeners().textChanged( aEvent );
+ }
+}
+
+void SVTXFormattedField::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ // FIXME: elide duplication ?
+ BASEPROPERTY_EFFECTIVE_MIN,
+ BASEPROPERTY_VALUEMIN_DOUBLE,
+ BASEPROPERTY_EFFECTIVE_MAX,
+ BASEPROPERTY_VALUEMAX_DOUBLE,
+ BASEPROPERTY_EFFECTIVE_DEFAULT,
+ BASEPROPERTY_TREATASNUMBER,
+ BASEPROPERTY_EFFECTIVE_VALUE,
+ BASEPROPERTY_VALUE_DOUBLE,
+ BASEPROPERTY_VALUESTEP_DOUBLE,
+ BASEPROPERTY_DECIMALACCURACY,
+ BASEPROPERTY_FORMATSSUPPLIER,
+ BASEPROPERTY_NUMSHOWTHOUSANDSEP,
+ BASEPROPERTY_FORMATKEY,
+ BASEPROPERTY_TREATASNUMBER,
+ BASEPROPERTY_ENFORCE_FORMAT,
+ 0);
+ VCLXWindow::ImplGetPropertyIds( rIds, true );
+ VCLXSpinField::ImplGetPropertyIds( rIds );
+}
+
+
+
+
+
+SVTXCurrencyField::SVTXCurrencyField()
+{
+}
+
+SVTXCurrencyField::~SVTXCurrencyField()
+{
+}
+
+css::uno::Any SVTXCurrencyField::queryInterface( const css::uno::Type & rType )
+{
+ css::uno::Any aRet = ::cppu::queryInterface( rType,
+ static_cast< css::awt::XCurrencyField* >(this),
+ static_cast< css::lang::XTypeProvider* >(this) );
+ return (aRet.hasValue() ? aRet : SVTXFormattedField::queryInterface( rType ));
+}
+
+IMPL_IMPLEMENTATION_ID( SVTXCurrencyField )
+
+// css::lang::XTypeProvider
+css::uno::Sequence< css::uno::Type > SVTXCurrencyField::getTypes()
+{
+ static const ::cppu::OTypeCollection aTypeList(
+ cppu::UnoType<css::lang::XTypeProvider>::get(),
+ cppu::UnoType<css::awt::XCurrencyField>::get(),
+ SVTXFormattedField::getTypes()
+ );
+ return aTypeList.getTypes();
+}
+
+void SVTXCurrencyField::setValue( double Value )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ pField->SetValue( Value );
+}
+
+double SVTXCurrencyField::getValue()
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField ? pField->GetValue() : 0;
+}
+
+void SVTXCurrencyField::setMin( double Value )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ pField->SetMinValue( Value );
+}
+
+double SVTXCurrencyField::getMin()
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField ? pField->GetMinValue() : 0;
+}
+
+void SVTXCurrencyField::setMax( double Value )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ pField->SetMaxValue( Value );
+}
+
+double SVTXCurrencyField::getMax()
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField ? pField->GetMaxValue() : 0;
+}
+
+void SVTXCurrencyField::setFirst( double Value )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ pField->SetSpinFirst( Value );
+}
+
+double SVTXCurrencyField::getFirst()
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField ? pField->GetSpinFirst() : 0;
+}
+
+void SVTXCurrencyField::setLast( double Value )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ pField->SetSpinLast( Value );
+}
+
+double SVTXCurrencyField::getLast()
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField ? pField->GetSpinLast() : 0;
+}
+
+void SVTXCurrencyField::setSpinSize( double Value )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ pField->SetSpinSize( Value );
+}
+
+double SVTXCurrencyField::getSpinSize()
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField ? pField->GetSpinSize() : 0;
+}
+
+void SVTXCurrencyField::setDecimalDigits( sal_Int16 Value )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ pField->SetDecimalDigits( Value );
+}
+
+sal_Int16 SVTXCurrencyField::getDecimalDigits()
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField ? pField->GetDecimalDigits() : 0;
+}
+
+void SVTXCurrencyField::setStrictFormat( sal_Bool bStrict )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ pField->SetStrictFormat( bStrict );
+}
+
+sal_Bool SVTXCurrencyField::isStrictFormat()
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField && pField->IsStrictFormat();
+}
+
+void SVTXCurrencyField::setProperty( const OUString& PropertyName, const css::uno::Any& Value)
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr< DoubleCurrencyField > pField = GetAs< DoubleCurrencyField >();
+ if ( pField )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch (nPropType)
+ {
+ case BASEPROPERTY_CURRENCYSYMBOL:
+ {
+ OUString aStr;
+ Value >>= aStr;
+ pField->setCurrencySymbol( aStr );
+ }
+ break;
+ case BASEPROPERTY_CURSYM_POSITION:
+ {
+ bool b = false;
+ Value >>= b;
+ pField->setPrependCurrSym(b);
+ }
+ break;
+
+ default:
+ SVTXFormattedField::setProperty(PropertyName, Value);
+ }
+ }
+ else
+ SVTXFormattedField::setProperty(PropertyName, Value);
+}
+
+css::uno::Any SVTXCurrencyField::getProperty( const OUString& PropertyName )
+{
+ SolarMutexGuard aGuard;
+
+ css::uno::Any aReturn;
+
+ VclPtr< DoubleCurrencyField > pField = GetAs< DoubleCurrencyField >();
+ if ( pField )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch (nPropType)
+ {
+ case BASEPROPERTY_CURRENCYSYMBOL:
+ {
+ aReturn <<= pField->getCurrencySymbol();
+ }
+ break;
+ case BASEPROPERTY_CURSYM_POSITION:
+ {
+ aReturn <<= pField->getPrependCurrSym();
+ }
+ break;
+ default:
+ return SVTXFormattedField::getProperty(PropertyName);
+ }
+ }
+ return SVTXFormattedField::getProperty(PropertyName);
+}
+
+void SVTXCurrencyField::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_CURRENCYSYMBOL,
+ BASEPROPERTY_CURSYM_POSITION,
+ 0);
+ SVTXFormattedField::ImplGetPropertyIds( rIds );
+}
+
+SVTXNumericField::SVTXNumericField()
+{
+}
+
+SVTXNumericField::~SVTXNumericField()
+{
+}
+
+css::uno::Any SVTXNumericField::queryInterface( const css::uno::Type & rType )
+{
+ css::uno::Any aRet = ::cppu::queryInterface( rType,
+ static_cast< css::awt::XNumericField* >(this),
+ static_cast< css::lang::XTypeProvider* >(this) );
+ return (aRet.hasValue() ? aRet : SVTXFormattedField::queryInterface( rType ));
+}
+
+IMPL_IMPLEMENTATION_ID( SVTXNumericField )
+
+// css::lang::XTypeProvider
+css::uno::Sequence< css::uno::Type > SVTXNumericField::getTypes()
+{
+ static const ::cppu::OTypeCollection aTypeList(
+ cppu::UnoType<css::lang::XTypeProvider>::get(),
+ cppu::UnoType<css::awt::XNumericField>::get(),
+ SVTXFormattedField::getTypes()
+ );
+ return aTypeList.getTypes();
+}
+
+
+void SVTXNumericField::setValue( double Value )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ pField->SetValue( Value );
+}
+
+double SVTXNumericField::getValue()
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField ? pField->GetValue() : 0;
+}
+
+void SVTXNumericField::setMin( double Value )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ pField->SetMinValue( Value );
+}
+
+double SVTXNumericField::getMin()
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField ? pField->GetMinValue() : 0;
+}
+
+void SVTXNumericField::setMax( double Value )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ pField->SetMaxValue( Value );
+}
+
+double SVTXNumericField::getMax()
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField ? pField->GetMaxValue() : 0;
+}
+
+void SVTXNumericField::setFirst( double Value )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ pField->SetSpinFirst( Value );
+}
+
+double SVTXNumericField::getFirst()
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField ? pField->GetSpinFirst() : 0;
+}
+
+void SVTXNumericField::setLast( double Value )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ pField->SetSpinLast( Value );
+}
+
+double SVTXNumericField::getLast()
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField ? pField->GetSpinLast() : 0;
+}
+
+void SVTXNumericField::setSpinSize( double Value )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ pField->SetSpinSize( Value );
+}
+
+double SVTXNumericField::getSpinSize()
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField ? pField->GetSpinSize() : 0;
+}
+
+void SVTXNumericField::setDecimalDigits( sal_Int16 Value )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ pField->SetDecimalDigits( Value );
+}
+
+sal_Int16 SVTXNumericField::getDecimalDigits()
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField ? pField->GetDecimalDigits() : 0;
+}
+
+void SVTXNumericField::setStrictFormat( sal_Bool bStrict )
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ if ( pField )
+ pField->SetStrictFormat( bStrict );
+}
+
+sal_Bool SVTXNumericField::isStrictFormat()
+{
+ SolarMutexGuard aGuard;
+
+ VclPtr<FormattedField> pField = GetAs< FormattedField >();
+ return pField && pField->IsStrictFormat();
+}
+
+void SVTXNumericField::GetPropertyIds( std::vector< sal_uInt16 > &rIds )
+{
+ SVTXFormattedField::ImplGetPropertyIds( rIds );
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */