tdf#131098 docx export: write fill property of graphic
[LibreOffice.git] / lotuswordpro / source / filter / lwpfribmark.cxx
blob2dda5912fbcaa5c8760f9e2b29bce8583fbd373e
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,
29 * MA 02111-1307 USA
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 /*************************************************************************
57 * @file
58 * For LWP filter architecture prototype
59 ************************************************************************/
61 #include "lwpfribmark.hxx"
62 #include <lwptools.hxx>
63 #include <lwpglobalmgr.hxx>
64 #include "lwpdoc.hxx"
65 #include "lwpdivinfo.hxx"
66 #include <xfilter/xfstylemanager.hxx>
67 #include <xfilter/xftextspan.hxx>
68 #include <xfilter/xfbookmark.hxx>
69 #include <xfilter/xfentry.hxx>
70 #include <xfilter/xftextcontent.hxx>
71 #include <xfilter/xfcrossref.hxx>
72 #include <xfilter/xfdocfield.hxx>
73 #include <xfilter/xfdatestyle.hxx>
74 #include <xfilter/xftimestyle.hxx>
75 #include <xfilter/xfdate.hxx>
76 #include <xfilter/xfruby.hxx>
77 #include <lwpchangemgr.hxx>
78 #include <xfilter/xfchange.hxx>
80 /**
81 * @short: Read hyperlink frib and Click here block
83 void LwpFribCHBlock::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
85 m_objMarker.ReadIndexed(pObjStrm);
86 m_nType = pObjStrm->QuickReaduInt8();
89 void LwpFribCHBlock::XFConvert(XFContentContainer* pXFPara, LwpStory* pStory)
91 sal_uInt8 type = GetType();
92 if (!pStory)
93 return;
94 LwpCHBlkMarker* pMarker = dynamic_cast<LwpCHBlkMarker*>(m_objMarker.obj().get());
96 if (!pMarker)
97 return;
98 sal_uInt16 nAction = pMarker->GetAction();
99 if (nAction == LwpCHBlkMarker::CLICKHERE_CHBEHAVIORINTERNETLINK) //hyperlink
101 LwpHyperlinkMgr* pHyperlink = pStory->GetHyperlinkMgr();
102 if (type == MARKER_START)
104 if (pHyperlink)
106 pHyperlink->SetHyperlinkFlag(true);
107 pHyperlink->SetHyperlink(pMarker->GetNamedProperty(u"URL"));
110 else if (type == MARKER_END) //or none
112 pHyperlink->SetHyperlinkFlag(false);
115 else //click here block
117 pMarker->ConvertCHBlock(pXFPara, type);
121 * @short: register bookmark frib
123 void LwpFribBookMark::RegisterStyle(LwpFoundry* pFoundry)
125 OUString name;
126 LwpBookMark* pBook = pFoundry ? pFoundry->GetBookMark(GetMarkerID()) : nullptr;
127 if (pBook)
128 name = pBook->GetName();
130 OUString sDivision;
131 LwpDocument* pDoc = pFoundry ? pFoundry->GetDocument() : nullptr;
132 if (pDoc)
134 LwpObjectID& rID = pDoc->GetDivInfoID();
135 if (!rID.IsNull())
137 LwpDivInfo* pDivInvo = dynamic_cast<LwpDivInfo*>(rID.obj(VO_DIVISIONINFO).get());
138 if (pDivInvo)
139 sDivision = pDivInvo->GetDivName();
143 sal_uInt8 type = GetType();
145 LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
146 LwpBookmarkMgr* pMarkMgr = pGlobal->GetLwpBookmarkMgr();
147 if (type == MARKER_START)
149 rtl::Reference<XFBookmarkStart> xMarkStart(new XFBookmarkStart);
150 xMarkStart->SetDivision(sDivision);
151 xMarkStart->SetName(name);
152 pMarkMgr->AddXFBookmarkStart(name, xMarkStart.get()); //add to map
153 m_xStart = xMarkStart;
155 else if (type == MARKER_END)
157 rtl::Reference<XFBookmarkEnd> xMarkEnd(new XFBookmarkEnd);
158 xMarkEnd->SetDivision(sDivision);
159 xMarkEnd->SetName(name);
160 pMarkMgr->AddXFBookmarkEnd(name, xMarkEnd.get()); //add to map
161 m_xEnd = xMarkEnd;
165 LwpFribBookMark::LwpFribBookMark(LwpPara* pPara)
166 : LwpFrib(pPara)
167 , m_nType(0)
172 * @short: Read bookmark frib
174 void LwpFribBookMark::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
176 m_objMarker.ReadIndexed(pObjStrm);
177 m_nType = pObjStrm->QuickReaduInt8();
180 * @short: convert bookmark frib
182 void LwpFribBookMark::XFConvert(XFContentContainer* pXFPara)
184 sal_uInt8 type = GetType();
186 if (type == MARKER_START && m_xStart)
188 pXFPara->Add(m_xStart.get());
190 else if (type == MARKER_END && m_xEnd)
192 pXFPara->Add(m_xEnd.get());
197 * @short: Read index entry frib
199 LwpFribField::LwpFribField(LwpPara* pPara)
200 : LwpFrib(pPara)
201 , m_nType(0)
202 , m_TimeStyle(u""_ustr)
203 , m_nSubType(0)
204 , m_sFormula(u""_ustr)
205 , m_nCrossRefType(0)
206 , m_nDateTimeType(0)
207 , m_nDocPowerType(0)
211 void LwpFribField::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
213 m_objMarker.ReadIndexed(pObjStrm);
214 m_nType = pObjStrm->QuickReaduInt8();
217 LwpFieldMark* LwpFribField::GetMarker()
219 return dynamic_cast<LwpFieldMark*>(m_objMarker.obj().get());
222 void LwpFribField::XFConvert(XFContentContainer* pXFPara)
224 LwpFieldMark* pFieldMark = GetMarker();
225 if (!pFieldMark)
226 return;
228 sal_uInt8 type = GetType();
229 sal_uInt16 fieldType = pFieldMark->GetFieldType();
231 OUString sChangeID;
232 if (pFieldMark->GetRevisionFlag())
234 LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
235 LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
236 sChangeID = pChangeMgr->GetChangeID(pFieldMark->GetStartFrib());
239 CheckFieldType(pFieldMark);
240 //end marker
241 if (type == MARKER_END)
243 if (!pFieldMark->GetStart())
244 return;
245 if (pFieldMark->IsFormulaInsert())
247 XFTextContent* pSpan = new XFTextContent();
248 pSpan->SetText(u">"_ustr);
249 pXFPara->Add(pSpan);
251 if (fieldType == LwpFieldMark::FLD_FIELD)
253 if (m_nSubType == SUBFIELD_DATETIME)
255 ConvertDateTimeEnd(pXFPara, pFieldMark);
257 else if (m_nSubType == SUBFIELD_CROSSREF)
259 ConvertCrossRefEnd(pXFPara, pFieldMark);
261 else if (m_nSubType == SUBFIELD_DOCPOWER)
263 ConvertDocFieldEnd(pXFPara, pFieldMark);
266 if (pFieldMark->GetRevisionFlag() && !sChangeID.isEmpty())
268 XFChangeEnd* pChangeEnd = new XFChangeEnd;
269 pChangeEnd->SetChangeID(sChangeID);
270 pXFPara->Add(pChangeEnd);
273 return;
276 //start marker
277 if (pFieldMark->GetRevisionFlag() && !sChangeID.isEmpty())
279 XFChangeStart* pChangeStart = new XFChangeStart;
280 pChangeStart->SetChangeID(sChangeID);
281 pXFPara->Add(pChangeStart);
284 if (fieldType == LwpFieldMark::FLD_INDEX)
286 OUString sKey1, sKey2;
287 pFieldMark->ParseIndex(sKey1, sKey2);
288 if (!sKey1.isEmpty())
290 XFEntry* pEntry = new XFEntry;
291 pEntry->SetEntryType(enumXFEntryAlphabetical);
292 pEntry->SetKey(sKey1, sKey2);
293 pXFPara->Add(pEntry);
296 else if (fieldType == LwpFieldMark::FLD_TOC)
298 OUString sLevel, sText;
299 pFieldMark->ParseTOC(sLevel, sText);
300 if (!sLevel.isEmpty() && !sText.isEmpty())
302 XFEntry* pEntry = new XFEntry;
303 pEntry->SetEntryType(enumXFEntryTOC);
304 pEntry->SetStringValue(sText);
305 pEntry->SetOutlineLevel(sLevel.toInt32());
306 pXFPara->Add(pEntry);
309 else if (fieldType == LwpFieldMark::FLD_FIELD)
311 sal_uInt8 nDatetype;
312 OUString sFormula;
313 /*sal_Bool bIsDateTime =*/pFieldMark->IsDateTimeField(nDatetype, sFormula);
315 if (m_nSubType == SUBFIELD_DATETIME) //date time
317 ConvertDateTimeStart(pXFPara, pFieldMark);
319 else if (m_nSubType == SUBFIELD_CROSSREF) //cross ref
321 ConvertCrossRefStart(pXFPara, pFieldMark);
323 else if (m_nSubType == SUBFIELD_DOCPOWER)
325 ConvertDocFieldStart(pXFPara, pFieldMark);
329 if (pFieldMark->IsFormulaInsert())
331 XFTextContent* pSpan = new XFTextContent();
332 pSpan->SetText(u"<"_ustr);
333 pXFPara->Add(pSpan);
336 pFieldMark->SetStart(true);
339 void LwpFribField::RegisterStyle(LwpFoundry* pFoundry)
341 LwpFrib::RegisterStyle(pFoundry);
342 LwpFieldMark* pFieldMark = GetMarker();
343 if (!pFieldMark)
344 return;
346 sal_uInt8 type = GetType();
347 sal_uInt16 fieldType = pFieldMark->GetFieldType();
349 if (type == MARKER_START && fieldType == LwpFieldMark::FLD_FIELD)
351 RegisterTimeField(pFieldMark);
354 if (type == MARKER_START && m_bRevisionFlag)
356 LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
357 LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
358 pChangeMgr->AddChangeFrib(this);
359 pFieldMark->SetStartFrib(this);
360 pFieldMark->SetRevisionFlag(true);
364 void LwpFribField::RegisterTimeField(const LwpFieldMark* pFieldMark)
366 OUString sFormula
367 = pFieldMark->GetFormula(); //now bookmark maybe not all register to bookmarkmgr,
368 if (sFormula == "TotalEditingTime") //so check field type now is not correct.
369 RegisterTotalTimeStyle();
370 else
372 sal_Int32 index = sFormula.indexOf(0x20); //space
373 if (index < 0)
374 return;
376 std::u16string_view tag = sFormula.subView(0, index);
377 if (tag == u"Now()" || tag == u"CreateDate" || tag == u"EditDate")
378 RegisterDateTimeStyle(sFormula.subView(index + 1));
382 void LwpFribField::RegisterTotalTimeStyle()
384 std::unique_ptr<XFTimeStyle> pTimeStyle(new XFTimeStyle); //use the default format
385 pTimeStyle->SetTruncate(false);
386 pTimeStyle->AddMinute();
387 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
388 m_TimeStyle = pXFStyleManager->AddStyle(std::move(pTimeStyle)).m_pStyle->GetStyleName();
391 void LwpFribField::RegisterDateTimeStyle(std::u16string_view sFormula)
393 std::unique_ptr<XFDateStyle> pDateStyle;
394 std::unique_ptr<XFTimeStyle> pTimeStyle;
395 //DATE
396 if (sFormula.size() < 2)
397 return;
398 if (sFormula[1] == 'F')
400 if (sFormula == u"%FLSystemShortDate")
402 pDateStyle = LwpTools::GetSystemDateStyle(false);
404 else if (sFormula == u"%FLSystemLongDate")
406 pDateStyle = LwpTools::GetSystemDateStyle(true);
408 else if (sFormula == u"%FLISODate1" || sFormula == u"%FLYYYY/MM/DD")
410 pDateStyle.reset(new XFDateStyle);
411 pDateStyle->AddYear();
412 pDateStyle->AddText(u"/"_ustr);
413 pDateStyle->AddMonth();
414 pDateStyle->AddText(u"/"_ustr);
415 pDateStyle->AddMonthDay();
417 else if (sFormula == u"%FLISODate2" || sFormula == u"%FLYYYY/MM/DD HH:mm:SS")
419 pDateStyle.reset(new XFDateStyle);
420 pDateStyle->AddYear();
421 pDateStyle->AddText(u"/"_ustr);
422 pDateStyle->AddMonth();
423 pDateStyle->AddText(u"/"_ustr);
424 pDateStyle->AddMonthDay();
425 pDateStyle->AddText(u" "_ustr);
426 pDateStyle->AddHour();
427 pDateStyle->AddText(u":"_ustr);
428 pDateStyle->AddMinute();
429 pDateStyle->AddText(u":"_ustr);
430 pDateStyle->AddSecond();
432 else if (sFormula == u"%FLM/D/YY")
434 pDateStyle.reset(new XFDateStyle);
435 pDateStyle->AddMonth(false);
436 pDateStyle->AddText(u"/"_ustr);
437 pDateStyle->AddMonthDay(false);
438 pDateStyle->AddText(u"/"_ustr);
439 pDateStyle->AddYear(false);
441 else if (sFormula == u"%FLMonth D, YYYY")
443 pDateStyle.reset(new XFDateStyle);
444 pDateStyle->AddMonth(true, true);
445 pDateStyle->AddText(u" "_ustr);
446 pDateStyle->AddMonthDay(false);
447 pDateStyle->AddText(u", "_ustr);
448 pDateStyle->AddYear();
450 else if (sFormula == u"%FLWeekday, Month D, YYYY")
452 pDateStyle.reset(new XFDateStyle);
453 pDateStyle->AddWeekDay();
454 pDateStyle->AddText(u", "_ustr);
455 pDateStyle->AddMonth(true, true);
456 pDateStyle->AddText(u" "_ustr);
457 pDateStyle->AddMonthDay(false);
458 pDateStyle->AddText(u", "_ustr);
459 pDateStyle->AddYear();
461 else if (sFormula == u"%FLMn D, YYYY")
463 pDateStyle.reset(new XFDateStyle);
464 pDateStyle->AddMonth(false, true);
465 pDateStyle->AddText(u" "_ustr);
466 pDateStyle->AddMonthDay(false);
467 pDateStyle->AddText(u", "_ustr);
468 pDateStyle->AddYear();
470 else if (sFormula == u"%FLWday, Mn D, YYYY")
472 pDateStyle.reset(new XFDateStyle);
473 pDateStyle->AddWeekDay(false);
474 pDateStyle->AddText(u", "_ustr);
475 pDateStyle->AddMonth(false, true);
476 pDateStyle->AddText(u" "_ustr);
477 pDateStyle->AddMonthDay(false);
478 pDateStyle->AddText(u", "_ustr);
479 pDateStyle->AddYear();
481 else if (sFormula == u"%FLMn D")
483 pDateStyle.reset(new XFDateStyle);
484 pDateStyle->AddMonth(false, true);
485 pDateStyle->AddText(u" "_ustr);
486 pDateStyle->AddMonthDay(false);
488 else if (sFormula == u"%FLWeekday, Mn D")
490 pDateStyle.reset(new XFDateStyle);
491 pDateStyle->AddWeekDay();
492 pDateStyle->AddText(u", "_ustr);
493 pDateStyle->AddMonth(false, true);
494 pDateStyle->AddText(u" "_ustr);
495 pDateStyle->AddMonthDay(false);
497 else if (sFormula == u"%FLMn D, YY")
499 pDateStyle.reset(new XFDateStyle);
500 pDateStyle->AddMonth(false, true);
501 pDateStyle->AddText(u" "_ustr);
502 pDateStyle->AddMonthDay(false);
503 pDateStyle->AddText(u", "_ustr);
504 pDateStyle->AddYear(false);
506 else if (sFormula == u"%FLM/D")
508 pDateStyle.reset(new XFDateStyle);
509 pDateStyle->AddMonth(false);
510 pDateStyle->AddText(u"/"_ustr);
511 pDateStyle->AddMonthDay(false);
513 else if (sFormula == u"%FLM/YY")
515 pDateStyle.reset(new XFDateStyle);
516 pDateStyle->AddMonth(false);
517 pDateStyle->AddText(u"/"_ustr);
518 pDateStyle->AddYear(false);
520 else if (sFormula == u"%FLMn YY")
522 pDateStyle.reset(new XFDateStyle);
523 pDateStyle->AddMonth(false, true);
524 pDateStyle->AddText(u" "_ustr);
525 pDateStyle->AddYear(false);
527 else if (sFormula == u"%FLWeekday")
529 pDateStyle.reset(new XFDateStyle);
530 pDateStyle->AddWeekDay();
532 else if (sFormula == u"%FLWday")
534 pDateStyle.reset(new XFDateStyle);
535 pDateStyle->AddWeekDay(false);
537 else if (sFormula == u"%FLMonth")
539 pDateStyle.reset(new XFDateStyle);
540 pDateStyle->AddMonth(true, true);
542 else if (sFormula == u"%FLMn")
544 pDateStyle.reset(new XFDateStyle);
545 pDateStyle->AddMonth(false, true);
547 else if (sFormula == u"%FLD")
549 pDateStyle.reset(new XFDateStyle);
550 pDateStyle->AddMonthDay(false);
552 else if (sFormula == u"%FLM")
554 pDateStyle.reset(new XFDateStyle);
555 pDateStyle->AddMonth(false);
557 else if (sFormula == u"%FLYYYY")
559 pDateStyle.reset(new XFDateStyle);
560 pDateStyle->AddYear();
562 else if (sFormula == u"%FLYY")
564 pDateStyle.reset(new XFDateStyle);
565 pDateStyle->AddYear(false);
567 //chinese version begin
568 else if (sFormula == u"%FLYY/M/D")
570 pDateStyle.reset(new XFDateStyle);
571 pDateStyle->AddYear(false);
572 pDateStyle->AddText(u"-"_ustr);
573 pDateStyle->AddMonth(false);
574 pDateStyle->AddText(u"-"_ustr);
575 pDateStyle->AddMonthDay(false);
577 else if (sFormula == u"%FLYYYY Month D")
579 pDateStyle.reset(new XFDateStyle);
580 pDateStyle->AddYear();
581 pDateStyle->AddText(u" "_ustr);
582 pDateStyle->AddMonth(true, true);
583 pDateStyle->AddText(u" "_ustr);
584 pDateStyle->AddMonthDay(false);
586 else if (sFormula == u"%FLWeekday, YYYY Month D")
588 pDateStyle.reset(new XFDateStyle);
589 pDateStyle->AddWeekDay();
590 pDateStyle->AddText(u","_ustr);
591 pDateStyle->AddYear();
592 pDateStyle->AddText(u" "_ustr);
593 pDateStyle->AddMonth(true, true);
594 pDateStyle->AddText(u" "_ustr);
595 pDateStyle->AddMonthDay(false);
597 else if (sFormula == u"%FLYYYY Mn D")
599 pDateStyle.reset(new XFDateStyle);
600 pDateStyle->AddYear();
601 pDateStyle->AddText(u" "_ustr);
602 pDateStyle->AddMonth(false, true);
603 pDateStyle->AddText(u" "_ustr);
604 pDateStyle->AddMonthDay(false);
606 else if (sFormula == u"%FLWday, YYYY Mn D")
608 pDateStyle.reset(new XFDateStyle);
609 pDateStyle->AddWeekDay(false);
610 pDateStyle->AddText(u","_ustr);
611 pDateStyle->AddYear();
612 pDateStyle->AddText(u" "_ustr);
613 pDateStyle->AddMonth(true, true);
614 pDateStyle->AddText(u" "_ustr);
615 pDateStyle->AddMonthDay(false);
617 //next 2 are the same with english version
618 else if (sFormula == u"%FLYY Mn D")
620 pDateStyle.reset(new XFDateStyle);
621 pDateStyle->AddYear(false);
622 pDateStyle->AddText(u" "_ustr);
623 pDateStyle->AddMonth(false, true);
624 pDateStyle->AddText(u" "_ustr);
625 pDateStyle->AddMonthDay(false);
627 else if (sFormula == u"%FLYY/M")
629 pDateStyle.reset(new XFDateStyle);
630 pDateStyle->AddMonth(false);
631 pDateStyle->AddText(u"-"_ustr);
632 pDateStyle->AddMonth(false);
634 else if (sFormula == u"%FLYY Mn")
636 pDateStyle.reset(new XFDateStyle);
637 pDateStyle->AddMonth(false);
638 pDateStyle->AddText(u" "_ustr);
639 pDateStyle->AddMonth(false, true);
641 else if (sFormula == u"%FLeeeeoa" || sFormula == u"%FLffffooaa" || sFormula == u"%FLEEEEOA")
643 pDateStyle.reset(new XFDateStyle);
644 OUString sText;
645 pDateStyle->AddYear();
646 sText = OUString(u'\x5e74');
647 pDateStyle->AddText(sText);
648 pDateStyle->AddMonth(false);
649 sText = OUString(u'\x6708');
650 pDateStyle->AddText(sText);
651 pDateStyle->AddMonthDay(false);
652 sText = OUString(u'\x65e5');
653 pDateStyle->AddText(sText);
655 else if (sFormula == u"%FLoa" || sFormula == u"%FLooaa" || sFormula == u"%FLOA")
657 pDateStyle.reset(new XFDateStyle);
658 OUString sText;
659 pDateStyle->AddMonth(false);
660 sText = OUString(u'\x6708');
661 pDateStyle->AddText(sText);
662 pDateStyle->AddMonthDay(false);
663 sText = OUString(u'\x65e5');
664 pDateStyle->AddText(sText);
666 else if (sFormula == u"%FLYYYY/M/D" || sFormula == u"%FLGGGG/od/ad")
668 pDateStyle.reset(new XFDateStyle);
669 pDateStyle->AddYear();
670 pDateStyle->AddText(u"-"_ustr);
671 pDateStyle->AddMonth(false);
672 pDateStyle->AddText(u"-"_ustr);
673 pDateStyle->AddMonthDay(false);
675 else if (sFormula == u"%FLYY.M.D")
677 pDateStyle.reset(new XFDateStyle);
678 pDateStyle->AddYear(false);
679 pDateStyle->AddText(u"."_ustr);
680 pDateStyle->AddMonth(false);
681 pDateStyle->AddText(u"."_ustr);
682 pDateStyle->AddMonthDay(false);
684 //chinese version end
685 //other version begin
686 else if (sFormula == u"%FLWeekday, Month DD, YYYY")
688 pDateStyle.reset(new XFDateStyle);
689 pDateStyle->AddWeekDay();
690 pDateStyle->AddText(u", "_ustr);
691 pDateStyle->AddMonth(true, true);
692 pDateStyle->AddText(u" "_ustr);
693 pDateStyle->AddMonthDay();
694 pDateStyle->AddText(u", "_ustr);
695 pDateStyle->AddYear();
697 else if (sFormula == u"%FLYYYY/MM/DD")
699 pDateStyle.reset(new XFDateStyle);
700 pDateStyle->AddWeekDay();
701 pDateStyle->AddText(u", "_ustr);
702 pDateStyle->AddMonth(true, true);
703 pDateStyle->AddText(u" "_ustr);
704 pDateStyle->AddMonthDay();
705 pDateStyle->AddText(u", "_ustr);
706 pDateStyle->AddYear();
708 else if (sFormula == u"%FLD/M/YY")
710 pDateStyle.reset(new XFDateStyle);
711 pDateStyle->AddMonthDay(false);
712 pDateStyle->AddText(u"/"_ustr);
713 pDateStyle->AddMonth(false);
714 pDateStyle->AddText(u"/"_ustr);
715 pDateStyle->AddYear(false);
717 else if (sFormula == u"%FLD Month YYYY")
719 pDateStyle.reset(new XFDateStyle);
720 pDateStyle->AddMonthDay(false);
721 pDateStyle->AddText(u" "_ustr);
722 pDateStyle->AddMonth(true, true);
723 pDateStyle->AddText(u" "_ustr);
724 pDateStyle->AddYear();
726 else if (sFormula == u"%FLDD Month YYYY")
728 pDateStyle.reset(new XFDateStyle);
729 pDateStyle->AddMonthDay();
730 pDateStyle->AddText(u" "_ustr);
731 pDateStyle->AddMonth(true, true);
732 pDateStyle->AddText(u" "_ustr);
733 pDateStyle->AddYear();
735 else if (sFormula == u"%FLWeekday, D Month YYYY")
737 pDateStyle.reset(new XFDateStyle);
738 pDateStyle->AddWeekDay();
739 pDateStyle->AddText(u", "_ustr);
740 pDateStyle->AddMonthDay(false);
741 pDateStyle->AddText(u" "_ustr);
742 pDateStyle->AddMonth(true, true);
743 pDateStyle->AddText(u" "_ustr);
744 pDateStyle->AddYear();
746 else if (sFormula == u"%FLWeekday, DD Month YYYY")
748 pDateStyle.reset(new XFDateStyle);
749 pDateStyle->AddWeekDay();
750 pDateStyle->AddText(u", "_ustr);
751 pDateStyle->AddMonthDay();
752 pDateStyle->AddText(u" "_ustr);
753 pDateStyle->AddMonth(true, true);
754 pDateStyle->AddText(u" "_ustr);
755 pDateStyle->AddYear();
757 else if (sFormula == u"%FLD Mn YYYY")
759 pDateStyle.reset(new XFDateStyle);
760 pDateStyle->AddMonthDay(false);
761 pDateStyle->AddText(u" "_ustr);
762 pDateStyle->AddMonth(false, true);
763 pDateStyle->AddText(u" "_ustr);
764 pDateStyle->AddYear();
766 else if (sFormula == u"%FLWday, D Mn YYYY")
768 pDateStyle.reset(new XFDateStyle);
769 pDateStyle->AddWeekDay(false);
770 pDateStyle->AddText(u", "_ustr);
771 pDateStyle->AddMonthDay(false);
772 pDateStyle->AddText(u" "_ustr);
773 pDateStyle->AddMonth(false, true);
774 pDateStyle->AddText(u" "_ustr);
775 pDateStyle->AddYear();
777 else if (sFormula == u"%FLWday, DD Mn YYYY")
779 pDateStyle.reset(new XFDateStyle);
780 pDateStyle->AddWeekDay(false);
781 pDateStyle->AddText(u", "_ustr);
782 pDateStyle->AddMonthDay();
783 pDateStyle->AddText(u" "_ustr);
784 pDateStyle->AddMonth(false, true);
785 pDateStyle->AddText(u" "_ustr);
786 pDateStyle->AddYear();
788 else if (sFormula == u"%FLD Mn")
790 pDateStyle.reset(new XFDateStyle);
791 pDateStyle->AddMonthDay(false);
792 pDateStyle->AddText(u" "_ustr);
793 pDateStyle->AddMonth(false, true);
795 else if (sFormula == u"%FLDD Mn")
797 pDateStyle.reset(new XFDateStyle);
798 pDateStyle->AddMonthDay();
799 pDateStyle->AddText(u" "_ustr);
800 pDateStyle->AddMonth(false, true);
802 else if (sFormula == u"%FLWeekday, D Mn")
804 pDateStyle.reset(new XFDateStyle);
805 pDateStyle->AddWeekDay();
806 pDateStyle->AddText(u", "_ustr);
807 pDateStyle->AddMonthDay(false);
808 pDateStyle->AddText(u" "_ustr);
809 pDateStyle->AddMonth(false, true);
811 else if (sFormula == u"%FLWeekday, DD Mn")
813 pDateStyle.reset(new XFDateStyle);
814 pDateStyle->AddWeekDay();
815 pDateStyle->AddText(u", "_ustr);
816 pDateStyle->AddMonthDay();
817 pDateStyle->AddText(u" "_ustr);
818 pDateStyle->AddMonth(false, true);
820 else if (sFormula == u"%FLD Mn YY")
822 pDateStyle.reset(new XFDateStyle);
823 pDateStyle->AddMonthDay(false);
824 pDateStyle->AddText(u" "_ustr);
825 pDateStyle->AddMonth(false, true);
826 pDateStyle->AddText(u" "_ustr);
827 pDateStyle->AddYear(false);
829 else if (sFormula == u"%FLDD Mn YY")
831 pDateStyle.reset(new XFDateStyle);
832 pDateStyle->AddMonthDay();
833 pDateStyle->AddText(u" "_ustr);
834 pDateStyle->AddMonth(false, true);
835 pDateStyle->AddText(u" "_ustr);
836 pDateStyle->AddYear(false);
838 else if (sFormula == u"%FLD/M")
840 pDateStyle.reset(new XFDateStyle);
841 pDateStyle->AddMonthDay(false);
842 pDateStyle->AddText(u"/"_ustr);
843 pDateStyle->AddMonth(false);
845 else if (sFormula == u"%FLDD/MM")
847 pDateStyle.reset(new XFDateStyle);
848 pDateStyle->AddMonthDay();
849 pDateStyle->AddText(u"/"_ustr);
850 pDateStyle->AddMonth();
852 else if (sFormula == u"%FLDD/MM/YY")
854 pDateStyle.reset(new XFDateStyle);
855 pDateStyle->AddMonthDay();
856 pDateStyle->AddText(u"/"_ustr);
857 pDateStyle->AddMonth();
858 pDateStyle->AddText(u"/"_ustr);
859 pDateStyle->AddYear(false);
861 else if (sFormula == u"%FLMM/YY")
863 pDateStyle.reset(new XFDateStyle);
864 pDateStyle->AddMonth();
865 pDateStyle->AddText(u"/"_ustr);
866 pDateStyle->AddYear(false);
868 //other version end
869 //TIME
870 else if (sFormula == u"%FLSystemTime")
872 pTimeStyle = LwpTools::GetSystemTimeStyle();
874 else if (sFormula == u"%FLISOTime1" || sFormula == u"%FLH:mm:SS")
876 pTimeStyle.reset(new XFTimeStyle);
877 pTimeStyle->AddHour();
878 pTimeStyle->AddText(u":"_ustr);
879 pTimeStyle->AddMinute();
880 pTimeStyle->AddText(u":"_ustr);
881 pTimeStyle->AddSecond();
883 else if (sFormula == u"%FLH:mm ampm")
885 pTimeStyle.reset(new XFTimeStyle);
886 pTimeStyle->AddHour(false);
887 pTimeStyle->AddText(u":"_ustr);
888 pTimeStyle->AddMinute();
889 pTimeStyle->AddText(u" "_ustr);
890 pTimeStyle->SetAmPm(true);
892 else if (sFormula == u"%FLH:mm")
894 pTimeStyle.reset(new XFTimeStyle);
895 pTimeStyle->AddHour(false);
896 pTimeStyle->AddText(u":"_ustr);
897 pTimeStyle->AddMinute();
899 else if (sFormula == u"%FLH:mm:SS ampm")
901 pTimeStyle.reset(new XFTimeStyle);
902 pTimeStyle->AddHour(false);
903 pTimeStyle->AddText(u":"_ustr);
904 pTimeStyle->AddMinute();
905 pTimeStyle->AddText(u":"_ustr);
906 pTimeStyle->AddSecond();
907 pTimeStyle->AddText(u" "_ustr);
908 pTimeStyle->SetAmPm(true);
910 else if (sFormula == u"%FLH:mm:SS")
912 pTimeStyle.reset(new XFTimeStyle);
913 pTimeStyle->AddHour(false);
914 pTimeStyle->AddText(u":"_ustr);
915 pTimeStyle->AddMinute();
916 pTimeStyle->AddText(u":"_ustr);
917 pTimeStyle->AddSecond();
919 else if (sFormula == u"%FLH ampm")
921 pTimeStyle.reset(new XFTimeStyle);
922 pTimeStyle->AddHour(false);
923 pTimeStyle->AddText(u" "_ustr);
924 pTimeStyle->SetAmPm(true);
926 else if (sFormula == u"%FLH")
928 pTimeStyle.reset(new XFTimeStyle);
929 pTimeStyle->AddHour(false);
931 else if (sFormula == u"%FLmm")
933 pTimeStyle.reset(new XFTimeStyle);
934 pTimeStyle->AddMinute();
936 else if (sFormula == u"%FLSS")
938 pTimeStyle.reset(new XFTimeStyle);
939 pTimeStyle->AddSecond();
941 else if (sFormula == u"%FLampm")
943 pTimeStyle.reset(new XFTimeStyle);
944 pTimeStyle->SetAmPm(true);
946 //chinese version begin
947 else if (sFormula == u"%FLjF" || sFormula == u"%FLJFF" || sFormula == u"%FLjjF"
948 || sFormula == u"%FLJJFF ")
950 pTimeStyle.reset(new XFTimeStyle);
951 pTimeStyle->AddHour(false);
952 OUString sText;
953 sText = OUString(u'\x70b9');
954 pTimeStyle->AddText(sText);
955 pTimeStyle->AddMinute(false);
956 sText = OUString(u'\x5206');
957 pTimeStyle->AddText(sText);
959 else if (sFormula == u"%FLjjjF" || sFormula == u"%FLJJJFF")
961 pTimeStyle.reset(new XFTimeStyle);
962 pTimeStyle->SetAmPm(true);
963 pTimeStyle->AddHour(false);
964 OUString sText;
965 sText = OUString(u'\x70b9');
966 pTimeStyle->AddText(sText);
967 pTimeStyle->AddMinute(false);
968 sText = OUString(u'\x5206');
969 pTimeStyle->AddText(sText);
971 //chinese version end
972 //other version begin
973 else if (sFormula == u"%FLHH:mm ampm")
975 pTimeStyle.reset(new XFTimeStyle);
976 pTimeStyle->AddHour();
977 pTimeStyle->AddText(u":"_ustr);
978 pTimeStyle->AddMinute();
979 pTimeStyle->AddText(u" "_ustr);
980 pTimeStyle->SetAmPm(true);
982 else if (sFormula == u"%FLHH ampm")
984 pTimeStyle.reset(new XFTimeStyle);
985 pTimeStyle->AddHour();
986 pTimeStyle->AddText(u" "_ustr);
987 pTimeStyle->SetAmPm(true);
989 else if (sFormula == u"%FLHH:mm:SS ampm")
991 pTimeStyle.reset(new XFTimeStyle);
992 pTimeStyle->AddHour();
993 pTimeStyle->AddText(u":"_ustr);
994 pTimeStyle->AddMinute();
995 pTimeStyle->AddText(u":"_ustr);
996 pTimeStyle->AddSecond();
997 pTimeStyle->AddText(u" "_ustr);
998 pTimeStyle->SetAmPm(true);
1000 else if (sFormula == u"%FLHH:mm")
1002 pTimeStyle.reset(new XFTimeStyle);
1003 pTimeStyle->AddHour();
1004 pTimeStyle->AddText(u":"_ustr);
1005 pTimeStyle->AddMinute();
1007 else if (sFormula == u"%FLHH:mm:SS")
1009 pTimeStyle.reset(new XFTimeStyle);
1010 pTimeStyle->AddHour();
1011 pTimeStyle->AddText(u":"_ustr);
1012 pTimeStyle->AddMinute();
1013 pTimeStyle->AddText(u":"_ustr);
1014 pTimeStyle->AddSecond();
1016 //other version end
1018 else if (sFormula[1] == 'D')
1020 if (sFormula == u"%Da")
1022 pDateStyle = LwpTools::GetSystemDateStyle(false);
1024 else if (sFormula == u"%DB" || sFormula == u"%Db")
1026 pDateStyle.reset(new XFDateStyle);
1027 pDateStyle->AddMonth(true, true);
1028 pDateStyle->AddText(u" "_ustr);
1029 pDateStyle->AddMonthDay(false);
1030 pDateStyle->AddText(u", "_ustr);
1031 pDateStyle->AddYear();
1033 else if (sFormula == u"%Dc" || sFormula == u"%DC")
1035 pDateStyle.reset(new XFDateStyle);
1036 pDateStyle->AddMonthDay(false);
1037 pDateStyle->AddText(u" "_ustr);
1038 pDateStyle->AddMonth(true, true);
1039 pDateStyle->AddText(u" "_ustr);
1040 pDateStyle->AddYear();
1042 else if (sFormula == u"%Dd" || sFormula == u"%DD")
1044 pDateStyle.reset(new XFDateStyle);
1045 pDateStyle->AddWeekDay();
1046 pDateStyle->AddText(u", "_ustr);
1047 pDateStyle->AddMonth(true, true);
1048 pDateStyle->AddText(u" "_ustr);
1049 pDateStyle->AddMonthDay(false);
1050 pDateStyle->AddText(u", "_ustr);
1051 pDateStyle->AddYear();
1053 else if (sFormula == u"%DE" || sFormula == u"%De")
1055 pDateStyle.reset(new XFDateStyle);
1056 pDateStyle->AddMonth(true, true);
1057 pDateStyle->AddText(u" "_ustr);
1058 pDateStyle->AddMonthDay(false);
1060 else if (sFormula == u"%Df" || sFormula == u"%DF")
1062 pDateStyle.reset(new XFDateStyle);
1063 pDateStyle->AddWeekDay();
1064 pDateStyle->AddText(u" "_ustr);
1065 pDateStyle->AddMonth(true, true);
1066 pDateStyle->AddText(u" "_ustr);
1067 pDateStyle->AddMonthDay(false);
1069 else if (sFormula == u"%Dg")
1071 pDateStyle.reset(new XFDateStyle);
1072 pDateStyle->AddMonth(false);
1073 pDateStyle->AddText(u"/"_ustr);
1074 pDateStyle->AddMonthDay(false);
1076 else if (sFormula == u"%Dh")
1078 pDateStyle.reset(new XFDateStyle);
1079 pDateStyle->AddMonth(false);
1080 pDateStyle->AddText(u"/"_ustr);
1081 pDateStyle->AddMonthDay(false);
1082 pDateStyle->AddText(u"/"_ustr);
1083 pDateStyle->AddYear();
1085 else if (sFormula == u"%Di" || sFormula == u"%DI")
1087 pDateStyle.reset(new XFDateStyle);
1088 pDateStyle->AddMonthDay(false);
1089 pDateStyle->AddText(u"."_ustr);
1090 pDateStyle->AddMonth(true, true);
1092 else if (sFormula == u"%Dj" || sFormula == u"%DJ")
1094 pDateStyle.reset(new XFDateStyle);
1095 pDateStyle->AddMonthDay(false);
1096 pDateStyle->AddText(u"."_ustr);
1097 pDateStyle->AddMonth(true, true);
1098 pDateStyle->AddText(u" "_ustr);
1099 pDateStyle->AddYear();
1101 else if (sFormula == u"%Dk" || sFormula == u"%DK")
1103 pDateStyle.reset(new XFDateStyle);
1104 pDateStyle->AddYear();
1105 pDateStyle->AddText(u" "_ustr);
1106 pDateStyle->AddMonth(true, true);
1107 pDateStyle->AddText(u" "_ustr);
1108 pDateStyle->AddMonthDay(false);
1110 else if (sFormula == u"%DL" || sFormula == u"%Dl")
1112 pDateStyle.reset(new XFDateStyle);
1113 pDateStyle->AddMonth(true, true);
1114 pDateStyle->AddText(u","_ustr);
1115 pDateStyle->AddYear();
1117 else if (sFormula == u"%Dm")
1119 pDateStyle.reset(new XFDateStyle);
1120 pDateStyle->AddMonthDay();
1121 pDateStyle->AddText(u"/"_ustr);
1122 pDateStyle->AddMonth();
1123 pDateStyle->AddText(u"/"_ustr);
1124 pDateStyle->AddYear();
1127 else if (sFormula[1] == 'T')
1129 if (sFormula == u"%T1")
1131 pTimeStyle.reset(new XFTimeStyle);
1132 pTimeStyle->AddHour();
1133 pTimeStyle->AddText(u":"_ustr);
1134 pTimeStyle->AddMinute();
1136 else if (sFormula == u"%T2" || sFormula == u"%T6" || sFormula == u"%T4"
1137 || sFormula == u"%T8")
1139 pTimeStyle.reset(new XFTimeStyle);
1140 pTimeStyle->AddHour(false);
1141 pTimeStyle->AddText(u":"_ustr);
1142 pTimeStyle->AddMinute();
1143 pTimeStyle->AddText(u":"_ustr);
1144 pTimeStyle->SetAmPm(true);
1146 else if (sFormula == u"%T3" || sFormula == u"%T7" || sFormula == u"%T5"
1147 || sFormula == u"%T9")
1149 pTimeStyle.reset(new XFTimeStyle);
1150 pTimeStyle->AddHour();
1151 pTimeStyle->AddText(u":"_ustr);
1152 pTimeStyle->AddMinute();
1153 pTimeStyle->AddText(u":"_ustr);
1154 pTimeStyle->SetAmPm(true);
1157 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
1158 if (pDateStyle)
1159 m_TimeStyle = pXFStyleManager->AddStyle(std::move(pDateStyle)).m_pStyle->GetStyleName();
1160 if (pTimeStyle)
1161 m_TimeStyle = pXFStyleManager->AddStyle(std::move(pTimeStyle)).m_pStyle->GetStyleName();
1164 void LwpFribField::CheckFieldType(LwpFieldMark* pFieldMark)
1166 sal_uInt8 nType;
1167 OUString sFormula;
1168 if (pFieldMark->IsDateTimeField(nType, sFormula))
1170 m_nDateTimeType = nType;
1171 m_sFormula = sFormula;
1172 m_nSubType = SUBFIELD_DATETIME;
1174 else if (pFieldMark->IsCrossRefField(nType, sFormula))
1176 m_nCrossRefType = nType;
1177 m_sFormula = sFormula;
1178 m_nSubType = SUBFIELD_CROSSREF;
1180 else if (pFieldMark->IsDocPowerField(nType, sFormula))
1182 m_nDocPowerType = nType;
1183 m_nSubType = SUBFIELD_DOCPOWER;
1185 else
1187 m_nSubType = SUBFIELD_INVALID;
1191 void LwpFribField::ConvertDocFieldStart(XFContentContainer* pXFPara, LwpFieldMark* pFieldMark)
1193 XFContent* pContent = nullptr;
1194 switch (m_nDocPowerType)
1196 case LwpFieldMark::DOC_DESCRIPTION:
1198 pContent = new XFDescriptionStart;
1199 break;
1201 case LwpFieldMark::DOC_NUMPAGES:
1203 pContent = new XFPageCountStart;
1204 break;
1206 case LwpFieldMark::DOC_NUMWORDS:
1208 pContent = new XFWordCountStart;
1209 break;
1211 case LwpFieldMark::DOC_NUMCHARS:
1213 pContent = new XFCharCountStart;
1214 break;
1217 if (!pContent)
1218 return;
1220 if (m_ModFlag) //(m_pModifiers)
1222 XFTextSpanStart* pSpan = new XFTextSpanStart;
1223 pSpan->SetStyleName(GetStyleName());
1224 pSpan->Add(pContent);
1225 pXFPara->Add(pSpan);
1226 pFieldMark->SetStyleFlag(true);
1228 else
1229 pXFPara->Add(pContent);
1232 void LwpFribField::ConvertDocFieldEnd(XFContentContainer* pXFPara, const LwpFieldMark* pFieldMark)
1234 XFContent* pContent = nullptr;
1235 switch (m_nDocPowerType)
1237 case LwpFieldMark::DOC_DESCRIPTION:
1239 pContent = new XFDescriptionEnd;
1240 break;
1242 case LwpFieldMark::DOC_NUMPAGES:
1244 pContent = new XFPageCountEnd;
1245 break;
1247 case LwpFieldMark::DOC_NUMWORDS:
1249 pContent = new XFWordCountEnd;
1250 break;
1252 case LwpFieldMark::DOC_NUMCHARS:
1254 pContent = new XFCharCountEnd;
1255 break;
1258 if (pContent)
1260 if (pFieldMark->GetStyleFlag())
1262 XFTextSpanEnd* pSpan = new XFTextSpanEnd;
1263 pSpan->Add(pContent);
1264 pXFPara->Add(pSpan);
1266 else
1267 pXFPara->Add(pContent);
1271 void LwpFribField::ConvertDateTimeStart(XFContentContainer* pXFPara, LwpFieldMark* pFieldMark)
1273 XFContent* pContent = nullptr;
1274 switch (m_nDateTimeType)
1276 case LwpFieldMark::DATETIME_NOW:
1278 pContent = new XFDateStart;
1279 pContent->SetStyleName(m_TimeStyle);
1280 break;
1282 case LwpFieldMark::DATETIME_CREATE:
1284 pContent = new XFCreateTimeStart;
1285 pContent->SetStyleName(m_TimeStyle);
1286 break;
1288 case LwpFieldMark::DATETIME_LASTEDIT:
1290 pContent = new XFLastEditTimeStart;
1291 pContent->SetStyleName(m_TimeStyle);
1292 break;
1294 case LwpFieldMark::DATETIME_TOTALTIME:
1296 pContent = new XFTotalEditTimeStart;
1297 pContent->SetStyleName(m_TimeStyle);
1298 break;
1300 default:
1301 break;
1303 if (!pContent)
1304 return;
1306 if (m_ModFlag)
1308 XFTextSpanStart* pSpan = new XFTextSpanStart;
1309 pSpan->SetStyleName(GetStyleName());
1310 pSpan->Add(pContent);
1311 pXFPara->Add(pSpan);
1312 pFieldMark->SetStyleFlag(true);
1314 else
1315 pXFPara->Add(pContent);
1318 void LwpFribField::ConvertDateTimeEnd(XFContentContainer* pXFPara, const LwpFieldMark* pFieldMark)
1320 XFContent* pContent = nullptr;
1321 switch (m_nDateTimeType)
1323 case LwpFieldMark::DATETIME_NOW:
1325 pContent = new XFDateEnd;
1326 break;
1328 case LwpFieldMark::DATETIME_CREATE:
1330 pContent = new XFCreateTimeEnd;
1331 break;
1333 case LwpFieldMark::DATETIME_LASTEDIT:
1335 pContent = new XFLastEditTimeEnd;
1336 break;
1338 case LwpFieldMark::DATETIME_TOTALTIME:
1340 pContent = new XFTotalEditTimeEnd;
1341 break;
1344 if (pContent)
1346 if (pFieldMark->GetStyleFlag())
1348 XFTextSpanEnd* pSpan = new XFTextSpanEnd;
1349 pSpan->Add(pContent);
1350 pXFPara->Add(pSpan);
1352 else
1353 pXFPara->Add(pContent);
1357 void LwpFribField::ConvertCrossRefStart(XFContentContainer* pXFPara, LwpFieldMark* pFieldMark)
1359 XFCrossRefStart* pRef = new XFCrossRefStart;
1360 pRef->SetRefType(m_nCrossRefType);
1361 pRef->SetMarkName(m_sFormula);
1362 // pFieldMark->SetStart(sal_True);//for some unusual cases
1363 if (m_ModFlag)
1365 XFTextSpanStart* pSpan = new XFTextSpanStart;
1366 pSpan->SetStyleName(GetStyleName());
1367 pSpan->Add(pRef);
1368 pXFPara->Add(pSpan);
1369 pFieldMark->SetStyleFlag(true);
1371 else
1372 pXFPara->Add(pRef);
1375 void LwpFribField::ConvertCrossRefEnd(XFContentContainer* pXFPara, const LwpFieldMark* pFieldMark)
1377 XFCrossRefEnd* pRef = new XFCrossRefEnd;
1378 if (pFieldMark->GetStyleFlag())
1380 XFTextSpanEnd* pSpan = new XFTextSpanEnd;
1381 pSpan->Add(pRef);
1382 pXFPara->Add(pSpan);
1384 else
1385 pXFPara->Add(pRef);
1388 LwpFribRubyMarker::LwpFribRubyMarker(LwpPara* pPara)
1389 : LwpFrib(pPara)
1390 , m_nType(0)
1394 void LwpFribRubyMarker::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
1396 m_objMarker.ReadIndexed(pObjStrm);
1397 m_nType = pObjStrm->QuickReaduInt8();
1400 void LwpFribRubyMarker::XFConvert(XFContentContainer* pXFPara)
1402 sal_uInt8 type = GetType();
1403 LwpRubyMarker* pMarker = dynamic_cast<LwpRubyMarker*>(m_objMarker.obj(VO_RUBYMARKER).get());
1405 if (type == MARKER_START)
1407 XFRubyStart* pRubyStart = new XFRubyStart;
1408 if (pMarker)
1410 pRubyStart->SetStyleName(pMarker->GetRubyStyleName());
1412 pXFPara->Add(pRubyStart);
1414 else if (type == MARKER_END)
1416 XFRubyEnd* pRubyEnd = new XFRubyEnd;
1417 if (pMarker)
1419 pRubyEnd->SetText(pMarker->GetRubyText());
1420 pRubyEnd->SetStyleName(pMarker->GetTextStyleName());
1422 pXFPara->Add(pRubyEnd);
1426 void LwpFribRubyMarker::RegisterStyle(LwpFoundry* /*pFoundry*/) {}
1428 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */