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