LCOV - code coverage report
Current view: top level - lotuswordpro/source/filter - lwpfribmark.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 111 897 12.4 %
Date: 2012-08-25 Functions: 10 27 37.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 76 1172 6.5 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  *  The Contents of this file are made available subject to the terms of
       5                 :            :  *  either of the following licenses
       6                 :            :  *
       7                 :            :  *         - GNU Lesser General Public License Version 2.1
       8                 :            :  *         - Sun Industry Standards Source License Version 1.1
       9                 :            :  *
      10                 :            :  *  Sun Microsystems Inc., October, 2000
      11                 :            :  *
      12                 :            :  *  GNU Lesser General Public License Version 2.1
      13                 :            :  *  =============================================
      14                 :            :  *  Copyright 2000 by Sun Microsystems, Inc.
      15                 :            :  *  901 San Antonio Road, Palo Alto, CA 94303, USA
      16                 :            :  *
      17                 :            :  *  This library is free software; you can redistribute it and/or
      18                 :            :  *  modify it under the terms of the GNU Lesser General Public
      19                 :            :  *  License version 2.1, as published by the Free Software Foundation.
      20                 :            :  *
      21                 :            :  *  This library is distributed in the hope that it will be useful,
      22                 :            :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
      23                 :            :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      24                 :            :  *  Lesser General Public License for more details.
      25                 :            :  *
      26                 :            :  *  You should have received a copy of the GNU Lesser General Public
      27                 :            :  *  License along with this library; if not, write to the Free Software
      28                 :            :  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
      29                 :            :  *  MA  02111-1307  USA
      30                 :            :  *
      31                 :            :  *
      32                 :            :  *  Sun Industry Standards Source License Version 1.1
      33                 :            :  *  =================================================
      34                 :            :  *  The contents of this file are subject to the Sun Industry Standards
      35                 :            :  *  Source License Version 1.1 (the "License"); You may not use this file
      36                 :            :  *  except in compliance with the License. You may obtain a copy of the
      37                 :            :  *  License at http://www.openoffice.org/license.html.
      38                 :            :  *
      39                 :            :  *  Software provided under this License is provided on an "AS IS" basis,
      40                 :            :  *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
      41                 :            :  *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
      42                 :            :  *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
      43                 :            :  *  See the License for the specific provisions governing your rights and
      44                 :            :  *  obligations concerning the Software.
      45                 :            :  *
      46                 :            :  *  The Initial Developer of the Original Code is: IBM Corporation
      47                 :            :  *
      48                 :            :  *  Copyright: 2008 by IBM Corporation
      49                 :            :  *
      50                 :            :  *  All Rights Reserved.
      51                 :            :  *
      52                 :            :  *  Contributor(s): _______________________________________
      53                 :            :  *
      54                 :            :  *
      55                 :            :  ************************************************************************/
      56                 :            : /*************************************************************************
      57                 :            :  * @file
      58                 :            :  *  For LWP filter architecture prototype
      59                 :            :  ************************************************************************/
      60                 :            : /*************************************************************************
      61                 :            :  * Change History
      62                 :            :  May 2005           Created
      63                 :            :  ************************************************************************/
      64                 :            : 
      65                 :            : #include "lwpfribmark.hxx"
      66                 :            : #include "lwptools.hxx"
      67                 :            : #include "lwpglobalmgr.hxx"
      68                 :            : #include "lwpdoc.hxx"
      69                 :            : #include "lwpdivinfo.hxx"
      70                 :            : #include "xfilter/xfstylemanager.hxx"
      71                 :            : #include "xfilter/xftextspan.hxx"
      72                 :            : #include "xfilter/xfbookmark.hxx"
      73                 :            : #include "xfilter/xfentry.hxx"
      74                 :            : #include "xfilter/xftextcontent.hxx"
      75                 :            : #include "xfilter/xfcrossref.hxx"
      76                 :            : #include "xfilter/xfdocfield.hxx"
      77                 :            : #include "xfilter/xfdatestyle.hxx"
      78                 :            : #include "xfilter/xftimestyle.hxx"
      79                 :            : #include "xfilter/xfdate.hxx"
      80                 :            : #include "xfilter/xfruby.hxx"
      81                 :            : #include "lwpchangemgr.hxx"
      82                 :            : #include "xfilter/xfchange.hxx"
      83                 :            : 
      84                 :            : /**
      85                 :            :  * @short:   Read hyperlink frib and Click here block
      86                 :            :  * @param:
      87                 :            :  * @param:
      88                 :            :  */
      89                 :          0 : void LwpFribCHBlock::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
      90                 :            : {
      91                 :          0 :     m_objMarker.ReadIndexed(pObjStrm);
      92                 :          0 :     m_nType = pObjStrm->QuickReaduInt8();
      93                 :          0 : }
      94                 :            : 
      95                 :          0 : LwpCHBlkMarker* LwpFribCHBlock::GetMarker()
      96                 :            : {
      97         [ #  # ]:          0 :     return dynamic_cast<LwpCHBlkMarker*>(m_objMarker.obj());
      98                 :            : }
      99                 :            : 
     100                 :          0 : void LwpFribCHBlock::XFConvert(XFContentContainer* pXFPara,LwpStory* pStory)
     101                 :            : {
     102                 :          0 :     sal_uInt8 type = GetType();
     103         [ #  # ]:          0 :     if (!pStory)
     104                 :          0 :         return;
     105                 :          0 :     LwpCHBlkMarker* pMarker = GetMarker();
     106                 :            : 
     107         [ #  # ]:          0 :     if (!pMarker)
     108                 :          0 :         return;
     109                 :          0 :     sal_uInt16 nAction = pMarker->GetAction();
     110         [ #  # ]:          0 :     if (nAction == LwpCHBlkMarker::CLICKHERE_CHBEHAVIORINTERNETLINK)//hyperlink
     111                 :            :     {
     112                 :          0 :         LwpHyperlinkMgr* pHyperlink = pStory->GetHyperlinkMgr();
     113         [ #  # ]:          0 :         if (type == MARKER_START)
     114                 :            :         {
     115         [ #  # ]:          0 :             if (pHyperlink)
     116                 :            :             {
     117                 :          0 :                 pHyperlink->SetHyperlinkFlag(sal_True);
     118 [ #  # ][ #  # ]:          0 :                 pHyperlink->SetHyperlink(pMarker->GetNamedProperty(A2OUSTR("URL")));
     119                 :            :             }
     120                 :            :         }
     121         [ #  # ]:          0 :         else if (type == MARKER_END)//or none
     122                 :            :         {
     123                 :          0 :             pHyperlink->SetHyperlinkFlag(sal_False);
     124                 :            :         }
     125                 :            :     }
     126                 :            :     else//click here block
     127                 :            :     {
     128                 :          0 :         pMarker->ConvertCHBlock(pXFPara,type);
     129                 :            :     }
     130                 :            : }
     131                 :            : /**
     132                 :            :  * @short:   register bookmark frib
     133                 :            :  * @param:
     134                 :            :  * @param:
     135                 :            :  */
     136                 :          0 : void  LwpFribBookMark::RegisterStyle(LwpFoundry* pFoundry)
     137                 :            : {
     138                 :          0 :     OUString name;
     139         [ #  # ]:          0 :     LwpBookMark* pBook = pFoundry->GetBookMark(GetMarkerID());
     140         [ #  # ]:          0 :     if (pBook)
     141         [ #  # ]:          0 :         name = pBook->GetName();
     142                 :            : 
     143                 :          0 :     OUString sDivision;
     144                 :          0 :     LwpDocument* pDoc = pFoundry->GetDocument();
     145         [ #  # ]:          0 :     if (pDoc)
     146                 :            :     {
     147                 :          0 :         LwpObjectID* pID = pDoc->GetDivInfoID();
     148         [ #  # ]:          0 :         if (!pID->IsNull())
     149                 :            :         {
     150 [ #  # ][ #  # ]:          0 :             LwpDivInfo *pDivInvo = dynamic_cast<LwpDivInfo*>(pID->obj(VO_DIVISIONINFO));
     151         [ #  # ]:          0 :             if (pDivInvo)
     152                 :          0 :                 sDivision = pDivInvo->GetDivName();
     153                 :            :         }
     154                 :            :     }
     155                 :            : 
     156                 :          0 :     sal_uInt8 type = GetType();
     157                 :            : 
     158         [ #  # ]:          0 :     LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
     159                 :          0 :     LwpBookmarkMgr* pMarkMgr = pGlobal->GetLwpBookmarkMgr();
     160         [ #  # ]:          0 :     if (type == MARKER_START)
     161                 :            :     {
     162         [ #  # ]:          0 :         XFBookmarkStart* pMarkStart = new XFBookmarkStart;
     163                 :          0 :         pMarkStart->SetDivision(sDivision);
     164                 :          0 :         pMarkStart->SetName(name);
     165         [ #  # ]:          0 :         pMarkMgr->AddXFBookmarkStart(name,pMarkStart);//add to map
     166                 :          0 :         m_pStart = pMarkStart;
     167                 :            :     }
     168         [ #  # ]:          0 :     else if(type == MARKER_END)
     169                 :            :     {
     170         [ #  # ]:          0 :         XFBookmarkEnd* pMarkEnd = new XFBookmarkEnd;
     171                 :          0 :         pMarkEnd->SetDivision(sDivision);
     172                 :          0 :         pMarkEnd->SetName(name);
     173         [ #  # ]:          0 :         pMarkMgr->AddXFBookmarkEnd(name,pMarkEnd);  //add to map
     174                 :          0 :         m_pEnd = pMarkEnd;
     175                 :          0 :     }
     176                 :          0 : }
     177                 :            : 
     178         [ #  # ]:          0 : LwpFribBookMark::LwpFribBookMark(LwpPara* pPara ) : LwpFrib(pPara),m_pStart(NULL),m_pEnd(NULL)
     179                 :            : {
     180                 :          0 : }
     181                 :            : 
     182                 :            : /**
     183                 :            :  * @short:   Read bookmark frib
     184                 :            :  * @param:
     185                 :            :  * @param:
     186                 :            :  */
     187                 :          0 : void LwpFribBookMark::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
     188                 :            : {
     189                 :          0 :     m_objMarker.ReadIndexed(pObjStrm);
     190                 :          0 :     m_nType = pObjStrm->QuickReaduInt8();
     191                 :          0 : }
     192                 :            : /**
     193                 :            :  * @short:   convert bookmark frib
     194                 :            :  * @param:
     195                 :            :  * @param:
     196                 :            :  */
     197                 :          0 : void LwpFribBookMark::XFConvert(XFContentContainer* pXFPara)
     198                 :            : {
     199                 :          0 :     sal_uInt8 type = GetType();
     200                 :            : 
     201 [ #  # ][ #  # ]:          0 :     if (type == MARKER_START && m_pStart)
     202                 :            :     {
     203                 :          0 :         pXFPara->Add(m_pStart);
     204                 :            :     }
     205 [ #  # ][ #  # ]:          0 :     else if(type == MARKER_END && m_pEnd)
     206                 :            :     {
     207                 :          0 :         pXFPara->Add(m_pEnd);
     208                 :            :     }
     209                 :          0 : }
     210                 :            : 
     211                 :            : /**
     212                 :            :  * @short:   Read index entry frib
     213                 :            :  * @param:
     214                 :            :  * @param:
     215                 :            :  */
     216         [ +  - ]:         18 : LwpFribField::LwpFribField( LwpPara* pPara ) : LwpFrib(pPara)
     217                 :            : {
     218                 :         18 :     m_TimeStyle = A2OUSTR("");
     219                 :            : 
     220                 :         18 :     m_nSubType = 0;//datetime/crossref/other
     221                 :         18 :     m_sFormula = A2OUSTR("");
     222                 :            : 
     223                 :         18 :     m_nCrossRefType = 0;
     224                 :         18 :     m_nDateTimeType = 0;
     225                 :         18 : }
     226                 :            : 
     227                 :         18 : void LwpFribField::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
     228                 :            : {
     229                 :         18 :     m_objMarker.ReadIndexed(pObjStrm);
     230                 :         18 :     m_nType = pObjStrm->QuickReaduInt8();
     231                 :         18 : }
     232                 :            : 
     233                 :         30 : LwpFieldMark* LwpFribField::GetMarker()
     234                 :            : {
     235         [ +  - ]:         30 :     return dynamic_cast<LwpFieldMark*>(m_objMarker.obj());
     236                 :            : }
     237                 :            : 
     238                 :         12 : void LwpFribField::XFConvert(XFContentContainer* pXFPara)
     239                 :            : {
     240         [ +  - ]:         12 :     LwpFieldMark* pFieldMark = GetMarker();
     241         [ +  - ]:         12 :     if (!pFieldMark)
     242                 :            :         return;
     243                 :            : 
     244                 :         12 :     sal_uInt8 type = GetType();
     245                 :         12 :     sal_uInt16 fieldType = pFieldMark->GetFieldType();
     246                 :            : 
     247                 :         12 :     OUString sChangeID;
     248         [ -  + ]:         12 :     if(pFieldMark->GetRevisionFlag())
     249                 :            :     {
     250         [ #  # ]:          0 :         LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
     251                 :          0 :         LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
     252         [ #  # ]:          0 :         sChangeID = pChangeMgr->GetChangeID(pFieldMark->GetStartFrib());
     253                 :            :     }
     254                 :            : 
     255         [ +  - ]:         12 :     CheckFieldType(pFieldMark);
     256                 :            :     //end marker
     257         [ +  + ]:         12 :     if (type == MARKER_END)
     258                 :            :     {
     259         [ -  + ]:          6 :         if (pFieldMark->GetStart() == sal_False)
     260                 :            :             return;
     261 [ +  - ][ -  + ]:          6 :         if (pFieldMark->IsFormulaInsert())
     262                 :            :         {
     263         [ #  # ]:          0 :             XFTextContent *pSpan = new XFTextContent();
     264         [ #  # ]:          0 :             pSpan->SetText(A2OUSTR(">"));
     265         [ #  # ]:          0 :             pXFPara->Add(pSpan);
     266                 :            :         }
     267         [ +  - ]:          6 :         if (fieldType == LwpFieldMark::FLD_FIELD)
     268                 :            :         {
     269         [ +  - ]:          6 :             if (m_nSubType == SUBFIELD_DATETIME)
     270                 :            :             {
     271         [ +  - ]:          6 :                 ConvertDateTimeEnd(pXFPara,pFieldMark);
     272                 :            :             }
     273         [ #  # ]:          0 :             else if (m_nSubType == SUBFIELD_CROSSREF)
     274                 :            :             {
     275         [ #  # ]:          0 :                 ConvertCrossRefEnd(pXFPara,pFieldMark);
     276                 :            :             }
     277         [ #  # ]:          0 :             else if (m_nSubType == SUBFIELD_DOCPOWER)
     278                 :            :             {
     279         [ #  # ]:          0 :                 ConvertDocFieldEnd(pXFPara,pFieldMark);
     280                 :            :             }
     281                 :            :         }
     282 [ -  + ][ #  # ]:          6 :         if(pFieldMark->GetRevisionFlag() && !sChangeID.isEmpty())
                 [ -  + ]
     283                 :            :         {
     284         [ #  # ]:          0 :             XFChangeEnd* pChangeEnd = new XFChangeEnd;
     285                 :          0 :             pChangeEnd->SetChangeID(sChangeID);
     286         [ #  # ]:          6 :             pXFPara->Add(pChangeEnd);
     287                 :            :         }
     288                 :            : 
     289                 :            :         return;
     290                 :            :     }
     291                 :            : 
     292                 :            :     //start marker
     293 [ -  + ][ #  # ]:          6 :     if(pFieldMark->GetRevisionFlag() && !sChangeID.isEmpty())
                 [ -  + ]
     294                 :            :     {
     295         [ #  # ]:          0 :         XFChangeStart* pChangeStart = new XFChangeStart;
     296                 :          0 :         pChangeStart->SetChangeID(sChangeID);
     297         [ #  # ]:          0 :         pXFPara->Add(pChangeStart);
     298                 :            :     }
     299                 :            : 
     300         [ -  + ]:          6 :     if (fieldType == LwpFieldMark::FLD_INDEX)
     301                 :            :     {
     302                 :          0 :         OUString sKey1,sKey2;
     303         [ #  # ]:          0 :         pFieldMark->ParseIndex(sKey1,sKey2);
     304         [ #  # ]:          0 :         if (!sKey1.isEmpty())
     305                 :            :         {
     306 [ #  # ][ #  # ]:          0 :             XFEntry* pEntry = new XFEntry;
     307                 :          0 :             pEntry->SetEntryType(enumXFEntryAlphabetical);
     308                 :          0 :             pEntry->SetKey(sKey1,sKey2);
     309         [ #  # ]:          0 :             pXFPara->Add(pEntry);
     310                 :          0 :         }
     311                 :            :     }
     312         [ -  + ]:          6 :     else if (fieldType == LwpFieldMark::FLD_TOC)
     313                 :            :     {
     314                 :          0 :         OUString sLevel,sText;
     315         [ #  # ]:          0 :         pFieldMark->ParseTOC(sLevel,sText);
     316 [ #  # ][ #  # ]:          0 :         if (!sLevel.isEmpty() && !sText.isEmpty())
                 [ #  # ]
     317                 :            :         {
     318 [ #  # ][ #  # ]:          0 :             XFEntry* pEntry = new XFEntry;
     319                 :          0 :             pEntry->SetEntryType(enumXFEntryTOC);
     320                 :          0 :             pEntry->SetStringValue(sText);
     321                 :          0 :             pEntry->SetOutlineLevel(sLevel.toInt32(10));
     322         [ #  # ]:          0 :             pXFPara->Add(pEntry);
     323                 :          0 :         }
     324                 :            :     }
     325         [ +  - ]:          6 :     else if (fieldType == LwpFieldMark::FLD_FIELD)
     326                 :            :     {
     327                 :            :         sal_uInt8 nDatetype;
     328                 :          6 :         OUString sFormula;
     329         [ +  - ]:          6 :         /*sal_Bool bIsDateTime =*/ pFieldMark->IsDateTimeField(nDatetype,sFormula);
     330                 :            : 
     331         [ +  - ]:          6 :         if (m_nSubType == SUBFIELD_DATETIME)//date time
     332                 :            :         {
     333         [ +  - ]:          6 :             ConvertDateTimeStart(pXFPara,pFieldMark);
     334                 :            :         }
     335         [ #  # ]:          0 :         else if (m_nSubType == SUBFIELD_CROSSREF)//cross ref
     336                 :            :         {
     337         [ #  # ]:          0 :             ConvertCrossRefStart(pXFPara,pFieldMark);
     338                 :            :         }
     339         [ #  # ]:          0 :         else if (m_nSubType == SUBFIELD_DOCPOWER)
     340                 :            :         {
     341         [ #  # ]:          0 :             ConvertDocFieldStart(pXFPara,pFieldMark);
     342                 :          6 :         }
     343                 :            :     }
     344                 :            : 
     345 [ +  - ][ -  + ]:          6 :     if (pFieldMark->IsFormulaInsert())
     346                 :            :     {
     347         [ #  # ]:          0 :         XFTextContent *pSpan = new XFTextContent();
     348         [ #  # ]:          0 :         pSpan->SetText(A2OUSTR("<"));
     349         [ #  # ]:          0 :         pXFPara->Add(pSpan);
     350                 :            :     }
     351                 :            : 
     352         [ +  + ]:         12 :     pFieldMark->SetStart(sal_True);
     353                 :            : }
     354                 :            : 
     355                 :         18 : void LwpFribField::RegisterStyle(LwpFoundry* pFoundry)
     356                 :            : {
     357                 :         18 :     LwpFrib::RegisterStyle(pFoundry);
     358                 :         18 :     LwpFieldMark* pFieldMark = GetMarker();
     359         [ -  + ]:         18 :     if (!pFieldMark)
     360                 :         18 :         return;
     361                 :            : 
     362                 :         18 :     sal_uInt8 type = GetType();
     363                 :         18 :     sal_uInt16 fieldType = pFieldMark->GetFieldType();
     364                 :            : 
     365 [ +  - ][ +  + ]:         18 :     if (type == MARKER_START && fieldType == LwpFieldMark::FLD_FIELD)
     366                 :            :     {
     367                 :          9 :         RegisterTimeField(pFieldMark);
     368                 :            :     }
     369                 :            : 
     370 [ +  + ][ -  + ]:         18 :     if (type == MARKER_START && m_bRevisionFlag)
     371                 :            :     {
     372                 :          0 :         LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
     373                 :          0 :         LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
     374                 :          0 :         pChangeMgr->AddChangeFrib(this);
     375                 :          0 :         pFieldMark->SetStartFrib(this);
     376                 :          0 :         pFieldMark->SetRevisionFlag(sal_True);
     377                 :            :     }
     378                 :            : }
     379                 :            : 
     380                 :          9 : void LwpFribField::RegisterTimeField(LwpFieldMark* pFieldMark)
     381                 :            : {
     382                 :          9 :     OUString sFormula = pFieldMark->GetFormula();//now bookmark maybe not all register to bookmarkmgr,
     383         [ -  + ]:          9 :     if (sFormula == A2OUSTR("TotalEditingTime"))//so check field type now is not correct.
     384         [ #  # ]:          0 :         RegisterTotalTimeStyle();
     385                 :            :     else
     386                 :            :     {
     387                 :            :         sal_Int32 index;
     388                 :          9 :         sal_Unicode ch1(0x0020);//space
     389                 :          9 :         OUString tag;
     390                 :          9 :         index = sFormula.indexOf(ch1,0);
     391         [ -  + ]:          9 :         if (index < 0)
     392                 :          9 :             return;
     393                 :            : 
     394                 :          9 :         tag = sFormula.copy(0,index);
     395 [ #  # ][ #  # ]:          9 :         if (tag == A2OUSTR("Now()") || tag == A2OUSTR("CreateDate") ||  tag == A2OUSTR("EditDate"))
         [ -  + ][ -  + ]
         [ +  - ][ +  - ]
                 [ -  + ]
     396 [ +  - ][ +  - ]:          9 :             RegisterDateTimeStyle(sFormula.copy(index+1,sFormula.getLength()-index-1));
     397         [ +  - ]:          9 :     }
     398                 :            : }
     399                 :            : 
     400                 :          0 : void LwpFribField::RegisterTotalTimeStyle()
     401                 :            : {
     402         [ #  # ]:          0 :     XFTimeStyle* pTimeStyle = new XFTimeStyle;//use the default format
     403                 :          0 :     pTimeStyle->SetTruncate(sal_False);
     404                 :          0 :     pTimeStyle->AddMinute();
     405                 :          0 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
     406                 :          0 :     m_TimeStyle = pXFStyleManager->AddStyle(pTimeStyle)->GetStyleName();
     407                 :          0 : }
     408                 :            : 
     409                 :          9 : void LwpFribField::RegisterDateTimeStyle(OUString sFormula)
     410                 :            : {
     411                 :          9 :     XFDateStyle* pDateStyle = NULL;
     412                 :          9 :     XFTimeStyle* pTimeStyle = NULL;
     413                 :            : //DATE
     414         [ -  + ]:          9 :     if (sFormula.getLength()<2)
     415                 :          9 :         return;
     416         [ +  - ]:          9 :     if (sFormula[1] == 'F')
     417                 :            :     {
     418         [ -  + ]:          9 :         if (sFormula == A2OUSTR("%FLSystemShortDate"))
     419                 :            :         {
     420                 :          0 :             pDateStyle = LwpTools::GetSystemDateStyle(sal_False);
     421                 :            :         }
     422         [ -  + ]:          9 :         else if (sFormula == A2OUSTR("%FLSystemLongDate"))
     423                 :            :         {
     424                 :          0 :             pDateStyle = LwpTools::GetSystemDateStyle(sal_True);
     425                 :            :         }
     426 [ +  - ][ -  + ]:          9 :         else if (sFormula == A2OUSTR("%FLISODate1") || sFormula == A2OUSTR("%FLYYYY/MM/DD") )
         [ +  - ][ +  - ]
                 [ -  + ]
     427                 :            :         {
     428         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     429                 :          0 :             pDateStyle->AddYear();
     430         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
     431                 :          0 :             pDateStyle->AddMonth();
     432         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
     433                 :          0 :             pDateStyle->AddMonthDay();
     434                 :            :         }
     435 [ +  - ][ -  + ]:          9 :         else if (sFormula == A2OUSTR("%FLISODate2") || sFormula == A2OUSTR("%FLYYYY/MM/DD HH:mm:SS") )
         [ +  - ][ +  - ]
                 [ -  + ]
     436                 :            :         {
     437         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     438                 :          0 :             pDateStyle->AddYear();
     439         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
     440                 :          0 :             pDateStyle->AddMonth();
     441         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
     442                 :          0 :             pDateStyle->AddMonthDay();
     443         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     444                 :          0 :             pDateStyle->AddHour();
     445         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(":"));
     446                 :          0 :             pDateStyle->AddMinute();
     447         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(":"));
     448                 :          0 :             pDateStyle->AddSecond(sal_True,0);
     449                 :            :         }
     450         [ -  + ]:          9 :         else if (sFormula == A2OUSTR("%FLM/D/YY"))
     451                 :            :         {
     452         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     453                 :          0 :             pDateStyle->AddMonth(sal_False);
     454         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
     455                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     456         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
     457                 :          0 :             pDateStyle->AddYear(sal_False);
     458                 :            :         }
     459         [ +  - ]:          9 :         else if (sFormula == A2OUSTR("%FLMonth D, YYYY"))
     460                 :            :         {
     461         [ +  - ]:          9 :             pDateStyle = new XFDateStyle;
     462                 :          9 :             pDateStyle->AddMonth(sal_True,sal_True);
     463         [ +  - ]:          9 :             pDateStyle->AddText(A2OUSTR(" "));
     464                 :          9 :             pDateStyle->AddMonthDay(sal_False);
     465         [ +  - ]:          9 :             pDateStyle->AddText(A2OUSTR(", "));
     466                 :          9 :             pDateStyle->AddYear();
     467                 :            :         }
     468         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLWeekday, Month D, YYYY"))
     469                 :            :         {
     470         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     471                 :          0 :             pDateStyle->AddWeekDay();
     472         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     473                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
     474         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     475                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     476         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     477                 :          0 :             pDateStyle->AddYear();
     478                 :            :         }
     479         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLMn D, YYYY"))
     480                 :            :         {
     481         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     482                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     483         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     484                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     485         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     486                 :          0 :             pDateStyle->AddYear();
     487                 :            :         }
     488         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLWday, Mn D, YYYY"))
     489                 :            :         {
     490         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     491                 :          0 :             pDateStyle->AddWeekDay(sal_False);
     492         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     493                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     494         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     495                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     496         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     497                 :          0 :             pDateStyle->AddYear();
     498                 :            :         }
     499         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLMn D"))
     500                 :            :         {
     501         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     502                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     503         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     504                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     505                 :            :         }
     506         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLWeekday, Mn D"))
     507                 :            :         {
     508         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     509                 :          0 :             pDateStyle->AddWeekDay();
     510         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     511                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     512         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     513                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     514                 :            :         }
     515         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLMn D, YY"))
     516                 :            :         {
     517         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     518                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     519         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     520                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     521         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     522                 :          0 :             pDateStyle->AddYear(sal_False);
     523                 :            :         }
     524         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLM/D"))
     525                 :            :         {
     526         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     527                 :          0 :             pDateStyle->AddMonth(sal_False);
     528         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
     529                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     530                 :            :         }
     531         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLM/YY"))
     532                 :            :         {
     533         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     534                 :          0 :             pDateStyle->AddMonth(sal_False);
     535         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
     536                 :          0 :             pDateStyle->AddYear(sal_False);
     537                 :            :         }
     538         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLMn YY"))
     539                 :            :         {
     540         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     541                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     542         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     543                 :          0 :             pDateStyle->AddYear(sal_False);
     544                 :            :         }
     545         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLWeekday"))
     546                 :            :         {
     547         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     548                 :          0 :             pDateStyle->AddWeekDay();
     549                 :            :         }
     550         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLWday"))
     551                 :            :         {
     552         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     553                 :          0 :             pDateStyle->AddWeekDay(sal_False);
     554                 :            :         }
     555         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLMonth"))
     556                 :            :         {
     557         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     558                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
     559                 :            :         }
     560         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLMn"))
     561                 :            :         {
     562         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     563                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     564                 :            :         }
     565         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLD"))
     566                 :            :         {
     567         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     568                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     569                 :            :         }
     570         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLM"))
     571                 :            :         {
     572         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     573                 :          0 :             pDateStyle->AddMonth(sal_False);
     574                 :            :         }
     575         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLYYYY") )
     576                 :            :         {
     577         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     578                 :          0 :             pDateStyle->AddYear();
     579                 :            :         }
     580         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLYY"))
     581                 :            :         {
     582         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     583                 :          0 :             pDateStyle->AddYear(sal_False);
     584                 :            :         }
     585                 :            :         //chinese version begin
     586         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLYY/M/D"))
     587                 :            :         {
     588         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     589                 :          0 :             pDateStyle->AddYear(sal_False);
     590         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("-"));
     591                 :          0 :             pDateStyle->AddMonth(sal_False);
     592         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("-"));
     593                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     594                 :            :         }
     595         [ #  # ]:          0 :         else if(sFormula == A2OUSTR("%FLYYYY Month D"))
     596                 :            :         {
     597         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     598                 :          0 :             pDateStyle->AddYear();
     599         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     600                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
     601         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     602                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     603                 :            :         }
     604         [ #  # ]:          0 :         else if(sFormula == A2OUSTR("%FLWeekday, YYYY Month D"))
     605                 :            :         {
     606         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     607                 :          0 :             pDateStyle->AddWeekDay();
     608         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(","));
     609                 :          0 :             pDateStyle->AddYear();
     610         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     611                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
     612         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     613                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     614                 :            :         }
     615         [ #  # ]:          0 :         else if(sFormula == A2OUSTR("%FLYYYY Mn D"))
     616                 :            :         {
     617         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     618                 :          0 :             pDateStyle->AddYear();
     619         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     620                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     621         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     622                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     623                 :            :         }
     624         [ #  # ]:          0 :         else if(sFormula == A2OUSTR("%FLWday, YYYY Mn D"))
     625                 :            :         {
     626         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     627                 :          0 :             pDateStyle->AddWeekDay(sal_False);
     628         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(","));
     629                 :          0 :             pDateStyle->AddYear();
     630         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     631                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
     632         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     633                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     634                 :            :         }
     635                 :            :         //next 2 are the same with english version
     636         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLYY Mn D"))
     637                 :            :         {
     638         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     639                 :          0 :             pDateStyle->AddYear(sal_False);
     640         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     641                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     642         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     643                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     644                 :            :         }
     645         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLYY/M"))
     646                 :            :         {
     647         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     648                 :          0 :             pDateStyle->AddMonth(sal_False);
     649         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("-"));
     650                 :          0 :             pDateStyle->AddMonth(sal_False);
     651                 :            :         }
     652         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLYY Mn"))
     653                 :            :         {
     654         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     655                 :          0 :             pDateStyle->AddMonth(sal_False);
     656         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     657                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     658                 :            :         }
     659 [ #  # ][ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLeeeeoa") || sFormula == A2OUSTR("%FLffffooaa") || sFormula == A2OUSTR("%FLEEEEOA"))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     660                 :            :         {
     661 [ #  # ][ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     662                 :          0 :             rtl::OUString sText;
     663         [ #  # ]:          0 :             pDateStyle->AddYear();
     664                 :          0 :             sText = rtl::OUString(0x5e74);
     665         [ #  # ]:          0 :             pDateStyle->AddText(sText);
     666         [ #  # ]:          0 :             pDateStyle->AddMonth(sal_False);
     667                 :          0 :             sText = rtl::OUString(0x6708);
     668         [ #  # ]:          0 :             pDateStyle->AddText(sText);
     669         [ #  # ]:          0 :             pDateStyle->AddMonthDay(sal_False);
     670                 :          0 :             sText = rtl::OUString(0x65e5);
     671         [ #  # ]:          0 :             pDateStyle->AddText(sText);
     672                 :            :         }
     673 [ #  # ][ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLoa") || sFormula == A2OUSTR("%FLooaa") || sFormula == A2OUSTR("%FLOA") )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     674                 :            :         {
     675 [ #  # ][ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     676                 :          0 :             OUString sText;
     677         [ #  # ]:          0 :             pDateStyle->AddMonth(sal_False);
     678                 :          0 :             sText = rtl::OUString(0x6708);
     679         [ #  # ]:          0 :             pDateStyle->AddText(sText);
     680         [ #  # ]:          0 :             pDateStyle->AddMonthDay(sal_False);
     681                 :          0 :             sText = rtl::OUString(0x65e5);
     682         [ #  # ]:          0 :             pDateStyle->AddText(sText);
     683                 :            :         }
     684 [ #  # ][ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLYYYY/M/D") || sFormula == A2OUSTR("%FLGGGG/od/ad"))
         [ #  # ][ #  # ]
                 [ #  # ]
     685                 :            :         {
     686         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     687                 :          0 :             pDateStyle->AddYear();
     688         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("-"));
     689                 :          0 :             pDateStyle->AddMonth(sal_False);
     690         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("-"));
     691                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     692                 :            :         }
     693         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLYY.M.D") )
     694                 :            :         {
     695         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     696                 :          0 :             pDateStyle->AddYear(sal_False);
     697         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("."));
     698                 :          0 :             pDateStyle->AddMonth(sal_False);
     699         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("."));
     700                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     701                 :            :         }
     702                 :            :         //chinese version end
     703                 :            :         //other version begin
     704         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLWeekday, Month DD, YYYY") )
     705                 :            :         {
     706         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     707                 :          0 :             pDateStyle->AddWeekDay();
     708         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     709                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
     710         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     711                 :          0 :             pDateStyle->AddMonthDay();
     712         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     713                 :          0 :             pDateStyle->AddYear();
     714                 :            :         }
     715         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLYYYY/MM/DD") )
     716                 :            :         {
     717         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     718                 :          0 :             pDateStyle->AddWeekDay();
     719         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     720                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
     721         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     722                 :          0 :             pDateStyle->AddMonthDay();
     723         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     724                 :          0 :             pDateStyle->AddYear();
     725                 :            :         }
     726         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLD/M/YY") )
     727                 :            :         {
     728         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     729                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     730         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
     731                 :          0 :             pDateStyle->AddMonth(sal_False);
     732         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
     733                 :          0 :             pDateStyle->AddYear(sal_False);
     734                 :            :         }
     735         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLD Month YYYY"))
     736                 :            :         {
     737         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     738                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     739         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     740                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
     741         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     742                 :          0 :             pDateStyle->AddYear();
     743                 :            :         }
     744         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLDD Month YYYY"))
     745                 :            :         {
     746         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     747                 :          0 :             pDateStyle->AddMonthDay();
     748         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     749                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
     750         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     751                 :          0 :             pDateStyle->AddYear();
     752                 :            :         }
     753         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLWeekday, D Month YYYY"))
     754                 :            :         {
     755         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     756                 :          0 :             pDateStyle->AddWeekDay();
     757         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     758                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     759         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     760                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
     761         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     762                 :          0 :             pDateStyle->AddYear();
     763                 :            :         }
     764         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLWeekday, DD Month YYYY"))
     765                 :            :         {
     766         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     767                 :          0 :             pDateStyle->AddWeekDay();
     768         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     769                 :          0 :             pDateStyle->AddMonthDay();
     770         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     771                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
     772         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     773                 :          0 :             pDateStyle->AddYear();
     774                 :            :         }
     775         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLD Mn YYYY"))
     776                 :            :         {
     777         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     778                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     779         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     780                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     781         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     782                 :          0 :             pDateStyle->AddYear();
     783                 :            :         }
     784         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLWday, D Mn YYYY"))
     785                 :            :         {
     786         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     787                 :          0 :             pDateStyle->AddWeekDay(sal_False);
     788         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     789                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     790         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     791                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     792         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     793                 :          0 :             pDateStyle->AddYear();
     794                 :            :         }
     795         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLWday, DD Mn YYYY"))
     796                 :            :         {
     797         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     798                 :          0 :             pDateStyle->AddWeekDay(sal_False);
     799         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     800                 :          0 :             pDateStyle->AddMonthDay();
     801         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     802                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     803         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     804                 :          0 :             pDateStyle->AddYear();
     805                 :            :         }
     806         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLD Mn"))
     807                 :            :         {
     808         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     809                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     810         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     811                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     812                 :            :         }
     813         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLDD Mn"))
     814                 :            :         {
     815         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     816                 :          0 :             pDateStyle->AddMonthDay();
     817         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     818                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     819                 :            :         }
     820         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLWeekday, D Mn"))
     821                 :            :         {
     822         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     823                 :          0 :             pDateStyle->AddWeekDay();
     824         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     825                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     826         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     827                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     828                 :            :         }
     829         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLWeekday, DD Mn"))
     830                 :            :         {
     831         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     832                 :          0 :             pDateStyle->AddWeekDay();
     833         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
     834                 :          0 :             pDateStyle->AddMonthDay();
     835         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     836                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     837                 :            :         }
     838         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLD Mn YY"))
     839                 :            :         {
     840         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     841                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     842         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     843                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     844         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     845                 :          0 :             pDateStyle->AddYear(sal_False);
     846                 :            :         }
     847         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLDD Mn YY"))
     848                 :            :         {
     849         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     850                 :          0 :             pDateStyle->AddMonthDay();
     851         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     852                 :          0 :             pDateStyle->AddMonth(sal_False,sal_True);
     853         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
     854                 :          0 :             pDateStyle->AddYear(sal_False);
     855                 :            :         }
     856         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLD/M"))
     857                 :            :         {
     858         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     859                 :          0 :             pDateStyle->AddMonthDay(sal_False);
     860         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
     861                 :          0 :             pDateStyle->AddMonth(sal_False);
     862                 :            :         }
     863         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLDD/MM"))
     864                 :            :         {
     865         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     866                 :          0 :             pDateStyle->AddMonthDay();
     867         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
     868                 :          0 :             pDateStyle->AddMonth();
     869                 :            :         }
     870         [ #  # ]:          0 :         else if(sFormula == A2OUSTR("%FLDD/MM/YY"))
     871                 :            :         {
     872         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     873                 :          0 :             pDateStyle->AddMonthDay();
     874         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
     875                 :          0 :             pDateStyle->AddMonth();
     876         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
     877                 :          0 :             pDateStyle->AddYear(sal_False);
     878                 :            :         }
     879         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLMM/YY"))
     880                 :            :         {
     881         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
     882                 :          0 :             pDateStyle->AddMonth();
     883         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
     884                 :          0 :             pDateStyle->AddYear(sal_False);
     885                 :            :         }
     886                 :            :         //other version end
     887                 :            :     //TIME
     888         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLSystemTime"))
     889                 :            :         {
     890                 :          0 :             pTimeStyle = LwpTools::GetSystemTimeStyle();
     891                 :            :         }
     892 [ #  # ][ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLISOTime1") || sFormula == A2OUSTR("%FLH:mm:SS"))
         [ #  # ][ #  # ]
                 [ #  # ]
     893                 :            :         {
     894         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
     895                 :          0 :             pTimeStyle->AddHour();
     896         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
     897                 :          0 :             pTimeStyle->AddMinute();
     898         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
     899                 :          0 :             pTimeStyle->AddSecond(sal_True,0);
     900                 :            :         }
     901         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLH:mm ampm"))
     902                 :            :         {
     903         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
     904                 :          0 :             pTimeStyle->AddHour(sal_False);
     905         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
     906                 :          0 :             pTimeStyle->AddMinute();
     907         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(" "));
     908                 :          0 :             pTimeStyle->SetAmPm(sal_True);
     909                 :            :         }
     910         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLH:mm"))
     911                 :            :         {
     912         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
     913                 :          0 :             pTimeStyle->AddHour(sal_False);
     914         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
     915                 :          0 :             pTimeStyle->AddMinute();
     916                 :            :         }
     917         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLH:mm:SS ampm"))
     918                 :            :         {
     919         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
     920                 :          0 :             pTimeStyle->AddHour(sal_False);
     921         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
     922                 :          0 :             pTimeStyle->AddMinute();
     923         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
     924                 :          0 :             pTimeStyle->AddSecond(sal_True,0);
     925         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(" "));
     926                 :          0 :             pTimeStyle->SetAmPm(sal_True);
     927                 :            :         }
     928         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLH:mm:SS"))
     929                 :            :         {
     930         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
     931                 :          0 :             pTimeStyle->AddHour(sal_False);
     932         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
     933                 :          0 :             pTimeStyle->AddMinute();
     934         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
     935                 :          0 :             pTimeStyle->AddSecond(sal_True,0);
     936                 :            :         }
     937         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLH ampm"))
     938                 :            :         {
     939         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
     940                 :          0 :             pTimeStyle->AddHour(sal_False);
     941         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(" "));
     942                 :          0 :             pTimeStyle->SetAmPm(sal_True);
     943                 :            :         }
     944         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLH"))
     945                 :            :         {
     946         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
     947                 :          0 :             pTimeStyle->AddHour(sal_False);
     948                 :            :         }
     949         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLmm"))
     950                 :            :         {
     951         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
     952                 :          0 :             pTimeStyle->AddMinute();
     953                 :            :         }
     954         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLSS"))
     955                 :            :         {
     956         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
     957                 :          0 :             pTimeStyle->AddSecond(sal_True,0);
     958                 :            :         }
     959         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLampm"))
     960                 :            :         {
     961         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
     962                 :          0 :             pTimeStyle->SetAmPm(sal_True);
     963                 :            :         }
     964                 :            :         //chinese version begin
     965 [ #  # ][ #  #  :          0 :         else     if (sFormula == A2OUSTR("%FLjF") || sFormula == A2OUSTR("%FLJFF")
             #  #  #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     966 [ #  # ][ #  # ]:          0 :             || sFormula == A2OUSTR("%FLjjF") || sFormula == A2OUSTR("%FLJJFF ") )
     967                 :            :         {
     968 [ #  # ][ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
     969         [ #  # ]:          0 :             pTimeStyle->AddHour(sal_False);
     970                 :          0 :             rtl::OUString sText;
     971                 :          0 :             sText = rtl::OUString(0x70b9);
     972         [ #  # ]:          0 :             pTimeStyle->AddText(sText);
     973         [ #  # ]:          0 :             pTimeStyle->AddMinute(sal_False);
     974                 :          0 :             sText = rtl::OUString(0x5206);
     975         [ #  # ]:          0 :             pTimeStyle->AddText(sText);
     976                 :            :         }
     977 [ #  # ][ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLjjjF") || sFormula == A2OUSTR("%FLJJJFF") )
         [ #  # ][ #  # ]
                 [ #  # ]
     978                 :            :         {
     979 [ #  # ][ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
     980                 :          0 :             pTimeStyle->SetAmPm(sal_True);
     981         [ #  # ]:          0 :             pTimeStyle->AddHour(sal_False);
     982                 :          0 :             rtl::OUString sText;
     983                 :          0 :             sText = rtl::OUString(0x70b9);
     984         [ #  # ]:          0 :             pTimeStyle->AddText(sText);
     985         [ #  # ]:          0 :             pTimeStyle->AddMinute(sal_False);
     986                 :          0 :             sText = rtl::OUString(0x5206);
     987         [ #  # ]:          0 :             pTimeStyle->AddText(sText);
     988                 :            :         }
     989                 :            :         //chinese version end
     990                 :            :         //other version begin
     991         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLHH:mm ampm"))
     992                 :            :         {
     993         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
     994                 :          0 :             pTimeStyle->AddHour();
     995         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
     996                 :          0 :             pTimeStyle->AddMinute();
     997         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(" "));
     998                 :          0 :             pTimeStyle->SetAmPm(sal_True);
     999                 :            :         }
    1000         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLHH ampm"))
    1001                 :            :         {
    1002         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
    1003                 :          0 :             pTimeStyle->AddHour();
    1004         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(" "));
    1005                 :          0 :             pTimeStyle->SetAmPm(sal_True);
    1006                 :            :         }
    1007         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLHH:mm:SS ampm"))
    1008                 :            :         {
    1009         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
    1010                 :          0 :             pTimeStyle->AddHour();
    1011         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
    1012                 :          0 :             pTimeStyle->AddMinute();
    1013         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
    1014                 :          0 :             pTimeStyle->AddSecond(sal_True,0);
    1015         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(" "));
    1016                 :          0 :             pTimeStyle->SetAmPm(sal_True);
    1017                 :            :         }
    1018         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLHH:mm"))
    1019                 :            :         {
    1020         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
    1021                 :          0 :             pTimeStyle->AddHour();
    1022         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
    1023                 :          0 :             pTimeStyle->AddMinute();
    1024                 :            :         }
    1025         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%FLHH:mm:SS"))
    1026                 :            :         {
    1027         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
    1028                 :          0 :             pTimeStyle->AddHour();
    1029         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
    1030                 :          0 :             pTimeStyle->AddMinute();
    1031         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
    1032                 :          0 :             pTimeStyle->AddSecond(sal_True,0);
    1033                 :            :         }
    1034                 :            :         //other version end
    1035                 :            :     }
    1036         [ #  # ]:          0 :     else if(sFormula[1] == 'D')
    1037                 :            :     {
    1038         [ #  # ]:          0 :         if (sFormula == A2OUSTR("%Da"))
    1039                 :            :         {
    1040                 :          0 :             pDateStyle = LwpTools::GetSystemDateStyle(sal_False);
    1041                 :            :         }
    1042 [ #  # ][ #  # ]:          0 :         else if (sFormula == A2OUSTR("%DB") || sFormula == A2OUSTR("%Db"))
         [ #  # ][ #  # ]
                 [ #  # ]
    1043                 :            :         {
    1044         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
    1045                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
    1046         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
    1047                 :          0 :             pDateStyle->AddMonthDay(sal_False);
    1048         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
    1049                 :          0 :             pDateStyle->AddYear();
    1050                 :            :         }
    1051 [ #  # ][ #  # ]:          0 :         else if (sFormula == A2OUSTR("%Dc") || sFormula == A2OUSTR("%DC"))
         [ #  # ][ #  # ]
                 [ #  # ]
    1052                 :            :         {
    1053         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
    1054                 :          0 :             pDateStyle->AddMonthDay(sal_False);
    1055         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
    1056                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
    1057         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
    1058                 :          0 :             pDateStyle->AddYear();
    1059                 :            :         }
    1060 [ #  # ][ #  # ]:          0 :         else if (sFormula == A2OUSTR("%Dd") || sFormula == A2OUSTR("%DD"))
         [ #  # ][ #  # ]
                 [ #  # ]
    1061                 :            :         {
    1062         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
    1063                 :          0 :             pDateStyle->AddWeekDay();
    1064         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
    1065                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
    1066         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
    1067                 :          0 :             pDateStyle->AddMonthDay(sal_False);
    1068         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(", "));
    1069                 :          0 :             pDateStyle->AddYear();
    1070                 :            :         }
    1071 [ #  # ][ #  # ]:          0 :         else if (sFormula == A2OUSTR("%DE") || sFormula == A2OUSTR("%De"))
         [ #  # ][ #  # ]
                 [ #  # ]
    1072                 :            :         {
    1073         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
    1074                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
    1075         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
    1076                 :          0 :             pDateStyle->AddMonthDay(sal_False);
    1077                 :            :         }
    1078 [ #  # ][ #  # ]:          0 :         else if (sFormula == A2OUSTR("%Df") || sFormula == A2OUSTR("%DF"))
         [ #  # ][ #  # ]
                 [ #  # ]
    1079                 :            :         {
    1080         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
    1081                 :          0 :             pDateStyle->AddWeekDay();
    1082         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
    1083                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
    1084         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
    1085                 :          0 :             pDateStyle->AddMonthDay(sal_False);
    1086                 :            :         }
    1087         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%Dg"))
    1088                 :            :         {
    1089         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
    1090                 :          0 :             pDateStyle->AddMonth(sal_False);
    1091         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
    1092                 :          0 :             pDateStyle->AddMonthDay(sal_False);
    1093                 :            :         }
    1094         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%Dh"))
    1095                 :            :         {
    1096         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
    1097                 :          0 :             pDateStyle->AddMonth(sal_False);
    1098         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
    1099                 :          0 :             pDateStyle->AddMonthDay(sal_False);
    1100         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
    1101                 :          0 :             pDateStyle->AddYear();
    1102                 :            :         }
    1103 [ #  # ][ #  # ]:          0 :         else if (sFormula == A2OUSTR("%Di") || sFormula == A2OUSTR("%DI"))
         [ #  # ][ #  # ]
                 [ #  # ]
    1104                 :            :         {
    1105         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
    1106                 :          0 :             pDateStyle->AddMonthDay(sal_False);
    1107         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("."));
    1108                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
    1109                 :            :         }
    1110 [ #  # ][ #  # ]:          0 :         else if (sFormula == A2OUSTR("%Dj") || sFormula == A2OUSTR("%DJ"))
         [ #  # ][ #  # ]
                 [ #  # ]
    1111                 :            :         {
    1112         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
    1113                 :          0 :             pDateStyle->AddMonthDay(sal_False);
    1114         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("."));
    1115                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
    1116         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
    1117                 :          0 :             pDateStyle->AddYear();
    1118                 :            :         }
    1119 [ #  # ][ #  # ]:          0 :         else if (sFormula == A2OUSTR("%Dk") || sFormula == A2OUSTR("%DK"))
         [ #  # ][ #  # ]
                 [ #  # ]
    1120                 :            :         {
    1121         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
    1122                 :          0 :             pDateStyle->AddYear();
    1123         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
    1124                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
    1125         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(" "));
    1126                 :          0 :             pDateStyle->AddMonthDay(sal_False);
    1127                 :            :         }
    1128 [ #  # ][ #  # ]:          0 :         else if (sFormula == A2OUSTR("%DL") || sFormula == A2OUSTR("%Dl"))
         [ #  # ][ #  # ]
                 [ #  # ]
    1129                 :            :         {
    1130         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
    1131                 :          0 :             pDateStyle->AddMonth(sal_True,sal_True);
    1132         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR(","));
    1133                 :          0 :             pDateStyle->AddYear();
    1134                 :            :         }
    1135         [ #  # ]:          0 :         else if (sFormula == A2OUSTR("%Dm"))
    1136                 :            :         {
    1137         [ #  # ]:          0 :             pDateStyle = new XFDateStyle;
    1138                 :          0 :             pDateStyle->AddMonthDay();
    1139         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
    1140                 :          0 :             pDateStyle->AddMonth();
    1141         [ #  # ]:          0 :             pDateStyle->AddText(A2OUSTR("/"));
    1142                 :          0 :             pDateStyle->AddYear();
    1143                 :            :         }
    1144                 :            :     }
    1145         [ #  # ]:          0 :     else if (sFormula[1] == 'T')
    1146                 :            :     {
    1147         [ #  # ]:          0 :         if (sFormula == A2OUSTR("%T1"))
    1148                 :            :         {
    1149         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
    1150                 :          0 :             pTimeStyle->AddHour();
    1151         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
    1152                 :          0 :             pTimeStyle->AddMinute();
    1153                 :            :         }
    1154 [ #  # ][ #  #  :          0 :         else if (sFormula == A2OUSTR("%T2") || sFormula == A2OUSTR("%T6")
             #  #  #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1155 [ #  # ][ #  # ]:          0 :          || sFormula == A2OUSTR("%T4") || sFormula == A2OUSTR("%T8") )
    1156                 :            :         {
    1157         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
    1158                 :          0 :             pTimeStyle->AddHour(sal_False);
    1159         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
    1160                 :          0 :             pTimeStyle->AddMinute();
    1161         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
    1162                 :          0 :             pTimeStyle->SetAmPm(sal_True);
    1163                 :            :         }
    1164 [ #  # ][ #  #  :          0 :         else if (sFormula == A2OUSTR("%T3") || sFormula == A2OUSTR("%T7")
             #  #  #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1165 [ #  # ][ #  # ]:          0 :          || sFormula == A2OUSTR("%T5") || sFormula == A2OUSTR("%T9"))
    1166                 :            :         {
    1167         [ #  # ]:          0 :             pTimeStyle = new XFTimeStyle;
    1168                 :          0 :             pTimeStyle->AddHour();
    1169         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
    1170                 :          0 :             pTimeStyle->AddMinute();
    1171         [ #  # ]:          0 :             pTimeStyle->AddText(A2OUSTR(":"));
    1172                 :          0 :             pTimeStyle->SetAmPm(sal_True);
    1173                 :            :         }
    1174                 :            :     }
    1175                 :          9 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
    1176         [ +  - ]:          9 :     if (pDateStyle)
    1177                 :          9 :         m_TimeStyle = pXFStyleManager->AddStyle(pDateStyle)->GetStyleName();
    1178         [ -  + ]:          9 :     if (pTimeStyle)
    1179                 :          0 :         m_TimeStyle = pXFStyleManager->AddStyle(pTimeStyle)->GetStyleName();
    1180                 :            : }
    1181                 :            : 
    1182                 :         12 : void LwpFribField::CheckFieldType(LwpFieldMark* pFieldMark)
    1183                 :            : {
    1184                 :            :     sal_uInt8 nType;
    1185                 :         12 :     OUString sFormula;
    1186 [ +  - ][ +  - ]:         12 :     if (pFieldMark->IsDateTimeField(nType,sFormula))
    1187                 :            :     {
    1188                 :         12 :         m_nDateTimeType = nType;
    1189                 :         12 :         m_sFormula = sFormula;
    1190                 :         12 :         m_nSubType = SUBFIELD_DATETIME;
    1191                 :            :     }
    1192 [ #  # ][ #  # ]:          0 :     else if (pFieldMark->IsCrossRefField(nType,sFormula))
    1193                 :            :     {
    1194                 :          0 :         m_nCrossRefType = nType;
    1195                 :          0 :         m_sFormula = sFormula;
    1196                 :          0 :         m_nSubType = SUBFIELD_CROSSREF;
    1197                 :            :     }
    1198 [ #  # ][ #  # ]:          0 :     else if (pFieldMark->IsDocPowerField(nType,sFormula))
    1199                 :            :     {
    1200                 :          0 :         m_nDocPowerType = nType;
    1201                 :          0 :         m_nSubType = SUBFIELD_DOCPOWER;
    1202                 :            :     }
    1203                 :            :     else
    1204                 :            :     {
    1205                 :          0 :         m_nSubType = SUBFIELD_INVALID;
    1206                 :         12 :     }
    1207                 :         12 : }
    1208                 :            : 
    1209                 :          0 : void LwpFribField::ConvertDocFieldStart(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark)
    1210                 :            : {
    1211                 :          0 :     XFContent* pContent = NULL;
    1212   [ #  #  #  #  :          0 :     switch(m_nDocPowerType)
                      # ]
    1213                 :            :     {
    1214                 :            :         case LwpFieldMark::DOC_DESCRIPTION:
    1215                 :            :         {
    1216                 :          0 :             pContent = new XFDescriptionStart;
    1217                 :          0 :             break;
    1218                 :            :         }
    1219                 :            :         case LwpFieldMark::DOC_NUMPAGES:
    1220                 :            :         {
    1221                 :          0 :             pContent = new XFPageCountStart;
    1222                 :          0 :             break;
    1223                 :            :         }
    1224                 :            :         case LwpFieldMark::DOC_NUMWORDS:
    1225                 :            :         {
    1226                 :          0 :             pContent = new XFWordCountStart;
    1227                 :          0 :             break;
    1228                 :            :         }
    1229                 :            :         case LwpFieldMark::DOC_NUMCHARS:
    1230                 :            :         {
    1231                 :          0 :             pContent = new XFCharCountStart;
    1232                 :          0 :             break;
    1233                 :            :         }
    1234                 :            : //      case LwpFieldMark::DOC_TOTALTIME:
    1235                 :            : //      {
    1236                 :            : //          pContent = new XFTotalEditTimeStart;
    1237                 :            : //          pContent->SetStyleName(m_TimeStyle);
    1238                 :            : //          break;
    1239                 :            : //      }
    1240                 :            :     }
    1241         [ #  # ]:          0 :     if (pContent)
    1242                 :            :     {
    1243         [ #  # ]:          0 :         if (m_ModFlag)//(m_pModifiers)
    1244                 :            :         {
    1245         [ #  # ]:          0 :             XFTextSpanStart* pSpan = new XFTextSpanStart;
    1246         [ #  # ]:          0 :             pSpan->SetStyleName(GetStyleName());
    1247                 :          0 :             pSpan->Add(pContent);
    1248                 :          0 :             pXFPara->Add(pSpan);
    1249                 :          0 :             pFieldMark->SetStyleFlag(sal_True);
    1250                 :            :         }
    1251                 :            :         else
    1252                 :          0 :             pXFPara->Add(pContent);
    1253                 :            :     }
    1254                 :          0 : }
    1255                 :            : 
    1256                 :          0 : void LwpFribField::ConvertDocFieldEnd(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark)
    1257                 :            : {
    1258                 :          0 :     XFContent* pContent = NULL;
    1259   [ #  #  #  #  :          0 :     switch(m_nDocPowerType)
                      # ]
    1260                 :            :     {
    1261                 :            :         case LwpFieldMark::DOC_DESCRIPTION:
    1262                 :            :         {
    1263                 :          0 :             pContent = new XFDescriptionEnd;
    1264                 :          0 :             break;
    1265                 :            :         }
    1266                 :            :         case LwpFieldMark::DOC_NUMPAGES:
    1267                 :            :         {
    1268                 :          0 :             pContent = new XFPageCountEnd;
    1269                 :          0 :             break;
    1270                 :            :         }
    1271                 :            :         case LwpFieldMark::DOC_NUMWORDS:
    1272                 :            :         {
    1273                 :          0 :             pContent = new XFWordCountEnd;
    1274                 :          0 :             break;
    1275                 :            :         }
    1276                 :            :         case LwpFieldMark::DOC_NUMCHARS:
    1277                 :            :         {
    1278                 :          0 :             pContent = new XFCharCountEnd;
    1279                 :          0 :             break;
    1280                 :            :         }
    1281                 :            : //      case LwpFieldMark::DOC_TOTALTIME:
    1282                 :            : //      {
    1283                 :            : //          pContent = new XFTotalEditTimeEnd;
    1284                 :            : //          break;
    1285                 :            : //      }
    1286                 :            :     }
    1287         [ #  # ]:          0 :     if (pContent)
    1288                 :            :     {
    1289         [ #  # ]:          0 :         if (pFieldMark->GetStyleFlag())
    1290                 :            :         {
    1291         [ #  # ]:          0 :             XFTextSpanEnd* pSpan = new XFTextSpanEnd;
    1292                 :          0 :             pSpan->Add(pContent);
    1293                 :          0 :             pXFPara->Add(pSpan);
    1294                 :            :         }
    1295                 :            :         else
    1296                 :          0 :             pXFPara->Add(pContent);
    1297                 :            :     }
    1298                 :          0 : }
    1299                 :            : 
    1300                 :          6 : void LwpFribField::ConvertDateTimeStart(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark)
    1301                 :            : {
    1302                 :          6 :     XFContent* pContent = NULL;
    1303   [ +  -  -  -  :          6 :     switch(m_nDateTimeType)
                      - ]
    1304                 :            :     {
    1305                 :            :     case LwpFieldMark::DATETIME_NOW:
    1306                 :            :     {
    1307         [ +  - ]:          6 :         pContent = new XFDateStart;
    1308         [ +  - ]:          6 :         pContent->SetStyleName(m_TimeStyle);
    1309                 :          6 :         break;
    1310                 :            :     }
    1311                 :            :     case LwpFieldMark::DATETIME_CREATE:
    1312                 :            :     {
    1313                 :          0 :         pContent = new XFCreateTimeStart;
    1314         [ #  # ]:          0 :         pContent->SetStyleName(m_TimeStyle);
    1315                 :          0 :         break;
    1316                 :            :     }
    1317                 :            :     case LwpFieldMark::DATETIME_LASTEDIT:
    1318                 :            :     {
    1319                 :          0 :         pContent = new XFLastEditTimeStart;
    1320         [ #  # ]:          0 :         pContent->SetStyleName(m_TimeStyle);
    1321                 :          0 :         break;
    1322                 :            :     }
    1323                 :            :     case LwpFieldMark::DATETIME_TOTALTIME:
    1324                 :            :     {
    1325                 :          0 :         pContent = new XFTotalEditTimeStart;
    1326         [ #  # ]:          0 :         pContent->SetStyleName(m_TimeStyle);
    1327                 :          0 :         break;
    1328                 :            :     }
    1329                 :            :     default:
    1330                 :          0 :         break;
    1331                 :            :     }
    1332         [ +  - ]:          6 :     if (pContent)
    1333                 :            :     {
    1334         [ -  + ]:          6 :         if (m_ModFlag)//(m_pModifiers)
    1335                 :            :         {
    1336         [ #  # ]:          0 :             XFTextSpanStart* pSpan = new XFTextSpanStart;
    1337         [ #  # ]:          0 :             pSpan->SetStyleName(GetStyleName());
    1338                 :          0 :             pSpan->Add(pContent);
    1339                 :          0 :             pXFPara->Add(pSpan);
    1340                 :          0 :             pFieldMark->SetStyleFlag(sal_True);
    1341                 :            :         }
    1342                 :            :         else
    1343                 :          6 :             pXFPara->Add(pContent);
    1344                 :            :     }
    1345                 :            : 
    1346                 :          6 : }
    1347                 :            : 
    1348                 :          6 : void LwpFribField::ConvertDateTimeEnd(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark)
    1349                 :            : {
    1350                 :          6 :     XFContent* pContent = NULL;
    1351   [ +  -  -  -  :          6 :     switch(m_nDateTimeType)
                      - ]
    1352                 :            :     {
    1353                 :            :         case LwpFieldMark::DATETIME_NOW:
    1354                 :            :         {
    1355                 :          6 :             pContent = new XFDateEnd;
    1356                 :          6 :             break;
    1357                 :            :         }
    1358                 :            :         case LwpFieldMark::DATETIME_CREATE:
    1359                 :            :         {
    1360                 :          0 :             pContent = new XFCreateTimeEnd;
    1361                 :          0 :             break;
    1362                 :            :         }
    1363                 :            :         case LwpFieldMark::DATETIME_LASTEDIT:
    1364                 :            :         {
    1365                 :          0 :             pContent = new XFLastEditTimeEnd;
    1366                 :          0 :             break;
    1367                 :            :         }
    1368                 :            :         case LwpFieldMark::DATETIME_TOTALTIME:
    1369                 :            :         {
    1370                 :          0 :             pContent = new XFTotalEditTimeEnd;
    1371                 :          0 :             break;
    1372                 :            :         }
    1373                 :            :     }
    1374         [ +  - ]:          6 :     if (pContent)
    1375                 :            :     {
    1376         [ -  + ]:          6 :         if (pFieldMark->GetStyleFlag())
    1377                 :            :         {
    1378         [ #  # ]:          0 :             XFTextSpanEnd* pSpan = new XFTextSpanEnd;
    1379                 :          0 :             pSpan->Add(pContent);
    1380                 :          0 :             pXFPara->Add(pSpan);
    1381                 :            :         }
    1382                 :            :         else
    1383                 :          6 :             pXFPara->Add(pContent);
    1384                 :            :     }
    1385                 :          6 : }
    1386                 :            : 
    1387                 :          0 : void LwpFribField::ConvertCrossRefStart(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark)
    1388                 :            : {
    1389         [ #  # ]:          0 :     XFCrossRefStart* pRef = new XFCrossRefStart;
    1390                 :          0 :     pRef->SetRefType(m_nCrossRefType);
    1391                 :          0 :     pRef->SetMarkName(m_sFormula);
    1392                 :            : //  pFieldMark->SetStart(sal_True);//for some disnormal cases
    1393         [ #  # ]:          0 :     if (m_ModFlag)
    1394                 :            :     {
    1395         [ #  # ]:          0 :         XFTextSpanStart* pSpan = new XFTextSpanStart;
    1396         [ #  # ]:          0 :         pSpan->SetStyleName(GetStyleName());
    1397                 :          0 :         pSpan->Add(pRef);
    1398                 :          0 :         pXFPara->Add(pSpan);
    1399                 :          0 :         pFieldMark->SetStyleFlag(sal_True);
    1400                 :            :     }
    1401                 :            :     else
    1402                 :          0 :         pXFPara->Add(pRef);
    1403                 :          0 : }
    1404                 :            : 
    1405                 :          0 : void LwpFribField::ConvertCrossRefEnd(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark)
    1406                 :            : {
    1407         [ #  # ]:          0 :     XFCrossRefEnd* pRef = new XFCrossRefEnd;
    1408         [ #  # ]:          0 :     if (pFieldMark->GetStyleFlag())
    1409                 :            :     {
    1410         [ #  # ]:          0 :         XFTextSpanEnd* pSpan = new XFTextSpanEnd;
    1411                 :          0 :         pSpan->Add(pRef);
    1412                 :          0 :         pXFPara->Add(pSpan);
    1413                 :            :     }
    1414                 :            :     else
    1415                 :          0 :         pXFPara->Add(pRef);
    1416                 :          0 : }
    1417                 :            : 
    1418         [ #  # ]:          0 : LwpFribRubyMarker::LwpFribRubyMarker( LwpPara* pPara ): LwpFrib(pPara)
    1419                 :            : {
    1420                 :          0 : }
    1421                 :            : 
    1422                 :          0 : LwpRubyMarker* LwpFribRubyMarker::GetMarker()
    1423                 :            : {
    1424         [ #  # ]:          0 :     return dynamic_cast<LwpRubyMarker*>(m_objMarker.obj(VO_RUBYMARKER));
    1425                 :            : }
    1426                 :            : 
    1427                 :          0 : void LwpFribRubyMarker::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
    1428                 :            : {
    1429                 :          0 :     m_objMarker.ReadIndexed(pObjStrm);
    1430                 :          0 :     m_nType = pObjStrm->QuickReaduInt8();
    1431                 :          0 : }
    1432                 :            : 
    1433                 :          0 : void LwpFribRubyMarker::XFConvert(XFContentContainer* pXFPara)
    1434                 :            : {
    1435                 :          0 :     sal_uInt8 type = GetType();
    1436                 :          0 :     LwpRubyMarker* pMarker = GetMarker();
    1437                 :            : 
    1438         [ #  # ]:          0 :     if (type == MARKER_START)
    1439                 :            :     {
    1440                 :          0 :         XFRubyStart* pRubyStart = new XFRubyStart;
    1441         [ #  # ]:          0 :         if (pMarker)
    1442                 :            :         {
    1443         [ #  # ]:          0 :             pRubyStart->SetStyleName(pMarker->GetRubyStyleName());
    1444                 :            :         }
    1445                 :          0 :         pXFPara->Add(pRubyStart);
    1446                 :            :     }
    1447         [ #  # ]:          0 :     else if(type == MARKER_END)
    1448                 :            :     {
    1449                 :          0 :         XFRubyEnd* pRubyEnd = new XFRubyEnd;
    1450         [ #  # ]:          0 :         if (pMarker)
    1451                 :            :         {
    1452                 :          0 :             pRubyEnd->SetText(pMarker->GetRubyText());
    1453         [ #  # ]:          0 :             pRubyEnd->SetStyleName(pMarker->GetTextStyleName());
    1454                 :            :         }
    1455                 :          0 :         pXFPara->Add(pRubyEnd);
    1456                 :            :     }
    1457                 :          0 : }
    1458                 :            : 
    1459                 :          0 : void LwpFribRubyMarker::RegisterStyle(LwpFoundry* /*pFoundry*/)
    1460                 :            : {
    1461                 :          0 : }
    1462                 :            : 
    1463                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10