update dev300-m57
[ooovba.git] / lotuswordpro / source / filter / lwpfribmark.cxx
blobbc202b29edbfd0f1e55d8da531517f51cb6d3abb
1 /*************************************************************************
3 * The Contents of this file are made available subject to the terms of
4 * either of the following licenses
6 * - GNU Lesser General Public License Version 2.1
7 * - Sun Industry Standards Source License Version 1.1
9 * Sun Microsystems Inc., October, 2000
11 * GNU Lesser General Public License Version 2.1
12 * =============================================
13 * Copyright 2000 by Sun Microsystems, Inc.
14 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License version 2.1, as published by the Free Software Foundation.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA
31 * Sun Industry Standards Source License Version 1.1
32 * =================================================
33 * The contents of this file are subject to the Sun Industry Standards
34 * Source License Version 1.1 (the "License"); You may not use this file
35 * except in compliance with the License. You may obtain a copy of the
36 * License at http://www.openoffice.org/license.html.
38 * Software provided under this License is provided on an "AS IS" basis,
39 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
40 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
41 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
42 * See the License for the specific provisions governing your rights and
43 * obligations concerning the Software.
45 * The Initial Developer of the Original Code is: IBM Corporation
47 * Copyright: 2008 by IBM Corporation
49 * All Rights Reserved.
51 * Contributor(s): _______________________________________
54 ************************************************************************/
55 /*************************************************************************
56 * @file
57 * For LWP filter architecture prototype
58 ************************************************************************/
59 /*************************************************************************
60 * Change History
61 May 2005 Created
62 ************************************************************************/
64 #include "lwpfribmark.hxx"
65 #include "lwptools.hxx"
66 #include "lwpglobalmgr.hxx"
67 #include "lwpdoc.hxx"
68 #include "lwpdivinfo.hxx"
69 #include "xfilter/xfstylemanager.hxx"
70 #include "xfilter/xftextspan.hxx"
71 #include "xfilter/xfbookmark.hxx"
72 #include "xfilter/xfentry.hxx"
73 #include "xfilter/xftextcontent.hxx"
74 #include "xfilter/xfcrossref.hxx"
75 #include "xfilter/xfdocfield.hxx"
76 #include "xfilter/xfdatestyle.hxx"
77 #include "xfilter/xftimestyle.hxx"
78 #include "xfilter/xfdate.hxx"
79 #include "xfilter/xfruby.hxx"
80 #include "lwpchangemgr.hxx"
81 #include "xfilter/xfchange.hxx"
83 /**
84 * @short: Read hyperlink frib and Click here block
85 * @param:
86 * @param:
88 void LwpFribCHBlock::Read(LwpObjectStream* pObjStrm, sal_uInt16 len)
90 m_objMarker.ReadIndexed(pObjStrm);
91 m_nType = pObjStrm->QuickReaduInt8();
94 LwpCHBlkMarker* LwpFribCHBlock::GetMarker()
96 return static_cast<LwpCHBlkMarker*>(m_objMarker.obj());
99 void LwpFribCHBlock::XFConvert(XFContentContainer* pXFPara,LwpStory* pStory)
101 sal_uInt8 type = GetType();
102 if (!pStory)
103 return;
104 LwpCHBlkMarker* pMarker = GetMarker();
106 if (!pMarker)
107 return;
108 sal_uInt16 nAction = pMarker->GetAction();
109 if (nAction == LwpCHBlkMarker::CLICKHERE_CHBEHAVIORINTERNETLINK)//hyperlink
111 LwpHyperlinkMgr* pHyperlink = pStory->GetHyperlinkMgr();
112 if (type == MARKER_START)
114 if (pHyperlink)
116 pHyperlink->SetHyperlinkFlag(sal_True);
117 pHyperlink->SetHyperlink(pMarker->GetNamedProperty(A2OUSTR("URL")));
120 else if (type == MARKER_END)//or none
122 pHyperlink->SetHyperlinkFlag(sal_False);
125 else//click here block
127 pMarker->ConvertCHBlock(pXFPara,type);
131 * @short: register bookmark frib
132 * @param:
133 * @param:
135 void LwpFribBookMark::RegisterStyle(LwpFoundry* pFoundry)
137 OUString name;
138 LwpBookMark* pBook = pFoundry->GetBookMark(GetMarkerID());
139 if (pBook)
140 name = pBook->GetName();
142 OUString sDivision;
143 LwpDocument* pDoc = pFoundry->GetDocument();
144 if (pDoc)
146 LwpObjectID* pID = pDoc->GetDivInfoID();
147 if (!pID->IsNull())
149 sDivision = static_cast<LwpDivInfo*>(pID->obj(VO_DIVISIONINFO))->GetDivName();
153 sal_uInt8 type = GetType();
155 LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
156 LwpBookmarkMgr* pMarkMgr = pGlobal->GetLwpBookmarkMgr();
157 if (type == MARKER_START)
159 XFBookmarkStart* pMarkStart = new XFBookmarkStart;
160 pMarkStart->SetDivision(sDivision);
161 pMarkStart->SetName(name);
162 pMarkMgr->AddXFBookmarkStart(name,pMarkStart);//add to map
163 m_pStart = pMarkStart;
165 else if(type == MARKER_END)
167 XFBookmarkEnd* pMarkEnd = new XFBookmarkEnd;
168 pMarkEnd->SetDivision(sDivision);
169 pMarkEnd->SetName(name);
170 pMarkMgr->AddXFBookmarkEnd(name,pMarkEnd); //add to map
171 m_pEnd = pMarkEnd;
175 LwpFribBookMark::LwpFribBookMark(LwpPara* pPara ) : LwpFrib(pPara),m_pStart(NULL),m_pEnd(NULL)
180 * @short: Read bookmark frib
181 * @param:
182 * @param:
184 void LwpFribBookMark::Read(LwpObjectStream* pObjStrm, sal_uInt16 len)
186 m_objMarker.ReadIndexed(pObjStrm);
187 m_nType = pObjStrm->QuickReaduInt8();
190 * @short: convert bookmark frib
191 * @param:
192 * @param:
194 void LwpFribBookMark::XFConvert(XFContentContainer* pXFPara)
196 sal_uInt8 type = GetType();
198 if (type == MARKER_START && m_pStart)
200 pXFPara->Add(m_pStart);
202 else if(type == MARKER_END && m_pEnd)
204 pXFPara->Add(m_pEnd);
209 * @short: Read index entry frib
210 * @param:
211 * @param:
213 LwpFribField::LwpFribField( LwpPara* pPara ) : LwpFrib(pPara)
215 m_TimeStyle = A2OUSTR("");
217 m_nSubType = 0;//datetime/crossref/other
218 m_sFormula = A2OUSTR("");
220 m_nCrossRefType = 0;
221 m_nDateTimeType = 0;
224 void LwpFribField::Read(LwpObjectStream* pObjStrm, sal_uInt16 len)
226 m_objMarker.ReadIndexed(pObjStrm);
227 m_nType = pObjStrm->QuickReaduInt8();
230 LwpFieldMark* LwpFribField::GetMarker()
232 return static_cast<LwpFieldMark*>(m_objMarker.obj());
235 void LwpFribField::XFConvert(XFContentContainer* pXFPara)
237 LwpFieldMark* pFieldMark = GetMarker();
238 if (!pFieldMark)
239 return;
241 sal_uInt8 type = GetType();
242 sal_uInt16 fieldType = pFieldMark->GetFieldType();
244 OUString sChangeID;
245 if(pFieldMark->GetRevisionFlag())
247 LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
248 LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
249 sChangeID = pChangeMgr->GetChangeID(pFieldMark->GetStartFrib());
252 CheckFieldType(pFieldMark);
253 //end marker
254 if (type == MARKER_END)
256 if (pFieldMark->GetStart() == sal_False)
257 return;
258 if (pFieldMark->IsFormulaInsert())
260 XFTextContent *pSpan = new XFTextContent();
261 pSpan->SetText(A2OUSTR(">"));
262 pXFPara->Add(pSpan);
264 if (fieldType == LwpFieldMark::FLD_FIELD)
266 if (m_nSubType == SUBFIELD_DATETIME)
268 ConvertDateTimeEnd(pXFPara,pFieldMark);
270 else if (m_nSubType == SUBFIELD_CROSSREF)
272 ConvertCrossRefEnd(pXFPara,pFieldMark);
274 else if (m_nSubType == SUBFIELD_DOCPOWER)
276 ConvertDocFieldEnd(pXFPara,pFieldMark);
279 if(pFieldMark->GetRevisionFlag() && sChangeID.getLength())
281 XFChangeEnd* pChangeEnd = new XFChangeEnd;
282 pChangeEnd->SetChangeID(sChangeID);
283 pXFPara->Add(pChangeEnd);
286 return;
289 //start marker
290 if(pFieldMark->GetRevisionFlag() && sChangeID.getLength())
292 XFChangeStart* pChangeStart = new XFChangeStart;
293 pChangeStart->SetChangeID(sChangeID);
294 pXFPara->Add(pChangeStart);
297 if (fieldType == LwpFieldMark::FLD_INDEX)
299 OUString sKey1,sKey2;
300 pFieldMark->ParseIndex(sKey1,sKey2);
301 if (sKey1.getLength()>0)
303 XFEntry* pEntry = new XFEntry;
304 pEntry->SetEntryType(enumXFEntryAlphabetical);
305 pEntry->SetKey(sKey1,sKey2);
306 pXFPara->Add(pEntry);
309 else if (fieldType == LwpFieldMark::FLD_TOC)
311 OUString sLevel,sText;
312 pFieldMark->ParseTOC(sLevel,sText);
313 if (sLevel.getLength()>0 && sText.getLength()>0)
315 XFEntry* pEntry = new XFEntry;
316 pEntry->SetEntryType(enumXFEntryTOC);
317 pEntry->SetStringValue(sText);
318 pEntry->SetOutlineLevel(sLevel.toInt32(10));
319 pXFPara->Add(pEntry);
322 else if (fieldType == LwpFieldMark::FLD_FIELD)
324 sal_uInt8 nDatetype;
325 OUString sFormula;
326 sal_Bool bIsDateTime = pFieldMark->IsDateTimeField(nDatetype,sFormula);
328 if (m_nSubType == SUBFIELD_DATETIME)//date time
330 ConvertDateTimeStart(pXFPara,pFieldMark);
332 else if (m_nSubType == SUBFIELD_CROSSREF)//cross ref
334 ConvertCrossRefStart(pXFPara,pFieldMark);
336 else if (m_nSubType == SUBFIELD_DOCPOWER)
338 ConvertDocFieldStart(pXFPara,pFieldMark);
342 if (pFieldMark->IsFormulaInsert())
344 XFTextContent *pSpan = new XFTextContent();
345 pSpan->SetText(A2OUSTR("<"));
346 pXFPara->Add(pSpan);
349 pFieldMark->SetStart(sal_True);
352 void LwpFribField::RegisterStyle(LwpFoundry* pFoundry)
354 LwpFrib::RegisterStyle(pFoundry);
355 LwpFieldMark* pFieldMark = GetMarker();
356 if (!pFieldMark)
357 return;
359 sal_uInt8 type = GetType();
360 sal_uInt16 fieldType = pFieldMark->GetFieldType();
362 if (type == MARKER_START && fieldType == LwpFieldMark::FLD_FIELD)
364 RegisterTimeField(pFieldMark);
367 if (type == MARKER_START && m_bRevisionFlag)
369 LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
370 LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
371 pChangeMgr->AddChangeFrib(this);
372 pFieldMark->SetStartFrib(this);
373 pFieldMark->SetRevisionFlag(sal_True);
377 void LwpFribField::RegisterTimeField(LwpFieldMark* pFieldMark)
379 OUString sFormula = pFieldMark->GetFormula();//now bookmark maybe not all register to bookmarkmgr,
380 if (sFormula == A2OUSTR("TotalEditingTime"))//so check field type now is not correct.
381 RegisterTotalTimeStyle();
382 else
384 sal_Int32 index;
385 sal_Unicode ch1(0x0020);//space
386 OUString tag;
387 index = sFormula.indexOf(ch1,0);
388 if (index < 0)
389 return;
391 tag = sFormula.copy(0,index);
392 if (tag == A2OUSTR("Now()") || tag == A2OUSTR("CreateDate") || tag == A2OUSTR("EditDate"))
393 RegisterDateTimeStyle(sFormula.copy(index+1,sFormula.getLength()-index-1));
397 void LwpFribField::RegisterTotalTimeStyle()
399 XFTimeStyle* pTimeStyle = new XFTimeStyle;//use the default format
400 pTimeStyle->SetTruncate(sal_False);
401 pTimeStyle->AddMinute();
402 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
403 m_TimeStyle = pXFStyleManager->AddStyle(pTimeStyle)->GetStyleName();
406 void LwpFribField::RegisterDateTimeStyle(OUString sFormula)
408 XFDateStyle* pDateStyle = NULL;
409 XFTimeStyle* pTimeStyle = NULL;
410 //DATE
411 if (sFormula.getLength()<2)
412 return;
413 if (sFormula[1] == 'F')
415 if (sFormula == A2OUSTR("%FLSystemShortDate"))
417 pDateStyle = LwpTools::GetSystemDateStyle(sal_False);
419 else if (sFormula == A2OUSTR("%FLSystemLongDate"))
421 pDateStyle = LwpTools::GetSystemDateStyle(sal_True);
423 else if (sFormula == A2OUSTR("%FLISODate1") || sFormula == A2OUSTR("%FLYYYY/MM/DD") )
425 pDateStyle = new XFDateStyle;
426 pDateStyle->AddYear();
427 pDateStyle->AddText(A2OUSTR("/"));
428 pDateStyle->AddMonth();
429 pDateStyle->AddText(A2OUSTR("/"));
430 pDateStyle->AddMonthDay();
432 else if (sFormula == A2OUSTR("%FLISODate2") || sFormula == A2OUSTR("%FLYYYY/MM/DD HH:mm:SS") )
434 pDateStyle = new XFDateStyle;
435 pDateStyle->AddYear();
436 pDateStyle->AddText(A2OUSTR("/"));
437 pDateStyle->AddMonth();
438 pDateStyle->AddText(A2OUSTR("/"));
439 pDateStyle->AddMonthDay();
440 pDateStyle->AddText(A2OUSTR(" "));
441 pDateStyle->AddHour();
442 pDateStyle->AddText(A2OUSTR(":"));
443 pDateStyle->AddMinute();
444 pDateStyle->AddText(A2OUSTR(":"));
445 pDateStyle->AddSecond(sal_True,0);
447 else if (sFormula == A2OUSTR("%FLM/D/YY"))
449 pDateStyle = new XFDateStyle;
450 pDateStyle->AddMonth(sal_False);
451 pDateStyle->AddText(A2OUSTR("/"));
452 pDateStyle->AddMonthDay(sal_False);
453 pDateStyle->AddText(A2OUSTR("/"));
454 pDateStyle->AddYear(sal_False);
456 else if (sFormula == A2OUSTR("%FLMonth D, YYYY"))
458 pDateStyle = new XFDateStyle;
459 pDateStyle->AddMonth(sal_True,sal_True);
460 pDateStyle->AddText(A2OUSTR(" "));
461 pDateStyle->AddMonthDay(sal_False);
462 pDateStyle->AddText(A2OUSTR(", "));
463 pDateStyle->AddYear();
465 else if (sFormula == A2OUSTR("%FLWeekday, Month D, YYYY"))
467 pDateStyle = new XFDateStyle;
468 pDateStyle->AddWeekDay();
469 pDateStyle->AddText(A2OUSTR(", "));
470 pDateStyle->AddMonth(sal_True,sal_True);
471 pDateStyle->AddText(A2OUSTR(" "));
472 pDateStyle->AddMonthDay(sal_False);
473 pDateStyle->AddText(A2OUSTR(", "));
474 pDateStyle->AddYear();
476 else if (sFormula == A2OUSTR("%FLMn D, YYYY"))
478 pDateStyle = new XFDateStyle;
479 pDateStyle->AddMonth(sal_False,sal_True);
480 pDateStyle->AddText(A2OUSTR(" "));
481 pDateStyle->AddMonthDay(sal_False);
482 pDateStyle->AddText(A2OUSTR(", "));
483 pDateStyle->AddYear();
485 else if (sFormula == A2OUSTR("%FLWday, Mn D, YYYY"))
487 pDateStyle = new XFDateStyle;
488 pDateStyle->AddWeekDay(sal_False);
489 pDateStyle->AddText(A2OUSTR(", "));
490 pDateStyle->AddMonth(sal_False,sal_True);
491 pDateStyle->AddText(A2OUSTR(" "));
492 pDateStyle->AddMonthDay(sal_False);
493 pDateStyle->AddText(A2OUSTR(", "));
494 pDateStyle->AddYear();
496 else if (sFormula == A2OUSTR("%FLMn D"))
498 pDateStyle = new XFDateStyle;
499 pDateStyle->AddMonth(sal_False,sal_True);
500 pDateStyle->AddText(A2OUSTR(" "));
501 pDateStyle->AddMonthDay(sal_False);
503 else if (sFormula == A2OUSTR("%FLWeekday, Mn D"))
505 pDateStyle = new XFDateStyle;
506 pDateStyle->AddWeekDay();
507 pDateStyle->AddText(A2OUSTR(", "));
508 pDateStyle->AddMonth(sal_False,sal_True);
509 pDateStyle->AddText(A2OUSTR(" "));
510 pDateStyle->AddMonthDay(sal_False);
512 else if (sFormula == A2OUSTR("%FLMn D, YY"))
514 pDateStyle = new XFDateStyle;
515 pDateStyle->AddMonth(sal_False,sal_True);
516 pDateStyle->AddText(A2OUSTR(" "));
517 pDateStyle->AddMonthDay(sal_False);
518 pDateStyle->AddText(A2OUSTR(", "));
519 pDateStyle->AddYear(sal_False);
521 else if (sFormula == A2OUSTR("%FLM/D"))
523 pDateStyle = new XFDateStyle;
524 pDateStyle->AddMonth(sal_False);
525 pDateStyle->AddText(A2OUSTR("/"));
526 pDateStyle->AddMonthDay(sal_False);
528 else if (sFormula == A2OUSTR("%FLM/YY"))
530 pDateStyle = new XFDateStyle;
531 pDateStyle->AddMonth(sal_False);
532 pDateStyle->AddText(A2OUSTR("/"));
533 pDateStyle->AddYear(sal_False);
535 else if (sFormula == A2OUSTR("%FLMn YY"))
537 pDateStyle = new XFDateStyle;
538 pDateStyle->AddMonth(sal_False,sal_True);
539 pDateStyle->AddText(A2OUSTR(" "));
540 pDateStyle->AddYear(sal_False);
542 else if (sFormula == A2OUSTR("%FLWeekday"))
544 pDateStyle = new XFDateStyle;
545 pDateStyle->AddWeekDay();
547 else if (sFormula == A2OUSTR("%FLWday"))
549 pDateStyle = new XFDateStyle;
550 pDateStyle->AddWeekDay(sal_False);
552 else if (sFormula == A2OUSTR("%FLMonth"))
554 pDateStyle = new XFDateStyle;
555 pDateStyle->AddMonth(sal_True,sal_True);
557 else if (sFormula == A2OUSTR("%FLMn"))
559 pDateStyle = new XFDateStyle;
560 pDateStyle->AddMonth(sal_False,sal_True);
562 else if (sFormula == A2OUSTR("%FLD"))
564 pDateStyle = new XFDateStyle;
565 pDateStyle->AddMonthDay(sal_False);
567 else if (sFormula == A2OUSTR("%FLM"))
569 pDateStyle = new XFDateStyle;
570 pDateStyle->AddMonth(sal_False);
572 else if (sFormula == A2OUSTR("%FLYYYY") )
574 pDateStyle = new XFDateStyle;
575 pDateStyle->AddYear();
577 else if (sFormula == A2OUSTR("%FLYY"))
579 pDateStyle = new XFDateStyle;
580 pDateStyle->AddYear(sal_False);
582 //chinese version begin
583 else if (sFormula == A2OUSTR("%FLYY/M/D"))
585 pDateStyle = new XFDateStyle;
586 pDateStyle->AddYear(sal_False);
587 pDateStyle->AddText(A2OUSTR("-"));
588 pDateStyle->AddMonth(sal_False);
589 pDateStyle->AddText(A2OUSTR("-"));
590 pDateStyle->AddMonthDay(sal_False);
592 else if(sFormula == A2OUSTR("%FLYYYY Month D"))
594 pDateStyle = new XFDateStyle;
595 pDateStyle->AddYear();
596 pDateStyle->AddText(A2OUSTR(" "));
597 pDateStyle->AddMonth(sal_True,sal_True);
598 pDateStyle->AddText(A2OUSTR(" "));
599 pDateStyle->AddMonthDay(sal_False);
601 else if(sFormula == A2OUSTR("%FLWeekday, YYYY Month D"))
603 pDateStyle = new XFDateStyle;
604 pDateStyle->AddWeekDay();
605 pDateStyle->AddText(A2OUSTR(","));
606 pDateStyle->AddYear();
607 pDateStyle->AddText(A2OUSTR(" "));
608 pDateStyle->AddMonth(sal_True,sal_True);
609 pDateStyle->AddText(A2OUSTR(" "));
610 pDateStyle->AddMonthDay(sal_False);
612 else if(sFormula == A2OUSTR("%FLYYYY Mn D"))
614 pDateStyle = new XFDateStyle;
615 pDateStyle->AddYear();
616 pDateStyle->AddText(A2OUSTR(" "));
617 pDateStyle->AddMonth(sal_False,sal_True);
618 pDateStyle->AddText(A2OUSTR(" "));
619 pDateStyle->AddMonthDay(sal_False);
621 else if(sFormula == A2OUSTR("%FLWday, YYYY Mn D"))
623 pDateStyle = new XFDateStyle;
624 pDateStyle->AddWeekDay(sal_False);
625 pDateStyle->AddText(A2OUSTR(","));
626 pDateStyle->AddYear();
627 pDateStyle->AddText(A2OUSTR(" "));
628 pDateStyle->AddMonth(sal_True,sal_True);
629 pDateStyle->AddText(A2OUSTR(" "));
630 pDateStyle->AddMonthDay(sal_False);
632 //next 2 are the same with english version
633 else if (sFormula == A2OUSTR("%FLYY Mn D"))
635 pDateStyle = new XFDateStyle;
636 pDateStyle->AddYear(sal_False);
637 pDateStyle->AddText(A2OUSTR(" "));
638 pDateStyle->AddMonth(sal_False,sal_True);
639 pDateStyle->AddText(A2OUSTR(" "));
640 pDateStyle->AddMonthDay(sal_False);
642 else if (sFormula == A2OUSTR("%FLYY/M"))
644 pDateStyle = new XFDateStyle;
645 pDateStyle->AddMonth(sal_False);
646 pDateStyle->AddText(A2OUSTR("-"));
647 pDateStyle->AddMonth(sal_False);
649 else if (sFormula == A2OUSTR("%FLYY Mn"))
651 pDateStyle = new XFDateStyle;
652 pDateStyle->AddMonth(sal_False);
653 pDateStyle->AddText(A2OUSTR(" "));
654 pDateStyle->AddMonth(sal_False,sal_True);
656 else if (sFormula == A2OUSTR("%FLeeeeoa") || sFormula == A2OUSTR("%FLffffooaa") || sFormula == A2OUSTR("%FLEEEEOA"))
658 pDateStyle = new XFDateStyle;
659 // OUString lang = OUString::createFromAscii("zh-CN");
660 // pDateStyle->SetLanguage( lang);
661 rtl::OUString sText;
662 pDateStyle->AddYear();
663 sText = rtl::OUString(0x5e74);
664 pDateStyle->AddText(sText);
665 pDateStyle->AddMonth(sal_False);
666 sText = rtl::OUString(0x6708);
667 pDateStyle->AddText(sText);
668 pDateStyle->AddMonthDay(sal_False);
669 sText = rtl::OUString(0x65e5);
670 pDateStyle->AddText(sText);
672 else if (sFormula == A2OUSTR("%FLoa") || sFormula == A2OUSTR("%FLooaa") || sFormula == A2OUSTR("%FLOA") )
674 pDateStyle = new XFDateStyle;
675 OUString sText;
676 pDateStyle->AddMonth(sal_False);
677 sText = rtl::OUString(0x6708);
678 pDateStyle->AddText(sText);
679 pDateStyle->AddMonthDay(sal_False);
680 sText = rtl::OUString(0x65e5);
681 pDateStyle->AddText(sText);
683 else if (sFormula == A2OUSTR("%FLYYYY/M/D") || sFormula == A2OUSTR("%FLGGGG/od/ad"))
685 pDateStyle = new XFDateStyle;
686 pDateStyle->AddYear();
687 pDateStyle->AddText(A2OUSTR("-"));
688 pDateStyle->AddMonth(sal_False);
689 pDateStyle->AddText(A2OUSTR("-"));
690 pDateStyle->AddMonthDay(sal_False);
692 else if (sFormula == A2OUSTR("%FLYY.M.D") )
694 pDateStyle = new XFDateStyle;
695 pDateStyle->AddYear(sal_False);
696 pDateStyle->AddText(A2OUSTR("."));
697 pDateStyle->AddMonth(sal_False);
698 pDateStyle->AddText(A2OUSTR("."));
699 pDateStyle->AddMonthDay(sal_False);
701 //chinese version end
702 //other version begin
703 else if (sFormula == A2OUSTR("%FLWeekday, Month DD, YYYY") )
705 pDateStyle = new XFDateStyle;
706 pDateStyle->AddWeekDay();
707 pDateStyle->AddText(A2OUSTR(", "));
708 pDateStyle->AddMonth(sal_True,sal_True);
709 pDateStyle->AddText(A2OUSTR(" "));
710 pDateStyle->AddMonthDay();
711 pDateStyle->AddText(A2OUSTR(", "));
712 pDateStyle->AddYear();
714 else if (sFormula == A2OUSTR("%FLYYYY/MM/DD") )
716 pDateStyle = new XFDateStyle;
717 pDateStyle->AddWeekDay();
718 pDateStyle->AddText(A2OUSTR(", "));
719 pDateStyle->AddMonth(sal_True,sal_True);
720 pDateStyle->AddText(A2OUSTR(" "));
721 pDateStyle->AddMonthDay();
722 pDateStyle->AddText(A2OUSTR(", "));
723 pDateStyle->AddYear();
725 else if (sFormula == A2OUSTR("%FLD/M/YY") )
727 pDateStyle = new XFDateStyle;
728 pDateStyle->AddMonthDay(sal_False);
729 pDateStyle->AddText(A2OUSTR("/"));
730 pDateStyle->AddMonth(sal_False);
731 pDateStyle->AddText(A2OUSTR("/"));
732 pDateStyle->AddYear(sal_False);
734 else if (sFormula == A2OUSTR("%FLD Month YYYY"))
736 pDateStyle = new XFDateStyle;
737 pDateStyle->AddMonthDay(sal_False);
738 pDateStyle->AddText(A2OUSTR(" "));
739 pDateStyle->AddMonth(sal_True,sal_True);
740 pDateStyle->AddText(A2OUSTR(" "));
741 pDateStyle->AddYear();
743 else if (sFormula == A2OUSTR("%FLDD Month YYYY"))
745 pDateStyle = new XFDateStyle;
746 pDateStyle->AddMonthDay();
747 pDateStyle->AddText(A2OUSTR(" "));
748 pDateStyle->AddMonth(sal_True,sal_True);
749 pDateStyle->AddText(A2OUSTR(" "));
750 pDateStyle->AddYear();
752 else if (sFormula == A2OUSTR("%FLWeekday, D Month YYYY"))
754 pDateStyle = new XFDateStyle;
755 pDateStyle->AddWeekDay();
756 pDateStyle->AddText(A2OUSTR(", "));
757 pDateStyle->AddMonthDay(sal_False);
758 pDateStyle->AddText(A2OUSTR(" "));
759 pDateStyle->AddMonth(sal_True,sal_True);
760 pDateStyle->AddText(A2OUSTR(" "));
761 pDateStyle->AddYear();
763 else if (sFormula == A2OUSTR("%FLWeekday, DD Month YYYY"))
765 pDateStyle = new XFDateStyle;
766 pDateStyle->AddWeekDay();
767 pDateStyle->AddText(A2OUSTR(", "));
768 pDateStyle->AddMonthDay();
769 pDateStyle->AddText(A2OUSTR(" "));
770 pDateStyle->AddMonth(sal_True,sal_True);
771 pDateStyle->AddText(A2OUSTR(" "));
772 pDateStyle->AddYear();
774 else if (sFormula == A2OUSTR("%FLD Mn YYYY"))
776 pDateStyle = new XFDateStyle;
777 pDateStyle->AddMonthDay(sal_False);
778 pDateStyle->AddText(A2OUSTR(" "));
779 pDateStyle->AddMonth(sal_False,sal_True);
780 pDateStyle->AddText(A2OUSTR(" "));
781 pDateStyle->AddYear();
783 else if (sFormula == A2OUSTR("%FLWday, D Mn YYYY"))
785 pDateStyle = new XFDateStyle;
786 pDateStyle->AddWeekDay(sal_False);
787 pDateStyle->AddText(A2OUSTR(", "));
788 pDateStyle->AddMonthDay(sal_False);
789 pDateStyle->AddText(A2OUSTR(" "));
790 pDateStyle->AddMonth(sal_False,sal_True);
791 pDateStyle->AddText(A2OUSTR(" "));
792 pDateStyle->AddYear();
794 else if (sFormula == A2OUSTR("%FLWday, DD Mn YYYY"))
796 pDateStyle = new XFDateStyle;
797 pDateStyle->AddWeekDay(sal_False);
798 pDateStyle->AddText(A2OUSTR(", "));
799 pDateStyle->AddMonthDay();
800 pDateStyle->AddText(A2OUSTR(" "));
801 pDateStyle->AddMonth(sal_False,sal_True);
802 pDateStyle->AddText(A2OUSTR(" "));
803 pDateStyle->AddYear();
805 else if (sFormula == A2OUSTR("%FLD Mn"))
807 pDateStyle = new XFDateStyle;
808 pDateStyle->AddMonthDay(sal_False);
809 pDateStyle->AddText(A2OUSTR(" "));
810 pDateStyle->AddMonth(sal_False,sal_True);
812 else if (sFormula == A2OUSTR("%FLDD Mn"))
814 pDateStyle = new XFDateStyle;
815 pDateStyle->AddMonthDay();
816 pDateStyle->AddText(A2OUSTR(" "));
817 pDateStyle->AddMonth(sal_False,sal_True);
819 else if (sFormula == A2OUSTR("%FLWeekday, D Mn"))
821 pDateStyle = new XFDateStyle;
822 pDateStyle->AddWeekDay();
823 pDateStyle->AddText(A2OUSTR(", "));
824 pDateStyle->AddMonthDay(sal_False);
825 pDateStyle->AddText(A2OUSTR(" "));
826 pDateStyle->AddMonth(sal_False,sal_True);
828 else if (sFormula == A2OUSTR("%FLWeekday, DD Mn"))
830 pDateStyle = new XFDateStyle;
831 pDateStyle->AddWeekDay();
832 pDateStyle->AddText(A2OUSTR(", "));
833 pDateStyle->AddMonthDay();
834 pDateStyle->AddText(A2OUSTR(" "));
835 pDateStyle->AddMonth(sal_False,sal_True);
837 else if (sFormula == A2OUSTR("%FLD Mn YY"))
839 pDateStyle = new XFDateStyle;
840 pDateStyle->AddMonthDay(sal_False);
841 pDateStyle->AddText(A2OUSTR(" "));
842 pDateStyle->AddMonth(sal_False,sal_True);
843 pDateStyle->AddText(A2OUSTR(" "));
844 pDateStyle->AddYear(sal_False);
846 else if (sFormula == A2OUSTR("%FLDD Mn YY"))
848 pDateStyle = new XFDateStyle;
849 pDateStyle->AddMonthDay();
850 pDateStyle->AddText(A2OUSTR(" "));
851 pDateStyle->AddMonth(sal_False,sal_True);
852 pDateStyle->AddText(A2OUSTR(" "));
853 pDateStyle->AddYear(sal_False);
855 else if (sFormula == A2OUSTR("%FLD/M"))
857 pDateStyle = new XFDateStyle;
858 pDateStyle->AddMonthDay(sal_False);
859 pDateStyle->AddText(A2OUSTR("/"));
860 pDateStyle->AddMonth(sal_False);
862 else if (sFormula == A2OUSTR("%FLDD/MM"))
864 pDateStyle = new XFDateStyle;
865 pDateStyle->AddMonthDay();
866 pDateStyle->AddText(A2OUSTR("/"));
867 pDateStyle->AddMonth();
869 else if(sFormula == A2OUSTR("%FLDD/MM/YY"))
871 pDateStyle = new XFDateStyle;
872 pDateStyle->AddMonthDay();
873 pDateStyle->AddText(A2OUSTR("/"));
874 pDateStyle->AddMonth();
875 pDateStyle->AddText(A2OUSTR("/"));
876 pDateStyle->AddYear(sal_False);
878 else if (sFormula == A2OUSTR("%FLMM/YY"))
880 pDateStyle = new XFDateStyle;
881 pDateStyle->AddMonth();
882 pDateStyle->AddText(A2OUSTR("/"));
883 pDateStyle->AddYear(sal_False);
885 //other version end
886 //TIME
887 else if (sFormula == A2OUSTR("%FLSystemTime"))
889 pTimeStyle = LwpTools::GetSystemTimeStyle();
891 else if (sFormula == A2OUSTR("%FLISOTime1") || sFormula == A2OUSTR("%FLH:mm:SS"))
893 pTimeStyle = new XFTimeStyle;
894 pTimeStyle->AddHour();
895 pTimeStyle->AddText(A2OUSTR(":"));
896 pTimeStyle->AddMinute();
897 pTimeStyle->AddText(A2OUSTR(":"));
898 pTimeStyle->AddSecond(sal_True,0);
900 else if (sFormula == A2OUSTR("%FLH:mm ampm"))
902 pTimeStyle = new XFTimeStyle;
903 pTimeStyle->AddHour(sal_False);
904 pTimeStyle->AddText(A2OUSTR(":"));
905 pTimeStyle->AddMinute();
906 pTimeStyle->AddText(A2OUSTR(" "));
907 pTimeStyle->SetAmPm(sal_True);
909 else if (sFormula == A2OUSTR("%FLH:mm"))
911 pTimeStyle = new XFTimeStyle;
912 pTimeStyle->AddHour(sal_False);
913 pTimeStyle->AddText(A2OUSTR(":"));
914 pTimeStyle->AddMinute();
916 else if (sFormula == A2OUSTR("%FLH:mm:SS ampm"))
918 pTimeStyle = new XFTimeStyle;
919 pTimeStyle->AddHour(sal_False);
920 pTimeStyle->AddText(A2OUSTR(":"));
921 pTimeStyle->AddMinute();
922 pTimeStyle->AddText(A2OUSTR(":"));
923 pTimeStyle->AddSecond(sal_True,0);
924 pTimeStyle->AddText(A2OUSTR(" "));
925 pTimeStyle->SetAmPm(sal_True);
927 else if (sFormula == A2OUSTR("%FLH:mm:SS"))
929 pTimeStyle = new XFTimeStyle;
930 pTimeStyle->AddHour(sal_False);
931 pTimeStyle->AddText(A2OUSTR(":"));
932 pTimeStyle->AddMinute();
933 pTimeStyle->AddText(A2OUSTR(":"));
934 pTimeStyle->AddSecond(sal_True,0);
936 else if (sFormula == A2OUSTR("%FLH ampm"))
938 pTimeStyle = new XFTimeStyle;
939 pTimeStyle->AddHour(sal_False);
940 pTimeStyle->AddText(A2OUSTR(" "));
941 pTimeStyle->SetAmPm(sal_True);
943 else if (sFormula == A2OUSTR("%FLH"))
945 pTimeStyle = new XFTimeStyle;
946 pTimeStyle->AddHour(sal_False);
948 else if (sFormula == A2OUSTR("%FLmm"))
950 pTimeStyle = new XFTimeStyle;
951 pTimeStyle->AddMinute();
953 else if (sFormula == A2OUSTR("%FLSS"))
955 pTimeStyle = new XFTimeStyle;
956 pTimeStyle->AddSecond(sal_True,0);
958 else if (sFormula == A2OUSTR("%FLampm"))
960 pTimeStyle = new XFTimeStyle;
961 pTimeStyle->SetAmPm(sal_True);
963 //chinese version begin
964 else if (sFormula == A2OUSTR("%FLjF") || sFormula == A2OUSTR("%FLJFF")
965 || sFormula == A2OUSTR("%FLjjF") || sFormula == A2OUSTR("%FLJJFF ") )
967 pTimeStyle = new XFTimeStyle;
968 pTimeStyle->AddHour(sal_False);
969 rtl::OUString sText;
970 sText = rtl::OUString(0x70b9);
971 pTimeStyle->AddText(sText);
972 pTimeStyle->AddMinute(sal_False);
973 sText = rtl::OUString(0x5206);
974 pTimeStyle->AddText(sText);
976 else if (sFormula == A2OUSTR("%FLjjjF") || sFormula == A2OUSTR("%FLJJJFF") )
978 pTimeStyle = new XFTimeStyle;
979 pTimeStyle->SetAmPm(sal_True);
980 pTimeStyle->AddHour(sal_False);
981 rtl::OUString sText;
982 sText = rtl::OUString(0x70b9);
983 pTimeStyle->AddText(sText);
984 pTimeStyle->AddMinute(sal_False);
985 sText = rtl::OUString(0x5206);
986 pTimeStyle->AddText(sText);
988 //chinese version end
989 //other version begin
990 else if (sFormula == A2OUSTR("%FLHH:mm ampm"))
992 pTimeStyle = new XFTimeStyle;
993 pTimeStyle->AddHour();
994 pTimeStyle->AddText(A2OUSTR(":"));
995 pTimeStyle->AddMinute();
996 pTimeStyle->AddText(A2OUSTR(" "));
997 pTimeStyle->SetAmPm(sal_True);
999 else if (sFormula == A2OUSTR("%FLHH ampm"))
1001 pTimeStyle = new XFTimeStyle;
1002 pTimeStyle->AddHour();
1003 pTimeStyle->AddText(A2OUSTR(" "));
1004 pTimeStyle->SetAmPm(sal_True);
1006 else if (sFormula == A2OUSTR("%FLHH:mm:SS ampm"))
1008 pTimeStyle = new XFTimeStyle;
1009 pTimeStyle->AddHour();
1010 pTimeStyle->AddText(A2OUSTR(":"));
1011 pTimeStyle->AddMinute();
1012 pTimeStyle->AddText(A2OUSTR(":"));
1013 pTimeStyle->AddSecond(sal_True,0);
1014 pTimeStyle->AddText(A2OUSTR(" "));
1015 pTimeStyle->SetAmPm(sal_True);
1017 else if (sFormula == A2OUSTR("%FLHH:mm"))
1019 pTimeStyle = new XFTimeStyle;
1020 pTimeStyle->AddHour();
1021 pTimeStyle->AddText(A2OUSTR(":"));
1022 pTimeStyle->AddMinute();
1024 else if (sFormula == A2OUSTR("%FLHH:mm:SS"))
1026 pTimeStyle = new XFTimeStyle;
1027 pTimeStyle->AddHour();
1028 pTimeStyle->AddText(A2OUSTR(":"));
1029 pTimeStyle->AddMinute();
1030 pTimeStyle->AddText(A2OUSTR(":"));
1031 pTimeStyle->AddSecond(sal_True,0);
1033 //other version end
1035 else if(sFormula[1] == 'D')
1037 if (sFormula == A2OUSTR("%Da"))
1039 pDateStyle = LwpTools::GetSystemDateStyle(sal_False);
1041 else if (sFormula == A2OUSTR("%DB") || sFormula == A2OUSTR("%Db"))
1043 pDateStyle = new XFDateStyle;
1044 pDateStyle->AddMonth(sal_True,sal_True);
1045 pDateStyle->AddText(A2OUSTR(" "));
1046 pDateStyle->AddMonthDay(sal_False);
1047 pDateStyle->AddText(A2OUSTR(", "));
1048 pDateStyle->AddYear();
1050 else if (sFormula == A2OUSTR("%Dc") || sFormula == A2OUSTR("%DC"))
1052 pDateStyle = new XFDateStyle;
1053 pDateStyle->AddMonthDay(sal_False);
1054 pDateStyle->AddText(A2OUSTR(" "));
1055 pDateStyle->AddMonth(sal_True,sal_True);
1056 pDateStyle->AddText(A2OUSTR(" "));
1057 pDateStyle->AddYear();
1059 else if (sFormula == A2OUSTR("%Dd") || sFormula == A2OUSTR("%DD"))
1061 pDateStyle = new XFDateStyle;
1062 pDateStyle->AddWeekDay();
1063 pDateStyle->AddText(A2OUSTR(", "));
1064 pDateStyle->AddMonth(sal_True,sal_True);
1065 pDateStyle->AddText(A2OUSTR(" "));
1066 pDateStyle->AddMonthDay(sal_False);
1067 pDateStyle->AddText(A2OUSTR(", "));
1068 pDateStyle->AddYear();
1070 else if (sFormula == A2OUSTR("%DE") || sFormula == A2OUSTR("%De"))
1072 pDateStyle = new XFDateStyle;
1073 pDateStyle->AddMonth(sal_True,sal_True);
1074 pDateStyle->AddText(A2OUSTR(" "));
1075 pDateStyle->AddMonthDay(sal_False);
1077 else if (sFormula == A2OUSTR("%Df") || sFormula == A2OUSTR("%DF"))
1079 pDateStyle = new XFDateStyle;
1080 pDateStyle->AddWeekDay();
1081 pDateStyle->AddText(A2OUSTR(" "));
1082 pDateStyle->AddMonth(sal_True,sal_True);
1083 pDateStyle->AddText(A2OUSTR(" "));
1084 pDateStyle->AddMonthDay(sal_False);
1086 else if (sFormula == A2OUSTR("%Dg"))
1088 pDateStyle = new XFDateStyle;
1089 pDateStyle->AddMonth(sal_False);
1090 pDateStyle->AddText(A2OUSTR("/"));
1091 pDateStyle->AddMonthDay(sal_False);
1093 else if (sFormula == A2OUSTR("%Dh"))
1095 pDateStyle = new XFDateStyle;
1096 pDateStyle->AddMonth(sal_False);
1097 pDateStyle->AddText(A2OUSTR("/"));
1098 pDateStyle->AddMonthDay(sal_False);
1099 pDateStyle->AddText(A2OUSTR("/"));
1100 pDateStyle->AddYear();
1102 else if (sFormula == A2OUSTR("%Di") || sFormula == A2OUSTR("%DI"))
1104 pDateStyle = new XFDateStyle;
1105 pDateStyle->AddMonthDay(sal_False);
1106 pDateStyle->AddText(A2OUSTR("."));
1107 pDateStyle->AddMonth(sal_True,sal_True);
1109 else if (sFormula == A2OUSTR("%Dj") || sFormula == A2OUSTR("%DJ"))
1111 pDateStyle = new XFDateStyle;
1112 pDateStyle->AddMonthDay(sal_False);
1113 pDateStyle->AddText(A2OUSTR("."));
1114 pDateStyle->AddMonth(sal_True,sal_True);
1115 pDateStyle->AddText(A2OUSTR(" "));
1116 pDateStyle->AddYear();
1118 else if (sFormula == A2OUSTR("%Dk") || sFormula == A2OUSTR("%DK"))
1120 pDateStyle = new XFDateStyle;
1121 pDateStyle->AddYear();
1122 pDateStyle->AddText(A2OUSTR(" "));
1123 pDateStyle->AddMonth(sal_True,sal_True);
1124 pDateStyle->AddText(A2OUSTR(" "));
1125 pDateStyle->AddMonthDay(sal_False);
1127 else if (sFormula == A2OUSTR("%DL") || sFormula == A2OUSTR("%Dl"))
1129 pDateStyle = new XFDateStyle;
1130 pDateStyle->AddMonth(sal_True,sal_True);
1131 pDateStyle->AddText(A2OUSTR(","));
1132 pDateStyle->AddYear();
1134 else if (sFormula == A2OUSTR("%Dm"))
1136 pDateStyle = new XFDateStyle;
1137 pDateStyle->AddMonthDay();
1138 pDateStyle->AddText(A2OUSTR("/"));
1139 pDateStyle->AddMonth();
1140 pDateStyle->AddText(A2OUSTR("/"));
1141 pDateStyle->AddYear();
1144 else if (sFormula[1] == 'T')
1146 if (sFormula == A2OUSTR("%T1"))
1148 pTimeStyle = new XFTimeStyle;
1149 pTimeStyle->AddHour();
1150 pTimeStyle->AddText(A2OUSTR(":"));
1151 pTimeStyle->AddMinute();
1153 else if (sFormula == A2OUSTR("%T2") || sFormula == A2OUSTR("%T6")
1154 || sFormula == A2OUSTR("%T4") || sFormula == A2OUSTR("%T8") )
1156 pTimeStyle = new XFTimeStyle;
1157 pTimeStyle->AddHour(sal_False);
1158 pTimeStyle->AddText(A2OUSTR(":"));
1159 pTimeStyle->AddMinute();
1160 pTimeStyle->AddText(A2OUSTR(":"));
1161 pTimeStyle->SetAmPm(sal_True);
1163 else if (sFormula == A2OUSTR("%T3") || sFormula == A2OUSTR("%T7")
1164 || sFormula == A2OUSTR("%T5") || sFormula == A2OUSTR("%T9"))
1166 pTimeStyle = new XFTimeStyle;
1167 pTimeStyle->AddHour();
1168 pTimeStyle->AddText(A2OUSTR(":"));
1169 pTimeStyle->AddMinute();
1170 pTimeStyle->AddText(A2OUSTR(":"));
1171 pTimeStyle->SetAmPm(sal_True);
1174 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
1175 if (pDateStyle)
1176 m_TimeStyle = pXFStyleManager->AddStyle(pDateStyle)->GetStyleName();
1177 if (pTimeStyle)
1178 m_TimeStyle = pXFStyleManager->AddStyle(pTimeStyle)->GetStyleName();
1181 void LwpFribField::CheckFieldType(LwpFieldMark* pFieldMark)
1183 sal_uInt8 nType;
1184 OUString sFormula;
1185 if (pFieldMark->IsDateTimeField(nType,sFormula))
1187 m_nDateTimeType = nType;
1188 m_sFormula = sFormula;
1189 m_nSubType = SUBFIELD_DATETIME;
1191 else if (pFieldMark->IsCrossRefField(nType,sFormula))
1193 m_nCrossRefType = nType;
1194 m_sFormula = sFormula;
1195 m_nSubType = SUBFIELD_CROSSREF;
1197 else if (pFieldMark->IsDocPowerField(nType,sFormula))
1199 m_nDocPowerType = nType;
1200 m_nSubType = SUBFIELD_DOCPOWER;
1202 else
1204 m_nSubType = SUBFIELD_INVALID;
1208 void LwpFribField::ConvertDocFieldStart(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark)
1210 XFContent* pContent = NULL;
1211 switch(m_nDocPowerType)
1213 case LwpFieldMark::DOC_DESCRIPTION:
1215 pContent = new XFDescriptionStart;
1216 break;
1218 case LwpFieldMark::DOC_NUMPAGES:
1220 pContent = new XFPageCountStart;
1221 break;
1223 case LwpFieldMark::DOC_NUMWORDS:
1225 pContent = new XFWordCountStart;
1226 break;
1228 case LwpFieldMark::DOC_NUMCHARS:
1230 pContent = new XFCharCountStart;
1231 break;
1233 // case LwpFieldMark::DOC_TOTALTIME:
1234 // {
1235 // pContent = new XFTotalEditTimeStart;
1236 // pContent->SetStyleName(m_TimeStyle);
1237 // break;
1238 // }
1240 if (pContent)
1242 if (m_ModFlag)//(m_pModifiers)
1244 XFTextSpanStart* pSpan = new XFTextSpanStart;
1245 pSpan->SetStyleName(GetStyleName());
1246 pSpan->Add(pContent);
1247 pXFPara->Add(pSpan);
1248 pFieldMark->SetStyleFlag(sal_True);
1250 else
1251 pXFPara->Add(pContent);
1255 void LwpFribField::ConvertDocFieldEnd(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark)
1257 XFContent* pContent = NULL;
1258 switch(m_nDocPowerType)
1260 case LwpFieldMark::DOC_DESCRIPTION:
1262 pContent = new XFDescriptionEnd;
1263 break;
1265 case LwpFieldMark::DOC_NUMPAGES:
1267 pContent = new XFPageCountEnd;
1268 break;
1270 case LwpFieldMark::DOC_NUMWORDS:
1272 pContent = new XFWordCountEnd;
1273 break;
1275 case LwpFieldMark::DOC_NUMCHARS:
1277 pContent = new XFCharCountEnd;
1278 break;
1280 // case LwpFieldMark::DOC_TOTALTIME:
1281 // {
1282 // pContent = new XFTotalEditTimeEnd;
1283 // break;
1284 // }
1286 if (pContent)
1288 if (pFieldMark->GetStyleFlag())
1290 XFTextSpanEnd* pSpan = new XFTextSpanEnd;
1291 pSpan->Add(pContent);
1292 pXFPara->Add(pSpan);
1294 else
1295 pXFPara->Add(pContent);
1299 void LwpFribField::ConvertDateTimeStart(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark)
1301 XFContent* pContent = NULL;
1302 switch(m_nDateTimeType)
1304 case LwpFieldMark::DATETIME_NOW:
1306 pContent = new XFDateStart;
1307 pContent->SetStyleName(m_TimeStyle);
1308 break;
1310 case LwpFieldMark::DATETIME_CREATE:
1312 pContent = new XFCreateTimeStart;
1313 pContent->SetStyleName(m_TimeStyle);
1314 break;
1316 case LwpFieldMark::DATETIME_LASTEDIT:
1318 pContent = new XFLastEditTimeStart;
1319 pContent->SetStyleName(m_TimeStyle);
1320 break;
1322 case LwpFieldMark::DATETIME_TOTALTIME:
1324 pContent = new XFTotalEditTimeStart;
1325 pContent->SetStyleName(m_TimeStyle);
1326 break;
1328 default:
1329 break;
1331 if (pContent)
1333 if (m_ModFlag)//(m_pModifiers)
1335 XFTextSpanStart* pSpan = new XFTextSpanStart;
1336 pSpan->SetStyleName(GetStyleName());
1337 pSpan->Add(pContent);
1338 pXFPara->Add(pSpan);
1339 pFieldMark->SetStyleFlag(sal_True);
1341 else
1342 pXFPara->Add(pContent);
1347 void LwpFribField::ConvertDateTimeEnd(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark)
1349 XFContent* pContent = NULL;
1350 switch(m_nDateTimeType)
1352 case LwpFieldMark::DATETIME_NOW:
1354 pContent = new XFDateEnd;
1355 break;
1357 case LwpFieldMark::DATETIME_CREATE:
1359 pContent = new XFCreateTimeEnd;
1360 break;
1362 case LwpFieldMark::DATETIME_LASTEDIT:
1364 pContent = new XFLastEditTimeEnd;
1365 break;
1367 case LwpFieldMark::DATETIME_TOTALTIME:
1369 pContent = new XFTotalEditTimeEnd;
1370 break;
1373 if (pContent)
1375 if (pFieldMark->GetStyleFlag())
1377 XFTextSpanEnd* pSpan = new XFTextSpanEnd;
1378 pSpan->Add(pContent);
1379 pXFPara->Add(pSpan);
1381 else
1382 pXFPara->Add(pContent);
1386 void LwpFribField::ConvertCrossRefStart(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark)
1388 XFCrossRefStart* pRef = new XFCrossRefStart;
1389 pRef->SetRefType(m_nCrossRefType);
1390 pRef->SetMarkName(m_sFormula);
1391 // pFieldMark->SetStart(sal_True);//for some disnormal cases
1392 if (m_ModFlag)
1394 XFTextSpanStart* pSpan = new XFTextSpanStart;
1395 pSpan->SetStyleName(GetStyleName());
1396 pSpan->Add(pRef);
1397 pXFPara->Add(pSpan);
1398 pFieldMark->SetStyleFlag(sal_True);
1400 else
1401 pXFPara->Add(pRef);
1404 void LwpFribField::ConvertCrossRefEnd(XFContentContainer* pXFPara,LwpFieldMark* pFieldMark)
1406 XFCrossRefEnd* pRef = new XFCrossRefEnd;
1407 if (pFieldMark->GetStyleFlag())
1409 XFTextSpanEnd* pSpan = new XFTextSpanEnd;
1410 pSpan->Add(pRef);
1411 pXFPara->Add(pSpan);
1413 else
1414 pXFPara->Add(pRef);
1417 LwpFribRubyMarker::LwpFribRubyMarker( LwpPara* pPara ): LwpFrib(pPara)
1421 LwpRubyMarker* LwpFribRubyMarker::GetMarker()
1423 return static_cast<LwpRubyMarker*>(m_objMarker.obj(VO_RUBYMARKER));
1426 void LwpFribRubyMarker::Read(LwpObjectStream* pObjStrm, sal_uInt16 len)
1428 m_objMarker.ReadIndexed(pObjStrm);
1429 m_nType = pObjStrm->QuickReaduInt8();
1432 void LwpFribRubyMarker::XFConvert(XFContentContainer* pXFPara)
1434 sal_uInt8 type = GetType();
1435 LwpRubyMarker* pMarker = GetMarker();
1437 if (type == MARKER_START)
1439 XFRubyStart* pRubyStart = new XFRubyStart;
1440 if (pMarker)
1442 pRubyStart->SetStyleName(pMarker->GetRubyStyleName());
1444 pXFPara->Add(pRubyStart);
1446 else if(type == MARKER_END)
1448 XFRubyEnd* pRubyEnd = new XFRubyEnd;
1449 if (pMarker)
1451 pRubyEnd->SetText(pMarker->GetRubyText());
1452 pRubyEnd->SetStyleName(pMarker->GetTextStyleName());
1454 pXFPara->Add(pRubyEnd);
1458 void LwpFribRubyMarker::RegisterStyle(LwpFoundry* pFoundry)