1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
10 * Sun Microsystems Inc., October, 2000
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
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.
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.
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,
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.
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.
46 * The Initial Developer of the Original Code is: IBM Corporation
48 * Copyright: 2008 by IBM Corporation
50 * All Rights Reserved.
52 * Contributor(s): _______________________________________
55 ************************************************************************/
56 /*************************************************************************
58 * For LWP filter architecture prototype
59 ************************************************************************/
60 /*************************************************************************
63 ************************************************************************/
65 #include "lwpfribmark.hxx"
66 #include "lwptools.hxx"
67 #include "lwpglobalmgr.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"
85 * @short: Read hyperlink frib and Click here block
89 void LwpFribCHBlock::Read(LwpObjectStream
* pObjStrm
, sal_uInt16
/*len*/)
91 m_objMarker
.ReadIndexed(pObjStrm
);
92 m_nType
= pObjStrm
->QuickReaduInt8();
95 LwpCHBlkMarker
* LwpFribCHBlock::GetMarker()
97 return dynamic_cast<LwpCHBlkMarker
*>(m_objMarker
.obj());
100 void LwpFribCHBlock::XFConvert(XFContentContainer
* pXFPara
,LwpStory
* pStory
)
102 sal_uInt8 type
= GetType();
105 LwpCHBlkMarker
* pMarker
= GetMarker();
109 sal_uInt16 nAction
= pMarker
->GetAction();
110 if (nAction
== LwpCHBlkMarker::CLICKHERE_CHBEHAVIORINTERNETLINK
)//hyperlink
112 LwpHyperlinkMgr
* pHyperlink
= pStory
->GetHyperlinkMgr();
113 if (type
== MARKER_START
)
117 pHyperlink
->SetHyperlinkFlag(sal_True
);
118 pHyperlink
->SetHyperlink(pMarker
->GetNamedProperty(A2OUSTR("URL")));
121 else if (type
== MARKER_END
)//or none
123 pHyperlink
->SetHyperlinkFlag(sal_False
);
126 else//click here block
128 pMarker
->ConvertCHBlock(pXFPara
,type
);
132 * @short: register bookmark frib
136 void LwpFribBookMark::RegisterStyle(LwpFoundry
* pFoundry
)
139 LwpBookMark
* pBook
= pFoundry
->GetBookMark(GetMarkerID());
141 name
= pBook
->GetName();
144 LwpDocument
* pDoc
= pFoundry
->GetDocument();
147 LwpObjectID
* pID
= pDoc
->GetDivInfoID();
150 LwpDivInfo
*pDivInvo
= dynamic_cast<LwpDivInfo
*>(pID
->obj(VO_DIVISIONINFO
));
152 sDivision
= pDivInvo
->GetDivName();
156 sal_uInt8 type
= GetType();
158 LwpGlobalMgr
* pGlobal
= LwpGlobalMgr::GetInstance();
159 LwpBookmarkMgr
* pMarkMgr
= pGlobal
->GetLwpBookmarkMgr();
160 if (type
== MARKER_START
)
162 XFBookmarkStart
* pMarkStart
= new XFBookmarkStart
;
163 pMarkStart
->SetDivision(sDivision
);
164 pMarkStart
->SetName(name
);
165 pMarkMgr
->AddXFBookmarkStart(name
,pMarkStart
);//add to map
166 m_pStart
= pMarkStart
;
168 else if(type
== MARKER_END
)
170 XFBookmarkEnd
* pMarkEnd
= new XFBookmarkEnd
;
171 pMarkEnd
->SetDivision(sDivision
);
172 pMarkEnd
->SetName(name
);
173 pMarkMgr
->AddXFBookmarkEnd(name
,pMarkEnd
); //add to map
178 LwpFribBookMark::LwpFribBookMark(LwpPara
* pPara
) : LwpFrib(pPara
),m_pStart(NULL
),m_pEnd(NULL
)
183 * @short: Read bookmark frib
187 void LwpFribBookMark::Read(LwpObjectStream
* pObjStrm
, sal_uInt16
/*len*/)
189 m_objMarker
.ReadIndexed(pObjStrm
);
190 m_nType
= pObjStrm
->QuickReaduInt8();
193 * @short: convert bookmark frib
197 void LwpFribBookMark::XFConvert(XFContentContainer
* pXFPara
)
199 sal_uInt8 type
= GetType();
201 if (type
== MARKER_START
&& m_pStart
)
203 pXFPara
->Add(m_pStart
);
205 else if(type
== MARKER_END
&& m_pEnd
)
207 pXFPara
->Add(m_pEnd
);
212 * @short: Read index entry frib
216 LwpFribField::LwpFribField( LwpPara
* pPara
) : LwpFrib(pPara
)
218 m_TimeStyle
= A2OUSTR("");
220 m_nSubType
= 0;//datetime/crossref/other
221 m_sFormula
= A2OUSTR("");
227 void LwpFribField::Read(LwpObjectStream
* pObjStrm
, sal_uInt16
/*len*/)
229 m_objMarker
.ReadIndexed(pObjStrm
);
230 m_nType
= pObjStrm
->QuickReaduInt8();
233 LwpFieldMark
* LwpFribField::GetMarker()
235 return dynamic_cast<LwpFieldMark
*>(m_objMarker
.obj());
238 void LwpFribField::XFConvert(XFContentContainer
* pXFPara
)
240 LwpFieldMark
* pFieldMark
= GetMarker();
244 sal_uInt8 type
= GetType();
245 sal_uInt16 fieldType
= pFieldMark
->GetFieldType();
248 if(pFieldMark
->GetRevisionFlag())
250 LwpGlobalMgr
* pGlobal
= LwpGlobalMgr::GetInstance();
251 LwpChangeMgr
* pChangeMgr
= pGlobal
->GetLwpChangeMgr();
252 sChangeID
= pChangeMgr
->GetChangeID(pFieldMark
->GetStartFrib());
255 CheckFieldType(pFieldMark
);
257 if (type
== MARKER_END
)
259 if (pFieldMark
->GetStart() == sal_False
)
261 if (pFieldMark
->IsFormulaInsert())
263 XFTextContent
*pSpan
= new XFTextContent();
264 pSpan
->SetText(A2OUSTR(">"));
267 if (fieldType
== LwpFieldMark::FLD_FIELD
)
269 if (m_nSubType
== SUBFIELD_DATETIME
)
271 ConvertDateTimeEnd(pXFPara
,pFieldMark
);
273 else if (m_nSubType
== SUBFIELD_CROSSREF
)
275 ConvertCrossRefEnd(pXFPara
,pFieldMark
);
277 else if (m_nSubType
== SUBFIELD_DOCPOWER
)
279 ConvertDocFieldEnd(pXFPara
,pFieldMark
);
282 if(pFieldMark
->GetRevisionFlag() && !sChangeID
.isEmpty())
284 XFChangeEnd
* pChangeEnd
= new XFChangeEnd
;
285 pChangeEnd
->SetChangeID(sChangeID
);
286 pXFPara
->Add(pChangeEnd
);
293 if(pFieldMark
->GetRevisionFlag() && !sChangeID
.isEmpty())
295 XFChangeStart
* pChangeStart
= new XFChangeStart
;
296 pChangeStart
->SetChangeID(sChangeID
);
297 pXFPara
->Add(pChangeStart
);
300 if (fieldType
== LwpFieldMark::FLD_INDEX
)
302 OUString sKey1
,sKey2
;
303 pFieldMark
->ParseIndex(sKey1
,sKey2
);
304 if (!sKey1
.isEmpty())
306 XFEntry
* pEntry
= new XFEntry
;
307 pEntry
->SetEntryType(enumXFEntryAlphabetical
);
308 pEntry
->SetKey(sKey1
,sKey2
);
309 pXFPara
->Add(pEntry
);
312 else if (fieldType
== LwpFieldMark::FLD_TOC
)
314 OUString sLevel
,sText
;
315 pFieldMark
->ParseTOC(sLevel
,sText
);
316 if (!sLevel
.isEmpty() && !sText
.isEmpty())
318 XFEntry
* pEntry
= new XFEntry
;
319 pEntry
->SetEntryType(enumXFEntryTOC
);
320 pEntry
->SetStringValue(sText
);
321 pEntry
->SetOutlineLevel(sLevel
.toInt32(10));
322 pXFPara
->Add(pEntry
);
325 else if (fieldType
== LwpFieldMark::FLD_FIELD
)
329 /*sal_Bool bIsDateTime =*/ pFieldMark
->IsDateTimeField(nDatetype
,sFormula
);
331 if (m_nSubType
== SUBFIELD_DATETIME
)//date time
333 ConvertDateTimeStart(pXFPara
,pFieldMark
);
335 else if (m_nSubType
== SUBFIELD_CROSSREF
)//cross ref
337 ConvertCrossRefStart(pXFPara
,pFieldMark
);
339 else if (m_nSubType
== SUBFIELD_DOCPOWER
)
341 ConvertDocFieldStart(pXFPara
,pFieldMark
);
345 if (pFieldMark
->IsFormulaInsert())
347 XFTextContent
*pSpan
= new XFTextContent();
348 pSpan
->SetText(A2OUSTR("<"));
352 pFieldMark
->SetStart(sal_True
);
355 void LwpFribField::RegisterStyle(LwpFoundry
* pFoundry
)
357 LwpFrib::RegisterStyle(pFoundry
);
358 LwpFieldMark
* pFieldMark
= GetMarker();
362 sal_uInt8 type
= GetType();
363 sal_uInt16 fieldType
= pFieldMark
->GetFieldType();
365 if (type
== MARKER_START
&& fieldType
== LwpFieldMark::FLD_FIELD
)
367 RegisterTimeField(pFieldMark
);
370 if (type
== MARKER_START
&& m_bRevisionFlag
)
372 LwpGlobalMgr
* pGlobal
= LwpGlobalMgr::GetInstance();
373 LwpChangeMgr
* pChangeMgr
= pGlobal
->GetLwpChangeMgr();
374 pChangeMgr
->AddChangeFrib(this);
375 pFieldMark
->SetStartFrib(this);
376 pFieldMark
->SetRevisionFlag(sal_True
);
380 void LwpFribField::RegisterTimeField(LwpFieldMark
* pFieldMark
)
382 OUString sFormula
= pFieldMark
->GetFormula();//now bookmark maybe not all register to bookmarkmgr,
383 if (sFormula
== A2OUSTR("TotalEditingTime"))//so check field type now is not correct.
384 RegisterTotalTimeStyle();
388 sal_Unicode
ch1(0x0020);//space
390 index
= sFormula
.indexOf(ch1
,0);
394 tag
= sFormula
.copy(0,index
);
395 if (tag
== A2OUSTR("Now()") || tag
== A2OUSTR("CreateDate") || tag
== A2OUSTR("EditDate"))
396 RegisterDateTimeStyle(sFormula
.copy(index
+1,sFormula
.getLength()-index
-1));
400 void LwpFribField::RegisterTotalTimeStyle()
402 XFTimeStyle
* pTimeStyle
= new XFTimeStyle
;//use the default format
403 pTimeStyle
->SetTruncate(sal_False
);
404 pTimeStyle
->AddMinute();
405 XFStyleManager
* pXFStyleManager
= LwpGlobalMgr::GetInstance()->GetXFStyleManager();
406 m_TimeStyle
= pXFStyleManager
->AddStyle(pTimeStyle
)->GetStyleName();
409 void LwpFribField::RegisterDateTimeStyle(OUString sFormula
)
411 XFDateStyle
* pDateStyle
= NULL
;
412 XFTimeStyle
* pTimeStyle
= NULL
;
414 if (sFormula
.getLength()<2)
416 if (sFormula
[1] == 'F')
418 if (sFormula
== A2OUSTR("%FLSystemShortDate"))
420 pDateStyle
= LwpTools::GetSystemDateStyle(sal_False
);
422 else if (sFormula
== A2OUSTR("%FLSystemLongDate"))
424 pDateStyle
= LwpTools::GetSystemDateStyle(sal_True
);
426 else if (sFormula
== A2OUSTR("%FLISODate1") || sFormula
== A2OUSTR("%FLYYYY/MM/DD") )
428 pDateStyle
= new XFDateStyle
;
429 pDateStyle
->AddYear();
430 pDateStyle
->AddText(A2OUSTR("/"));
431 pDateStyle
->AddMonth();
432 pDateStyle
->AddText(A2OUSTR("/"));
433 pDateStyle
->AddMonthDay();
435 else if (sFormula
== A2OUSTR("%FLISODate2") || sFormula
== A2OUSTR("%FLYYYY/MM/DD HH:mm:SS") )
437 pDateStyle
= new XFDateStyle
;
438 pDateStyle
->AddYear();
439 pDateStyle
->AddText(A2OUSTR("/"));
440 pDateStyle
->AddMonth();
441 pDateStyle
->AddText(A2OUSTR("/"));
442 pDateStyle
->AddMonthDay();
443 pDateStyle
->AddText(A2OUSTR(" "));
444 pDateStyle
->AddHour();
445 pDateStyle
->AddText(A2OUSTR(":"));
446 pDateStyle
->AddMinute();
447 pDateStyle
->AddText(A2OUSTR(":"));
448 pDateStyle
->AddSecond(sal_True
,0);
450 else if (sFormula
== A2OUSTR("%FLM/D/YY"))
452 pDateStyle
= new XFDateStyle
;
453 pDateStyle
->AddMonth(sal_False
);
454 pDateStyle
->AddText(A2OUSTR("/"));
455 pDateStyle
->AddMonthDay(sal_False
);
456 pDateStyle
->AddText(A2OUSTR("/"));
457 pDateStyle
->AddYear(sal_False
);
459 else if (sFormula
== A2OUSTR("%FLMonth D, YYYY"))
461 pDateStyle
= new XFDateStyle
;
462 pDateStyle
->AddMonth(sal_True
,sal_True
);
463 pDateStyle
->AddText(A2OUSTR(" "));
464 pDateStyle
->AddMonthDay(sal_False
);
465 pDateStyle
->AddText(A2OUSTR(", "));
466 pDateStyle
->AddYear();
468 else if (sFormula
== A2OUSTR("%FLWeekday, Month D, YYYY"))
470 pDateStyle
= new XFDateStyle
;
471 pDateStyle
->AddWeekDay();
472 pDateStyle
->AddText(A2OUSTR(", "));
473 pDateStyle
->AddMonth(sal_True
,sal_True
);
474 pDateStyle
->AddText(A2OUSTR(" "));
475 pDateStyle
->AddMonthDay(sal_False
);
476 pDateStyle
->AddText(A2OUSTR(", "));
477 pDateStyle
->AddYear();
479 else if (sFormula
== A2OUSTR("%FLMn D, YYYY"))
481 pDateStyle
= new XFDateStyle
;
482 pDateStyle
->AddMonth(sal_False
,sal_True
);
483 pDateStyle
->AddText(A2OUSTR(" "));
484 pDateStyle
->AddMonthDay(sal_False
);
485 pDateStyle
->AddText(A2OUSTR(", "));
486 pDateStyle
->AddYear();
488 else if (sFormula
== A2OUSTR("%FLWday, Mn D, YYYY"))
490 pDateStyle
= new XFDateStyle
;
491 pDateStyle
->AddWeekDay(sal_False
);
492 pDateStyle
->AddText(A2OUSTR(", "));
493 pDateStyle
->AddMonth(sal_False
,sal_True
);
494 pDateStyle
->AddText(A2OUSTR(" "));
495 pDateStyle
->AddMonthDay(sal_False
);
496 pDateStyle
->AddText(A2OUSTR(", "));
497 pDateStyle
->AddYear();
499 else if (sFormula
== A2OUSTR("%FLMn D"))
501 pDateStyle
= new XFDateStyle
;
502 pDateStyle
->AddMonth(sal_False
,sal_True
);
503 pDateStyle
->AddText(A2OUSTR(" "));
504 pDateStyle
->AddMonthDay(sal_False
);
506 else if (sFormula
== A2OUSTR("%FLWeekday, Mn D"))
508 pDateStyle
= new XFDateStyle
;
509 pDateStyle
->AddWeekDay();
510 pDateStyle
->AddText(A2OUSTR(", "));
511 pDateStyle
->AddMonth(sal_False
,sal_True
);
512 pDateStyle
->AddText(A2OUSTR(" "));
513 pDateStyle
->AddMonthDay(sal_False
);
515 else if (sFormula
== A2OUSTR("%FLMn D, YY"))
517 pDateStyle
= new XFDateStyle
;
518 pDateStyle
->AddMonth(sal_False
,sal_True
);
519 pDateStyle
->AddText(A2OUSTR(" "));
520 pDateStyle
->AddMonthDay(sal_False
);
521 pDateStyle
->AddText(A2OUSTR(", "));
522 pDateStyle
->AddYear(sal_False
);
524 else if (sFormula
== A2OUSTR("%FLM/D"))
526 pDateStyle
= new XFDateStyle
;
527 pDateStyle
->AddMonth(sal_False
);
528 pDateStyle
->AddText(A2OUSTR("/"));
529 pDateStyle
->AddMonthDay(sal_False
);
531 else if (sFormula
== A2OUSTR("%FLM/YY"))
533 pDateStyle
= new XFDateStyle
;
534 pDateStyle
->AddMonth(sal_False
);
535 pDateStyle
->AddText(A2OUSTR("/"));
536 pDateStyle
->AddYear(sal_False
);
538 else if (sFormula
== A2OUSTR("%FLMn YY"))
540 pDateStyle
= new XFDateStyle
;
541 pDateStyle
->AddMonth(sal_False
,sal_True
);
542 pDateStyle
->AddText(A2OUSTR(" "));
543 pDateStyle
->AddYear(sal_False
);
545 else if (sFormula
== A2OUSTR("%FLWeekday"))
547 pDateStyle
= new XFDateStyle
;
548 pDateStyle
->AddWeekDay();
550 else if (sFormula
== A2OUSTR("%FLWday"))
552 pDateStyle
= new XFDateStyle
;
553 pDateStyle
->AddWeekDay(sal_False
);
555 else if (sFormula
== A2OUSTR("%FLMonth"))
557 pDateStyle
= new XFDateStyle
;
558 pDateStyle
->AddMonth(sal_True
,sal_True
);
560 else if (sFormula
== A2OUSTR("%FLMn"))
562 pDateStyle
= new XFDateStyle
;
563 pDateStyle
->AddMonth(sal_False
,sal_True
);
565 else if (sFormula
== A2OUSTR("%FLD"))
567 pDateStyle
= new XFDateStyle
;
568 pDateStyle
->AddMonthDay(sal_False
);
570 else if (sFormula
== A2OUSTR("%FLM"))
572 pDateStyle
= new XFDateStyle
;
573 pDateStyle
->AddMonth(sal_False
);
575 else if (sFormula
== A2OUSTR("%FLYYYY") )
577 pDateStyle
= new XFDateStyle
;
578 pDateStyle
->AddYear();
580 else if (sFormula
== A2OUSTR("%FLYY"))
582 pDateStyle
= new XFDateStyle
;
583 pDateStyle
->AddYear(sal_False
);
585 //chinese version begin
586 else if (sFormula
== A2OUSTR("%FLYY/M/D"))
588 pDateStyle
= new XFDateStyle
;
589 pDateStyle
->AddYear(sal_False
);
590 pDateStyle
->AddText(A2OUSTR("-"));
591 pDateStyle
->AddMonth(sal_False
);
592 pDateStyle
->AddText(A2OUSTR("-"));
593 pDateStyle
->AddMonthDay(sal_False
);
595 else if(sFormula
== A2OUSTR("%FLYYYY Month D"))
597 pDateStyle
= new XFDateStyle
;
598 pDateStyle
->AddYear();
599 pDateStyle
->AddText(A2OUSTR(" "));
600 pDateStyle
->AddMonth(sal_True
,sal_True
);
601 pDateStyle
->AddText(A2OUSTR(" "));
602 pDateStyle
->AddMonthDay(sal_False
);
604 else if(sFormula
== A2OUSTR("%FLWeekday, YYYY Month D"))
606 pDateStyle
= new XFDateStyle
;
607 pDateStyle
->AddWeekDay();
608 pDateStyle
->AddText(A2OUSTR(","));
609 pDateStyle
->AddYear();
610 pDateStyle
->AddText(A2OUSTR(" "));
611 pDateStyle
->AddMonth(sal_True
,sal_True
);
612 pDateStyle
->AddText(A2OUSTR(" "));
613 pDateStyle
->AddMonthDay(sal_False
);
615 else if(sFormula
== A2OUSTR("%FLYYYY Mn D"))
617 pDateStyle
= new XFDateStyle
;
618 pDateStyle
->AddYear();
619 pDateStyle
->AddText(A2OUSTR(" "));
620 pDateStyle
->AddMonth(sal_False
,sal_True
);
621 pDateStyle
->AddText(A2OUSTR(" "));
622 pDateStyle
->AddMonthDay(sal_False
);
624 else if(sFormula
== A2OUSTR("%FLWday, YYYY Mn D"))
626 pDateStyle
= new XFDateStyle
;
627 pDateStyle
->AddWeekDay(sal_False
);
628 pDateStyle
->AddText(A2OUSTR(","));
629 pDateStyle
->AddYear();
630 pDateStyle
->AddText(A2OUSTR(" "));
631 pDateStyle
->AddMonth(sal_True
,sal_True
);
632 pDateStyle
->AddText(A2OUSTR(" "));
633 pDateStyle
->AddMonthDay(sal_False
);
635 //next 2 are the same with english version
636 else if (sFormula
== A2OUSTR("%FLYY Mn D"))
638 pDateStyle
= new XFDateStyle
;
639 pDateStyle
->AddYear(sal_False
);
640 pDateStyle
->AddText(A2OUSTR(" "));
641 pDateStyle
->AddMonth(sal_False
,sal_True
);
642 pDateStyle
->AddText(A2OUSTR(" "));
643 pDateStyle
->AddMonthDay(sal_False
);
645 else if (sFormula
== A2OUSTR("%FLYY/M"))
647 pDateStyle
= new XFDateStyle
;
648 pDateStyle
->AddMonth(sal_False
);
649 pDateStyle
->AddText(A2OUSTR("-"));
650 pDateStyle
->AddMonth(sal_False
);
652 else if (sFormula
== A2OUSTR("%FLYY Mn"))
654 pDateStyle
= new XFDateStyle
;
655 pDateStyle
->AddMonth(sal_False
);
656 pDateStyle
->AddText(A2OUSTR(" "));
657 pDateStyle
->AddMonth(sal_False
,sal_True
);
659 else if (sFormula
== A2OUSTR("%FLeeeeoa") || sFormula
== A2OUSTR("%FLffffooaa") || sFormula
== A2OUSTR("%FLEEEEOA"))
661 pDateStyle
= new XFDateStyle
;
663 pDateStyle
->AddYear();
664 sText
= OUString(0x5e74);
665 pDateStyle
->AddText(sText
);
666 pDateStyle
->AddMonth(sal_False
);
667 sText
= OUString(0x6708);
668 pDateStyle
->AddText(sText
);
669 pDateStyle
->AddMonthDay(sal_False
);
670 sText
= OUString(0x65e5);
671 pDateStyle
->AddText(sText
);
673 else if (sFormula
== A2OUSTR("%FLoa") || sFormula
== A2OUSTR("%FLooaa") || sFormula
== A2OUSTR("%FLOA") )
675 pDateStyle
= new XFDateStyle
;
677 pDateStyle
->AddMonth(sal_False
);
678 sText
= OUString(0x6708);
679 pDateStyle
->AddText(sText
);
680 pDateStyle
->AddMonthDay(sal_False
);
681 sText
= OUString(0x65e5);
682 pDateStyle
->AddText(sText
);
684 else if (sFormula
== A2OUSTR("%FLYYYY/M/D") || sFormula
== A2OUSTR("%FLGGGG/od/ad"))
686 pDateStyle
= new XFDateStyle
;
687 pDateStyle
->AddYear();
688 pDateStyle
->AddText(A2OUSTR("-"));
689 pDateStyle
->AddMonth(sal_False
);
690 pDateStyle
->AddText(A2OUSTR("-"));
691 pDateStyle
->AddMonthDay(sal_False
);
693 else if (sFormula
== A2OUSTR("%FLYY.M.D") )
695 pDateStyle
= new XFDateStyle
;
696 pDateStyle
->AddYear(sal_False
);
697 pDateStyle
->AddText(A2OUSTR("."));
698 pDateStyle
->AddMonth(sal_False
);
699 pDateStyle
->AddText(A2OUSTR("."));
700 pDateStyle
->AddMonthDay(sal_False
);
702 //chinese version end
703 //other version begin
704 else if (sFormula
== A2OUSTR("%FLWeekday, Month DD, YYYY") )
706 pDateStyle
= new XFDateStyle
;
707 pDateStyle
->AddWeekDay();
708 pDateStyle
->AddText(A2OUSTR(", "));
709 pDateStyle
->AddMonth(sal_True
,sal_True
);
710 pDateStyle
->AddText(A2OUSTR(" "));
711 pDateStyle
->AddMonthDay();
712 pDateStyle
->AddText(A2OUSTR(", "));
713 pDateStyle
->AddYear();
715 else if (sFormula
== A2OUSTR("%FLYYYY/MM/DD") )
717 pDateStyle
= new XFDateStyle
;
718 pDateStyle
->AddWeekDay();
719 pDateStyle
->AddText(A2OUSTR(", "));
720 pDateStyle
->AddMonth(sal_True
,sal_True
);
721 pDateStyle
->AddText(A2OUSTR(" "));
722 pDateStyle
->AddMonthDay();
723 pDateStyle
->AddText(A2OUSTR(", "));
724 pDateStyle
->AddYear();
726 else if (sFormula
== A2OUSTR("%FLD/M/YY") )
728 pDateStyle
= new XFDateStyle
;
729 pDateStyle
->AddMonthDay(sal_False
);
730 pDateStyle
->AddText(A2OUSTR("/"));
731 pDateStyle
->AddMonth(sal_False
);
732 pDateStyle
->AddText(A2OUSTR("/"));
733 pDateStyle
->AddYear(sal_False
);
735 else if (sFormula
== A2OUSTR("%FLD Month YYYY"))
737 pDateStyle
= new XFDateStyle
;
738 pDateStyle
->AddMonthDay(sal_False
);
739 pDateStyle
->AddText(A2OUSTR(" "));
740 pDateStyle
->AddMonth(sal_True
,sal_True
);
741 pDateStyle
->AddText(A2OUSTR(" "));
742 pDateStyle
->AddYear();
744 else if (sFormula
== A2OUSTR("%FLDD Month YYYY"))
746 pDateStyle
= new XFDateStyle
;
747 pDateStyle
->AddMonthDay();
748 pDateStyle
->AddText(A2OUSTR(" "));
749 pDateStyle
->AddMonth(sal_True
,sal_True
);
750 pDateStyle
->AddText(A2OUSTR(" "));
751 pDateStyle
->AddYear();
753 else if (sFormula
== A2OUSTR("%FLWeekday, D Month YYYY"))
755 pDateStyle
= new XFDateStyle
;
756 pDateStyle
->AddWeekDay();
757 pDateStyle
->AddText(A2OUSTR(", "));
758 pDateStyle
->AddMonthDay(sal_False
);
759 pDateStyle
->AddText(A2OUSTR(" "));
760 pDateStyle
->AddMonth(sal_True
,sal_True
);
761 pDateStyle
->AddText(A2OUSTR(" "));
762 pDateStyle
->AddYear();
764 else if (sFormula
== A2OUSTR("%FLWeekday, DD Month YYYY"))
766 pDateStyle
= new XFDateStyle
;
767 pDateStyle
->AddWeekDay();
768 pDateStyle
->AddText(A2OUSTR(", "));
769 pDateStyle
->AddMonthDay();
770 pDateStyle
->AddText(A2OUSTR(" "));
771 pDateStyle
->AddMonth(sal_True
,sal_True
);
772 pDateStyle
->AddText(A2OUSTR(" "));
773 pDateStyle
->AddYear();
775 else if (sFormula
== A2OUSTR("%FLD Mn YYYY"))
777 pDateStyle
= new XFDateStyle
;
778 pDateStyle
->AddMonthDay(sal_False
);
779 pDateStyle
->AddText(A2OUSTR(" "));
780 pDateStyle
->AddMonth(sal_False
,sal_True
);
781 pDateStyle
->AddText(A2OUSTR(" "));
782 pDateStyle
->AddYear();
784 else if (sFormula
== A2OUSTR("%FLWday, D Mn YYYY"))
786 pDateStyle
= new XFDateStyle
;
787 pDateStyle
->AddWeekDay(sal_False
);
788 pDateStyle
->AddText(A2OUSTR(", "));
789 pDateStyle
->AddMonthDay(sal_False
);
790 pDateStyle
->AddText(A2OUSTR(" "));
791 pDateStyle
->AddMonth(sal_False
,sal_True
);
792 pDateStyle
->AddText(A2OUSTR(" "));
793 pDateStyle
->AddYear();
795 else if (sFormula
== A2OUSTR("%FLWday, DD Mn YYYY"))
797 pDateStyle
= new XFDateStyle
;
798 pDateStyle
->AddWeekDay(sal_False
);
799 pDateStyle
->AddText(A2OUSTR(", "));
800 pDateStyle
->AddMonthDay();
801 pDateStyle
->AddText(A2OUSTR(" "));
802 pDateStyle
->AddMonth(sal_False
,sal_True
);
803 pDateStyle
->AddText(A2OUSTR(" "));
804 pDateStyle
->AddYear();
806 else if (sFormula
== A2OUSTR("%FLD Mn"))
808 pDateStyle
= new XFDateStyle
;
809 pDateStyle
->AddMonthDay(sal_False
);
810 pDateStyle
->AddText(A2OUSTR(" "));
811 pDateStyle
->AddMonth(sal_False
,sal_True
);
813 else if (sFormula
== A2OUSTR("%FLDD Mn"))
815 pDateStyle
= new XFDateStyle
;
816 pDateStyle
->AddMonthDay();
817 pDateStyle
->AddText(A2OUSTR(" "));
818 pDateStyle
->AddMonth(sal_False
,sal_True
);
820 else if (sFormula
== A2OUSTR("%FLWeekday, D Mn"))
822 pDateStyle
= new XFDateStyle
;
823 pDateStyle
->AddWeekDay();
824 pDateStyle
->AddText(A2OUSTR(", "));
825 pDateStyle
->AddMonthDay(sal_False
);
826 pDateStyle
->AddText(A2OUSTR(" "));
827 pDateStyle
->AddMonth(sal_False
,sal_True
);
829 else if (sFormula
== A2OUSTR("%FLWeekday, DD Mn"))
831 pDateStyle
= new XFDateStyle
;
832 pDateStyle
->AddWeekDay();
833 pDateStyle
->AddText(A2OUSTR(", "));
834 pDateStyle
->AddMonthDay();
835 pDateStyle
->AddText(A2OUSTR(" "));
836 pDateStyle
->AddMonth(sal_False
,sal_True
);
838 else if (sFormula
== A2OUSTR("%FLD Mn YY"))
840 pDateStyle
= new XFDateStyle
;
841 pDateStyle
->AddMonthDay(sal_False
);
842 pDateStyle
->AddText(A2OUSTR(" "));
843 pDateStyle
->AddMonth(sal_False
,sal_True
);
844 pDateStyle
->AddText(A2OUSTR(" "));
845 pDateStyle
->AddYear(sal_False
);
847 else if (sFormula
== A2OUSTR("%FLDD Mn YY"))
849 pDateStyle
= new XFDateStyle
;
850 pDateStyle
->AddMonthDay();
851 pDateStyle
->AddText(A2OUSTR(" "));
852 pDateStyle
->AddMonth(sal_False
,sal_True
);
853 pDateStyle
->AddText(A2OUSTR(" "));
854 pDateStyle
->AddYear(sal_False
);
856 else if (sFormula
== A2OUSTR("%FLD/M"))
858 pDateStyle
= new XFDateStyle
;
859 pDateStyle
->AddMonthDay(sal_False
);
860 pDateStyle
->AddText(A2OUSTR("/"));
861 pDateStyle
->AddMonth(sal_False
);
863 else if (sFormula
== A2OUSTR("%FLDD/MM"))
865 pDateStyle
= new XFDateStyle
;
866 pDateStyle
->AddMonthDay();
867 pDateStyle
->AddText(A2OUSTR("/"));
868 pDateStyle
->AddMonth();
870 else if(sFormula
== A2OUSTR("%FLDD/MM/YY"))
872 pDateStyle
= new XFDateStyle
;
873 pDateStyle
->AddMonthDay();
874 pDateStyle
->AddText(A2OUSTR("/"));
875 pDateStyle
->AddMonth();
876 pDateStyle
->AddText(A2OUSTR("/"));
877 pDateStyle
->AddYear(sal_False
);
879 else if (sFormula
== A2OUSTR("%FLMM/YY"))
881 pDateStyle
= new XFDateStyle
;
882 pDateStyle
->AddMonth();
883 pDateStyle
->AddText(A2OUSTR("/"));
884 pDateStyle
->AddYear(sal_False
);
888 else if (sFormula
== A2OUSTR("%FLSystemTime"))
890 pTimeStyle
= LwpTools::GetSystemTimeStyle();
892 else if (sFormula
== A2OUSTR("%FLISOTime1") || sFormula
== A2OUSTR("%FLH:mm:SS"))
894 pTimeStyle
= new XFTimeStyle
;
895 pTimeStyle
->AddHour();
896 pTimeStyle
->AddText(A2OUSTR(":"));
897 pTimeStyle
->AddMinute();
898 pTimeStyle
->AddText(A2OUSTR(":"));
899 pTimeStyle
->AddSecond(sal_True
,0);
901 else if (sFormula
== A2OUSTR("%FLH:mm ampm"))
903 pTimeStyle
= new XFTimeStyle
;
904 pTimeStyle
->AddHour(sal_False
);
905 pTimeStyle
->AddText(A2OUSTR(":"));
906 pTimeStyle
->AddMinute();
907 pTimeStyle
->AddText(A2OUSTR(" "));
908 pTimeStyle
->SetAmPm(sal_True
);
910 else if (sFormula
== A2OUSTR("%FLH:mm"))
912 pTimeStyle
= new XFTimeStyle
;
913 pTimeStyle
->AddHour(sal_False
);
914 pTimeStyle
->AddText(A2OUSTR(":"));
915 pTimeStyle
->AddMinute();
917 else if (sFormula
== A2OUSTR("%FLH:mm:SS ampm"))
919 pTimeStyle
= new XFTimeStyle
;
920 pTimeStyle
->AddHour(sal_False
);
921 pTimeStyle
->AddText(A2OUSTR(":"));
922 pTimeStyle
->AddMinute();
923 pTimeStyle
->AddText(A2OUSTR(":"));
924 pTimeStyle
->AddSecond(sal_True
,0);
925 pTimeStyle
->AddText(A2OUSTR(" "));
926 pTimeStyle
->SetAmPm(sal_True
);
928 else if (sFormula
== A2OUSTR("%FLH:mm:SS"))
930 pTimeStyle
= new XFTimeStyle
;
931 pTimeStyle
->AddHour(sal_False
);
932 pTimeStyle
->AddText(A2OUSTR(":"));
933 pTimeStyle
->AddMinute();
934 pTimeStyle
->AddText(A2OUSTR(":"));
935 pTimeStyle
->AddSecond(sal_True
,0);
937 else if (sFormula
== A2OUSTR("%FLH ampm"))
939 pTimeStyle
= new XFTimeStyle
;
940 pTimeStyle
->AddHour(sal_False
);
941 pTimeStyle
->AddText(A2OUSTR(" "));
942 pTimeStyle
->SetAmPm(sal_True
);
944 else if (sFormula
== A2OUSTR("%FLH"))
946 pTimeStyle
= new XFTimeStyle
;
947 pTimeStyle
->AddHour(sal_False
);
949 else if (sFormula
== A2OUSTR("%FLmm"))
951 pTimeStyle
= new XFTimeStyle
;
952 pTimeStyle
->AddMinute();
954 else if (sFormula
== A2OUSTR("%FLSS"))
956 pTimeStyle
= new XFTimeStyle
;
957 pTimeStyle
->AddSecond(sal_True
,0);
959 else if (sFormula
== A2OUSTR("%FLampm"))
961 pTimeStyle
= new XFTimeStyle
;
962 pTimeStyle
->SetAmPm(sal_True
);
964 //chinese version begin
965 else if (sFormula
== A2OUSTR("%FLjF") || sFormula
== A2OUSTR("%FLJFF")
966 || sFormula
== A2OUSTR("%FLjjF") || sFormula
== A2OUSTR("%FLJJFF ") )
968 pTimeStyle
= new XFTimeStyle
;
969 pTimeStyle
->AddHour(sal_False
);
971 sText
= OUString(0x70b9);
972 pTimeStyle
->AddText(sText
);
973 pTimeStyle
->AddMinute(sal_False
);
974 sText
= OUString(0x5206);
975 pTimeStyle
->AddText(sText
);
977 else if (sFormula
== A2OUSTR("%FLjjjF") || sFormula
== A2OUSTR("%FLJJJFF") )
979 pTimeStyle
= new XFTimeStyle
;
980 pTimeStyle
->SetAmPm(sal_True
);
981 pTimeStyle
->AddHour(sal_False
);
983 sText
= OUString(0x70b9);
984 pTimeStyle
->AddText(sText
);
985 pTimeStyle
->AddMinute(sal_False
);
986 sText
= OUString(0x5206);
987 pTimeStyle
->AddText(sText
);
989 //chinese version end
990 //other version begin
991 else if (sFormula
== A2OUSTR("%FLHH:mm ampm"))
993 pTimeStyle
= new XFTimeStyle
;
994 pTimeStyle
->AddHour();
995 pTimeStyle
->AddText(A2OUSTR(":"));
996 pTimeStyle
->AddMinute();
997 pTimeStyle
->AddText(A2OUSTR(" "));
998 pTimeStyle
->SetAmPm(sal_True
);
1000 else if (sFormula
== A2OUSTR("%FLHH ampm"))
1002 pTimeStyle
= new XFTimeStyle
;
1003 pTimeStyle
->AddHour();
1004 pTimeStyle
->AddText(A2OUSTR(" "));
1005 pTimeStyle
->SetAmPm(sal_True
);
1007 else if (sFormula
== A2OUSTR("%FLHH:mm:SS ampm"))
1009 pTimeStyle
= new XFTimeStyle
;
1010 pTimeStyle
->AddHour();
1011 pTimeStyle
->AddText(A2OUSTR(":"));
1012 pTimeStyle
->AddMinute();
1013 pTimeStyle
->AddText(A2OUSTR(":"));
1014 pTimeStyle
->AddSecond(sal_True
,0);
1015 pTimeStyle
->AddText(A2OUSTR(" "));
1016 pTimeStyle
->SetAmPm(sal_True
);
1018 else if (sFormula
== A2OUSTR("%FLHH:mm"))
1020 pTimeStyle
= new XFTimeStyle
;
1021 pTimeStyle
->AddHour();
1022 pTimeStyle
->AddText(A2OUSTR(":"));
1023 pTimeStyle
->AddMinute();
1025 else if (sFormula
== A2OUSTR("%FLHH:mm:SS"))
1027 pTimeStyle
= new XFTimeStyle
;
1028 pTimeStyle
->AddHour();
1029 pTimeStyle
->AddText(A2OUSTR(":"));
1030 pTimeStyle
->AddMinute();
1031 pTimeStyle
->AddText(A2OUSTR(":"));
1032 pTimeStyle
->AddSecond(sal_True
,0);
1036 else if(sFormula
[1] == 'D')
1038 if (sFormula
== A2OUSTR("%Da"))
1040 pDateStyle
= LwpTools::GetSystemDateStyle(sal_False
);
1042 else if (sFormula
== A2OUSTR("%DB") || sFormula
== A2OUSTR("%Db"))
1044 pDateStyle
= new XFDateStyle
;
1045 pDateStyle
->AddMonth(sal_True
,sal_True
);
1046 pDateStyle
->AddText(A2OUSTR(" "));
1047 pDateStyle
->AddMonthDay(sal_False
);
1048 pDateStyle
->AddText(A2OUSTR(", "));
1049 pDateStyle
->AddYear();
1051 else if (sFormula
== A2OUSTR("%Dc") || sFormula
== A2OUSTR("%DC"))
1053 pDateStyle
= new XFDateStyle
;
1054 pDateStyle
->AddMonthDay(sal_False
);
1055 pDateStyle
->AddText(A2OUSTR(" "));
1056 pDateStyle
->AddMonth(sal_True
,sal_True
);
1057 pDateStyle
->AddText(A2OUSTR(" "));
1058 pDateStyle
->AddYear();
1060 else if (sFormula
== A2OUSTR("%Dd") || sFormula
== A2OUSTR("%DD"))
1062 pDateStyle
= new XFDateStyle
;
1063 pDateStyle
->AddWeekDay();
1064 pDateStyle
->AddText(A2OUSTR(", "));
1065 pDateStyle
->AddMonth(sal_True
,sal_True
);
1066 pDateStyle
->AddText(A2OUSTR(" "));
1067 pDateStyle
->AddMonthDay(sal_False
);
1068 pDateStyle
->AddText(A2OUSTR(", "));
1069 pDateStyle
->AddYear();
1071 else if (sFormula
== A2OUSTR("%DE") || sFormula
== A2OUSTR("%De"))
1073 pDateStyle
= new XFDateStyle
;
1074 pDateStyle
->AddMonth(sal_True
,sal_True
);
1075 pDateStyle
->AddText(A2OUSTR(" "));
1076 pDateStyle
->AddMonthDay(sal_False
);
1078 else if (sFormula
== A2OUSTR("%Df") || sFormula
== A2OUSTR("%DF"))
1080 pDateStyle
= new XFDateStyle
;
1081 pDateStyle
->AddWeekDay();
1082 pDateStyle
->AddText(A2OUSTR(" "));
1083 pDateStyle
->AddMonth(sal_True
,sal_True
);
1084 pDateStyle
->AddText(A2OUSTR(" "));
1085 pDateStyle
->AddMonthDay(sal_False
);
1087 else if (sFormula
== A2OUSTR("%Dg"))
1089 pDateStyle
= new XFDateStyle
;
1090 pDateStyle
->AddMonth(sal_False
);
1091 pDateStyle
->AddText(A2OUSTR("/"));
1092 pDateStyle
->AddMonthDay(sal_False
);
1094 else if (sFormula
== A2OUSTR("%Dh"))
1096 pDateStyle
= new XFDateStyle
;
1097 pDateStyle
->AddMonth(sal_False
);
1098 pDateStyle
->AddText(A2OUSTR("/"));
1099 pDateStyle
->AddMonthDay(sal_False
);
1100 pDateStyle
->AddText(A2OUSTR("/"));
1101 pDateStyle
->AddYear();
1103 else if (sFormula
== A2OUSTR("%Di") || sFormula
== A2OUSTR("%DI"))
1105 pDateStyle
= new XFDateStyle
;
1106 pDateStyle
->AddMonthDay(sal_False
);
1107 pDateStyle
->AddText(A2OUSTR("."));
1108 pDateStyle
->AddMonth(sal_True
,sal_True
);
1110 else if (sFormula
== A2OUSTR("%Dj") || sFormula
== A2OUSTR("%DJ"))
1112 pDateStyle
= new XFDateStyle
;
1113 pDateStyle
->AddMonthDay(sal_False
);
1114 pDateStyle
->AddText(A2OUSTR("."));
1115 pDateStyle
->AddMonth(sal_True
,sal_True
);
1116 pDateStyle
->AddText(A2OUSTR(" "));
1117 pDateStyle
->AddYear();
1119 else if (sFormula
== A2OUSTR("%Dk") || sFormula
== A2OUSTR("%DK"))
1121 pDateStyle
= new XFDateStyle
;
1122 pDateStyle
->AddYear();
1123 pDateStyle
->AddText(A2OUSTR(" "));
1124 pDateStyle
->AddMonth(sal_True
,sal_True
);
1125 pDateStyle
->AddText(A2OUSTR(" "));
1126 pDateStyle
->AddMonthDay(sal_False
);
1128 else if (sFormula
== A2OUSTR("%DL") || sFormula
== A2OUSTR("%Dl"))
1130 pDateStyle
= new XFDateStyle
;
1131 pDateStyle
->AddMonth(sal_True
,sal_True
);
1132 pDateStyle
->AddText(A2OUSTR(","));
1133 pDateStyle
->AddYear();
1135 else if (sFormula
== A2OUSTR("%Dm"))
1137 pDateStyle
= new XFDateStyle
;
1138 pDateStyle
->AddMonthDay();
1139 pDateStyle
->AddText(A2OUSTR("/"));
1140 pDateStyle
->AddMonth();
1141 pDateStyle
->AddText(A2OUSTR("/"));
1142 pDateStyle
->AddYear();
1145 else if (sFormula
[1] == 'T')
1147 if (sFormula
== A2OUSTR("%T1"))
1149 pTimeStyle
= new XFTimeStyle
;
1150 pTimeStyle
->AddHour();
1151 pTimeStyle
->AddText(A2OUSTR(":"));
1152 pTimeStyle
->AddMinute();
1154 else if (sFormula
== A2OUSTR("%T2") || sFormula
== A2OUSTR("%T6")
1155 || sFormula
== A2OUSTR("%T4") || sFormula
== A2OUSTR("%T8") )
1157 pTimeStyle
= new XFTimeStyle
;
1158 pTimeStyle
->AddHour(sal_False
);
1159 pTimeStyle
->AddText(A2OUSTR(":"));
1160 pTimeStyle
->AddMinute();
1161 pTimeStyle
->AddText(A2OUSTR(":"));
1162 pTimeStyle
->SetAmPm(sal_True
);
1164 else if (sFormula
== A2OUSTR("%T3") || sFormula
== A2OUSTR("%T7")
1165 || sFormula
== A2OUSTR("%T5") || sFormula
== A2OUSTR("%T9"))
1167 pTimeStyle
= new XFTimeStyle
;
1168 pTimeStyle
->AddHour();
1169 pTimeStyle
->AddText(A2OUSTR(":"));
1170 pTimeStyle
->AddMinute();
1171 pTimeStyle
->AddText(A2OUSTR(":"));
1172 pTimeStyle
->SetAmPm(sal_True
);
1175 XFStyleManager
* pXFStyleManager
= LwpGlobalMgr::GetInstance()->GetXFStyleManager();
1177 m_TimeStyle
= pXFStyleManager
->AddStyle(pDateStyle
)->GetStyleName();
1179 m_TimeStyle
= pXFStyleManager
->AddStyle(pTimeStyle
)->GetStyleName();
1182 void LwpFribField::CheckFieldType(LwpFieldMark
* pFieldMark
)
1186 if (pFieldMark
->IsDateTimeField(nType
,sFormula
))
1188 m_nDateTimeType
= nType
;
1189 m_sFormula
= sFormula
;
1190 m_nSubType
= SUBFIELD_DATETIME
;
1192 else if (pFieldMark
->IsCrossRefField(nType
,sFormula
))
1194 m_nCrossRefType
= nType
;
1195 m_sFormula
= sFormula
;
1196 m_nSubType
= SUBFIELD_CROSSREF
;
1198 else if (pFieldMark
->IsDocPowerField(nType
,sFormula
))
1200 m_nDocPowerType
= nType
;
1201 m_nSubType
= SUBFIELD_DOCPOWER
;
1205 m_nSubType
= SUBFIELD_INVALID
;
1209 void LwpFribField::ConvertDocFieldStart(XFContentContainer
* pXFPara
,LwpFieldMark
* pFieldMark
)
1211 XFContent
* pContent
= NULL
;
1212 switch(m_nDocPowerType
)
1214 case LwpFieldMark::DOC_DESCRIPTION
:
1216 pContent
= new XFDescriptionStart
;
1219 case LwpFieldMark::DOC_NUMPAGES
:
1221 pContent
= new XFPageCountStart
;
1224 case LwpFieldMark::DOC_NUMWORDS
:
1226 pContent
= new XFWordCountStart
;
1229 case LwpFieldMark::DOC_NUMCHARS
:
1231 pContent
= new XFCharCountStart
;
1234 // case LwpFieldMark::DOC_TOTALTIME:
1236 // pContent = new XFTotalEditTimeStart;
1237 // pContent->SetStyleName(m_TimeStyle);
1243 if (m_ModFlag
)//(m_pModifiers)
1245 XFTextSpanStart
* pSpan
= new XFTextSpanStart
;
1246 pSpan
->SetStyleName(GetStyleName());
1247 pSpan
->Add(pContent
);
1248 pXFPara
->Add(pSpan
);
1249 pFieldMark
->SetStyleFlag(sal_True
);
1252 pXFPara
->Add(pContent
);
1256 void LwpFribField::ConvertDocFieldEnd(XFContentContainer
* pXFPara
,LwpFieldMark
* pFieldMark
)
1258 XFContent
* pContent
= NULL
;
1259 switch(m_nDocPowerType
)
1261 case LwpFieldMark::DOC_DESCRIPTION
:
1263 pContent
= new XFDescriptionEnd
;
1266 case LwpFieldMark::DOC_NUMPAGES
:
1268 pContent
= new XFPageCountEnd
;
1271 case LwpFieldMark::DOC_NUMWORDS
:
1273 pContent
= new XFWordCountEnd
;
1276 case LwpFieldMark::DOC_NUMCHARS
:
1278 pContent
= new XFCharCountEnd
;
1281 // case LwpFieldMark::DOC_TOTALTIME:
1283 // pContent = new XFTotalEditTimeEnd;
1289 if (pFieldMark
->GetStyleFlag())
1291 XFTextSpanEnd
* pSpan
= new XFTextSpanEnd
;
1292 pSpan
->Add(pContent
);
1293 pXFPara
->Add(pSpan
);
1296 pXFPara
->Add(pContent
);
1300 void LwpFribField::ConvertDateTimeStart(XFContentContainer
* pXFPara
,LwpFieldMark
* pFieldMark
)
1302 XFContent
* pContent
= NULL
;
1303 switch(m_nDateTimeType
)
1305 case LwpFieldMark::DATETIME_NOW
:
1307 pContent
= new XFDateStart
;
1308 pContent
->SetStyleName(m_TimeStyle
);
1311 case LwpFieldMark::DATETIME_CREATE
:
1313 pContent
= new XFCreateTimeStart
;
1314 pContent
->SetStyleName(m_TimeStyle
);
1317 case LwpFieldMark::DATETIME_LASTEDIT
:
1319 pContent
= new XFLastEditTimeStart
;
1320 pContent
->SetStyleName(m_TimeStyle
);
1323 case LwpFieldMark::DATETIME_TOTALTIME
:
1325 pContent
= new XFTotalEditTimeStart
;
1326 pContent
->SetStyleName(m_TimeStyle
);
1334 if (m_ModFlag
)//(m_pModifiers)
1336 XFTextSpanStart
* pSpan
= new XFTextSpanStart
;
1337 pSpan
->SetStyleName(GetStyleName());
1338 pSpan
->Add(pContent
);
1339 pXFPara
->Add(pSpan
);
1340 pFieldMark
->SetStyleFlag(sal_True
);
1343 pXFPara
->Add(pContent
);
1348 void LwpFribField::ConvertDateTimeEnd(XFContentContainer
* pXFPara
,LwpFieldMark
* pFieldMark
)
1350 XFContent
* pContent
= NULL
;
1351 switch(m_nDateTimeType
)
1353 case LwpFieldMark::DATETIME_NOW
:
1355 pContent
= new XFDateEnd
;
1358 case LwpFieldMark::DATETIME_CREATE
:
1360 pContent
= new XFCreateTimeEnd
;
1363 case LwpFieldMark::DATETIME_LASTEDIT
:
1365 pContent
= new XFLastEditTimeEnd
;
1368 case LwpFieldMark::DATETIME_TOTALTIME
:
1370 pContent
= new XFTotalEditTimeEnd
;
1376 if (pFieldMark
->GetStyleFlag())
1378 XFTextSpanEnd
* pSpan
= new XFTextSpanEnd
;
1379 pSpan
->Add(pContent
);
1380 pXFPara
->Add(pSpan
);
1383 pXFPara
->Add(pContent
);
1387 void LwpFribField::ConvertCrossRefStart(XFContentContainer
* pXFPara
,LwpFieldMark
* pFieldMark
)
1389 XFCrossRefStart
* pRef
= new XFCrossRefStart
;
1390 pRef
->SetRefType(m_nCrossRefType
);
1391 pRef
->SetMarkName(m_sFormula
);
1392 // pFieldMark->SetStart(sal_True);//for some disnormal cases
1395 XFTextSpanStart
* pSpan
= new XFTextSpanStart
;
1396 pSpan
->SetStyleName(GetStyleName());
1398 pXFPara
->Add(pSpan
);
1399 pFieldMark
->SetStyleFlag(sal_True
);
1405 void LwpFribField::ConvertCrossRefEnd(XFContentContainer
* pXFPara
,LwpFieldMark
* pFieldMark
)
1407 XFCrossRefEnd
* pRef
= new XFCrossRefEnd
;
1408 if (pFieldMark
->GetStyleFlag())
1410 XFTextSpanEnd
* pSpan
= new XFTextSpanEnd
;
1412 pXFPara
->Add(pSpan
);
1418 LwpFribRubyMarker::LwpFribRubyMarker( LwpPara
* pPara
): LwpFrib(pPara
)
1422 LwpRubyMarker
* LwpFribRubyMarker::GetMarker()
1424 return dynamic_cast<LwpRubyMarker
*>(m_objMarker
.obj(VO_RUBYMARKER
));
1427 void LwpFribRubyMarker::Read(LwpObjectStream
* pObjStrm
, sal_uInt16
/*len*/)
1429 m_objMarker
.ReadIndexed(pObjStrm
);
1430 m_nType
= pObjStrm
->QuickReaduInt8();
1433 void LwpFribRubyMarker::XFConvert(XFContentContainer
* pXFPara
)
1435 sal_uInt8 type
= GetType();
1436 LwpRubyMarker
* pMarker
= GetMarker();
1438 if (type
== MARKER_START
)
1440 XFRubyStart
* pRubyStart
= new XFRubyStart
;
1443 pRubyStart
->SetStyleName(pMarker
->GetRubyStyleName());
1445 pXFPara
->Add(pRubyStart
);
1447 else if(type
== MARKER_END
)
1449 XFRubyEnd
* pRubyEnd
= new XFRubyEnd
;
1452 pRubyEnd
->SetText(pMarker
->GetRubyText());
1453 pRubyEnd
->SetStyleName(pMarker
->GetTextStyleName());
1455 pXFPara
->Add(pRubyEnd
);
1459 void LwpFribRubyMarker::RegisterStyle(LwpFoundry
* /*pFoundry*/)
1463 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */