10d63794cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 30d63794cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 40d63794cSAndrew Rist * or more contributor license agreements. See the NOTICE file 50d63794cSAndrew Rist * distributed with this work for additional information 60d63794cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 70d63794cSAndrew Rist * to you under the Apache License, Version 2.0 (the 80d63794cSAndrew Rist * "License"); you may not use this file except in compliance 90d63794cSAndrew Rist * with the License. You may obtain a copy of the License at 100d63794cSAndrew Rist * 110d63794cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 120d63794cSAndrew Rist * 130d63794cSAndrew Rist * Unless required by applicable law or agreed to in writing, 140d63794cSAndrew Rist * software distributed under the License is distributed on an 150d63794cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 160d63794cSAndrew Rist * KIND, either express or implied. See the License for the 170d63794cSAndrew Rist * specific language governing permissions and limitations 180d63794cSAndrew Rist * under the License. 190d63794cSAndrew Rist * 200d63794cSAndrew Rist *************************************************************/ 210d63794cSAndrew Rist 220d63794cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SV_FIELD_HXX 25cdf0e10cSrcweir #define _SV_FIELD_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <vcl/dllapi.h> 28cdf0e10cSrcweir #include <tools/link.hxx> 29cdf0e10cSrcweir #include <tools/date.hxx> 30cdf0e10cSrcweir #include <tools/time.hxx> 31cdf0e10cSrcweir #include <vcl/spinfld.hxx> 32cdf0e10cSrcweir #include <vcl/combobox.hxx> 33cdf0e10cSrcweir #include <tools/fldunit.hxx> 34cdf0e10cSrcweir 35cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace lang { struct Locale; } } } } 36cdf0e10cSrcweir 37cdf0e10cSrcweir class CalendarWrapper; 38cdf0e10cSrcweir class LocaleDataWrapper; 39cdf0e10cSrcweir 40cdf0e10cSrcweir // ----------------- 41cdf0e10cSrcweir // - FormatterBase - 42cdf0e10cSrcweir // ----------------- 43cdf0e10cSrcweir 44cdf0e10cSrcweir class VCL_DLLPUBLIC FormatterBase 45cdf0e10cSrcweir { 46cdf0e10cSrcweir private: 47cdf0e10cSrcweir Edit* mpField; 48cdf0e10cSrcweir LocaleDataWrapper* mpLocaleDataWrapper; 49cdf0e10cSrcweir Link maErrorLink; 50cdf0e10cSrcweir sal_Bool mbReformat; 51cdf0e10cSrcweir sal_Bool mbStrictFormat; 52cdf0e10cSrcweir sal_Bool mbEmptyFieldValue; 53cdf0e10cSrcweir sal_Bool mbEmptyFieldValueEnabled; 54cdf0e10cSrcweir sal_Bool mbDefaultLocale; 55cdf0e10cSrcweir 56cdf0e10cSrcweir protected: 57cdf0e10cSrcweir SAL_DLLPRIVATE void ImplSetText( const XubString& rText, Selection* pNewSel = NULL ); ImplGetEmptyFieldValue() const58cdf0e10cSrcweir SAL_DLLPRIVATE sal_Bool ImplGetEmptyFieldValue() const { return mbEmptyFieldValue; } 59cdf0e10cSrcweir 60cdf0e10cSrcweir void SetFieldText( const XubString& rText, sal_Bool bKeepSelection ); SetEmptyFieldValueData(sal_Bool bValue)61cdf0e10cSrcweir void SetEmptyFieldValueData( sal_Bool bValue ) { mbEmptyFieldValue = bValue; } 62cdf0e10cSrcweir 63cdf0e10cSrcweir SAL_DLLPRIVATE LocaleDataWrapper& ImplGetLocaleDataWrapper() const; IsDefaultLocale() const64cdf0e10cSrcweir sal_Bool IsDefaultLocale() const { return mbDefaultLocale; } 65cdf0e10cSrcweir 66cdf0e10cSrcweir public: 67*e1beba7dSHerbert Dürr explicit FormatterBase( Edit* pField = NULL ); 68cdf0e10cSrcweir virtual ~FormatterBase(); 69cdf0e10cSrcweir 70cdf0e10cSrcweir const LocaleDataWrapper& GetLocaleDataWrapper() const; 71cdf0e10cSrcweir SetField(Edit * pField)72cdf0e10cSrcweir void SetField( Edit* pField ) { mpField = pField; } GetField() const73cdf0e10cSrcweir Edit* GetField() const { return mpField; } 74cdf0e10cSrcweir MustBeReformatted() const75cdf0e10cSrcweir sal_Bool MustBeReformatted() const { return mbReformat; } MarkToBeReformatted(sal_Bool b)76cdf0e10cSrcweir void MarkToBeReformatted( sal_Bool b ) { mbReformat = b; } 77cdf0e10cSrcweir 78cdf0e10cSrcweir void SetStrictFormat( sal_Bool bStrict ); IsStrictFormat() const79cdf0e10cSrcweir sal_Bool IsStrictFormat() const { return mbStrictFormat; } 80cdf0e10cSrcweir 81cdf0e10cSrcweir virtual void Reformat(); 82cdf0e10cSrcweir virtual void ReformatAll(); 83cdf0e10cSrcweir 84cdf0e10cSrcweir virtual void SetLocale( const ::com::sun::star::lang::Locale& rLocale ); 85cdf0e10cSrcweir const ::com::sun::star::lang::Locale& GetLocale() const; 86cdf0e10cSrcweir 87cdf0e10cSrcweir const AllSettings& GetFieldSettings() const; 88cdf0e10cSrcweir SetErrorHdl(const Link & rLink)89cdf0e10cSrcweir void SetErrorHdl( const Link& rLink ) { maErrorLink = rLink; } GetErrorHdl() const90cdf0e10cSrcweir const Link& GetErrorHdl() const { return maErrorLink; } 91cdf0e10cSrcweir 92cdf0e10cSrcweir void SetEmptyFieldValue(); 93cdf0e10cSrcweir sal_Bool IsEmptyFieldValue() const; 94cdf0e10cSrcweir EnableEmptyFieldValue(sal_Bool bEnable)95cdf0e10cSrcweir void EnableEmptyFieldValue( sal_Bool bEnable ) { mbEmptyFieldValueEnabled = bEnable; } IsEmptyFieldValueEnabled() const96cdf0e10cSrcweir sal_Bool IsEmptyFieldValueEnabled() const { return mbEmptyFieldValueEnabled; } 97cdf0e10cSrcweir }; 98cdf0e10cSrcweir 99cdf0e10cSrcweir 100cdf0e10cSrcweir // -------------------- 101cdf0e10cSrcweir // - PatternFormatter - 102cdf0e10cSrcweir // -------------------- 103cdf0e10cSrcweir 104cdf0e10cSrcweir #define PATTERN_FORMAT_EMPTYLITERALS ((sal_uInt16)0x0001) 105cdf0e10cSrcweir 106cdf0e10cSrcweir class VCL_DLLPUBLIC PatternFormatter : public FormatterBase 107cdf0e10cSrcweir { 108cdf0e10cSrcweir private: 109cdf0e10cSrcweir ByteString maEditMask; 110cdf0e10cSrcweir XubString maFieldString; 111cdf0e10cSrcweir XubString maLiteralMask; 112cdf0e10cSrcweir sal_uInt16 mnFormatFlags; 113cdf0e10cSrcweir sal_Bool mbSameMask; 114cdf0e10cSrcweir sal_Bool mbInPattKeyInput; 115cdf0e10cSrcweir 116cdf0e10cSrcweir protected: 117cdf0e10cSrcweir PatternFormatter(); 118cdf0e10cSrcweir 119cdf0e10cSrcweir SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); 120cdf0e10cSrcweir SAL_DLLPRIVATE void ImplSetMask( const ByteString& rEditMask, const XubString& rLiteralMask ); ImplIsSameMask() const121cdf0e10cSrcweir SAL_DLLPRIVATE sal_Bool ImplIsSameMask() const { return mbSameMask; } ImplGetInPattKeyInput()122cdf0e10cSrcweir SAL_DLLPRIVATE sal_Bool& ImplGetInPattKeyInput() { return mbInPattKeyInput; } 123cdf0e10cSrcweir 124cdf0e10cSrcweir public: 125cdf0e10cSrcweir ~PatternFormatter(); 126cdf0e10cSrcweir 127cdf0e10cSrcweir virtual void Reformat(); 128cdf0e10cSrcweir 129cdf0e10cSrcweir void SetMask( const ByteString& rEditMask, 130cdf0e10cSrcweir const XubString& rLiteralMask ); GetEditMask() const131cdf0e10cSrcweir const ByteString& GetEditMask() const { return maEditMask; } GetLiteralMask() const132cdf0e10cSrcweir const XubString& GetLiteralMask() const { return maLiteralMask; } 133cdf0e10cSrcweir SetFormatFlags(sal_uInt16 nFlags)134cdf0e10cSrcweir void SetFormatFlags( sal_uInt16 nFlags ) { mnFormatFlags = nFlags; } GetFormatFlags() const135cdf0e10cSrcweir sal_uInt16 GetFormatFlags() const { return mnFormatFlags; } 136cdf0e10cSrcweir 137cdf0e10cSrcweir void SetString( const XubString& rStr ); 138cdf0e10cSrcweir XubString GetString() const; IsStringModified() const139cdf0e10cSrcweir sal_Bool IsStringModified() const { return !(GetString().Equals( maFieldString )); } 140cdf0e10cSrcweir 141cdf0e10cSrcweir void SelectFixedFont(); 142cdf0e10cSrcweir }; 143cdf0e10cSrcweir 144cdf0e10cSrcweir // -------------------- 145cdf0e10cSrcweir // - NumericFormatter - 146cdf0e10cSrcweir // -------------------- 147cdf0e10cSrcweir 148cdf0e10cSrcweir class VCL_DLLPUBLIC NumericFormatter : public FormatterBase 149cdf0e10cSrcweir { 150cdf0e10cSrcweir private: 151cdf0e10cSrcweir SAL_DLLPRIVATE void ImplInit(); 152cdf0e10cSrcweir 153cdf0e10cSrcweir protected: 154cdf0e10cSrcweir sal_Int64 mnFieldValue; 155cdf0e10cSrcweir sal_Int64 mnLastValue; 156cdf0e10cSrcweir sal_Int64 mnMin; 157cdf0e10cSrcweir sal_Int64 mnMax; 158cdf0e10cSrcweir sal_Int64 mnCorrectedValue; 159cdf0e10cSrcweir sal_uInt16 mnType; 160cdf0e10cSrcweir sal_uInt16 mnDecimalDigits; 161cdf0e10cSrcweir sal_Bool mbThousandSep; 162cdf0e10cSrcweir sal_Bool mbShowTrailingZeros; 163cdf0e10cSrcweir 164cdf0e10cSrcweir // the members below are used in all derivatives of NumericFormatter 165cdf0e10cSrcweir // not in NumericFormatter itself. 166cdf0e10cSrcweir sal_Int64 mnSpinSize; 167cdf0e10cSrcweir sal_Int64 mnFirst; 168cdf0e10cSrcweir sal_Int64 mnLast; 169cdf0e10cSrcweir 170cdf0e10cSrcweir protected: 171cdf0e10cSrcweir NumericFormatter(); 172cdf0e10cSrcweir 173cdf0e10cSrcweir virtual XubString CreateFieldText( sal_Int64 nValue ) const; 174cdf0e10cSrcweir 175cdf0e10cSrcweir void FieldUp(); 176cdf0e10cSrcweir void FieldDown(); 177cdf0e10cSrcweir void FieldFirst(); 178cdf0e10cSrcweir void FieldLast(); 179cdf0e10cSrcweir 180cdf0e10cSrcweir SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); 181cdf0e10cSrcweir SAL_DLLPRIVATE sal_Bool ImplNumericReformat( const XubString& rStr, double& rValue, XubString& rOutStr ); 182cdf0e10cSrcweir SAL_DLLPRIVATE void ImplNewFieldValue( sal_Int64 nNewValue ); 183cdf0e10cSrcweir SAL_DLLPRIVATE void ImplSetUserValue( sal_Int64 nNewValue, Selection* pNewSelection = NULL ); 184cdf0e10cSrcweir 185cdf0e10cSrcweir public: 186cdf0e10cSrcweir ~NumericFormatter(); 187cdf0e10cSrcweir 188cdf0e10cSrcweir virtual void Reformat(); 189cdf0e10cSrcweir 190cdf0e10cSrcweir void SetMin( sal_Int64 nNewMin ); GetMin() const191cdf0e10cSrcweir sal_Int64 GetMin() const { return mnMin; } 192cdf0e10cSrcweir void SetMax( sal_Int64 nNewMax ); GetMax() const193cdf0e10cSrcweir sal_Int64 GetMax() const { return mnMax; } 194cdf0e10cSrcweir SetFirst(sal_Int64 nNewFirst)195cdf0e10cSrcweir void SetFirst( sal_Int64 nNewFirst ) { mnFirst = nNewFirst; } GetFirst() const196cdf0e10cSrcweir sal_Int64 GetFirst() const { return mnFirst; } SetLast(sal_Int64 nNewLast)197cdf0e10cSrcweir void SetLast( sal_Int64 nNewLast ) { mnLast = nNewLast; } GetLast() const198cdf0e10cSrcweir sal_Int64 GetLast() const { return mnLast; } SetSpinSize(sal_Int64 nNewSize)199cdf0e10cSrcweir void SetSpinSize( sal_Int64 nNewSize ) { mnSpinSize = nNewSize; } GetSpinSize() const200cdf0e10cSrcweir sal_Int64 GetSpinSize() const { return mnSpinSize; } 201cdf0e10cSrcweir 202cdf0e10cSrcweir void SetDecimalDigits( sal_uInt16 nDigits ); 203cdf0e10cSrcweir sal_uInt16 GetDecimalDigits() const; 204cdf0e10cSrcweir 205cdf0e10cSrcweir void SetUseThousandSep( sal_Bool b ); IsUseThousandSep() const206cdf0e10cSrcweir sal_Bool IsUseThousandSep() const { return mbThousandSep; } 207cdf0e10cSrcweir 208cdf0e10cSrcweir void SetShowTrailingZeros( sal_Bool bShowTrailingZeros ); IsShowTrailingZeros() const209cdf0e10cSrcweir sal_Bool IsShowTrailingZeros() const { return mbShowTrailingZeros; } 210cdf0e10cSrcweir 211cdf0e10cSrcweir 212cdf0e10cSrcweir void SetUserValue( sal_Int64 nNewValue ); 213cdf0e10cSrcweir virtual void SetValue( sal_Int64 nNewValue ); 214cdf0e10cSrcweir virtual sal_Int64 GetValue() const; 215cdf0e10cSrcweir sal_Bool IsValueModified() const; GetCorrectedValue() const216cdf0e10cSrcweir sal_Int64 GetCorrectedValue() const { return mnCorrectedValue; } 217cdf0e10cSrcweir 218cdf0e10cSrcweir Fraction ConvertToFraction( sal_Int64 nValue ); 219cdf0e10cSrcweir sal_Int64 ConvertToLong( const Fraction& rValue ); 220cdf0e10cSrcweir sal_Int64 Normalize( sal_Int64 nValue ) const; 221cdf0e10cSrcweir sal_Int64 Denormalize( sal_Int64 nValue ) const; 222cdf0e10cSrcweir }; 223cdf0e10cSrcweir 224cdf0e10cSrcweir // ------------------- 225cdf0e10cSrcweir // - MetricFormatter - 226cdf0e10cSrcweir // ------------------- 227cdf0e10cSrcweir 228cdf0e10cSrcweir class VCL_DLLPUBLIC MetricFormatter : public NumericFormatter 229cdf0e10cSrcweir { 230cdf0e10cSrcweir private: 231cdf0e10cSrcweir SAL_DLLPRIVATE void ImplInit(); 232cdf0e10cSrcweir 233cdf0e10cSrcweir protected: 234cdf0e10cSrcweir XubString maCustomUnitText; 235cdf0e10cSrcweir XubString maCurUnitText; 236cdf0e10cSrcweir sal_Int64 mnBaseValue; 237cdf0e10cSrcweir FieldUnit meUnit; 238cdf0e10cSrcweir Link maCustomConvertLink; 239cdf0e10cSrcweir 240cdf0e10cSrcweir protected: 241cdf0e10cSrcweir MetricFormatter(); 242cdf0e10cSrcweir 243cdf0e10cSrcweir virtual XubString CreateFieldText( sal_Int64 nValue ) const; 244cdf0e10cSrcweir 245cdf0e10cSrcweir SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); 246cdf0e10cSrcweir SAL_DLLPRIVATE sal_Bool ImplMetricReformat( const XubString& rStr, double& rValue, XubString& rOutStr ); 247cdf0e10cSrcweir 248cdf0e10cSrcweir public: 249cdf0e10cSrcweir ~MetricFormatter(); 250cdf0e10cSrcweir 251cdf0e10cSrcweir virtual void CustomConvert() = 0; 252cdf0e10cSrcweir virtual void Reformat(); 253cdf0e10cSrcweir 254cdf0e10cSrcweir void SetUnit( FieldUnit meUnit ); GetUnit() const255cdf0e10cSrcweir FieldUnit GetUnit() const { return meUnit; } 256cdf0e10cSrcweir void SetCustomUnitText( const XubString& rStr ); GetCustomUnitText() const257cdf0e10cSrcweir const XubString& GetCustomUnitText() const { return maCustomUnitText; } GetCurUnitText() const258cdf0e10cSrcweir const XubString& GetCurUnitText() const { return maCurUnitText; } 259cdf0e10cSrcweir 260cdf0e10cSrcweir using NumericFormatter::SetMax; 261cdf0e10cSrcweir void SetMax( sal_Int64 nNewMax, FieldUnit eInUnit ); 262cdf0e10cSrcweir using NumericFormatter::GetMax; 263cdf0e10cSrcweir sal_Int64 GetMax( FieldUnit eOutUnit ) const; 264cdf0e10cSrcweir using NumericFormatter::SetMin; 265cdf0e10cSrcweir void SetMin( sal_Int64 nNewMin, FieldUnit eInUnit ); 266cdf0e10cSrcweir using NumericFormatter::GetMin; 267cdf0e10cSrcweir sal_Int64 GetMin( FieldUnit eOutUnit ) const; 268cdf0e10cSrcweir void SetBaseValue( sal_Int64 nNewBase, FieldUnit eInUnit = FUNIT_NONE ); 269cdf0e10cSrcweir sal_Int64 GetBaseValue( FieldUnit eOutUnit = FUNIT_NONE ) const; 270cdf0e10cSrcweir 271cdf0e10cSrcweir virtual void SetValue( sal_Int64 nNewValue, FieldUnit eInUnit ); 272cdf0e10cSrcweir virtual void SetValue( sal_Int64 nValue ); 273cdf0e10cSrcweir using NumericFormatter::SetUserValue; 274cdf0e10cSrcweir void SetUserValue( sal_Int64 nNewValue, FieldUnit eInUnit ); 275cdf0e10cSrcweir virtual sal_Int64 GetValue( FieldUnit eOutUnit ) const; 276cdf0e10cSrcweir virtual sal_Int64 GetValue() const; 277cdf0e10cSrcweir using NumericFormatter::GetCorrectedValue; 278cdf0e10cSrcweir sal_Int64 GetCorrectedValue( FieldUnit eOutUnit ) const; 279cdf0e10cSrcweir SetCustomConvertHdl(const Link & rLink)280cdf0e10cSrcweir void SetCustomConvertHdl( const Link& rLink ) { maCustomConvertLink = rLink; } GetCustomConvertHdl() const281cdf0e10cSrcweir const Link& GetCustomConvertHdl() const { return maCustomConvertLink; } 282cdf0e10cSrcweir }; 283cdf0e10cSrcweir 284cdf0e10cSrcweir 285cdf0e10cSrcweir // --------------------- 286cdf0e10cSrcweir // - CurrencyFormatter - 287cdf0e10cSrcweir // --------------------- 288cdf0e10cSrcweir 289cdf0e10cSrcweir class VCL_DLLPUBLIC CurrencyFormatter : public NumericFormatter 290cdf0e10cSrcweir { 291cdf0e10cSrcweir private: 292cdf0e10cSrcweir String maCurrencySymbol; 293cdf0e10cSrcweir 294cdf0e10cSrcweir SAL_DLLPRIVATE void ImplInit(); 295cdf0e10cSrcweir 296cdf0e10cSrcweir protected: 297cdf0e10cSrcweir CurrencyFormatter(); 298cdf0e10cSrcweir virtual XubString CreateFieldText( sal_Int64 nValue ) const; 299cdf0e10cSrcweir SAL_DLLPRIVATE sal_Bool ImplCurrencyReformat( const XubString& rStr, XubString& rOutStr ); 300cdf0e10cSrcweir 301cdf0e10cSrcweir public: 302cdf0e10cSrcweir ~CurrencyFormatter(); 303cdf0e10cSrcweir 304cdf0e10cSrcweir virtual void Reformat(); 305cdf0e10cSrcweir 306cdf0e10cSrcweir void SetCurrencySymbol( const String& rStr ); 307cdf0e10cSrcweir String GetCurrencySymbol() const; 308cdf0e10cSrcweir 309cdf0e10cSrcweir virtual void SetValue( sal_Int64 nNewValue ); 310cdf0e10cSrcweir virtual sal_Int64 GetValue() const; 311cdf0e10cSrcweir }; 312cdf0e10cSrcweir 313cdf0e10cSrcweir 314cdf0e10cSrcweir // ----------------- 315cdf0e10cSrcweir // - DateFormatter - 316cdf0e10cSrcweir // ----------------- 317cdf0e10cSrcweir 318cdf0e10cSrcweir class VCL_DLLPUBLIC DateFormatter : public FormatterBase 319cdf0e10cSrcweir { 320cdf0e10cSrcweir private: 321cdf0e10cSrcweir CalendarWrapper* mpCalendarWrapper; 322cdf0e10cSrcweir Date maFieldDate; 323cdf0e10cSrcweir Date maLastDate; 324cdf0e10cSrcweir Date maMin; 325cdf0e10cSrcweir Date maMax; 326cdf0e10cSrcweir Date maCorrectedDate; 327cdf0e10cSrcweir sal_Bool mbLongFormat; 328cdf0e10cSrcweir sal_Bool mbEmptyDate; 329cdf0e10cSrcweir sal_Bool mbShowDateCentury; 330cdf0e10cSrcweir sal_uInt16 mnDateFormat; 331cdf0e10cSrcweir sal_uLong mnExtDateFormat; 332cdf0e10cSrcweir sal_Bool mbEnforceValidValue; 333cdf0e10cSrcweir 334cdf0e10cSrcweir SAL_DLLPRIVATE void ImplInit(); 335cdf0e10cSrcweir 336cdf0e10cSrcweir protected: 337cdf0e10cSrcweir DateFormatter(); 338cdf0e10cSrcweir 339cdf0e10cSrcweir SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); ImplGetFieldDate() const340cdf0e10cSrcweir SAL_DLLPRIVATE const Date& ImplGetFieldDate() const { return maFieldDate; } 341cdf0e10cSrcweir SAL_DLLPRIVATE sal_Bool ImplDateReformat( const XubString& rStr, XubString& rOutStr, 342cdf0e10cSrcweir const AllSettings& rSettings ); 343cdf0e10cSrcweir SAL_DLLPRIVATE void ImplSetUserDate( const Date& rNewDate, 344cdf0e10cSrcweir Selection* pNewSelection = NULL ); 345cdf0e10cSrcweir SAL_DLLPRIVATE XubString ImplGetDateAsText( const Date& rDate, 346cdf0e10cSrcweir const AllSettings& rSettings ) const; 347cdf0e10cSrcweir SAL_DLLPRIVATE void ImplNewFieldValue( const Date& rDate ); 348cdf0e10cSrcweir CalendarWrapper& GetCalendarWrapper() const; 349cdf0e10cSrcweir 350cdf0e10cSrcweir SAL_DLLPRIVATE sal_Bool ImplAllowMalformedInput() const; 351cdf0e10cSrcweir 352cdf0e10cSrcweir public: 353cdf0e10cSrcweir ~DateFormatter(); 354cdf0e10cSrcweir 355cdf0e10cSrcweir virtual void Reformat(); 356cdf0e10cSrcweir virtual void ReformatAll(); 357cdf0e10cSrcweir 358cdf0e10cSrcweir virtual void SetLocale( const ::com::sun::star::lang::Locale& rLocale ); 359cdf0e10cSrcweir 360cdf0e10cSrcweir 361cdf0e10cSrcweir void SetExtDateFormat( ExtDateFieldFormat eFormat ); 362cdf0e10cSrcweir ExtDateFieldFormat GetExtDateFormat( sal_Bool bResolveSystemFormat = sal_False ) const; 363cdf0e10cSrcweir 364cdf0e10cSrcweir void SetMin( const Date& rNewMin ); GetMin() const365cdf0e10cSrcweir const Date& GetMin() const { return maMin; } 366cdf0e10cSrcweir 367cdf0e10cSrcweir void SetMax( const Date& rNewMax ); GetMax() const368cdf0e10cSrcweir const Date& GetMax() const { return maMax; } 369cdf0e10cSrcweir 370cdf0e10cSrcweir 371cdf0e10cSrcweir // -------------------------------------------------------------- 372cdf0e10cSrcweir // MT: Remove these methods too, ExtDateFormat should be enough! 373cdf0e10cSrcweir // What should happen if using DDMMYYYY, but ShowCentury=sal_False? 374cdf0e10cSrcweir // -------------------------------------------------------------- 375cdf0e10cSrcweir void SetLongFormat( sal_Bool bLong ); IsLongFormat() const376cdf0e10cSrcweir sal_Bool IsLongFormat() const { return mbLongFormat; } 377cdf0e10cSrcweir void SetShowDateCentury( sal_Bool bShowCentury ); IsShowDateCentury() const378cdf0e10cSrcweir sal_Bool IsShowDateCentury() const { return mbShowDateCentury; } 379cdf0e10cSrcweir // -------------------------------------------------------------- 380cdf0e10cSrcweir 381cdf0e10cSrcweir void SetDate( const Date& rNewDate ); 382cdf0e10cSrcweir void SetUserDate( const Date& rNewDate ); 383cdf0e10cSrcweir Date GetDate() const; 384cdf0e10cSrcweir Date GetRealDate() const; 385cdf0e10cSrcweir sal_Bool IsDateModified() const; 386cdf0e10cSrcweir void SetEmptyDate(); 387cdf0e10cSrcweir sal_Bool IsEmptyDate() const; GetCorrectedDate() const388cdf0e10cSrcweir Date GetCorrectedDate() const { return maCorrectedDate; } 389cdf0e10cSrcweir ResetLastDate()390cdf0e10cSrcweir void ResetLastDate() { maLastDate = Date( 0, 0, 0 ); } 391cdf0e10cSrcweir 392cdf0e10cSrcweir static void ExpandCentury( Date& rDate ); 393cdf0e10cSrcweir static void ExpandCentury( Date& rDate, sal_uInt16 nTwoDigitYearStart ); 394cdf0e10cSrcweir GetInvalidDate()395cdf0e10cSrcweir static Date GetInvalidDate() { return Date( 0, 0, 0 ); } 396cdf0e10cSrcweir 397cdf0e10cSrcweir /** enables or disables the enforcement of valid values 398cdf0e10cSrcweir 399cdf0e10cSrcweir If this is set to <TRUE/> (which is the default), then GetDate will always return a valid 400cdf0e10cSrcweir date, no matter whether the current text can really be interpreted as date. (Note: this 401cdf0e10cSrcweir is the compatible bahavior). 402cdf0e10cSrcweir 403cdf0e10cSrcweir If this is set to <FALSE/>, the GetDate will return GetInvalidDate, in case the current text 404cdf0e10cSrcweir cannot be interpreted as date. 405cdf0e10cSrcweir 406cdf0e10cSrcweir In addition, if this is set to <FALSE/>, the text in the field will <em>not</em> be corrected 407cdf0e10cSrcweir when the control loses the focus - instead, the invalid input will be preserved. 408cdf0e10cSrcweir */ EnforceValidValue(sal_Bool _bEnforce)409cdf0e10cSrcweir void EnforceValidValue( sal_Bool _bEnforce ) { mbEnforceValidValue = _bEnforce; } IsEnforceValidValue() const410cdf0e10cSrcweir inline sal_Bool IsEnforceValidValue( ) const { return mbEnforceValidValue; } 411cdf0e10cSrcweir }; 412cdf0e10cSrcweir 413cdf0e10cSrcweir 414cdf0e10cSrcweir // ----------------- 415cdf0e10cSrcweir // - TimeFormatter - 416cdf0e10cSrcweir // ----------------- 417cdf0e10cSrcweir 418cdf0e10cSrcweir class VCL_DLLPUBLIC TimeFormatter : public FormatterBase 419cdf0e10cSrcweir { 420cdf0e10cSrcweir private: 421cdf0e10cSrcweir Time maLastTime; 422cdf0e10cSrcweir Time maMin; 423cdf0e10cSrcweir Time maMax; 424cdf0e10cSrcweir Time maCorrectedTime; 425cdf0e10cSrcweir TimeFieldFormat meFormat; 426cdf0e10cSrcweir sal_uInt16 mnTimeFormat; 427cdf0e10cSrcweir sal_Bool mbDuration; 428cdf0e10cSrcweir sal_Bool mbEmptyTime; 429cdf0e10cSrcweir sal_Bool mbEnforceValidValue; 430cdf0e10cSrcweir 431cdf0e10cSrcweir SAL_DLLPRIVATE void ImplInit(); 432cdf0e10cSrcweir 433cdf0e10cSrcweir protected: 434cdf0e10cSrcweir Time maFieldTime; 435cdf0e10cSrcweir 436cdf0e10cSrcweir TimeFormatter(); 437cdf0e10cSrcweir 438cdf0e10cSrcweir SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); 439cdf0e10cSrcweir SAL_DLLPRIVATE sal_Bool ImplTimeReformat( const XubString& rStr, XubString& rOutStr ); 440cdf0e10cSrcweir SAL_DLLPRIVATE void ImplNewFieldValue( const Time& rTime ); 441cdf0e10cSrcweir SAL_DLLPRIVATE void ImplSetUserTime( const Time& rNewTime, Selection* pNewSelection = NULL ); 442cdf0e10cSrcweir SAL_DLLPRIVATE sal_Bool ImplAllowMalformedInput() const; 443cdf0e10cSrcweir 444cdf0e10cSrcweir public: 445cdf0e10cSrcweir 446cdf0e10cSrcweir enum TimeFormat { 447cdf0e10cSrcweir HOUR_12, 448cdf0e10cSrcweir HOUR_24 449cdf0e10cSrcweir }; 450cdf0e10cSrcweir 451cdf0e10cSrcweir ~TimeFormatter(); 452cdf0e10cSrcweir 453cdf0e10cSrcweir virtual void Reformat(); 454cdf0e10cSrcweir virtual void ReformatAll(); 455cdf0e10cSrcweir 456cdf0e10cSrcweir void SetMin( const Time& rNewMin ); GetMin() const457cdf0e10cSrcweir const Time& GetMin() const { return maMin; } 458cdf0e10cSrcweir void SetMax( const Time& rNewMax ); GetMax() const459cdf0e10cSrcweir const Time& GetMax() const { return maMax; } 460cdf0e10cSrcweir 461cdf0e10cSrcweir void SetTimeFormat( TimeFormat eNewFormat ); 462cdf0e10cSrcweir TimeFormat GetTimeFormat() const; 463cdf0e10cSrcweir 464cdf0e10cSrcweir void SetFormat( TimeFieldFormat eNewFormat ); GetFormat() const465cdf0e10cSrcweir TimeFieldFormat GetFormat() const { return meFormat; } 466cdf0e10cSrcweir 467cdf0e10cSrcweir void SetDuration( sal_Bool mbDuration ); IsDuration() const468cdf0e10cSrcweir sal_Bool IsDuration() const { return mbDuration; } 469cdf0e10cSrcweir 470cdf0e10cSrcweir void SetTime( const Time& rNewTime ); 471cdf0e10cSrcweir void SetUserTime( const Time& rNewTime ); 472cdf0e10cSrcweir Time GetTime() const; 473cdf0e10cSrcweir Time GetRealTime() const; 474cdf0e10cSrcweir sal_Bool IsTimeModified() const; SetEmptyTime()475cdf0e10cSrcweir void SetEmptyTime() { FormatterBase::SetEmptyFieldValue(); } IsEmptyTime() const476cdf0e10cSrcweir sal_Bool IsEmptyTime() const { return FormatterBase::IsEmptyFieldValue(); } GetCorrectedTime() const477cdf0e10cSrcweir Time GetCorrectedTime() const { return maCorrectedTime; } 478cdf0e10cSrcweir GetInvalidTime()479cdf0e10cSrcweir static Time GetInvalidTime() { return Time( 99, 99, 99 ); } 480cdf0e10cSrcweir 481cdf0e10cSrcweir /** enables or disables the enforcement of valid values 482cdf0e10cSrcweir 483cdf0e10cSrcweir If this is set to <TRUE/> (which is the default), then GetTime will always return a valid 484cdf0e10cSrcweir time, no matter whether the current text can really be interpreted as time. (Note: this 485cdf0e10cSrcweir is the compatible bahavior). 486cdf0e10cSrcweir 487cdf0e10cSrcweir If this is set to <FALSE/>, the GetTime will return GetInvalidTime, in case the current text 488cdf0e10cSrcweir cannot be interpreted as time. 489cdf0e10cSrcweir 490cdf0e10cSrcweir In addition, if this is set to <FALSE/>, the text in the field will <em>not</em> be corrected 491cdf0e10cSrcweir when the control loses the focus - instead, the invalid input will be preserved. 492cdf0e10cSrcweir */ EnforceValidValue(sal_Bool _bEnforce)493cdf0e10cSrcweir void EnforceValidValue( sal_Bool _bEnforce ) { mbEnforceValidValue = _bEnforce; } IsEnforceValidValue() const494cdf0e10cSrcweir inline sal_Bool IsEnforceValidValue( ) const { return mbEnforceValidValue; } 495cdf0e10cSrcweir }; 496cdf0e10cSrcweir 497cdf0e10cSrcweir 498cdf0e10cSrcweir // ---------------- 499cdf0e10cSrcweir // - PatternField - 500cdf0e10cSrcweir // ---------------- 501cdf0e10cSrcweir 502cdf0e10cSrcweir class VCL_DLLPUBLIC PatternField : public SpinField, public PatternFormatter 503cdf0e10cSrcweir { 504cdf0e10cSrcweir public: 505*e1beba7dSHerbert Dürr explicit PatternField( Window* pParent, WinBits nWinStyle ); 506*e1beba7dSHerbert Dürr explicit PatternField( Window* pParent, const ResId& ); 507*e1beba7dSHerbert Dürr virtual ~PatternField(); 508cdf0e10cSrcweir 509cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 510cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 511cdf0e10cSrcweir virtual void Modify(); 512cdf0e10cSrcweir }; 513cdf0e10cSrcweir 514cdf0e10cSrcweir 515cdf0e10cSrcweir // ---------------- 516cdf0e10cSrcweir // - NumericField - 517cdf0e10cSrcweir // ---------------- 518cdf0e10cSrcweir 519cdf0e10cSrcweir class VCL_DLLPUBLIC NumericField : public SpinField, public NumericFormatter 520cdf0e10cSrcweir { 521cdf0e10cSrcweir protected: 522cdf0e10cSrcweir SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); 523cdf0e10cSrcweir 524cdf0e10cSrcweir public: 525*e1beba7dSHerbert Dürr explicit NumericField( Window* pParent, WinBits nWinStyle ); 526*e1beba7dSHerbert Dürr explicit NumericField( Window* pParent, const ResId& ); 527*e1beba7dSHerbert Dürr virtual ~NumericField(); 528cdf0e10cSrcweir 529cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 530cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 531cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 532cdf0e10cSrcweir 533cdf0e10cSrcweir virtual void Modify(); 534cdf0e10cSrcweir 535cdf0e10cSrcweir virtual void Up(); 536cdf0e10cSrcweir virtual void Down(); 537cdf0e10cSrcweir virtual void First(); 538cdf0e10cSrcweir virtual void Last(); 539cdf0e10cSrcweir }; 540cdf0e10cSrcweir 541cdf0e10cSrcweir 542cdf0e10cSrcweir // ---------------- 543cdf0e10cSrcweir // - MetricField - 544cdf0e10cSrcweir // ---------------- 545cdf0e10cSrcweir 546cdf0e10cSrcweir class VCL_DLLPUBLIC MetricField : public SpinField, public MetricFormatter 547cdf0e10cSrcweir { 548cdf0e10cSrcweir protected: 549cdf0e10cSrcweir SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); 550cdf0e10cSrcweir 551cdf0e10cSrcweir public: 552*e1beba7dSHerbert Dürr explicit MetricField( Window* pParent, WinBits nWinStyle ); 553*e1beba7dSHerbert Dürr explicit MetricField( Window* pParent, const ResId& ); 554*e1beba7dSHerbert Dürr virtual ~MetricField(); 555cdf0e10cSrcweir 556cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 557cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 558cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 559cdf0e10cSrcweir 560cdf0e10cSrcweir virtual void Modify(); 561cdf0e10cSrcweir 562cdf0e10cSrcweir virtual void Up(); 563cdf0e10cSrcweir virtual void Down(); 564cdf0e10cSrcweir virtual void First(); 565cdf0e10cSrcweir virtual void Last(); 566cdf0e10cSrcweir virtual void CustomConvert(); 567cdf0e10cSrcweir 568cdf0e10cSrcweir void SetFirst( sal_Int64 nNewFirst, FieldUnit eInUnit ); SetFirst(sal_Int64 first)569cdf0e10cSrcweir inline void SetFirst(sal_Int64 first) { SetFirst(first, FUNIT_NONE); } 570cdf0e10cSrcweir sal_Int64 GetFirst( FieldUnit eOutUnit ) const; GetFirst() const571cdf0e10cSrcweir inline sal_Int64 GetFirst() const { return GetFirst(FUNIT_NONE); } 572cdf0e10cSrcweir void SetLast( sal_Int64 nNewLast, FieldUnit eInUnit ); SetLast(sal_Int64 last)573cdf0e10cSrcweir inline void SetLast(sal_Int64 last) { SetLast(last, FUNIT_NONE); } 574cdf0e10cSrcweir sal_Int64 GetLast( FieldUnit eOutUnit ) const; GetLast() const575cdf0e10cSrcweir inline sal_Int64 GetLast() const { return GetLast(FUNIT_NONE); } 576cdf0e10cSrcweir 577cdf0e10cSrcweir static void SetDefaultUnit( FieldUnit eDefaultUnit ); 578cdf0e10cSrcweir static FieldUnit GetDefaultUnit(); 579cdf0e10cSrcweir static sal_Int64 ConvertValue( sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits, 580cdf0e10cSrcweir FieldUnit eInUnit, FieldUnit eOutUnit ); 581cdf0e10cSrcweir static sal_Int64 ConvertValue( sal_Int64 nValue, sal_uInt16 nDecDigits, 582cdf0e10cSrcweir FieldUnit eInUnit, MapUnit eOutUnit ); 583cdf0e10cSrcweir static sal_Int64 ConvertValue( sal_Int64 nValue, sal_uInt16 nDecDigits, 584cdf0e10cSrcweir MapUnit eInUnit, FieldUnit eOutUnit ); 585cdf0e10cSrcweir 586cdf0e10cSrcweir // for backwards compatibility 587cdf0e10cSrcweir // caution: conversion to double loses precision 588cdf0e10cSrcweir static double ConvertDoubleValue( double nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits, 589cdf0e10cSrcweir FieldUnit eInUnit, FieldUnit eOutUnit ); 590cdf0e10cSrcweir static double ConvertDoubleValue( double nValue, sal_uInt16 nDecDigits, 591cdf0e10cSrcweir FieldUnit eInUnit, MapUnit eOutUnit ); 592cdf0e10cSrcweir static double ConvertDoubleValue( double nValue, sal_uInt16 nDecDigits, 593cdf0e10cSrcweir MapUnit eInUnit, FieldUnit eOutUnit ); 594cdf0e10cSrcweir 595cdf0e10cSrcweir // for backwards compatibility 596cdf0e10cSrcweir // caution: conversion to double loses precision ConvertDoubleValue(sal_Int64 nValue,sal_Int64 nBaseValue,sal_uInt16 nDecDigits,FieldUnit eInUnit,FieldUnit eOutUnit)597cdf0e10cSrcweir static double ConvertDoubleValue( sal_Int64 nValue, sal_Int64 nBaseValue, sal_uInt16 nDecDigits, 598cdf0e10cSrcweir FieldUnit eInUnit, FieldUnit eOutUnit ) 599cdf0e10cSrcweir { return ConvertDoubleValue( static_cast<double>(nValue), nBaseValue, nDecDigits, eInUnit, eOutUnit ); } ConvertDoubleValue(sal_Int64 nValue,sal_uInt16 nDecDigits,FieldUnit eInUnit,MapUnit eOutUnit)600cdf0e10cSrcweir static double ConvertDoubleValue( sal_Int64 nValue, sal_uInt16 nDecDigits, 601cdf0e10cSrcweir FieldUnit eInUnit, MapUnit eOutUnit ) 602cdf0e10cSrcweir { return ConvertDoubleValue( static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit ); } ConvertDoubleValue(sal_Int64 nValue,sal_uInt16 nDecDigits,MapUnit eInUnit,FieldUnit eOutUnit)603cdf0e10cSrcweir static double ConvertDoubleValue( sal_Int64 nValue, sal_uInt16 nDecDigits, 604cdf0e10cSrcweir MapUnit eInUnit, FieldUnit eOutUnit ) 605cdf0e10cSrcweir { return ConvertDoubleValue( static_cast<double>(nValue), nDecDigits, eInUnit, eOutUnit ); } 606cdf0e10cSrcweir }; 607cdf0e10cSrcweir 608cdf0e10cSrcweir 609cdf0e10cSrcweir // ----------------- 610cdf0e10cSrcweir // - CurrencyField - 611cdf0e10cSrcweir // ----------------- 612cdf0e10cSrcweir 613cdf0e10cSrcweir class VCL_DLLPUBLIC CurrencyField : public SpinField, public CurrencyFormatter 614cdf0e10cSrcweir { 615cdf0e10cSrcweir protected: 616cdf0e10cSrcweir SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); 617cdf0e10cSrcweir 618cdf0e10cSrcweir public: 619*e1beba7dSHerbert Dürr explicit CurrencyField( Window* pParent, WinBits nWinStyle ); 620*e1beba7dSHerbert Dürr explicit CurrencyField( Window* pParent, const ResId& ); 621*e1beba7dSHerbert Dürr virtual ~CurrencyField(); 622cdf0e10cSrcweir 623cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 624cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 625cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 626cdf0e10cSrcweir 627cdf0e10cSrcweir virtual void Modify(); 628cdf0e10cSrcweir 629cdf0e10cSrcweir virtual void Up(); 630cdf0e10cSrcweir virtual void Down(); 631cdf0e10cSrcweir virtual void First(); 632cdf0e10cSrcweir virtual void Last(); 633cdf0e10cSrcweir }; 634cdf0e10cSrcweir 635cdf0e10cSrcweir 636cdf0e10cSrcweir // ------------- 637cdf0e10cSrcweir // - DateField - 638cdf0e10cSrcweir // ------------- 639cdf0e10cSrcweir 640cdf0e10cSrcweir class VCL_DLLPUBLIC DateField : public SpinField, public DateFormatter 641cdf0e10cSrcweir { 642cdf0e10cSrcweir private: 643cdf0e10cSrcweir Date maFirst; 644cdf0e10cSrcweir Date maLast; 645cdf0e10cSrcweir 646cdf0e10cSrcweir protected: 647cdf0e10cSrcweir SAL_DLLPRIVATE void ImplDateSpinArea( sal_Bool bUp ); 648cdf0e10cSrcweir SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); 649cdf0e10cSrcweir 650cdf0e10cSrcweir public: 651*e1beba7dSHerbert Dürr explicit DateField( Window* pParent, WinBits nWinStyle ); 652*e1beba7dSHerbert Dürr explicit DateField( Window* pParent, const ResId& ); 653*e1beba7dSHerbert Dürr virtual ~DateField(); 654cdf0e10cSrcweir 655cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 656cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 657cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 658cdf0e10cSrcweir 659cdf0e10cSrcweir virtual void Modify(); 660cdf0e10cSrcweir 661cdf0e10cSrcweir virtual void Up(); 662cdf0e10cSrcweir virtual void Down(); 663cdf0e10cSrcweir virtual void First(); 664cdf0e10cSrcweir virtual void Last(); 665cdf0e10cSrcweir SetFirst(const Date & rNewFirst)666cdf0e10cSrcweir void SetFirst( const Date& rNewFirst ) { maFirst = rNewFirst; } GetFirst() const667cdf0e10cSrcweir Date GetFirst() const { return maFirst; } SetLast(const Date & rNewLast)668cdf0e10cSrcweir void SetLast( const Date& rNewLast ) { maLast = rNewLast; } GetLast() const669cdf0e10cSrcweir Date GetLast() const { return maLast; } 670cdf0e10cSrcweir }; 671cdf0e10cSrcweir 672cdf0e10cSrcweir // ------------- 673cdf0e10cSrcweir // - TimeField - 674cdf0e10cSrcweir // ------------- 675cdf0e10cSrcweir 676cdf0e10cSrcweir class VCL_DLLPUBLIC TimeField : public SpinField, public TimeFormatter 677cdf0e10cSrcweir { 678cdf0e10cSrcweir private: 679cdf0e10cSrcweir Time maFirst; 680cdf0e10cSrcweir Time maLast; 681cdf0e10cSrcweir 682cdf0e10cSrcweir protected: 683cdf0e10cSrcweir SAL_DLLPRIVATE void ImplTimeSpinArea( sal_Bool bUp ); 684cdf0e10cSrcweir SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); 685cdf0e10cSrcweir 686cdf0e10cSrcweir public: 687*e1beba7dSHerbert Dürr explicit TimeField( Window* pParent, WinBits nWinStyle ); 688*e1beba7dSHerbert Dürr explicit TimeField( Window* pParent, const ResId& ); 689*e1beba7dSHerbert Dürr virtual ~TimeField(); 690cdf0e10cSrcweir 691cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 692cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 693cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 694cdf0e10cSrcweir 695cdf0e10cSrcweir virtual void Modify(); 696cdf0e10cSrcweir 697cdf0e10cSrcweir virtual void Up(); 698cdf0e10cSrcweir virtual void Down(); 699cdf0e10cSrcweir virtual void First(); 700cdf0e10cSrcweir virtual void Last(); 701cdf0e10cSrcweir SetFirst(const Time & rNewFirst)702cdf0e10cSrcweir void SetFirst( const Time& rNewFirst ) { maFirst = rNewFirst; } GetFirst() const703cdf0e10cSrcweir Time GetFirst() const { return maFirst; } SetLast(const Time & rNewLast)704cdf0e10cSrcweir void SetLast( const Time& rNewLast ) { maLast = rNewLast; } GetLast() const705cdf0e10cSrcweir Time GetLast() const { return maLast; } 706cdf0e10cSrcweir 707cdf0e10cSrcweir void SetExtFormat( ExtTimeFieldFormat eFormat ); 708cdf0e10cSrcweir }; 709cdf0e10cSrcweir 710cdf0e10cSrcweir 711cdf0e10cSrcweir // -------------- 712cdf0e10cSrcweir // - PatternBox - 713cdf0e10cSrcweir // -------------- 714cdf0e10cSrcweir 715cdf0e10cSrcweir class VCL_DLLPUBLIC PatternBox : public ComboBox, public PatternFormatter 716cdf0e10cSrcweir { 717cdf0e10cSrcweir public: 718*e1beba7dSHerbert Dürr explicit PatternBox( Window* pParent, WinBits nWinStyle ); 719*e1beba7dSHerbert Dürr explicit PatternBox( Window* pParent, const ResId& ); 720*e1beba7dSHerbert Dürr virtual ~PatternBox(); 721cdf0e10cSrcweir 722cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 723cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 724cdf0e10cSrcweir 725cdf0e10cSrcweir virtual void Modify(); 726cdf0e10cSrcweir 727cdf0e10cSrcweir virtual void ReformatAll(); 728cdf0e10cSrcweir 729cdf0e10cSrcweir void InsertString( const XubString& rStr, 730cdf0e10cSrcweir sal_uInt16 nPos = COMBOBOX_APPEND ); 731cdf0e10cSrcweir void RemoveString( const XubString& rStr ); 732cdf0e10cSrcweir using PatternFormatter::GetString; 733cdf0e10cSrcweir XubString GetString( sal_uInt16 nPos ) const; 734cdf0e10cSrcweir sal_uInt16 GetStringPos( const XubString& rStr ) const; 735cdf0e10cSrcweir }; 736cdf0e10cSrcweir 737cdf0e10cSrcweir 738cdf0e10cSrcweir // -------------- 739cdf0e10cSrcweir // - NumericBox - 740cdf0e10cSrcweir // -------------- 741cdf0e10cSrcweir 742cdf0e10cSrcweir class VCL_DLLPUBLIC NumericBox : public ComboBox, public NumericFormatter 743cdf0e10cSrcweir { 744cdf0e10cSrcweir public: 745*e1beba7dSHerbert Dürr explicit NumericBox( Window* pParent, WinBits nWinStyle ); 746*e1beba7dSHerbert Dürr explicit NumericBox( Window* pParent, const ResId& ); 747*e1beba7dSHerbert Dürr virtual ~NumericBox(); 748cdf0e10cSrcweir 749cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 750cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 751cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 752cdf0e10cSrcweir 753cdf0e10cSrcweir virtual void Modify(); 754cdf0e10cSrcweir 755cdf0e10cSrcweir virtual void ReformatAll(); 756cdf0e10cSrcweir 757cdf0e10cSrcweir void InsertValue( sal_Int64 nValue, sal_uInt16 nPos = COMBOBOX_APPEND ); 758cdf0e10cSrcweir void RemoveValue( sal_Int64 nValue ); 759cdf0e10cSrcweir using NumericFormatter::GetValue; 760cdf0e10cSrcweir sal_Int64 GetValue( sal_uInt16 nPos ) const; 761cdf0e10cSrcweir sal_uInt16 GetValuePos( sal_Int64 nPos ) const; 762cdf0e10cSrcweir }; 763cdf0e10cSrcweir 764cdf0e10cSrcweir 765cdf0e10cSrcweir // ------------- 766cdf0e10cSrcweir // - MetricBox - 767cdf0e10cSrcweir // ------------- 768cdf0e10cSrcweir 769cdf0e10cSrcweir class VCL_DLLPUBLIC MetricBox : public ComboBox, public MetricFormatter 770cdf0e10cSrcweir { 771cdf0e10cSrcweir public: 772*e1beba7dSHerbert Dürr explicit MetricBox( Window* pParent, WinBits nWinStyle ); 773*e1beba7dSHerbert Dürr explicit MetricBox( Window* pParent, const ResId& ); 774*e1beba7dSHerbert Dürr virtual ~MetricBox(); 775cdf0e10cSrcweir 776cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 777cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 778cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 779cdf0e10cSrcweir 780cdf0e10cSrcweir virtual void Modify(); 781cdf0e10cSrcweir 782cdf0e10cSrcweir virtual void CustomConvert(); 783cdf0e10cSrcweir virtual void ReformatAll(); 784cdf0e10cSrcweir 785cdf0e10cSrcweir void InsertValue( sal_Int64 nValue, FieldUnit eInUnit = FUNIT_NONE, 786cdf0e10cSrcweir sal_uInt16 nPos = COMBOBOX_APPEND ); 787cdf0e10cSrcweir void RemoveValue( sal_Int64 nValue, FieldUnit eInUnit = FUNIT_NONE ); 788cdf0e10cSrcweir sal_Int64 GetValue( sal_uInt16 nPos, FieldUnit eOutUnit = FUNIT_NONE ) const; 789cdf0e10cSrcweir sal_uInt16 GetValuePos( sal_Int64 nValue, 790cdf0e10cSrcweir FieldUnit eInUnit = FUNIT_NONE ) const; 791cdf0e10cSrcweir 792cdf0e10cSrcweir // Needed, because GetValue() with nPos hide these functions 793cdf0e10cSrcweir virtual sal_Int64 GetValue( FieldUnit eOutUnit ) const; 794cdf0e10cSrcweir virtual sal_Int64 GetValue() const; 795cdf0e10cSrcweir }; 796cdf0e10cSrcweir 797cdf0e10cSrcweir 798cdf0e10cSrcweir // --------------- 799cdf0e10cSrcweir // - CurrencyBox - 800cdf0e10cSrcweir // --------------- 801cdf0e10cSrcweir 802cdf0e10cSrcweir class VCL_DLLPUBLIC CurrencyBox : public ComboBox, public CurrencyFormatter 803cdf0e10cSrcweir { 804cdf0e10cSrcweir public: 805*e1beba7dSHerbert Dürr explicit CurrencyBox( Window* pParent, WinBits nWinStyle ); 806*e1beba7dSHerbert Dürr explicit CurrencyBox( Window* pParent, const ResId& ); 807*e1beba7dSHerbert Dürr virtual ~CurrencyBox(); 808cdf0e10cSrcweir 809cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 810cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 811cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 812cdf0e10cSrcweir 813cdf0e10cSrcweir virtual void Modify(); 814cdf0e10cSrcweir 815cdf0e10cSrcweir virtual void ReformatAll(); 816cdf0e10cSrcweir 817cdf0e10cSrcweir void InsertValue( sal_Int64 nValue, sal_uInt16 nPos = COMBOBOX_APPEND ); 818cdf0e10cSrcweir void RemoveValue( sal_Int64 nValue ); 819cdf0e10cSrcweir sal_Int64 GetValue( sal_uInt16 nPos ) const; 820cdf0e10cSrcweir sal_uInt16 GetValuePos( sal_Int64 nValue ) const; 821cdf0e10cSrcweir 822cdf0e10cSrcweir // Needed, because GetValue() with nPos hide this function 823cdf0e10cSrcweir virtual sal_Int64 GetValue() const; 824cdf0e10cSrcweir }; 825cdf0e10cSrcweir 826cdf0e10cSrcweir 827cdf0e10cSrcweir // ----------- 828cdf0e10cSrcweir // - DateBox - 829cdf0e10cSrcweir // ----------- 830cdf0e10cSrcweir 831cdf0e10cSrcweir class VCL_DLLPUBLIC DateBox : public ComboBox, public DateFormatter 832cdf0e10cSrcweir { 833cdf0e10cSrcweir public: 834*e1beba7dSHerbert Dürr explicit DateBox( Window* pParent, WinBits nWinStyle ); 835*e1beba7dSHerbert Dürr explicit DateBox( Window* pParent, const ResId& ); 836*e1beba7dSHerbert Dürr virtual ~DateBox(); 837cdf0e10cSrcweir 838cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 839cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 840cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 841cdf0e10cSrcweir 842cdf0e10cSrcweir virtual void Modify(); 843cdf0e10cSrcweir 844cdf0e10cSrcweir virtual void ReformatAll(); 845cdf0e10cSrcweir 846cdf0e10cSrcweir void InsertDate( const Date& rDate, sal_uInt16 nPos = COMBOBOX_APPEND ); 847cdf0e10cSrcweir void RemoveDate( const Date& rDate ); 848cdf0e10cSrcweir using DateFormatter::GetDate; 849cdf0e10cSrcweir Date GetDate( sal_uInt16 nPos ) const; 850cdf0e10cSrcweir sal_uInt16 GetDatePos( const Date& rDate ) const; 851cdf0e10cSrcweir }; 852cdf0e10cSrcweir 853cdf0e10cSrcweir 854cdf0e10cSrcweir // ----------- 855cdf0e10cSrcweir // - TimeBox - 856cdf0e10cSrcweir // ----------- 857cdf0e10cSrcweir 858cdf0e10cSrcweir class VCL_DLLPUBLIC TimeBox : public ComboBox, public TimeFormatter 859cdf0e10cSrcweir { 860cdf0e10cSrcweir public: 861*e1beba7dSHerbert Dürr explicit TimeBox( Window* pParent, WinBits nWinStyle ); 862*e1beba7dSHerbert Dürr explicit TimeBox( Window* pParent, const ResId& ); 863*e1beba7dSHerbert Dürr virtual ~TimeBox(); 864cdf0e10cSrcweir 865cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 866cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 867cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 868cdf0e10cSrcweir 869cdf0e10cSrcweir virtual void Modify(); 870cdf0e10cSrcweir 871cdf0e10cSrcweir virtual void ReformatAll(); 872cdf0e10cSrcweir 873cdf0e10cSrcweir void InsertTime( const Time& rTime, sal_uInt16 nPos = COMBOBOX_APPEND ); 874cdf0e10cSrcweir void RemoveTime( const Time& rTime ); 875cdf0e10cSrcweir using TimeFormatter::GetTime; 876cdf0e10cSrcweir Time GetTime( sal_uInt16 nPos ) const; 877cdf0e10cSrcweir sal_uInt16 GetTimePos( const Time& rTime ) const; 878cdf0e10cSrcweir }; 879cdf0e10cSrcweir 880cdf0e10cSrcweir #endif // _SV_FIELD_HXX 881