LCOV - code coverage report
Current view: top level - libreoffice/sw/inc - flddat.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 6 50.0 %
Date: 2012-12-27 Functions: 5 7 71.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef SW_FLDDAT_HXX
      21             : #define SW_FLDDAT_HXX
      22             : 
      23             : #include <tools/string.hxx>
      24             : 
      25             : #include "fldbas.hxx"
      26             : 
      27             : class DateTime;
      28             : class Date;
      29             : class Time;
      30             : 
      31             : 
      32             : enum SwDateFormat
      33             : {
      34             :     DF_BEGIN,
      35             :     // new formats
      36             :     DFF_SSYS = DF_BEGIN,
      37             :     DFF_LSYS ,
      38             :     DFF_DMY ,
      39             :     DFF_DMYY ,
      40             :     DFF_DMMY ,
      41             :     DFF_DMMYY,
      42             :     DFF_DMMMY ,
      43             :     DFF_DMMMYY,
      44             :     DFF_DDMMY ,
      45             :     DFF_DDMMMY ,
      46             :     DFF_DDMMMYY ,
      47             :     DFF_DDDMMMY ,
      48             :     DFF_DDDMMMYY ,
      49             :     DFF_MY ,
      50             :     DFF_MD ,
      51             :     DFF_YMD ,
      52             :     DFF_YYMD ,
      53             :     DF_END ,
      54             :     // Compatibility
      55             :     DF_SSYS     = DFF_SSYS,
      56             :     DF_LSYS     = DFF_LSYS,
      57             :     DF_SHORT    = DFF_DMY,
      58             :     DF_SCENT    = DFF_DMYY,
      59             :     DF_LMON     = DFF_DMMYY,
      60             :     DF_LMONTH   = DFF_DMMMYY,
      61             :     DF_LDAYMON  = DFF_DDMMMYY,
      62             :     DF_LDAYMONTH= DFF_DDDMMMYY
      63             : };
      64             : 
      65             : enum SwTimeFormat
      66             : {
      67             :     TF_BEGIN,
      68             :     TF_SYSTEM=TF_BEGIN,
      69             :     TF_SSMM_24,
      70             :     TF_SSMM_12,
      71             :     TF_END
      72             : };
      73             : 
      74             : enum SwTimeSubFormat
      75             : {
      76             :     TIME_FIX,
      77             :     TIME_VAR
      78             : };
      79             : 
      80             : enum SwDateSubFormat
      81             : {
      82             :     DATE_FIX,
      83             :     DATE_VAR
      84             : };
      85             : 
      86             : 
      87         204 : class SwDateTimeFieldType : public SwValueFieldType
      88             : {
      89             : public:
      90             :         SwDateTimeFieldType(SwDoc* pDoc);
      91             : 
      92             :         virtual SwFieldType*    Copy() const;
      93             : };
      94             : 
      95             : 
      96           8 : class SW_DLLPUBLIC SwDateTimeField : public SwValueField
      97             : {
      98             :         sal_uInt16              nSubType;
      99             :         long                nOffset;    // Offset in minutes.
     100             : 
     101             :         virtual String      Expand() const;
     102             :         virtual SwField*    Copy() const;
     103             : 
     104             : public:
     105             :         SwDateTimeField(SwDateTimeFieldType* pType, sal_uInt16 nSubType = DATEFLD,
     106             :                     sal_uLong nFmt = 0, sal_uInt16 nLng = 0);
     107             : 
     108             :         virtual sal_uInt16          GetSubType() const;
     109             :         virtual void            SetSubType(sal_uInt16 nSub);
     110             : 
     111             :         virtual double          GetValue() const;
     112             : 
     113             :         virtual void            SetPar2(const rtl::OUString& rStr);
     114             :         virtual rtl::OUString   GetPar2() const;
     115             : 
     116           0 :         inline sal_Bool             IsDate() const
     117           0 :                                 { return (nSubType & DATEFLD) != 0; }
     118             : 
     119           5 :         inline void             SetOffset(long nMinutes)    { nOffset = nMinutes; }
     120           0 :         inline long             GetOffset() const           { return nOffset; }
     121             : 
     122             :         Date                    GetDate(sal_Bool bUseOffset = sal_False) const;
     123             :         Time                    GetTime(sal_Bool bUseOffset = sal_False) const;
     124             :         void                    SetDateTime(const DateTime& rDT);
     125             :         static double           GetDateTime(SwDoc* pDoc, const DateTime& rDT);
     126             : 
     127             :         virtual bool            QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nMId ) const;
     128             :         virtual bool            PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nMId );
     129             : };
     130             : 
     131             : #endif // SW_FLDDAT_HXX
     132             : 
     133             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10