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

Generated by: LCOV version 1.10