LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/editeng - flditem.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 31 59 52.5 %
Date: 2012-12-27 Functions: 47 79 59.5 %
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             : #ifndef _SVX_FLDITEM_HXX
      20             : #define _SVX_FLDITEM_HXX
      21             : 
      22             : #include <i18npool/lang.h>
      23             : #include <tools/time.hxx>
      24             : #include <tools/date.hxx>
      25             : #include <svl/poolitem.hxx>
      26             : #include <tools/pstm.hxx>
      27             : #include "editeng/editengdllapi.h"
      28             : 
      29             : #include <com/sun/star/text/textfield/Type.hpp>
      30             : 
      31             : namespace com { namespace sun { namespace star { namespace text {
      32             : 
      33             : class XTextContent;
      34             : 
      35             : }}}}
      36             : 
      37             : class SvNumberFormatter;
      38             : class MetaAction;
      39             : 
      40             : // class SvxFieldItem ---------------------------------------------------
      41             : 
      42             : 
      43             : 
      44         880 : class EDITENG_DLLPUBLIC SvxFieldData : public SvPersistBase
      45             : {
      46             : public:
      47             :     static const sal_Int32 UNKNOWN_FIELD;
      48             : 
      49             :     static SvxFieldData* Create(const com::sun::star::uno::Reference<com::sun::star::text::XTextContent>& xContent);
      50             : 
      51          18 :     SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, com::sun::star::text::textfield::Type::UNSPECIFIED)
      52             : 
      53             :                             SvxFieldData();
      54             :     virtual                 ~SvxFieldData();
      55             : 
      56             :     virtual SvxFieldData*   Clone() const;
      57             :     virtual int             operator==( const SvxFieldData& ) const;
      58             : 
      59             :     virtual MetaAction* createBeginComment() const;
      60             :     virtual MetaAction* createEndComment() const;
      61             : };
      62             : 
      63             : /**
      64             :  * This item stores a field (SvxFieldData).  The field is controlled by or
      65             :  * belongs to the item.  The field itself is determined by a derivation from
      66             :  * SvxFieldData (RTTI)
      67             :  */
      68             : class EDITENG_DLLPUBLIC SvxFieldItem : public SfxPoolItem
      69             : {
      70             : private:
      71             :     SvxFieldData*           pField;
      72             : 
      73             :                     EDITENG_DLLPRIVATE SvxFieldItem( SvxFieldData* pField, const sal_uInt16 nId );
      74             : 
      75             : public:
      76             :             TYPEINFO();
      77             : 
      78             :             SvxFieldItem( const SvxFieldData& rField, const sal_uInt16 nId  );
      79             :             SvxFieldItem( const SvxFieldItem& rItem );
      80             :             ~SvxFieldItem();
      81             : 
      82             :     virtual int             operator==( const SfxPoolItem& ) const;
      83             :     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
      84             :     virtual SfxPoolItem*    Create( SvStream&, sal_uInt16 nVer ) const;
      85             :     virtual SvStream&       Store( SvStream& , sal_uInt16 nItemVersion ) const;
      86             : 
      87       15182 :     const SvxFieldData*     GetField() const    { return pField; }
      88             :     static SvClassManager&  GetClassManager();
      89             : };
      90             : 
      91             : // =================================================================
      92             : // The following are the derivatives of SvxFieldData ...
      93             : // =================================================================
      94             : 
      95             : enum SvxDateType { SVXDATETYPE_FIX, SVXDATETYPE_VAR };
      96             : enum SvxDateFormat {    SVXDATEFORMAT_APPDEFAULT = 0,   // Set as in App
      97             :                         SVXDATEFORMAT_SYSTEM,       // Set as in System
      98             :                         SVXDATEFORMAT_STDSMALL,
      99             :                         SVXDATEFORMAT_STDBIG,
     100             :                         SVXDATEFORMAT_A,    // 13.02.96
     101             :                         SVXDATEFORMAT_B,    // 13.02.1996
     102             :                         SVXDATEFORMAT_C,    // 13.Feb 1996
     103             :                         SVXDATEFORMAT_D,    // 13.February 1996
     104             :                         SVXDATEFORMAT_E,    // Tue, 13.February 1996
     105             :                         SVXDATEFORMAT_F     // Tuesday, 13.February 1996
     106             :                     };
     107             : 
     108        2061 : class EDITENG_DLLPUBLIC SvxDateField : public SvxFieldData
     109             : {
     110             :     sal_uInt32              nFixDate;
     111             :     SvxDateType             eType;
     112             :     SvxDateFormat           eFormat;
     113             : 
     114             : public:
     115          32 :     SV_DECL_PERSIST1( SvxDateField, SvxFieldData, com::sun::star::text::textfield::Type::DATE )
     116             : 
     117             :                             SvxDateField();
     118             :     explicit                SvxDateField( const Date& rDate,
     119             :                                 SvxDateType eType = SVXDATETYPE_VAR,
     120             :                                 SvxDateFormat eFormat = SVXDATEFORMAT_STDSMALL );
     121             : 
     122           0 :     sal_uInt32              GetFixDate() const { return nFixDate; }
     123           0 :     void                    SetFixDate( const Date& rDate ) { nFixDate = rDate.GetDate(); }
     124             : 
     125           4 :     SvxDateType             GetType() const { return eType; }
     126           0 :     void                    SetType( SvxDateType eTp ) { eType = eTp; }
     127             : 
     128           4 :     SvxDateFormat           GetFormat() const { return eFormat; }
     129           1 :     void                    SetFormat( SvxDateFormat eFmt ) { eFormat = eFmt; }
     130             : 
     131             :                             // If eLanguage==LANGUAGE_DONTKNOW the language/country
     132             :                             // used in number formatter initialization is taken.
     133             :     rtl::OUString           GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
     134             :     static rtl::OUString    GetFormatted( Date& rDate, SvxDateFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
     135             : 
     136             :     virtual SvxFieldData*   Clone() const;
     137             :     virtual int             operator==( const SvxFieldData& ) const;
     138             : 
     139             :     virtual MetaAction* createBeginComment() const;
     140             : };
     141             : 
     142             : 
     143             : enum SvxURLFormat   {   SVXURLFORMAT_APPDEFAULT = 0,    // Set as in App
     144             :                         SVXURLFORMAT_URL,           // Represent URL
     145             :                         SVXURLFORMAT_REPR           // Constitute repraesentation
     146             :                     };
     147             : 
     148          80 : class EDITENG_DLLPUBLIC SvxURLField : public SvxFieldData
     149             : {
     150             : private:
     151             :     SvxURLFormat            eFormat;
     152             :     rtl::OUString           aURL;               // URL-Address
     153             :     rtl::OUString           aRepresentation;    // What is shown
     154             :     rtl::OUString           aTargetFrame;       // In what Frame
     155             : 
     156             : public:
     157          18 :     SV_DECL_PERSIST1( SvxURLField, SvxFieldData, com::sun::star::text::textfield::Type::URL )
     158             : 
     159             :                             SvxURLField();
     160             :                             SvxURLField( const rtl::OUString& rURL, const rtl::OUString& rRepres, SvxURLFormat eFmt = SVXURLFORMAT_URL );
     161             : 
     162           0 :     const rtl::OUString&    GetURL() const { return aURL; }
     163           0 :     void                    SetURL( const rtl::OUString& rURL ) { aURL = rURL; }
     164             : 
     165           0 :     const rtl::OUString&    GetRepresentation() const { return aRepresentation; }
     166           0 :     void                    SetRepresentation( const rtl::OUString& rRep ) { aRepresentation= rRep; }
     167             : 
     168           0 :     const rtl::OUString&    GetTargetFrame() const { return aTargetFrame; }
     169           0 :     void                    SetTargetFrame( const rtl::OUString& rFrm ) { aTargetFrame = rFrm; }
     170             : 
     171           0 :     SvxURLFormat            GetFormat() const { return eFormat; }
     172           0 :     void                    SetFormat( SvxURLFormat eFmt ) { eFormat = eFmt; }
     173             : 
     174             :     virtual SvxFieldData*   Clone() const;
     175             :     virtual int             operator==( const SvxFieldData& ) const;
     176             : 
     177             :     virtual MetaAction* createBeginComment() const;
     178             : };
     179             : 
     180        3260 : class EDITENG_DLLPUBLIC SvxPageField : public SvxFieldData
     181             : {
     182             : public:
     183         310 :     SV_DECL_PERSIST1( SvxPageField, SvxFieldData, com::sun::star::text::textfield::Type::PAGE )
     184             :     SvxPageField();
     185             : 
     186             :     virtual SvxFieldData*   Clone() const;
     187             :     virtual int             operator==( const SvxFieldData& ) const;
     188             : 
     189             :     virtual MetaAction* createBeginComment() const;
     190             : };
     191             : 
     192        1279 : class EDITENG_DLLPUBLIC SvxPagesField : public SvxFieldData
     193             : {
     194             : public:
     195          19 :     SV_DECL_PERSIST1( SvxPagesField, SvxFieldData, com::sun::star::text::textfield::Type::PAGES )
     196             :     SvxPagesField();
     197             : 
     198             :     virtual SvxFieldData*   Clone() const;
     199             :     virtual int             operator==( const SvxFieldData& ) const;
     200             : };
     201             : 
     202         933 : class EDITENG_DLLPUBLIC SvxTimeField : public SvxFieldData
     203             : {
     204             : public:
     205          32 :     SV_DECL_PERSIST1( SvxTimeField, SvxFieldData, com::sun::star::text::textfield::Type::TIME )
     206             :     SvxTimeField();
     207             : 
     208             :     virtual SvxFieldData*   Clone() const;
     209             :     virtual int             operator==( const SvxFieldData& ) const;
     210             : 
     211             :     virtual MetaAction* createBeginComment() const;
     212             : };
     213             : 
     214        1323 : class EDITENG_DLLPUBLIC SvxFileField : public SvxFieldData
     215             : {
     216             : public:
     217          19 :     SV_DECL_PERSIST1( SvxFileField, SvxFieldData, com::sun::star::text::textfield::Type::DOCINFO_TITLE )
     218             :     SvxFileField();
     219             : 
     220             :     virtual SvxFieldData*   Clone() const;
     221             :     virtual int             operator==( const SvxFieldData& ) const;
     222             : };
     223             : 
     224        3042 : class EDITENG_DLLPUBLIC SvxTableField : public SvxFieldData
     225             : {
     226             :     int mnTab;
     227             : public:
     228         297 :     SV_DECL_PERSIST1( SvxTableField, SvxFieldData, com::sun::star::text::textfield::Type::TABLE )
     229             :     SvxTableField();
     230             :     explicit SvxTableField(int nTab);
     231             : 
     232             :     void SetTab(int nTab);
     233             :     int GetTab() const;
     234             : 
     235             :     virtual SvxFieldData*   Clone() const;
     236             :     virtual int             operator==( const SvxFieldData& ) const;
     237             : };
     238             : 
     239             : 
     240             : enum SvxTimeType { SVXTIMETYPE_FIX, SVXTIMETYPE_VAR };
     241             : enum SvxTimeFormat {    SVXTIMEFORMAT_APPDEFAULT = 0,   // Set as in App
     242             :                         SVXTIMEFORMAT_SYSTEM,       // Set as in System
     243             :                         SVXTIMEFORMAT_STANDARD,
     244             :                         SVXTIMEFORMAT_24_HM,    // 13:49
     245             :                         SVXTIMEFORMAT_24_HMS,   // 13:49:38
     246             :                         SVXTIMEFORMAT_24_HMSH,  // 13:49:38.78
     247             :                         SVXTIMEFORMAT_12_HM,    // 01:49
     248             :                         SVXTIMEFORMAT_12_HMS,   // 01:49:38
     249             :                         SVXTIMEFORMAT_12_HMSH,  // 01:49:38.78
     250             :                         SVXTIMEFORMAT_AM_HM,    // 01:49 PM
     251             :                         SVXTIMEFORMAT_AM_HMS,   // 01:49:38 PM
     252             :                         SVXTIMEFORMAT_AM_HMSH   // 01:49:38.78 PM
     253             :                     };
     254             : 
     255         522 : class EDITENG_DLLPUBLIC SvxExtTimeField : public SvxFieldData
     256             : {
     257             : private:
     258             :     sal_uInt32              nFixTime;
     259             :     SvxTimeType             eType;
     260             :     SvxTimeFormat           eFormat;
     261             : 
     262             : public:
     263          18 :     SV_DECL_PERSIST1( SvxExtTimeField, SvxFieldData, com::sun::star::text::textfield::Type::EXTENDED_TIME )
     264             :                             SvxExtTimeField();
     265             :     explicit                SvxExtTimeField( const Time& rTime,
     266             :                                 SvxTimeType eType = SVXTIMETYPE_VAR,
     267             :                                 SvxTimeFormat eFormat = SVXTIMEFORMAT_STANDARD );
     268             : 
     269           0 :     sal_uInt32              GetFixTime() const { return nFixTime; }
     270           0 :     void                    SetFixTime( const Time& rTime ) { nFixTime = rTime.GetTime(); }
     271             : 
     272           0 :     SvxTimeType             GetType() const { return eType; }
     273           0 :     void                    SetType( SvxTimeType eTp ) { eType = eTp; }
     274             : 
     275           0 :     SvxTimeFormat           GetFormat() const { return eFormat; }
     276           0 :     void                    SetFormat( SvxTimeFormat eFmt ) { eFormat = eFmt; }
     277             : 
     278             :                             // If eLanguage==LANGUAGE_DONTKNOW the language/country
     279             :                             // used in number formatter initialization is taken.
     280             :     rtl::OUString           GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
     281             :     static rtl::OUString    GetFormatted( Time& rTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
     282             : 
     283             :     virtual SvxFieldData*   Clone() const;
     284             :     virtual int             operator==( const SvxFieldData& ) const;
     285             : 
     286             :     virtual MetaAction* createBeginComment() const;
     287             : };
     288             : 
     289             : 
     290             : enum SvxFileType { SVXFILETYPE_FIX, SVXFILETYPE_VAR };
     291             : enum SvxFileFormat {    SVXFILEFORMAT_NAME_EXT = 0, // File name with Extension
     292             :                         SVXFILEFORMAT_FULLPATH, // full path
     293             :                         SVXFILEFORMAT_PATH,     // only path
     294             :                         SVXFILEFORMAT_NAME      // only file name
     295             :                    };
     296             : 
     297             : 
     298             : 
     299          22 : class EDITENG_DLLPUBLIC SvxExtFileField : public SvxFieldData
     300             : {
     301             : private:
     302             :     rtl::OUString           aFile;
     303             :     SvxFileType             eType;
     304             :     SvxFileFormat           eFormat;
     305             : 
     306             : public:
     307          18 :     SV_DECL_PERSIST1( SvxExtFileField, SvxFieldData, com::sun::star::text::textfield::Type::EXTENDED_FILE )
     308             :                             SvxExtFileField();
     309             :     explicit                SvxExtFileField( const rtl::OUString& rString,
     310             :                                 SvxFileType eType = SVXFILETYPE_VAR,
     311             :                                 SvxFileFormat eFormat = SVXFILEFORMAT_FULLPATH );
     312             : 
     313           0 :     rtl::OUString           GetFile() const { return aFile; }
     314           0 :     void                    SetFile( const rtl::OUString& rString ) { aFile = rString; }
     315             : 
     316           0 :     SvxFileType             GetType() const { return eType; }
     317           0 :     void                    SetType( SvxFileType eTp ) { eType = eTp; }
     318             : 
     319           0 :     SvxFileFormat           GetFormat() const { return eFormat; }
     320           0 :     void                    SetFormat( SvxFileFormat eFmt ) { eFormat = eFmt; }
     321             : 
     322             :     rtl::OUString           GetFormatted() const;
     323             : 
     324             :     virtual SvxFieldData*   Clone() const;
     325             :     virtual int             operator==( const SvxFieldData& ) const;
     326             : };
     327             : 
     328             : 
     329             : enum SvxAuthorType { SVXAUTHORTYPE_FIX, SVXAUTHORTYPE_VAR };
     330             : enum SvxAuthorFormat {  SVXAUTHORFORMAT_FULLNAME = 0, // full name
     331             :                         SVXAUTHORFORMAT_NAME,       // Only Last name
     332             :                         SVXAUTHORFORMAT_FIRSTNAME,  // Only first name
     333             :                         SVXAUTHORFORMAT_SHORTNAME   // Initials
     334             :                     };
     335             : 
     336           0 : class EDITENG_DLLPUBLIC SvxAuthorField : public SvxFieldData
     337             : {
     338             : private:
     339             :     rtl::OUString   aName;
     340             :     rtl::OUString   aFirstName;
     341             :     rtl::OUString   aShortName;
     342             :     SvxAuthorType   eType;
     343             :     SvxAuthorFormat eFormat;
     344             : 
     345             : public:
     346          18 :     SV_DECL_PERSIST1( SvxAuthorField, SvxFieldData, com::sun::star::text::textfield::Type::AUTHOR )
     347             :                             SvxAuthorField();
     348             :                             SvxAuthorField(
     349             :                                 const rtl::OUString& rFirstName,
     350             :                                 const rtl::OUString& rLastName,
     351             :                                 const rtl::OUString& rShortName,
     352             :                                 SvxAuthorType eType = SVXAUTHORTYPE_VAR,
     353             :                                 SvxAuthorFormat eFormat = SVXAUTHORFORMAT_FULLNAME );
     354             : 
     355             :     rtl::OUString           GetName() const { return aName; }
     356             :     void                    SetName( const rtl::OUString& rString ) { aName = rString; }
     357             : 
     358             :     rtl::OUString           GetFirstName() const { return aFirstName; }
     359             :     void                    SetFirstName( const rtl::OUString& rString ) { aFirstName = rString; }
     360             : 
     361             :     rtl::OUString           GetShortName() const { return aShortName; }
     362             :     void                    SetShortName( const rtl::OUString& rString ) { aShortName = rString; }
     363             : 
     364           0 :     SvxAuthorType           GetType() const { return eType; }
     365           0 :     void                    SetType( SvxAuthorType eTp ) { eType = eTp; }
     366             : 
     367           0 :     SvxAuthorFormat         GetFormat() const { return eFormat; }
     368           0 :     void                    SetFormat( SvxAuthorFormat eFmt ) { eFormat = eFmt; }
     369             : 
     370             :     rtl::OUString           GetFormatted() const;
     371             : 
     372             :     virtual SvxFieldData*   Clone() const;
     373             :     virtual int             operator==( const SvxFieldData& ) const;
     374             : };
     375             : 
     376             : /** this field is used as a placeholder for a header&footer in impress. The actual
     377             :     value is stored at the page */
     378         147 : class EDITENG_DLLPUBLIC SvxHeaderField : public SvxFieldData
     379             : {
     380             : public:
     381          18 :     SV_DECL_PERSIST1( SvxHeaderField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_HEADER )
     382             :     SvxHeaderField();
     383             : 
     384             :     virtual SvxFieldData*   Clone() const;
     385             :     virtual int             operator==( const SvxFieldData& ) const;
     386             : };
     387             : 
     388             : /** this field is used as a placeholder for a header&footer in impress. The actual
     389             :     value is stored at the page */
     390         232 : class EDITENG_DLLPUBLIC SvxFooterField : public SvxFieldData
     391             : {
     392             : public:
     393          18 :     SV_DECL_PERSIST1( SvxFooterField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_FOOTER )
     394             :     SvxFooterField();
     395             :     virtual SvxFieldData*   Clone() const;
     396             :     virtual int             operator==( const SvxFieldData& ) const;
     397             : };
     398             : 
     399             : /** this field is used as a placeholder for a header&footer in impress. The actual
     400             :     value is stored at the page */
     401         228 : class EDITENG_DLLPUBLIC SvxDateTimeField : public SvxFieldData
     402             : {
     403             : public:
     404          18 :     SV_DECL_PERSIST1( SvxDateTimeField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_DATE_TIME )
     405             :     SvxDateTimeField();
     406             : 
     407             :     static rtl::OUString    GetFormatted( Date& rDate, Time& rTime, int eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
     408             : 
     409             :     virtual SvxFieldData*   Clone() const;
     410             :     virtual int             operator==( const SvxFieldData& ) const;
     411             : };
     412             : 
     413             : 
     414             : 
     415             : 
     416             : #endif
     417             : 
     418             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10