1*1d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*1d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*1d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*1d2dbeb0SAndrew Rist * distributed with this work for additional information 6*1d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*1d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*1d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 9*1d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 10*1d2dbeb0SAndrew Rist * 11*1d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*1d2dbeb0SAndrew Rist * 13*1d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*1d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 15*1d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*1d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 17*1d2dbeb0SAndrew Rist * specific language governing permissions and limitations 18*1d2dbeb0SAndrew Rist * under the License. 19*1d2dbeb0SAndrew Rist * 20*1d2dbeb0SAndrew Rist *************************************************************/ 21*1d2dbeb0SAndrew Rist 22*1d2dbeb0SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SW_FLDDAT_HXX 25cdf0e10cSrcweir #define SW_FLDDAT_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <tools/string.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include "fldbas.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir class DateTime; 32cdf0e10cSrcweir class Date; 33cdf0e10cSrcweir class Time; 34cdf0e10cSrcweir 35cdf0e10cSrcweir /*-------------------------------------------------------------------- 36cdf0e10cSrcweir Beschreibung: Formate 37cdf0e10cSrcweir --------------------------------------------------------------------*/ 38cdf0e10cSrcweir 39cdf0e10cSrcweir enum SwDateFormat 40cdf0e10cSrcweir { 41cdf0e10cSrcweir DF_BEGIN, 42cdf0e10cSrcweir //neue Formate: 43cdf0e10cSrcweir DFF_SSYS = DF_BEGIN, 44cdf0e10cSrcweir DFF_LSYS , 45cdf0e10cSrcweir DFF_DMY , 46cdf0e10cSrcweir DFF_DMYY , 47cdf0e10cSrcweir DFF_DMMY , 48cdf0e10cSrcweir DFF_DMMYY, 49cdf0e10cSrcweir DFF_DMMMY , 50cdf0e10cSrcweir DFF_DMMMYY, 51cdf0e10cSrcweir DFF_DDMMY , 52cdf0e10cSrcweir DFF_DDMMMY , 53cdf0e10cSrcweir DFF_DDMMMYY , 54cdf0e10cSrcweir DFF_DDDMMMY , 55cdf0e10cSrcweir DFF_DDDMMMYY , 56cdf0e10cSrcweir DFF_MY , 57cdf0e10cSrcweir DFF_MD , 58cdf0e10cSrcweir DFF_YMD , 59cdf0e10cSrcweir DFF_YYMD , 60cdf0e10cSrcweir DF_END , 61cdf0e10cSrcweir // Kompatibilitaet: 62cdf0e10cSrcweir DF_SSYS = DFF_SSYS, 63cdf0e10cSrcweir DF_LSYS = DFF_LSYS, 64cdf0e10cSrcweir DF_SHORT = DFF_DMY, 65cdf0e10cSrcweir DF_SCENT = DFF_DMYY, 66cdf0e10cSrcweir DF_LMON = DFF_DMMYY, 67cdf0e10cSrcweir DF_LMONTH = DFF_DMMMYY, 68cdf0e10cSrcweir DF_LDAYMON = DFF_DDMMMYY, 69cdf0e10cSrcweir DF_LDAYMONTH= DFF_DDDMMMYY 70cdf0e10cSrcweir }; 71cdf0e10cSrcweir 72cdf0e10cSrcweir enum SwTimeFormat 73cdf0e10cSrcweir { 74cdf0e10cSrcweir TF_BEGIN, 75cdf0e10cSrcweir TF_SYSTEM=TF_BEGIN, 76cdf0e10cSrcweir TF_SSMM_24, 77cdf0e10cSrcweir TF_SSMM_12, 78cdf0e10cSrcweir TF_END 79cdf0e10cSrcweir }; 80cdf0e10cSrcweir 81cdf0e10cSrcweir enum SwTimeSubFormat 82cdf0e10cSrcweir { 83cdf0e10cSrcweir TIME_FIX, 84cdf0e10cSrcweir TIME_VAR 85cdf0e10cSrcweir }; 86cdf0e10cSrcweir 87cdf0e10cSrcweir enum SwDateSubFormat 88cdf0e10cSrcweir { 89cdf0e10cSrcweir DATE_FIX, 90cdf0e10cSrcweir DATE_VAR 91cdf0e10cSrcweir }; 92cdf0e10cSrcweir 93cdf0e10cSrcweir /*-------------------------------------------------------------------- 94cdf0e10cSrcweir Beschreibung: Datum/Uhrzeitfeld 95cdf0e10cSrcweir --------------------------------------------------------------------*/ 96cdf0e10cSrcweir 97cdf0e10cSrcweir class SwDateTimeFieldType : public SwValueFieldType 98cdf0e10cSrcweir { 99cdf0e10cSrcweir public: 100cdf0e10cSrcweir SwDateTimeFieldType(SwDoc* pDoc); 101cdf0e10cSrcweir 102cdf0e10cSrcweir virtual SwFieldType* Copy() const; 103cdf0e10cSrcweir }; 104cdf0e10cSrcweir 105cdf0e10cSrcweir /*-------------------------------------------------------------------- 106cdf0e10cSrcweir Beschreibung: Datum/Uhrzeitfeld 107cdf0e10cSrcweir --------------------------------------------------------------------*/ 108cdf0e10cSrcweir 109cdf0e10cSrcweir class SW_DLLPUBLIC SwDateTimeField : public SwValueField 110cdf0e10cSrcweir { 111cdf0e10cSrcweir sal_uInt16 nSubType; 112cdf0e10cSrcweir long nOffset; // Offset in Minuten 113cdf0e10cSrcweir 114cdf0e10cSrcweir virtual String Expand() const; 115cdf0e10cSrcweir virtual SwField* Copy() const; 116cdf0e10cSrcweir 117cdf0e10cSrcweir public: 118cdf0e10cSrcweir SwDateTimeField(SwDateTimeFieldType* pType, sal_uInt16 nSubType = DATEFLD, 119cdf0e10cSrcweir sal_uLong nFmt = 0, sal_uInt16 nLng = 0); 120cdf0e10cSrcweir 121cdf0e10cSrcweir virtual sal_uInt16 GetSubType() const; 122cdf0e10cSrcweir virtual void SetSubType(sal_uInt16 nSub); 123cdf0e10cSrcweir 124cdf0e10cSrcweir virtual double GetValue() const; 125cdf0e10cSrcweir 126cdf0e10cSrcweir virtual void SetPar2(const String& rStr); 127cdf0e10cSrcweir virtual String GetPar2() const; 128cdf0e10cSrcweir IsDate() const129cdf0e10cSrcweir inline sal_Bool IsDate() const 130cdf0e10cSrcweir { return (nSubType & DATEFLD) != 0; } 131cdf0e10cSrcweir SetOffset(long nMinutes)132cdf0e10cSrcweir inline void SetOffset(long nMinutes) { nOffset = nMinutes; } GetOffset() const133cdf0e10cSrcweir inline long GetOffset() const { return nOffset; } 134cdf0e10cSrcweir 135cdf0e10cSrcweir Date GetDate(sal_Bool bUseOffset = sal_False) const; 136cdf0e10cSrcweir Time GetTime(sal_Bool bUseOffset = sal_False) const; 137cdf0e10cSrcweir void SetDateTime(const DateTime& rDT); 138cdf0e10cSrcweir static double GetDateTime(SwDoc* pDoc, const DateTime& rDT); 139cdf0e10cSrcweir 140cdf0e10cSrcweir virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nMId ) const; 141cdf0e10cSrcweir virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nMId ); 142cdf0e10cSrcweir }; 143cdf0e10cSrcweir 144cdf0e10cSrcweir #endif // SW_FLDDAT_HXX 145