LibreOffice Module sw (master) 1
writerwordglue.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <msfilter.hxx>
21#include "writerwordglue.hxx"
22#include <doc.hxx>
23#include "writerhelper.hxx"
25
26#include <algorithm>
27
28#include <o3tl/string_view.hxx>
29#include <rtl/tencinfo.h>
30#include <sal/log.hxx>
31#include <svl/numformat.hxx>
32
33#include <unicode/ubidi.h>
34#include <tools/tenccvt.hxx>
35#include <com/sun/star/i18n/ScriptType.hpp>
36#include <com/sun/star/i18n/XBreakIterator.hpp>
37
38#include <editeng/lrspitem.hxx>
39#include <editeng/ulspitem.hxx>
40#include <editeng/boxitem.hxx>
41#include <editeng/fontitem.hxx>
43#include <frmfmt.hxx>
44#include <fmtclds.hxx>
45#include <hfspacingitem.hxx>
46#include <fmtfsize.hxx>
47#include <poolfmt.hxx>
48#include <swrect.hxx>
49#include <fmthdft.hxx>
50#include <frmatr.hxx>
51#include <ndtxt.hxx>
52#include <breakit.hxx>
53
54using namespace css;
55
56namespace myImplHelpers
57{
58 static SwTwips CalcHdFtDist(const SwFrameFormat& rFormat, sal_uInt16 nSpacing)
59 {
60 /*
61 The normal case for reexporting word docs is to have dynamic spacing,
62 as this is word's only setting, and the reason for the existence of the
63 dynamic spacing features. If we have dynamic spacing active then we can
64 add its spacing to the value height of the h/f and get the wanted total
65 size for word.
66
67 Otherwise we have to get the real layout rendered
68 height, which is totally nonoptimum, but the best we can do.
69 */
70 tools::Long nDist=0;
71 const SwFormatFrameSize& rSz = rFormat.GetFrameSize();
72
73 const SwHeaderAndFooterEatSpacingItem &rSpacingCtrl =
75 if (rSpacingCtrl.GetValue())
76 nDist += rSz.GetHeight();
77 else
78 {
79 SwRect aRect(rFormat.FindLayoutRect());
80 if (aRect.Height())
81 nDist += aRect.Height();
82 else
83 {
84 const SwFormatFrameSize& rSize = rFormat.GetFrameSize();
86 nDist += rSize.GetHeight();
87 else
88 {
89 nDist += 274; // default for 12pt text
90 nDist += nSpacing;
91 }
92 }
93 }
94 return nDist;
95 }
96
97 static SwTwips CalcHdDist(const SwFrameFormat& rFormat)
98 {
99 return CalcHdFtDist(rFormat, rFormat.GetULSpace().GetUpper());
100 }
101
102 static SwTwips CalcFtDist(const SwFrameFormat& rFormat)
103 {
104 return CalcHdFtDist(rFormat, rFormat.GetULSpace().GetLower());
105 }
106
107 /*
108 SwTextFormatColl and SwCharFormat are quite distinct types and how they are
109 gotten is also distinct, but the algorithm to match word's equivalents into
110 them is the same, so we put the different stuff into two separate helper
111 implementations and a core template that uses the helpers that uses the
112 same algorithm to do the work. We'll make the helpers specializations of a
113 non existing template so I can let the compiler figure out the right one
114 to use from a simple argument to the algorithm class
115 */
116 template <class C> class MapperImpl;
117 template<> class MapperImpl<SwTextFormatColl>
118 {
119 private:
121 public:
122 MapperImpl(SwDoc &rDoc) : mrDoc(rDoc) {}
123 SwTextFormatColl* GetBuiltInStyle(ww::sti eSti);
124 SwTextFormatColl* GetStyle(const OUString &rName);
125 SwTextFormatColl* MakeStyle(const OUString &rName);
126 };
127
129 {
131 static const RES_POOL_COLLFMT_TYPE aArr[]=
132 {
139 RES_POOLCOLL_TOX_IDX3, RES_NONE, RES_NONE, RES_NONE, RES_NONE,
140 RES_NONE, RES_NONE, RES_POOLCOLL_TOX_CNTNT1,
146 RES_POOLCOLL_FOOTER, RES_POOLCOLL_TOX_IDXH, RES_NONE, RES_NONE,
148 RES_NONE, RES_NONE, RES_NONE, RES_NONE, RES_POOLCOLL_ENDNOTE,
149 RES_NONE, RES_NONE, RES_NONE, RES_POOLCOLL_LISTS_BEGIN,
150 RES_NONE, RES_NONE, RES_NONE, RES_NONE, RES_NONE, RES_NONE,
151 RES_NONE, RES_NONE, RES_NONE, RES_NONE, RES_NONE, RES_NONE,
152 RES_NONE, RES_NONE, RES_POOLCOLL_HEADLINE_BASE, RES_NONE,
154 RES_POOLCOLL_TEXT_MOVE, RES_NONE, RES_NONE, RES_NONE, RES_NONE,
155 RES_NONE, RES_NONE, RES_POOLCOLL_DOC_SUBTITLE
156 };
157
158 OSL_ENSURE(SAL_N_ELEMENTS(aArr) == 75, "Style Array has false size");
159
160 SwTextFormatColl* pRet = nullptr;
161 //If this is a built-in word style that has a built-in writer
162 //equivalent, then map it to one of our built in styles regardless
163 //of its name
164 if (sal::static_int_cast< size_t >(eSti) < SAL_N_ELEMENTS(aArr) && aArr[eSti] != RES_NONE)
165 pRet = mrDoc.getIDocumentStylePoolAccess().GetTextCollFromPool( static_cast< sal_uInt16 >(aArr[eSti]), false);
166 return pRet;
167 }
168
170 {
171 return sw::util::GetParaStyle(mrDoc, rName);
172 }
173
175 {
176 return mrDoc.MakeTextFormatColl(rName,
177 mrDoc.GetDfltTextFormatColl());
178 }
179
180 template<> class MapperImpl<SwCharFormat>
181 {
182 private:
184 public:
185 MapperImpl(SwDoc &rDoc) : mrDoc(rDoc) {}
186 SwCharFormat* GetBuiltInStyle(ww::sti eSti);
187 SwCharFormat* GetStyle(const OUString &rName);
188 SwCharFormat* MakeStyle(const OUString &rName);
189 };
190
192 {
194 switch (eSti)
195 {
197 eLookup = RES_POOLCHR_FOOTNOTE;
198 break;
199 case ww::stiLnn:
200 eLookup = RES_POOLCHR_LINENUM;
201 break;
202 case ww::stiPgn:
203 eLookup = RES_POOLCHR_PAGENO;
204 break;
205 case ww::stiEdnRef:
206 eLookup = RES_POOLCHR_ENDNOTE;
207 break;
208 case ww::stiHyperlink:
209 eLookup = RES_POOLCHR_INET_NORMAL;
210 break;
212 eLookup = RES_POOLCHR_INET_VISIT;
213 break;
214 case ww::stiStrong:
215 eLookup = RES_POOLCHR_HTML_STRONG;
216 break;
217 case ww::stiEmphasis:
219 break;
220 default:
221 eLookup = RES_POOLCHR_NORMAL_END;
222 break;
223 }
224 SwCharFormat *pRet = nullptr;
225 if (eLookup != RES_POOLCHR_NORMAL_END)
226 pRet = mrDoc.getIDocumentStylePoolAccess().GetCharFormatFromPool( static_cast< sal_uInt16 >(eLookup) );
227 return pRet;
228 }
229
231 {
232 return sw::util::GetCharStyle(mrDoc, rName);
233 }
234
236 {
237 return mrDoc.MakeCharFormat(rName, mrDoc.GetDfltCharFormat());
238 }
239
240 template<class C> class StyleMapperImpl
241 {
242 private:
245 C* MakeNonCollidingStyle(const OUString& rName,
246 std::map<OUString, sal_Int32>& rCollisions);
247 public:
248 typedef std::pair<C*, bool> StyleResult;
249 explicit StyleMapperImpl(SwDoc &rDoc) : maHelper(rDoc) {}
250 StyleResult GetStyle(const OUString& rName, ww::sti eSti,
251 std::map<OUString, sal_Int32>& rCollisions);
252 };
253
254 template<class C>
256 StyleMapperImpl<C>::GetStyle(const OUString& rName, ww::sti eSti,
257 std::map<OUString, sal_Int32>& rCollisions)
258 {
259 C *pRet = maHelper.GetBuiltInStyle(eSti);
260
261 //If we've used it once, don't reuse it
262 if (pRet && (maUsedStyles.end() != maUsedStyles.find(pRet)))
263 pRet = nullptr;
264
265 if (!pRet)
266 {
267 pRet = maHelper.GetStyle(rName);
268 //If we've used it once, don't reuse it
269 if (pRet && (maUsedStyles.end() != maUsedStyles.find(pRet)))
270 pRet = nullptr;
271 }
272
273 bool bStyExist = pRet != nullptr;
274
275 if (!pRet)
276 {
277 OUString aName(rName);
278 sal_Int32 nIdx = rName.indexOf(',');
279 // No commas allow in SW style names
280 if (-1 != nIdx)
281 aName = rName.copy( 0, nIdx );
282 pRet = MakeNonCollidingStyle(aName, rCollisions);
283 }
284
285 if (pRet)
286 maUsedStyles.insert(pRet);
287
288 return StyleResult(pRet, bStyExist);
289 }
290
291 template<class C>
293 std::map<OUString, sal_Int32>& rCollisions)
294 {
295 OUString aName(rName);
296 C* pColl = nullptr;
297
298 if (nullptr != (pColl = maHelper.GetStyle(aName)))
299 {
300 //If the style collides first stick WW- in front of it, unless
301 //it already has it and then successively add a larger and
302 //larger number after it, it's got to work at some stage!
303 if (!aName.startsWith("WW-"))
304 aName = "WW-" + aName;
305
306 OUString aBaseName = aName;
307 sal_Int32 nI = 1;
308
309 // if we've seen this basename before then start at
310 // where we finished the last time
311 auto aFind = rCollisions.find(aBaseName);
312 if (aFind != rCollisions.end())
313 nI = aFind->second;
314
315 while (
316 nullptr != (pColl = maHelper.GetStyle(aName)) &&
317 (nI < SAL_MAX_INT32)
318 )
319 {
320 aName = aBaseName + OUString::number(nI++);
321 }
322
323 rCollisions.insert_or_assign(aBaseName, nI);
324 }
325
326 return pColl ? nullptr : maHelper.MakeStyle(aName);
327 }
328
329 static OUString FindBestMSSubstituteFont(std::u16string_view rFont)
330 {
331 if (IsOpenSymbol(rFont))
332 return "Arial Unicode MS";
333 return GetSubsFontName(rFont, SubsFontFlags::ONLYONE | SubsFontFlags::MS);
334 }
335
336 namespace {
337
338 //Utility to remove entries before a given starting position
339 class IfBeforeStart
340 {
341 private:
342 sal_Int32 mnStart;
343 public:
344 explicit IfBeforeStart(sal_Int32 nStart) : mnStart(nStart) {}
345 bool operator()(const sw::util::CharRunEntry &rEntry) const
346 {
347 return rEntry.mnEndPos < mnStart;
348 }
349 };
350
351 }
352}
353
356{
357 SvxLRSpaceItem aLR(rFormat.GetLRSpace());
358 const SvxBoxItem& rBox = rFormat.GetBox();
359
360 aLR.SetLeft(aLR.GetLeft() + rBox.GetDistance(SvxBoxItemLine::LEFT));
361 if (const editeng::SvxBorderLine* pLeft = rBox.GetLeft())
362 aLR.SetLeft(aLR.GetLeft() + pLeft->GetWidth());
363
364 aLR.SetRight(aLR.GetRight() + rBox.GetDistance(SvxBoxItemLine::RIGHT));
365 if (const editeng::SvxBorderLine* pRight = rBox.GetRight())
366 aLR.SetRight(aLR.GetRight() + pRight->GetWidth());
367
368 return aLR;
369}
370
371namespace sw
372{
373 namespace util
374 {
375
376 bool IsPlausableSingleWordSection(const SwFrameFormat &rTitleFormat, const SwFrameFormat &rFollowFormat)
377 {
378 bool bPlausableSingleWordSection = true;
379
380 const SwFormatCol& rFirstCols = rTitleFormat.GetCol();
381 const SwFormatCol& rFollowCols = rFollowFormat.GetCol();
382 const SwColumns& rFirstColumns = rFirstCols.GetColumns();
383 const SwColumns& rFollowColumns = rFollowCols.GetColumns();
384 SvxLRSpaceItem aOneLR = lcl_getWordLRSpace(rTitleFormat);
385 SvxLRSpaceItem aTwoLR = lcl_getWordLRSpace(rFollowFormat);
386 const SwFormatFrameSize& rFirstFrameSize = rTitleFormat.GetFrameSize();
387 const SwFormatFrameSize& rFollowFrameSize = rFollowFormat.GetFrameSize();
388
389 if (rFirstColumns.size() != rFollowColumns.size())
390 {
391 //e.g. #i4320#
392 bPlausableSingleWordSection = false;
393 }
394 else if (aOneLR != aTwoLR)
395 bPlausableSingleWordSection = false;
396 else if (rFirstFrameSize != rFollowFrameSize)
397 bPlausableSingleWordSection = false;
398 else
399 {
400 HdFtDistanceGlue aOne(rTitleFormat.GetAttrSet());
401 HdFtDistanceGlue aTwo(rFollowFormat.GetAttrSet());
402 //e.g. #i14509#
403 if (!aOne.StrictEqualTopBottom(aTwo))
404 bPlausableSingleWordSection = false;
405 }
406 return bPlausableSingleWordSection;
407 }
408
410 {
411 if (const SvxBoxItem *pBox = rPage.GetItem<SvxBoxItem>(RES_BOX))
412 {
413 m_DyaHdrTop = pBox->CalcLineSpace( SvxBoxItemLine::TOP, /*bEvenIfNoLine*/true );
414 m_DyaHdrBottom = pBox->CalcLineSpace( SvxBoxItemLine::BOTTOM, /*bEvenIfNoLine*/true );
415 }
416 else
417 {
419 }
420 const SvxULSpaceItem &rUL = rPage.Get(RES_UL_SPACE);
421 m_DyaHdrTop += rUL.GetUpper();
422 m_DyaHdrBottom += rUL.GetLower();
423
426
427 const SwFormatHeader *pHd = rPage.GetItem<SwFormatHeader>(RES_HEADER);
428 if (pHd && pHd->IsActive() && pHd->GetHeaderFormat())
429 {
430 mbHasHeader = true;
431 m_DyaTop = m_DyaTop + static_cast< sal_uInt16 >( (myImplHelpers::CalcHdDist(*(pHd->GetHeaderFormat()))) );
432 }
433 else
434 mbHasHeader = false;
435
436 const SwFormatFooter *pFt = rPage.GetItem<SwFormatFooter>(RES_FOOTER);
437 if (pFt && pFt->IsActive() && pFt->GetFooterFormat())
438 {
439 mbHasFooter = true;
440 m_DyaBottom = m_DyaBottom + static_cast< sal_uInt16 >( (myImplHelpers::CalcFtDist(*(pFt->GetFooterFormat()))) );
441 }
442 else
443 mbHasFooter = false;
444 }
445
447 const
448 {
449 // Check top only if both object have a header or if
450 // both object don't have a header
451 if (HasHeader() == rOther.HasHeader())
452 {
453 if (m_DyaTop != rOther.m_DyaTop)
454 return false;
455 }
456
457 // Check bottom only if both object have a footer or if
458 // both object don't have a footer
459 if (HasFooter() == rOther.HasFooter())
460 {
461 if (m_DyaBottom != rOther.m_DyaBottom)
462 return false;
463 }
464
465 return true;
466 }
467
469 : mpImpl(new myImplHelpers::StyleMapperImpl<SwTextFormatColl>(rDoc))
470 {
471 }
472
474 {
475 }
476
478 const OUString& rName, ww::sti eSti,
479 std::map<OUString, sal_Int32>& rCollisions)
480 {
481 return mpImpl->GetStyle(rName, eSti, rCollisions);
482 }
483
485 : mpImpl(new myImplHelpers::StyleMapperImpl<SwCharFormat>(rDoc))
486 {
487 }
488
490 {
491 }
492
494 const OUString& rName, ww::sti eSti,
495 std::map<OUString, sal_Int32>& rCollisions)
496 {
497 return mpImpl->GetStyle(rName, eSti, rCollisions);
498 }
499
500 FontMapExport::FontMapExport(std::u16string_view rFamilyName)
501 {
502 sal_Int32 nIndex = 0;
503 msPrimary = GetNextFontToken(rFamilyName, nIndex);
505 if (msSecondary.isEmpty() && nIndex != -1)
506 msSecondary = GetNextFontToken(rFamilyName, nIndex);
507 }
508
509 bool ItemSort::operator()(sal_uInt16 nA, sal_uInt16 nB) const
510 {
511 /*
512 #i24291#
513 All we want to do is ensure for now is that if a charfmt exist
514 in the character properties that it rises to the top and is
515 exported first. In the future we might find more ordering
516 dependencies for export, in which case this is the place to do
517 it
518 */
519 if (nA == nB)
520 return false;
521 if (nA == RES_TXTATR_CHARFMT)
522 return true;
523 if (nB == RES_TXTATR_CHARFMT)
524 return false;
525 if (nA == RES_TXTATR_INETFMT)
526 return true;
527 if (nB == RES_TXTATR_INETFMT)
528 return false;
529 return nA < nB;
530 }
533 {
534 const OUString &rText = rTextNd.GetText();
535
536 bool bParaIsRTL = false;
537 if (SvxFrameDirection::Horizontal_RL_TB ==
538 rTextNd.GetDoc().GetTextDirection(SwPosition(rTextNd)))
539 {
540 bParaIsRTL = true;
541 }
542
543 using namespace ::com::sun::star::i18n;
544
545 sal_uInt16 nScript = i18n::ScriptType::LATIN;
546 assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
547 if (!rText.isEmpty())
548 nScript = g_pBreakIt->GetBreakIter()->getScriptType(rText, 0);
549
551 rtl_TextEncoding eChrSet = rTextNd.GetAttr(nFontWhichId).GetCharSet();
552 eChrSet = GetExtendedTextEncoding(eChrSet);
553
554 CharRuns aRunChanges;
555
556 if (rText.isEmpty())
557 {
558 aRunChanges.emplace_back(0, nScript, eChrSet,
559 bParaIsRTL);
560 return aRunChanges;
561 }
562
563 typedef std::pair<int32_t, bool> DirEntry;
564 typedef std::pair<sal_Int32, sal_uInt16> ScriptEntry;
565 std::vector<DirEntry> aDirChanges;
566 std::vector<ScriptEntry> aScripts;
567
568 UBiDiDirection eDefaultDir = bParaIsRTL ? UBIDI_RTL : UBIDI_LTR;
569 UErrorCode nError = U_ZERO_ERROR;
570 UBiDi* pBidi = ubidi_openSized(rText.getLength(), 0, &nError);
571 ubidi_setPara(pBidi, reinterpret_cast<const UChar *>(rText.getStr()), rText.getLength(),
572 static_cast< UBiDiLevel >(eDefaultDir), nullptr, &nError);
573
574 sal_Int32 nCount = ubidi_countRuns(pBidi, &nError);
575 aDirChanges.reserve(nCount);
576
577 int32_t nStart = 0;
578 int32_t nEnd;
579 UBiDiLevel nCurrDir;
580
581 for (sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx)
582 {
583 ubidi_getLogicalRun(pBidi, nStart, &nEnd, &nCurrDir);
584 /*
585 UBiDiLevel is the type of the level values in this BiDi
586 implementation.
587
588 It holds an embedding level and indicates the visual direction
589 by its bit 0 (even/odd value).
590
591 The value for UBIDI_DEFAULT_LTR is even and the one for
592 UBIDI_DEFAULT_RTL is odd
593 */
594 aDirChanges.emplace_back(nEnd, nCurrDir & 0x1);
595 nStart = nEnd;
596 }
597 ubidi_close(pBidi);
598
599 assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
600
601 sal_Int32 nLen = rText.getLength();
602 sal_Int32 nPos = 0;
603 while (nPos < nLen)
604 {
605 sal_Int32 nEnd2 = g_pBreakIt->GetBreakIter()->endOfScript(rText, nPos,
606 nScript);
607 if (nEnd2 < 0)
608 break;
609 nPos = nEnd2;
610 aScripts.emplace_back(nPos, nScript);
611 nScript = g_pBreakIt->GetBreakIter()->getScriptType(rText, nPos);
612 }
613
614 auto aBiDiEnd = aDirChanges.cend();
615 auto aScriptEnd = aScripts.cend();
616
617 auto aBiDiIter = aDirChanges.cbegin();
618 auto aScriptIter = aScripts.cbegin();
619
620 bool bCharIsRTL = bParaIsRTL;
621
622 while (
623 aBiDiIter != aBiDiEnd ||
624 aScriptIter != aScriptEnd
625 )
626 {
627 sal_Int32 nMinPos = rText.getLength();
628
629 if (aBiDiIter != aBiDiEnd)
630 {
631 if (aBiDiIter->first < nMinPos)
632 nMinPos = aBiDiIter->first;
633 bCharIsRTL = aBiDiIter->second;
634 }
635
636 if (aScriptIter != aScriptEnd)
637 {
638 if (aScriptIter->first < nMinPos)
639 nMinPos = aScriptIter->first;
640 nScript = aScriptIter->second;
641 }
642
643 aRunChanges.emplace_back(nMinPos, nScript, eChrSet, bCharIsRTL);
644
645 if (aBiDiIter != aBiDiEnd)
646 {
647 if (aBiDiIter->first == nMinPos)
648 ++aBiDiIter;
649 }
650
651 if (aScriptIter != aScriptEnd)
652 {
653 if (aScriptIter->first == nMinPos)
654 ++aScriptIter;
655 }
656 }
657
658 aRunChanges.erase(std::remove_if(aRunChanges.begin(),
659 aRunChanges.end(), myImplHelpers::IfBeforeStart(0/*nTextStart*/)), aRunChanges.end());
660
661 return aRunChanges;
662 }
663 }
664
665 namespace ms
667 sal_uInt8 rtl_TextEncodingToWinCharset(rtl_TextEncoding eTextEncoding)
668 {
669 sal_uInt8 nRet =
670 rtl_getBestWindowsCharsetFromTextEncoding(eTextEncoding);
671 switch (eTextEncoding)
672 {
673 case RTL_TEXTENCODING_DONTKNOW:
674 case RTL_TEXTENCODING_UCS2:
675 case RTL_TEXTENCODING_UTF7:
676 case RTL_TEXTENCODING_UTF8:
677 case RTL_TEXTENCODING_JAVA_UTF8:
678 nRet = 0x01;
679 break;
680 default:
681 break;
682 }
683 return nRet;
684 }
685
686 static bool
687 CanEncode(OUString const& rString, rtl_TextEncoding const eEncoding)
688 {
689 OString tmp;
690 return rString.convertToString(&tmp, eEncoding,
691 RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
692 RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR);
693 }
696 OUString const& rFontName, OUString const& rAltName,
697 rtl_TextEncoding eTextEncoding)
698 {
699 sal_uInt8 nRet =
700 rtl_getBestWindowsCharsetFromTextEncoding(eTextEncoding);
701 rtl_TextEncoding enc2 = rtl_getTextEncodingFromWindowsCharset(nRet);
702 if (!rtl_isOctetTextEncoding(enc2) /* check to avoid asserts */ ||
703 !(CanEncode(rFontName, enc2) && CanEncode(rAltName, enc2)))
704 {
705 static struct { rtl_TextEncoding enc; sal_uInt8 charset; }
706 const s_fallbacks [] = {
707 { RTL_TEXTENCODING_MS_932, 0x80 }, // Shift-JIS
708 { RTL_TEXTENCODING_MS_936, 0x86 }, // GB-2312
709 { RTL_TEXTENCODING_MS_950, 0x88 }, // Big5
710 { RTL_TEXTENCODING_MS_949, 0x81 }, // EUC-KR
711 };
712 for (const auto & i : s_fallbacks)
713 {
714 // fall back to a charset that can at least encode the
715 // font's name
716 if (CanEncode(rFontName, i.enc)
717 && CanEncode(rAltName, i.enc))
718 {
719 return i.charset;
720 }
721 }
722 SAL_INFO("sw.rtf", "no fallback charset found for font: "
723 << rFontName << " " << rAltName);
724 nRet = 0x01; // all hope lost: "default", whatever that is
725 }
726 return nRet;
727 }
729 sal_uInt32 DateTime2DTTM( const DateTime& rDT )
730 {
731 /*
732 mint short :6 0000003F minutes (0-59)
733 hr short :5 000007C0 hours (0-23)
734 dom short :5 0000F800 days of month (1-31)
735 mon short :4 000F0000 months (1-12)
736 yr short :9 1FF00000 years (1900-2411)-1900
737 wdy short :3 E0000000 weekday(Sunday=0
738 Monday=1
739 ( wdy can be ignored ) Tuesday=2
740 Wednesday=3
741 Thursday=4
742 Friday=5
743 Saturday=6)
744 */
745
746 if ( rDT.GetDate() == 0 )
747 return 0;
748 sal_uInt32 nDT = ( rDT.GetDayOfWeek() + 1 ) % 7;
749 nDT <<= 9;
750 nDT += ( rDT.GetYear() - 1900 ) & 0x1ff;
751 nDT <<= 4;
752 nDT += rDT.GetMonth() & 0xf;
753 nDT <<= 5;
754 nDT += rDT.GetDay() & 0x1f;
755 nDT <<= 5;
756 nDT += rDT.GetHour() & 0x1f;
757 nDT <<= 6;
758 nDT += rDT.GetMin() & 0x3f;
759 return nDT;
760 }
761
762
766 static sal_Int32 findUnquoted( std::u16string_view aParams, sal_Unicode cFind, sal_Int32 nFromPos )
767 {
768 const sal_Int32 nLen = aParams.size();
769 if (nFromPos < 0 || nLen <= nFromPos)
770 return -1;
771 for (sal_Int32 nI = nFromPos; nI < nLen; ++nI)
772 {
773 const sal_Unicode c = aParams[nI];
774 if (c == '\\')
775 ++nI;
776 else if (c == '\"')
777 {
778 ++nI;
779 // While not at the end and not at an unescaped end quote
780 while (nI < nLen)
781 {
782 if (aParams[nI] == '\"' && aParams[nI-1] != '\\')
783 break;
784 ++nI;
785 }
786 }
787 else //normal unquoted section
788 {
789 if (c == cFind)
790 return nI;
791 }
792 }
793 return -1;
794 }
795
799 static bool replaceUnquoted( OUString& rParams, std::u16string_view aFind, std::u16string_view aReplace )
800 {
801 bool bReplaced = false;
802 if (aFind.empty())
803 return bReplaced;
804 const sal_Unicode cFirst = aFind[0];
805
806 sal_Int32 nLen = rParams.getLength();
807 for (sal_Int32 nI = 0; nI < nLen; ++nI)
808 {
809 const sal_Unicode c = rParams[nI];
810 if (rParams[nI] == '\\')
811 ++nI;
812 else if (rParams[nI] == '\"')
813 {
814 ++nI;
815 // While not at the end and not at an unescaped end quote
816 while (nI < nLen)
817 {
818 if (rParams[nI] == '\"' && rParams[nI-1] != '\\')
819 break;
820 ++nI;
821 }
822 }
823 else //normal unquoted section
824 {
825 if (c == cFirst && rParams.match( aFind, nI))
826 {
827 const sal_Int32 nFindLen = aFind.size();
828 const sal_Int32 nDiff = aReplace.size() - nFindLen;
829 rParams = rParams.replaceAt( nI, nFindLen, aReplace);
830 nI += nFindLen + nDiff - 1;
831 nLen += nDiff;
832 bReplaced = true;
833 }
834 }
835 }
836 return bReplaced;
837 }
839 sal_uLong MSDateTimeFormatToSwFormat(OUString& rParams,
840 SvNumberFormatter *pFormatter, LanguageType &rLang, bool bHijri,
841 LanguageType nDocLang)
842 {
843 // tell the Formatter about the new entry
844 sal_Int32 nCheckPos = 0;
845 SvNumFormatType nType = SvNumFormatType::DEFINED;
846 sal_uInt32 nKey = 0;
847
848 SwapQuotesInField(rParams);
849
850 // Force to Japanese when finding one of 'geE'.
851 // XXX This actually may not be correct, all era keywords could be
852 // used in other locales as well. I just don't know about Word. But
853 // this is how it was for 10 years...
854 bool bForceJapanese = (-1 != findUnquoted( rParams, 'g', 0));
855 // XXX Why replace? The number formatter does handle them and this
856 // effectively changes from Gengou to Gregorian calendar. Legacy
857 // because it wasn't supported a decade ago and now moot? Or is
858 // that a Word specialty?
859 bForceJapanese |= replaceUnquoted( rParams, u"ee", u"yyyy");
860 bForceJapanese |= replaceUnquoted( rParams, u"EE", u"YYYY");
861 if (LANGUAGE_FRENCH != nDocLang)
862 {
863 // Handle the 'a' case here
864 sal_Int32 nLastPos = 0;
865 do
866 {
867 sal_Int32 nPos = findUnquoted( rParams, 'a', nLastPos + 1 );
868 bForceJapanese |= ( nPos != -1 && IsNotAM( rParams, nPos ) );
869 nLastPos = nPos;
870 } while ( -1 != nLastPos );
871 }
872
873 // Force to NatNum when finding one of 'oOA'
874 bool bForceNatNum = replaceUnquoted( rParams, u"o", u"m")
875 || replaceUnquoted( rParams, u"O", u"M");
876 if (LANGUAGE_FRENCH != nDocLang)
877 {
878 // Handle the 'A' case here
879 sal_Int32 nLastPos = 0;
880 do
881 {
882 sal_Int32 nPos = findUnquoted( rParams, 'A', nLastPos + 1 );
883 bool bIsCharA = ( nPos != -1 && IsNotAM( rParams, nPos ) );
884 bForceNatNum |= bIsCharA;
885 if ( bIsCharA )
886 rParams = rParams.replaceAt( nPos, 1, u"D" );
887 nLastPos = nPos;
888 } while ( -1 != nLastPos );
889 }
890
891 sal_Int32 nLen = rParams.getLength();
892 for (sal_Int32 nI = 0; nI < nLen; ++nI)
893 {
894 if (rParams[nI] == '\\')
895 ++nI;
896 else if (rParams[nI] == '\"')
897 {
898 ++nI;
899 // While not at the end and not at an unescaped end quote
900 while (nI < nLen)
901 {
902 if (rParams[nI] == '\"' && rParams[nI-1] != '\\')
903 break;
904 ++nI;
905 }
906 }
907 else //normal unquoted section
908 {
909 sal_Unicode nChar = rParams[nI];
910
911 // Change the localized word string to english
912 if ( nDocLang == LANGUAGE_FRENCH )
913 {
914 if ( ( nChar == 'a' || nChar == 'A' ) && IsNotAM(rParams, nI) )
915 rParams = rParams.replaceAt(nI, 1, u"Y");
916 }
917 if (nChar == '/')
918 {
919 // MM: We have to escape '/' in case it's used as a char.
920 // But not if it's a '/' inside AM/PM
921 if (!(IsPreviousAM(rParams, nI) && IsNextPM(rParams, nI)))
922 {
923 rParams = rParams.replaceAt(nI, 1, u"\\/");
924 nLen++;
925 }
926 nI++;
927 }
928
929 // Deal with language differences in date format expression.
930 // Should be made with i18n framework.
931 // The list of the mappings and of those "special" locales is to be found at:
932 // http://l10n.openoffice.org/i18n_framework/LocaleData.html
933 if ( !bForceJapanese && !bForceNatNum )
934 {
935 // Convert to the localized equivalent for OOo
936 if ( rLang == LANGUAGE_FINNISH )
937 {
938 if (nChar == 'y' || nChar == 'Y')
939 rParams = rParams.replaceAt(nI, 1, u"V");
940 else if (nChar == 'm' || nChar == 'M')
941 rParams = rParams.replaceAt(nI, 1, u"K");
942 else if (nChar == 'd' || nChar == 'D')
943 rParams = rParams.replaceAt(nI, 1, u"P");
944 else if (nChar == 'h' || nChar == 'H')
945 rParams = rParams.replaceAt(nI, 1, u"T");
946 }
947 else if ( rLang.anyOf(
954 {
955 if (nChar == 'h' || nChar == 'H')
956 rParams = rParams.replaceAt(nI, 1, u"T");
957 }
958 else if ( rLang.anyOf(
981 {
982 if (nChar == 'a' || nChar == 'A')
983 rParams = rParams.replaceAt(nI, 1, u"O");
984 else if (nChar == 'y' || nChar == 'Y')
985 rParams = rParams.replaceAt(nI, 1, u"A");
986 }
987 else if ( rLang.anyOf(
990 {
991 if (nChar == 'y' || nChar == 'Y')
992 rParams = rParams.replaceAt(nI, 1, u"J");
993 else if (nChar == 'u' || nChar == 'U')
994 rParams = rParams.replaceAt(nI, 1, u"H");
995 }
996 else if ( rLang.anyOf(
999 {
1000 if (nChar == 'a' || nChar == 'A')
1001 rParams = rParams.replaceAt(nI, 1, u"O");
1002 else if (nChar == 'g' || nChar == 'G')
1003 rParams = rParams.replaceAt(nI, 1, u"X");
1004 else if (nChar == 'y' || nChar == 'Y')
1005 rParams = rParams.replaceAt(nI, 1, u"A");
1006 else if (nChar == 'd' || nChar == 'D')
1007 rParams = rParams.replaceAt(nI, 1, u"G");
1008 }
1009 else if ( rLang.anyOf(
1015 {
1016 if (nChar == 'y' || nChar == 'Y')
1017 rParams = rParams.replaceAt(nI, 1, u"J");
1018 else if (nChar == 'd' || nChar == 'D')
1019 rParams = rParams.replaceAt(nI, 1, u"T");
1020 }
1021 else if ( rLang.anyOf(
1028 {
1029 if (nChar == 'y' || nChar == 'Y' || nChar == 'a')
1030 rParams = rParams.replaceAt(nI, 1, u"A");
1031 else if (nChar == 'd' || nChar == 'D' || nChar == 'j')
1032 rParams = rParams.replaceAt(nI, 1, u"J");
1033 }
1034 }
1035 }
1036 }
1037
1038 if (bForceNatNum)
1039 bForceJapanese = true;
1040
1041 if (bForceJapanese)
1042 rLang = LANGUAGE_JAPANESE;
1043
1044 if (bForceNatNum)
1045 rParams = "[NatNum1][$-411]" + rParams;
1046
1047 if (bHijri)
1048 rParams = "[~hijri]" + rParams;
1049
1050 pFormatter->PutEntry(rParams, nCheckPos, nType, nKey, rLang);
1051
1052 return nKey;
1053 }
1055 bool IsPreviousAM(std::u16string_view rParams, sal_Int32 nPos)
1056 {
1057 return nPos>=2 && o3tl::matchIgnoreAsciiCase(rParams, u"am", nPos-2);
1059 bool IsNextPM(std::u16string_view rParams, sal_Int32 nPos)
1060 {
1061 return o3tl::make_unsigned(nPos+2)<rParams.size() && o3tl::matchIgnoreAsciiCase(rParams, u"pm", nPos+1);
1063 bool IsNotAM(std::u16string_view rParams, sal_Int32 nPos)
1064 {
1065 ++nPos;
1066 return o3tl::make_unsigned(nPos)>=rParams.size() || (rParams[nPos]!='M' && rParams[nPos]!='m');
1067 }
1069 void SwapQuotesInField(OUString &rFormat)
1070 {
1071 //Swap unescaped " and ' with ' and "
1072 const sal_Int32 nLen = rFormat.getLength();
1073 for (sal_Int32 nI = 0; nI < nLen; ++nI)
1074 {
1075 if (!nI || rFormat[nI-1]!='\\')
1076 {
1077 if (rFormat[nI]=='\"')
1078 rFormat = rFormat.replaceAt(nI, 1, u"\'");
1079 else if (rFormat[nI]=='\'')
1080 rFormat = rFormat.replaceAt(nI, 1, u"\"");
1081 }
1082 }
1083 }
1084
1085 }
1086}
1087
1088/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:34
sal_Int32 GetDate() const
sal_Int16 GetYear() const
sal_uInt16 GetDay() const
DayOfWeek GetDayOfWeek() const
sal_uInt16 GetMonth() const
bool GetValue() const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
bool PutEntry(OUString &rString, sal_Int32 &nCheckPos, SvNumFormatType &nType, sal_uInt32 &nKey, LanguageType eLnge=LANGUAGE_DONTKNOW, bool bReplaceBooleanEquivalent=true)
const editeng::SvxBorderLine * GetRight() const
const editeng::SvxBorderLine * GetLeft() const
sal_Int16 GetDistance(SvxBoxItemLine nLine, bool bAllowNegative=false) const
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
tools::Long GetRight() const
tools::Long GetLeft() const
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
tools::Long GetHeight() const
sal_uInt16 GetUpper() const
sal_uInt16 GetLower() const
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
Definition: breakit.hxx:63
Represents the style of a text portion.
Definition: charfmt.hxx:27
Definition: doc.hxx:197
SvxFrameDirection GetTextDirection(const SwPosition &rPos, const Point *pPt=nullptr) const
Definition: doclay.cxx:1641
const SwColumns & GetColumns() const
Definition: fmtclds.hxx:112
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:65
bool IsActive() const
Definition: fmthdft.hxx:89
const SwFrameFormat * GetFooterFormat() const
Definition: fmthdft.hxx:85
SwFrameSize GetHeightSizeType() const
Definition: fmtfsize.hxx:80
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:34
bool IsActive() const
Definition: fmthdft.hxx:58
const SwFrameFormat * GetHeaderFormat() const
Definition: fmthdft.hxx:54
const SvxBoxItem & GetBox(bool=true) const
Definition: frmatr.hxx:108
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:98
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:366
const SwFormatCol & GetCol(bool=true) const
Definition: fmtclds.hxx:168
const SvxULSpaceItem & GetULSpace(bool=true) const
Definition: frmatr.hxx:100
Style of a layout element.
Definition: frmfmt.hxx:72
SwRect FindLayoutRect(const bool bPrtArea=false, const Point *pPoint=nullptr) const
Definition: atrfrm.cxx:2749
SwDoc & GetDoc()
Definition: node.hxx:233
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void Height(tools::Long nNew)
Definition: swrect.hxx:193
Represents the style of a paragraph.
Definition: fmtcol.hxx:61
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
const SfxPoolItem & GetAttr(sal_uInt16 nWhich, bool bInParent=true) const
End: Data collected during idle time.
Definition: node.hxx:732
const OUString & GetText() const
Definition: ndtxt.hxx:244
std::pair< C *, bool > StyleResult
C * MakeNonCollidingStyle(const OUString &rName, std::map< OUString, sal_Int32 > &rCollisions)
o3tl::sorted_vector< const C * > maUsedStyles
StyleResult GetStyle(const OUString &rName, ww::sti eSti, std::map< OUString, sal_Int32 > &rCollisions)
StyleResult GetStyle(const OUString &rName, ww::sti eSti, std::map< OUString, sal_Int32 > &rCollisions)
Get the writer style which the word style should map to.
std::pair< SwCharFormat *, bool > StyleResult
StyleResult StyleResult is a std::pair of a pointer to a style and a flag which is true if the style ...
Definition: msfilter.hxx:215
std::unique_ptr<::myImplHelpers::StyleMapperImpl< SwCharFormat > > mpImpl
Definition: msfilter.hxx:206
FontMapExport(std::u16string_view rFontDescription)
Make export a word section top/bottom values easy.
bool StrictEqualTopBottom(const HdFtDistanceGlue &rOther) const
Is the top of the page the same in both objects when there are headers\footers present or non-present...
HdFtDistanceGlue(const SfxItemSet &rPage)
bool operator()(sal_uInt16 nA, sal_uInt16 nB) const
std::pair< SwTextFormatColl *, bool > StyleResult
StyleResult StyleResult is a std::pair of a pointer to a style and a flag which is true if the style ...
Definition: msfilter.hxx:153
std::unique_ptr<::myImplHelpers::StyleMapperImpl< SwTextFormatColl > > mpImpl
Definition: msfilter.hxx:144
StyleResult GetStyle(const OUString &rName, ww::sti eSti, std::map< OUString, sal_Int32 > &rCollisions)
Get the writer style which the word style should map to.
sal_uInt16 GetMin() const
sal_uInt16 GetHour() const
int nCount
float u
std::vector< SwColumn > SwColumns
Definition: fmtclds.hxx:57
@ Variable
Frame is variable in Var-direction.
UNOTOOLS_DLLPUBLIC bool IsOpenSymbol(std::u16string_view rFontName)
UNOTOOLS_DLLPUBLIC std::u16string_view GetNextFontToken(std::u16string_view rTokenStr, sal_Int32 &rIndex)
UNOTOOLS_DLLPUBLIC OUString GetSubsFontName(std::u16string_view rName, SubsFontFlags nFlags)
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(102)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SwHeaderAndFooterEatSpacingItem > RES_HEADER_FOOTER_EAT_SPACING(127)
constexpr TypedWhichId< SwFormatFooter > RES_FOOTER(103)
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
sal_uInt16 GetWhichOfScript(sal_uInt16 nWhich, sal_uInt16 nScript)
Definition: hints.cxx:184
sal_Int32 nIndex
OUString aName
#define LANGUAGE_GERMAN_AUSTRIAN
#define LANGUAGE_SPANISH_PARAGUAY
#define LANGUAGE_GERMAN_SWISS
#define LANGUAGE_SPANISH_BOLIVIA
#define LANGUAGE_SPANISH_ECUADOR
#define LANGUAGE_FRENCH_LUXEMBOURG
#define LANGUAGE_PORTUGUESE
#define LANGUAGE_SWEDISH_FINLAND
#define LANGUAGE_GERMAN_LUXEMBOURG
#define LANGUAGE_FINNISH
#define LANGUAGE_ITALIAN_SWISS
#define LANGUAGE_SPANISH_VENEZUELA
#define LANGUAGE_FRENCH_SWISS
#define LANGUAGE_FRENCH
#define LANGUAGE_ITALIAN
#define LANGUAGE_DUTCH
#define LANGUAGE_SPANISH_COLOMBIA
#define LANGUAGE_SPANISH_PANAMA
#define LANGUAGE_SPANISH_NICARAGUA
#define LANGUAGE_SPANISH_GUATEMALA
#define LANGUAGE_SPANISH_COSTARICA
#define LANGUAGE_JAPANESE
#define LANGUAGE_SPANISH_PERU
#define LANGUAGE_FRENCH_MONACO
#define LANGUAGE_SPANISH_CHILE
#define LANGUAGE_SPANISH_MODERN
#define LANGUAGE_SPANISH_EL_SALVADOR
#define LANGUAGE_SWEDISH
#define LANGUAGE_FRENCH_CANADIAN
#define LANGUAGE_SPANISH_DATED
#define LANGUAGE_SPANISH_PUERTO_RICO
#define LANGUAGE_FRENCH_BELGIAN
#define LANGUAGE_DANISH
#define LANGUAGE_GERMAN
#define LANGUAGE_SPANISH_DOMINICAN_REPUBLIC
#define LANGUAGE_NORWEGIAN
#define LANGUAGE_NORWEGIAN_NYNORSK
#define LANGUAGE_NORWEGIAN_BOKMAL
#define LANGUAGE_SPANISH_HONDURAS
#define LANGUAGE_GERMAN_LIECHTENSTEIN
#define LANGUAGE_SPANISH_ARGENTINA
#define LANGUAGE_SPANISH_MEXICAN
#define LANGUAGE_PORTUGUESE_BRAZILIAN
#define LANGUAGE_DUTCH_BELGIAN
#define LANGUAGE_SPANISH_URUGUAY
sal_uInt16 nPos
#define SAL_INFO(area, stream)
#define SAL_N_ELEMENTS(arr)
int i
static OUString FindBestMSSubstituteFont(std::u16string_view rFont)
static SwTwips CalcFtDist(const SwFrameFormat &rFormat)
static SwTwips CalcHdDist(const SwFrameFormat &rFormat)
static SwTwips CalcHdFtDist(const SwFrameFormat &rFormat, sal_uInt16 nSpacing)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
bool matchIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2, sal_Int32 fromIndex=0)
sal_uLong MSDateTimeFormatToSwFormat(OUString &rParams, SvNumberFormatter *pFormatter, LanguageType &rLang, bool bHijri, LanguageType nDocLang)
Convert from Word Date/Time field str to Writer's Date Time str.
sal_uInt8 rtl_TextEncodingToWinCharsetRTF(OUString const &rFontName, OUString const &rAltName, rtl_TextEncoding eTextEncoding)
MSOffice appears to set the charset of unicode fonts to MS 932.
sal_uInt8 rtl_TextEncodingToWinCharset(rtl_TextEncoding eTextEncoding)
MSOffice appears to set the charset of unicode fonts to MS 932.
sal_uInt32 DateTime2DTTM(const DateTime &rDT)
Convert from DTTM to Writer's DateTime.
static bool replaceUnquoted(OUString &rParams, std::u16string_view aFind, std::u16string_view aReplace)
Find all rFind in rParams if not embedded in " double quotes and replace with rReplace.
static bool CanEncode(OUString const &rString, rtl_TextEncoding const eEncoding)
void SwapQuotesInField(OUString &rFormat)
Another function used by MSDateTimeFormatToSwFormat.
bool IsNotAM(std::u16string_view rParams, sal_Int32 nPos)
Used by MSDateTimeFormatToSwFormat to identify AM time fields.
bool IsPreviousAM(std::u16string_view rParams, sal_Int32 nPos)
bool IsNextPM(std::u16string_view rParams, sal_Int32 nPos)
static sal_Int32 findUnquoted(std::u16string_view aParams, sal_Unicode cFind, sal_Int32 nFromPos)
Find cFind in rParams if not embedded in " double quotes.
const SvxPageUsage aArr[]
SwCharFormat * GetCharStyle(SwDoc &rDoc, const OUString &rName)
Get a Character Style which fits a given name.
CharRuns GetPseudoCharRuns(const SwTextNode &rTextNd)
Collect the ranges of Text which share.
std::vector< CharRunEntry > CharRuns
Definition: msfilter.hxx:383
SwTextFormatColl * GetParaStyle(SwDoc &rDoc, const OUString &rName)
Get a Paragraph Style which fits a given name.
bool IsPlausableSingleWordSection(const SwFrameFormat &rTitleFormat, const SwFrameFormat &rFollowFormat)
See if two page formats can be expressed as a single word section.
Dialog to specify the properties of date form field.
long Long
sti
Definition: wwstyles.hxx:29
@ stiHyperlink
Definition: wwstyles.hxx:126
@ stiEdnRef
Definition: wwstyles.hxx:78
@ stiLnn
Definition: wwstyles.hxx:76
@ stiEmphasis
Definition: wwstyles.hxx:129
@ stiStrong
Definition: wwstyles.hxx:128
@ stiPgn
Definition: wwstyles.hxx:77
@ stiFootnoteRef
Definition: wwstyles.hxx:74
@ stiHyperlinkFollowed
Definition: wwstyles.hxx:127
RES_POOL_COLLFMT_TYPE
Definition: poolfmt.hxx:246
@ RES_POOLCOLL_HEADLINE5
Heading 5.
Definition: poolfmt.hxx:266
@ RES_POOLCOLL_TEXT
Text body.
Definition: poolfmt.hxx:251
@ RES_POOLCOLL_STANDARD
Standard.
Definition: poolfmt.hxx:250
@ RES_POOLCOLL_HEADLINE6
Heading 6.
Definition: poolfmt.hxx:267
@ RES_POOLCOLL_TOX_CNTNT4
Content 4th level.
Definition: poolfmt.hxx:380
@ RES_POOLCOLL_SIGNATURE
Signature.
Definition: poolfmt.hxx:256
@ RES_POOLCOLL_TOX_IDX3
3rd level.
Definition: poolfmt.hxx:372
@ RES_POOLCOLL_TOX_IDXH
Subgroup index tables.
Definition: poolfmt.hxx:369
@ RES_POOLCOLL_HEADLINE8
Heading 8.
Definition: poolfmt.hxx:269
@ RES_POOLCOLL_ENVELOPE_ADDRESS
Addressee.
Definition: poolfmt.hxx:354
@ RES_POOLCOLL_TOX_IDX2
2nd level.
Definition: poolfmt.hxx:371
@ RES_POOLCOLL_HEADER
Header Left&Right.
Definition: poolfmt.hxx:331
@ RES_POOLCOLL_TOX_CNTNT6
Content 6th level.
Definition: poolfmt.hxx:391
@ RES_POOLCOLL_TOX_CNTNT3
Content 3rd level.
Definition: poolfmt.hxx:379
@ RES_POOLCOLL_TOX_CNTNT5
Content 5th level.
Definition: poolfmt.hxx:381
@ RES_POOLCOLL_HEADLINE9
Heading 9.
Definition: poolfmt.hxx:270
@ RES_POOLCOLL_TOX_CNTNT2
Content 2nd level.
Definition: poolfmt.hxx:378
@ RES_POOLCOLL_TOX_IDX1
1st level.
Definition: poolfmt.hxx:370
@ RES_POOLCOLL_TOX_CNTNT1
Content 1st level.
Definition: poolfmt.hxx:377
@ RES_POOLCOLL_TEXT_MOVE
Text body indent.
Definition: poolfmt.hxx:254
@ RES_POOLCOLL_HEADLINE_BASE
Subgroup headings.
Definition: poolfmt.hxx:261
@ RES_POOLCOLL_SEND_ADDRESS
Sender.
Definition: poolfmt.hxx:355
@ RES_POOLCOLL_DOC_END
Definition: poolfmt.hxx:429
@ RES_POOLCOLL_LISTS_BEGIN
Group lists.
Definition: poolfmt.hxx:276
@ RES_POOLCOLL_HEADLINE2
Heading 2.
Definition: poolfmt.hxx:263
@ RES_POOLCOLL_TOX_CNTNT7
Content 7th level.
Definition: poolfmt.hxx:392
@ RES_POOLCOLL_TOX_CNTNT8
Content 8th level.
Definition: poolfmt.hxx:393
@ RES_POOLCOLL_DOC_SUBTITLE
Doc. subtitle.
Definition: poolfmt.hxx:426
@ RES_POOLCOLL_TOX_CNTNT9
Content 9th level.
Definition: poolfmt.hxx:394
@ RES_POOLCOLL_HEADLINE4
Heading 4.
Definition: poolfmt.hxx:265
@ RES_POOLCOLL_FOOTNOTE
Footnotes.
Definition: poolfmt.hxx:353
@ RES_POOLCOLL_HEADLINE7
Heading 7.
Definition: poolfmt.hxx:268
@ RES_POOLCOLL_HEADLINE1
Heading 1.
Definition: poolfmt.hxx:262
@ RES_POOLCOLL_FOOTER
Subgroup footer.
Definition: poolfmt.hxx:336
@ RES_POOLCOLL_HEADLINE3
Heading 3.
Definition: poolfmt.hxx:264
@ RES_POOLCOLL_ENDNOTE
Endnotes.
Definition: poolfmt.hxx:356
RES_POOL_CHRFMT_TYPE
Ranges for the IDs of the formats.
Definition: poolfmt.hxx:109
@ RES_POOLCHR_INET_VISIT
Internet visited.
Definition: poolfmt.hxx:121
@ RES_POOLCHR_NORMAL_END
Definition: poolfmt.hxx:132
@ RES_POOLCHR_FOOTNOTE
Footnote.
Definition: poolfmt.hxx:113
@ RES_POOLCHR_HTML_EMPHASIS
Definition: poolfmt.hxx:135
@ RES_POOLCHR_ENDNOTE
Endnote.
Definition: poolfmt.hxx:124
@ RES_POOLCHR_PAGENO
Pages/field.
Definition: poolfmt.hxx:114
@ RES_POOLCHR_INET_NORMAL
Internet normal.
Definition: poolfmt.hxx:120
@ RES_POOLCHR_HTML_STRONG
Definition: poolfmt.hxx:137
@ RES_POOLCHR_LINENUM
Line numbering.
Definition: poolfmt.hxx:125
QPRO_FUNC_TYPE nType
sal_uIntPtr sal_uLong
Marks a position in the document model.
Definition: pam.hxx:38
bool anyOf(strong_int v) const
tools::Long SwTwips
Definition: swtypes.hxx:51
TOOLS_DLLPUBLIC rtl_TextEncoding GetExtendedTextEncoding(rtl_TextEncoding eEncoding)
unsigned char sal_uInt8
#define SAL_MAX_INT32
sal_uInt16 sal_Unicode
static SvxLRSpaceItem lcl_getWordLRSpace(const SwFrameFormat &rFormat)
Count what Word calls left/right margin from a format's LRSpace + Box.
sal_Int32 mnStart
#define C
SvNumFormatType