116 #include <section.hxx>
121 #include <com/sun/star/i18n/ScriptType.hpp>
122 #include <com/sun/star/i18n/XBreakIterator.hpp>
145 using ::editeng::SvxBorderLine;
154 if ( nScript == i18n::ScriptType::ASIAN )
177 else if ( nScript == i18n::ScriptType::COMPLEX )
212 for (
const auto& rItem : rItems )
215 sal_uInt16 nWhich = pItem->
Which();
216 if ( (
isCHRATR( nWhich ) ||
isTXTATR( nWhich ) ) && CollapseScriptsforWordOk( nScript, nWhich ) )
238 for (
const auto& rCharItem : aCharItems)
241 sal_uInt16 nCharWhich = pCharItem->
Which();
243 AttrOutput().OutputItem(*pCharItem);
253 AttrOutput().OutputItem( *pFont );
259 if (bWriteCombChars &&
265 AttrOutput().OutputItem( fontHeight );
275 AttrOutput().OutputItem(aForeground);
280 AttrOutput().OutputItem( *pItem );
290 if (
auto pNd = dynamic_cast< const SwContentNode *>( m_pOutFormatNode ) )
291 pInherited =
static_cast<SwTextFormatColl&
>( pNd->GetAnyFormatColl() ).GetAttrSet().GetItem(nWhich);
292 else if ( m_bStyDef && m_pCurrentStyle && m_pCurrentStyle->DerivedFrom() )
293 pInherited = &m_pCurrentStyle->DerivedFrom()->GetFormatAttr(nWhich);
298 AttrOutput().OutputItem( *pItem );
302 AttrOutput().OutputItem( *pItem );
314 bool bExportParentItemSet )
316 if( !(bExportParentItemSet || rSet.
Count()) )
328 if (
nullptr != pItem )
331 AttrOutput().OutputItem( *pItem );
339 AttrOutput().OutputItem( *pRuleItem );
343 if ( pRuleItem->
GetValue().isEmpty() &&
348 AttrOutput().OutputItem( *pLRItem );
355 ExportPoolItemsToCHP(aItems, nScript,
nullptr);
358 const bool bAlreadyOutputBrushItem = AttrOutput().MaybeOutputBrushItem(rSet);
360 for (
const auto& rItem : aItems )
363 sal_uInt16 nWhich = pItem->
Which();
367 AttrOutput().OutputItem( *pItem );
372 if (!bAlreadyOutputBrushItem && pFill
373 && (pFill->GetValue() == drawing::FillStyle_SOLID || pFill->GetValue() == drawing::FillStyle_NONE)
376 const bool bFillStyleNone = pFill->GetValue() == drawing::FillStyle_NONE;
378 std::unique_ptr<SvxBrushItem> pInherited;
381 if (
auto pNd = dynamic_cast<const SwContentNode*>(m_pOutFormatNode))
383 else if (m_bStyDef && m_pCurrentStyle && m_pCurrentStyle->DerivedFrom())
388 if (!bFillStyleNone || (pInherited && *pInherited != *aBrush))
389 AttrOutput().OutputItem(*aBrush);
395 AttrOutput().MaybeOutputBrushItem(rSet);
415 SwNodeIndex aEnd( *pSttIdx->GetNode().EndOfSectionNode() );
419 bRet = std::any_of(m_aChapterFieldLocs.cbegin(), m_aChapterFieldLocs.cend(),
420 [nStart, nEnd](
SwNodeOffset i) {
return ( nStart <=
i ) && (
i <= nEnd ); });
427 if ( m_aChapterFieldLocs.empty() )
433 if ( pFormat && ContentContainsChapterField( pFormat->
GetContent() ) )
437 return pFormat && ContentContainsChapterField( pFormat->
GetContent() );
442 bool bNewPageDesc =
false;
444 OSL_ENSURE(pCurrent && m_pCurrentPageDesc,
"Not possible surely");
445 if (m_pCurrentPageDesc && pCurrent)
447 if (pCurrent != m_pCurrentPageDesc)
449 if (m_pCurrentPageDesc->GetFollow() != pCurrent)
453 const SwFrameFormat& rTitleFormat = m_pCurrentPageDesc->GetFirstMaster();
459 m_pCurrentPageDesc = pCurrent;
464 bNewPageDesc = FormatHdFtContainsChapterField(rFormat);
482 if ( m_bStyDef || m_bOutKF || m_bInWriteEscher || m_bOutPageDescs )
485 m_bBreakBefore =
true;
486 bool bNewPageDesc =
false;
488 bool bExtraPageBreakBeforeSectionBreak =
false;
494 bool bBreakSet =
false;
499 if (m_pCurrentPageDesc != pPageDesc)
501 if (isCellOpen && ( m_pCurrentPageDesc->GetName() != pPageDesc->
GetName() ))
513 m_pCurrentPageDesc = pPageDesc;
517 if ( pSet && pSet->
Count() )
532 bExtraPageBreakBeforeSectionBreak =
true;
538 bool bRemoveHardBreakInsideTable =
false;
552 bRemoveHardBreakInsideTable =
true;
559 if ( !bRemoveHardBreakInsideTable )
561 OSL_ENSURE(m_pCurrentPageDesc,
"should not be possible");
570 if ( m_pCurrentPageDesc )
573 if ( pBreak->GetBreak() == SvxBreak::PageBefore )
575 bNewPageDesc |= SetCurrentPageDescFromNode( rNd );
579 AttrOutput().OutputItem( *pBreak );
591 bool bHackInBreak =
false;
597 if ( rBreak.
GetBreak() == SvxBreak::PageBefore )
611 OSL_ENSURE( m_pCurrentPageDesc,
"should not be possible" );
612 if ( m_pCurrentPageDesc )
613 bNewPageDesc = SetCurrentPageDescFromNode( rNd );
616 if ( bNewPageDesc && m_pCurrentPageDesc )
618 PrepareNewPageDesc( pSet, rNd, pPgDesc, m_pCurrentPageDesc, bExtraPageBreakBeforeSectionBreak );
620 m_bBreakBefore =
false;
629 m_pCurrentPageDesc &&
630 m_pCurrentPageDesc != m_pCurrentPageDesc->GetFollow() )
632 PrepareNewPageDesc( pSet, *pNd,
nullptr, m_pCurrentPageDesc->GetFollow() );
686 const sal_uLong nLnNm = GetSectionLineNo( pSet, rNd );
688 OSL_ENSURE( pNewPgDescFormat || pNewPgDesc,
"Neither page desc format nor page desc provided." );
690 if ( pNewPgDescFormat )
692 m_pSepx->AppendSep( Fc2Cp( nFcPos ), *pNewPgDescFormat, rNd, pFormat, nLnNm );
694 else if ( pNewPgDesc )
696 m_pSepx->AppendSep( Fc2Cp( nFcPos ), pNewPgDesc, rNd, pFormat, nLnNm );
708 for ( sal_uInt16 nCnt = 0; nCnt < aTStop.
Count(); ++nCnt )
736 case style::NumberingType::TEXT_NUMBER: nRet = 5;
break;
737 case style::NumberingType::TEXT_CARDINAL: nRet = 6;
break;
738 case style::NumberingType::TEXT_ORDINAL: nRet = 7;
break;
739 case style::NumberingType::AIU_HALFWIDTH_JA: nRet = 12;
break;
740 case style::NumberingType::IROHA_HALFWIDTH_JA: nRet = 13;
break;
741 case style::NumberingType::FULLWIDTH_ARABIC: nRet = 14;
break;
742 case style::NumberingType::NUMBER_TRADITIONAL_JA: nRet = 16;
break;
743 case style::NumberingType::CIRCLE_NUMBER: nRet = 18;
break;
744 case style::NumberingType::AIU_FULLWIDTH_JA: nRet = 20;
break;
745 case style::NumberingType::IROHA_FULLWIDTH_JA: nRet = 21;
break;
749 case style::NumberingType::HANGUL_SYLLABLE_KO: nRet = 24;
break;
750 case style::NumberingType::HANGUL_JAMO_KO: nRet = 25;
break;
751 case style::NumberingType::HANGUL_CIRCLED_SYLLABLE_KO: nRet = 24;
break;
752 case style::NumberingType::HANGUL_CIRCLED_JAMO_KO: nRet = 25;
break;
753 case style::NumberingType::TIAN_GAN_ZH: nRet = 30;
break;
754 case style::NumberingType::DI_ZI_ZH: nRet = 31;
break;
755 case style::NumberingType::NUMBER_UPPER_ZH_TW: nRet = 34;
break;
756 case style::NumberingType::NUMBER_UPPER_ZH: nRet = 38;
break;
757 case style::NumberingType::NUMBER_DIGITAL_KO: nRet = 41;
break;
758 case style::NumberingType::NUMBER_HANGUL_KO: nRet = 42;
break;
759 case style::NumberingType::NUMBER_LEGAL_KO: nRet = 43;
break;
760 case style::NumberingType::NUMBER_DIGITAL2_KO: nRet = 44;
break;
761 case style::NumberingType::NUMBER_HEBREW: nRet = 45;
break;
762 case style::NumberingType::CHARS_ARABIC: nRet = 46;
break;
763 case style::NumberingType::CHARS_HEBREW: nRet = 47;
break;
764 case style::NumberingType::CHARS_ARABIC_ABJAD: nRet = 48;
break;
765 case style::NumberingType::CHARS_PERSIAN:
766 case style::NumberingType::CHARS_NEPALI: nRet = 49;
break;
767 case style::NumberingType::CHARS_THAI: nRet = 53;
break;
768 case style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_N_RU:
769 case style::NumberingType::CHARS_CYRILLIC_LOWER_LETTER_RU: nRet = 58;
break;
770 case style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_N_RU:
771 case style::NumberingType::CHARS_CYRILLIC_UPPER_LETTER_RU: nRet = 59;
break;
804 if (static_cast<const SwTextFormatColl*>(pParent)->IsAssignedToListLevelOfOutlineStyle())
821 bool bCallOutSet =
true;
823 m_pOutFormatNode = &rFormat;
825 switch( rFormat.
Which() )
833 if (static_cast<const SwTextFormatColl&>(rFormat).IsAssignedToListLevelOfOutlineStyle())
834 nLvl = static_cast<const SwTextFormatColl&>(rFormat).GetAssignedOutlineStyleLevel();
842 AttrOutput().OutlineNumbering(static_cast<sal_uInt8>(nLvl));
856 OutputItemSet( aSet, bPapFormat, bChpFormat,
857 i18n::ScriptType::LATIN, m_bExportModeRTF);
868 if ( m_bStyDef && DisallowInheritingOutlineNumbering(rFormat) )
873 OutputItemSet( aSet, bPapFormat, bChpFormat,
874 css::i18n::ScriptType::LATIN, m_bExportModeRTF);
886 OSL_ENSURE(m_pParentFrame,
"No parent frame, all broken");
890 const SwFrameFormat &rFrameFormat = m_pParentFrame->GetFrameFormat();
903 aAnchor.
SetType(m_eNewAnchorType);
907 if (SfxItemState::SET != aSet.GetItemState(
RES_SURROUND))
913 switch (pXFillStyleItem->GetValue())
915 case drawing::FillStyle_NONE:
917 case drawing::FillStyle_SOLID:
929 m_bOutFlyFrameAttrs =
true;
931 OutputItemSet(aSet,
true,
false,
932 i18n::ScriptType::LATIN, m_bExportModeRTF);
933 m_bOutFlyFrameAttrs =
false;
942 OSL_ENSURE(
false,
"Which format is exported here?" );
947 OutputItemSet( rFormat.
GetAttrSet(), bPapFormat, bChpFormat,
948 i18n::ScriptType::LATIN, m_bExportModeRTF);
949 m_pOutFormatNode = pOldMod;
955 std::vector<SwGetRefField*> vpRFields;
957 return std::any_of(vpRFields.begin(), vpRFields.end(),
958 [rName](
SwGetRefField* pF) {
return rName == pF->GetSetRefName(); });
964 std::vector<SwGetRefField*> vpRFields;
966 return std::any_of(vpRFields.begin(), vpRFields.end(),
967 [nSeqNo](
SwGetRefField* pF) {
return nSeqNo == pF->GetSeqNo(); });
978 sRet =
"Ref_" + *pName;
984 sRet =
"Ref_" + *pName;
994 sRet =
"_RefF" + OUString::number( nSeqNo );
997 sRet =
"_RefE" + OUString::number( nSeqNo );
1011 m_rWW8Export.m_pO->push_back(
sal_uInt8(1) );
1016 if (nScript == i18n::ScriptType::COMPLEX && !bIsRTL)
1019 m_rWW8Export.m_pO->push_back(
sal_uInt8(0x81) );
1020 m_rWW8Export.m_pDop->bUseThaiLineBreakingRules =
true;
1026 m_rWW8Export.m_pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell() - (mbOnTOXEnding?2:0), m_rWW8Export.m_pO->size(), m_rWW8Export.m_pO->data() );
1027 mbOnTOXEnding =
false;
1028 m_rWW8Export.m_pO->clear();
1030 if ( pTextNodeInfoInner )
1032 if ( pTextNodeInfoInner->isEndOfLine() )
1034 TableRowEnd( pTextNodeInfoInner->getDepth() );
1037 ShortToSVBT16( 0, nSty );
1038 m_rWW8Export.m_pO->insert( m_rWW8Export.m_pO->end(), nSty, nSty+2 );
1039 TableInfoRow( pTextNodeInfoInner );
1040 m_rWW8Export.m_pPapPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), m_rWW8Export.m_pO->size(), m_rWW8Export.m_pO->data());
1041 m_rWW8Export.m_pO->clear();
1046 m_aBookmarksOfParagraphStart.clear();
1047 m_aBookmarksOfParagraphEnd.clear();
1053 m_nFieldResults = pCurrentFields ? pCurrentFields->
ResultCount() : 0;
1060 const OUString &rComment = pRedlineData->
GetComment();
1062 if (!rComment.isEmpty() && (m_rWW8Export.m_nTextTyp ==
TXT_MAINTEXT))
1064 if (m_rWW8Export.m_pAtn->IsNewRedlineComment(pRedlineData))
1066 m_rWW8Export.m_pAtn->Append( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ), pRedlineData );
1067 m_rWW8Export.WritePostItBegin( m_rWW8Export.m_pO.get() );
1073 auto aRange = m_aBookmarksOfParagraphStart.equal_range(nPos);
1074 for(
auto aIter = aRange.first; aIter != aRange.second; ++aIter)
1082 mbOnTOXEnding =
true;
1088 auto aRange = m_aBookmarksOfParagraphEnd.equal_range(nPos);
1089 for(
auto aIter = aRange.first; aIter != aRange.second; ++aIter)
1092 GetExport().AppendBookmarkEndWithCorrection(
BookmarkToWord(aIter->second));
1103 sal_uInt16 nNewFieldResults = pCurrentFields ? pCurrentFields->
ResultCount() : 0;
1105 bool bExportedFieldResult = ( m_nFieldResults != nNewFieldResults );
1111 if ( !bExportedFieldResult )
1113 m_rWW8Export.m_pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(),
1114 m_rWW8Export.m_pO->size(), m_rWW8Export.m_pO->data() );
1116 m_rWW8Export.m_pO->clear();
1121 RawText(rText, eCharSet);
1126 m_rWW8Export.OutSwString(rText, 0, rText.getLength());
1131 if (!m_rWW8Export.m_pO->empty() || bForce)
1133 m_rWW8Export.m_pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(),
1134 m_rWW8Export.m_pO->size(), m_rWW8Export.m_pO->data() );
1135 m_rWW8Export.m_pO->clear();
1141 OSL_ENSURE( m_rWW8Export.m_pO->empty(),
" pO is not empty at line end" );
1144 ShortToSVBT16( nStyle, nSty );
1145 m_rWW8Export.m_pO->insert( m_rWW8Export.m_pO->end(), nSty, nSty+2 );
1152 m_rWW8Export.m_pO->push_back( bVal ? 1 : 0 );
1157 OSL_ENSURE( nId <= 1,
"out of range" );
1162 m_rWW8Export.m_pO->push_back( bVal ? 1 : 0 );
1167 sal_uInt16 nFontID = m_rWW8Export.GetId( rFont );
1170 m_rWW8Export.InsUInt16( nFontID );
1173 m_rWW8Export.InsUInt16( nFontID );
1178 sal_uInt16 nFontID = m_rWW8Export.GetId( rFont );
1180 m_rWW8Export.InsUInt16( nFontID );
1185 sal_uInt16 nFontID = m_rWW8Export.GetId( rFont );
1187 m_rWW8Export.InsUInt16( nFontID );
1213 OutputWW8Attribute( 3, rContour.GetValue() );
1218 OutputWW8Attribute( 4, rShadow.GetValue() );
1225 m_rWW8Export.InsUInt16( rKerning.GetValue() );
1232 m_rWW8Export.InsUInt16( rAutoKern.GetValue() ? 2 : 0 );
1239 m_rWW8Export.m_pO->push_back( rBlink.GetValue() ? 2 : 0 );
1247 OutputWW8Attribute( 8,
true );
1252 OutputWW8Attribute( 2,
true );
1257 OutputWW8Attribute( 8,
false );
1258 OutputWW8Attribute( 2,
false );
1266 case SvxCaseMap::SmallCaps:
1267 OutputWW8Attribute( 5,
true );
1269 case SvxCaseMap::Uppercase:
1270 OutputWW8Attribute( 6,
true );
1272 case SvxCaseMap::Capitalize:
1277 OutputWW8Attribute( 5,
false );
1278 OutputWW8Attribute( 6,
false );
1285 OutputWW8Attribute( 7, rHidden.GetValue() );
1297 m_rWW8Export.m_pO->push_back( nColor );
1311 bWord = pWordline->GetValue();
1313 SAL_WARN(
"sw.ww8",
"m_rWW8Export has an RES_CHRATR_WORDLINEMODE item, but it's of the wrong type.");
1381 m_rWW8Export.m_pO->push_back( b );
1394 switch ( rLanguage.Which() )
1411 m_rWW8Export.InsUInt16( nId );
1412 m_rWW8Export.InsUInt16( static_cast<sal_uInt16>(rLanguage.
GetLanguage()) );
1419 m_rWW8Export.InsUInt16( static_cast<sal_uInt16>(rLanguage.
GetLanguage()) );
1424 m_rWW8Export.InsUInt16( static_cast<sal_uInt16>(rLanguage.
GetLanguage()) );
1438 else if (
DFLT_ESC_PROP == nProp || nProp < 1 || nProp > 100 )
1450 nEsc = .8 * (100 - nProp);
1457 nEsc = .2 * -(100 - nProp);
1464 m_rWW8Export.m_pO->push_back( b );
1467 if ( 0 != b && 0xFF != b )
1473 m_rWW8Export.InsUInt16(static_cast<short>(
round(fHeight * nEsc / 1000) ));
1475 if( 100 != nProp || !b )
1478 m_rWW8Export.InsUInt16(msword_cast<sal_uInt16>(
round(fHeight * nProp / 1000) ));
1485 switch ( rHeight.Which() )
1498 m_rWW8Export.InsUInt16( nId );
1500 m_rWW8Export.InsUInt16( o3tl::narrowing<sal_uInt16>(( rHeight.
GetHeight() + 5 ) / 10 ) );
1507 m_rWW8Export.InsUInt16( rScaleWidth.GetValue() );
1513 switch ( rRelief.GetValue() )
1517 default: nId = 0;
break;
1522 m_rWW8Export.InsUInt16( nId );
1523 m_rWW8Export.m_pO->push_back(
sal_uInt8(0x81) );
1529 m_rWW8Export.m_pO->push_back(
sal_uInt8(0x0) );
1531 m_rWW8Export.m_pO->push_back(
sal_uInt8(0x0) );
1540 m_rWW8Export.InsUInt16(0x85a);
1541 m_rWW8Export.m_pO->push_back(
sal_uInt8(1));
1548 m_rWW8Export.InsUInt16(0x286F);
1549 m_rWW8Export.m_pO->push_back(static_cast<sal_uInt8>(rAttr.
GetValue()));
1558 if (m_rWW8Export.IsInTable())
1566 m_rWW8Export.m_pO->push_back(
sal_uInt8(0x06) );
1567 m_rWW8Export.m_pO->push_back(
sal_uInt8(0x01) );
1569 m_rWW8Export.InsUInt16( rRotate.
IsFitToLine() ? 1 : 0 );
1570 static const sal_uInt8 aZeroArr[ 3 ] = { 0, 0, 0 };
1571 m_rWW8Export.m_pO->insert( m_rWW8Export.m_pO->end(), aZeroArr, aZeroArr+3);
1578 if (v == FontEmphasisMark::NONE)
1580 else if (v == (FontEmphasisMark::Accent | FontEmphasisMark::PosAbove))
1582 else if (v == (FontEmphasisMark::Circle | FontEmphasisMark::PosAbove))
1584 else if (v == (FontEmphasisMark::Dot | FontEmphasisMark::PosBelow))
1591 m_rWW8Export.m_pO->push_back( nVal );
1627 m_rWW8Export.m_pO->push_back( nColor );
1643 m_rWW8Export.InsUInt16( aSHD.
GetValue() );
1648 m_rWW8Export.m_pO->push_back( 10 );
1649 m_rWW8Export.InsUInt32( 0xFF000000 );
1651 m_rWW8Export.InsUInt16( 0x0000);
1654 namespace sw {
namespace util {
1665 OSL_ENSURE(
false,
"WW8AttributeOutput::TextINetFormat(..) - missing unvisited character format at hyperlink attribute" );
1683 m_rWW8Export.InsUInt16( m_rWW8Export.GetId( pFormat ) );
1692 OUString
const * pLinkStr,
1693 bool bIncludeEmptyPicLocation =
false )
1701 rWrt.
m_pChpPlc->AppendFkpEntry(rWrt.
Strm().
Tell(), aItems.size(), aItems.data());
1706 if ( bIncludeEmptyPicLocation &&
1707 ( c == 0x13 || c == 0x14 || c == 0x15 ) )
1714 if ( c == 0x01 && pLinkStr)
1719 const sal_uInt32 nLinkPosInDataStrm = rStrm.
Tell();
1721 const sal_uInt16 nEmptyHdrLen = 0x44;
1722 sal_uInt8 aEmptyHeader[ nEmptyHdrLen ] = { 0 };
1723 aEmptyHeader[ 4 ] = 0x44;
1724 rStrm.
WriteBytes( aEmptyHeader, nEmptyHdrLen );
1726 const sal_uInt16 nFixHdrLen = 0x19;
1727 sal_uInt8 const aFixHeader[ nFixHdrLen ] =
1729 0x08, 0xD0, 0xC9, 0xEA, 0x79, 0xF9, 0xBA, 0xCE,
1730 0x11, 0x8C, 0x82, 0x00, 0xAA, 0x00, 0x4B, 0xA9,
1731 0x0B, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
1736 sal_uInt32 nStrLen( pLinkStr->getLength() + 1 );
1742 const sal_uInt32 nCurrPos = rStrm.
Tell();
1743 rStrm.
Seek( nLinkPosInDataStrm );
1745 rStrm.
Seek( nCurrPos );
1762 aItems.push_back( 1 );
1764 rWrt.
m_pChpPlc->AppendFkpEntry(rWrt.
Strm().
Tell(), aItems.size(), aItems.data());
1770 return rField.
ExpandField(
true,
nullptr).replace(0x0A, 0x0B);
1779 pFieldP = m_pFieldMain.get();
1782 pFieldP = m_pFieldHdFt.get();
1785 pFieldP = m_pFieldFootnote.get();
1788 pFieldP = m_pFieldEdn.get();
1791 pFieldP = m_pFieldAtn.get();
1794 pFieldP = m_pFieldTextBxs.get();
1797 pFieldP = m_pFieldHFTextBxs.get();
1800 OSL_ENSURE(
false,
"what type of SubDoc is that?" );
1806 const OUString& rFieldCmd,
FieldFlags nMode )
1808 OUString sFieldCmd(rFieldCmd);
1827 assert(eFieldType <= 0x5F);
1831 const bool bIncludeEmptyPicLocation = ( eFieldType ==
ww::ePAGE );
1837 aField13[0] |= 0x80;
1838 aField13[1] =
static_cast< sal_uInt8 >(eFieldType);
1839 pFieldP->
Append( Fc2Cp( Strm().Tell() ), aField13 );
1847 bool bHandleBookmark =
false;
1854 bHandleBookmark =
true;
1857 if ( bHandleBookmark )
1861 const sal_uInt16 nSubType = pField->
GetSubType();
1867 aLinkStr = GetBookmarkName( nSubType, &aRefName, 0 );
1872 aLinkStr = GetBookmarkName( nSubType,
nullptr, rRField.
GetSeqNo() );
1884 static const sal_uInt8 aField14[2] = { 0x14, 0xff };
1885 pFieldP->
Append( Fc2Cp( Strm().Tell() ), aField14 );
1896 if( !sOut.isEmpty() )
1917 m_pChpPlc->AppendFkpEntry( Strm().Tell(), static_cast< short >(pArr - aArr), aArr );
1935 aField15[0] |= (0x4 << 5);
1942 aField15[1] |= 0x10;
1946 pFieldP->
Append( Fc2Cp( Strm().Tell() ), aField15 );
1958 const OUString sStr{ OUString::Concat(
" [") + rName +
"] " };
1965 std::vector<const SwTOXType*>::iterator it
1966 = std::find( m_aTOXArr.begin(), m_aTOXArr.end(), &rTOXType );
1967 if ( it != m_aTOXArr.end() )
1969 return it - m_aTOXArr.begin();
1971 m_aTOXArr.push_back( &rTOXType );
1972 return m_aTOXArr.size() - 1;
1986 SwFormTokens::iterator aIt = aPattern.begin();
1990 if (! aPattern.empty())
1992 bool bPgNumFnd =
false;
1995 while( ++aIt != aPattern.end() && !bPgNumFnd )
1997 eTType = aIt->eTokenType;
2011 sal_Int32
nCount = std::min<sal_Int32>(5, aIt->sText.getLength());
2012 rText = aIt->sText.copy(0, nCount);
2035 for (sal_uInt16 nI = 1; nI < nTOXLvl; ++nI)
2040 if ( !aPattern.empty() )
2042 SwFormTokens::iterator aIt = aPattern.begin();
2047 while ( ++aIt != aPattern.end() )
2049 eTType = aIt->eTokenType;
2067 if(GetExport().GetExportFormat() == MSWordExportBase::ExportFormat::RTF)
2074 for(
size_t i = 0;
i < pTextAttrs->
Count(); ++
i )
2084 const sal_uInt16 nSeqFieldNumber =
static_cast<const SwSetExpField*
>(pField)->GetSeqNumber();
2086 const SwFieldTypes* pFieldTypes = GetExport().m_rDoc.getIDocumentFieldsAccess().GetFieldTypes();
2087 bool bHaveFullBkm =
false;
2088 bool bHaveLabelAndNumberBkm =
false;
2089 bool bHaveCaptionOnlyBkm =
false;
2090 bool bHaveNumberOnlyBkm =
false;
2091 bool bRunSplittedAtSep =
false;
2092 for(
auto const & pFieldType : *pFieldTypes )
2105 const OUString& aText = rNode.
GetText();
2106 const sal_Int32 nCategoryStart = aText.indexOf(pRefField->
GetSetRefName());
2107 const sal_Int32 nPosBeforeSeparator = std::max(nCategoryStart, pHt->
GetStart());
2108 bool bCategoryFirst = nCategoryStart < pHt->
GetStart();
2109 sal_Int32 nSeparatorPos = 0;
2112 nSeparatorPos = aLocalAttrIter.
WhereNext();
2113 while (nSeparatorPos <= nPosBeforeSeparator)
2116 nSeparatorPos = aLocalAttrIter.
WhereNext();
2121 nSeparatorPos = nCategoryStart + pRefField->
GetSetRefName().getLength();
2123 sal_Int32 nRefTextPos = 0;
2124 if(nSeparatorPos < aText.getLength())
2127 if(nRefTextPos != nSeparatorPos)
2129 if(!bRunSplittedAtSep)
2134 bRunSplittedAtSep =
true;
2137 aLocalAttrIter.
SplitRun(nSeparatorPos);
2138 aLocalAttrIter.
SplitRun(nRefTextPos);
2140 else if (bCategoryFirst)
2142 if(!bRunSplittedAtSep)
2145 bRunSplittedAtSep =
true;
2147 aLocalAttrIter.
SplitRun(nSeparatorPos);
2160 sal_Int32 nLastAttrStart = 0;
2161 sal_Int32 nActAttr = aLocalAttrIter.
WhereNext();
2162 while (nActAttr < rNode.
GetText().getLength())
2164 nLastAttrStart = nActAttr;
2168 WriteBookmarkInActParagraph( sName +
"_full",
std::min(nCategoryStart, pHt->
GetStart()), nLastAttrStart );
2169 bHaveFullBkm =
true;
2174 if(!bHaveLabelAndNumberBkm)
2176 sName +=
"_label_and_number";
2178 WriteBookmarkInActParagraph( sName,
std::min(nCategoryStart, pHt->
GetStart()), std::max(nCategoryStart, pHt->
GetStart()) );
2183 sal_Int32 nCatLastRun = 0;
2184 sal_Int32 nNextAttr = aLocalAttrIter2.
WhereNext();
2185 while (nNextAttr < nSeparatorPos)
2187 nCatLastRun = nNextAttr;
2189 nNextAttr = aLocalAttrIter2.
WhereNext();
2191 WriteBookmarkInActParagraph( sName, pHt->
GetStart(), nCatLastRun );
2193 bHaveLabelAndNumberBkm =
true;
2199 if(!bHaveCaptionOnlyBkm)
2202 sal_Int32 nLastAttrStart = 0;
2203 sal_Int32 nActAttr = aLocalAttrIter.
WhereNext();
2204 while (nActAttr < rNode.
GetText().getLength())
2206 nLastAttrStart = nActAttr;
2210 WriteBookmarkInActParagraph( sName +
"_caption_only", nRefTextPos, nLastAttrStart );
2211 bHaveCaptionOnlyBkm =
true;
2217 if(!bHaveNumberOnlyBkm)
2219 WriteBookmarkInActParagraph( sName +
"_number_only", pHt->
GetStart(), pHt->
GetStart() );
2220 bHaveNumberOnlyBkm =
true;
2239 static const char sEntryEnd[] =
"\" ";
2242 OUString sStr = pTOX ->GetMSTOCExpression();
2243 if ( sStr.isEmpty() )
2245 OUString sUserTypeName;
2246 auto aType = pTOX->GetType();
2250 sUserTypeName = pTOX->GetTOXType()->GetTypeName();
2251 if ( !sUserTypeName.isEmpty() )
2263 sal_Int32 nCol = rColumns.size();
2268 if( GetExport().AddSectionBreaksForTOX() )
2272 pParent ? pParent->
GetFormat() :
nullptr, 0);
2276 sStr +=
"\\c \"" + OUString::number( nCol ) +
"\"";
2280 if (pTOX->GetTOXForm().IsCommaSeparated())
2284 sStr +=
"\\h \"A\" ";
2286 if (!sUserTypeName.isEmpty())
2288 sStr +=
"\\f \"" + sUserTypeName +
"\"";
2291 if (!pTOX->GetTOXForm().IsCommaSeparated())
2302 else if ((4 == nRet) || (2 == nRet))
2307 sStr +=
"\\e \"" + aFillText + sEntryEnd;
2314 if (!pTOX->IsFromObjectNames())
2317 const OUString& seqName = pTOX->GetSequenceName();
2318 if(!seqName.isEmpty())
2320 sStr +=
"\"" + seqName + sEntryEnd;
2326 else if( 3 == nRet || 4 == nRet )
2328 sStr +=
"\\p \"" + aText + sEntryEnd;
2344 sal_uInt16
n, nTOXLvl = pTOX->GetLevel();
2351 GetExport( ).m_bHideTabLeaderAndPageNumbers = true ;
2356 GetExport( ).m_bTabInTOC = true ;
2369 + OUStringChar(static_cast<char>(
'A' + GetExport( ).
GetId( *pTOX->GetTOXType() ) ))
2375 sStr +=
"\\b \"" + pTOX->GetBookmarkName() + sEntryEnd;
2402 for( n = rColls.
size(); n; )
2419 sal_uInt8 nMaxMSAutoEvaluate = nPosOfLowestNonStandardLvl < nTOXLvl ? nPosOfLowestNonStandardLvl : static_cast<sal_uInt8>(nTOXLvl);
2422 if ( nMaxMSAutoEvaluate )
2427 sStr +=
"\\o \"1-" + OUString::number(nMaxMSAutoEvaluate) + sEntryEnd;
2433 if( nMaxMSAutoEvaluate < nTOXLvl )
2436 for( n = rColls.
size(); n;)
2442 if (nTestLvl < nTOXLvl && nTestLvl >= nMaxMSAutoEvaluate)
2444 if (!sTOption.isEmpty())
2446 sTOption += pColl->
GetName() +
"," + OUString::number( nTestLvl + 1 );
2462 const OUString& rStyles = pTOX->GetStyleNames( n );
2463 if( !rStyles.isEmpty() )
2466 const OUString sLvl{
"," + OUString::number( n + 1 ) };
2469 if( !sStyle.isEmpty() )
2471 SwTextFormatColl* pColl = GetExport().m_rDoc.FindTextFormatCollByName(sStyle);
2476 if( !sTOption.isEmpty() )
2478 sTOption += sStyle + sLvl;
2482 }
while( -1 != nPos );
2491 bool bFirstFillText =
true, bOnlyText =
true;
2492 for( n = 0; n < nTOXLvl; ++n )
2501 nNoPgStt =
static_cast< sal_uInt8 >(n+1);
2509 bOnlyText = bOnlyText && 3 == nRet;
2510 if( 3 == nRet || 4 == nRet )
2512 if( bFirstFillText )
2514 else if( aFillText != aText )
2516 bFirstFillText =
false;
2525 + OUString::number( nNoPgStt )
2527 + OUString::number( nNoPgEnd )
2532 sStr +=
"\\p \"" + aFillText + sEntryEnd;
2536 if( !sTOption.isEmpty() )
2538 sStr +=
"\\t \"" + sTOption + sEntryEnd;
2548 if (!sStr.isEmpty())
2550 GetExport( ).m_bInWriteTOX =
true;
2551 if (GetExport().GetExportFormat() == MSWordExportBase::ExportFormat::RTF)
2553 StartRun(
nullptr, -42,
true);
2557 if (GetExport().GetExportFormat() == MSWordExportBase::ExportFormat::RTF)
2559 EndRun(
nullptr, -42,
true);
2564 GetExport( ).m_bStartTOX =
false;
2575 if ( pTOX->
GetType() ==
TOX_INDEX && GetExport().AddSectionBreaksForTOX() )
2579 sal_Int32 nCol = rColumns.size();
2588 GetExport( ).m_bInWriteTOX =
false;
2589 GetExport( ).m_bHideTabLeaderAndPageNumbers =
false;
2597 bool bHasFormat =
false;
2599 sal_uInt32 nFormatIdx = rField.
GetFormat();
2610 if (!sFormat.isEmpty())
2614 rStr =
"\\@\"" + sFormat +
"\" " ;
2627 rStr +=
"\\* ALPHABETIC ";
2631 rStr +=
"\\* alphabetic ";
2634 rStr +=
"\\* ROMAN ";
2637 rStr +=
"\\* roman ";
2640 rStr +=
"\\* Ordinal ";
2643 rStr +=
"\\* Ordtext ";
2646 rStr +=
"\\* Cardtext ";
2650 "Unknown numbering type exported as default of Arabic");
2653 rStr +=
"\\* ARABIC ";
2670 m_pChpPlc->AppendFkpEntry( Strm().Tell() );
2674 pOut->insert( pOut->end(),
aArr, pArr );
2676 m_pChpPlc->AppendFkpEntry( Strm().Tell(), static_cast< short >(pArr - aArr), aArr );
2682 return " " + OUString::createFromAscii(pField) +
" ";
2689 const OUString sExpand(rField.
GetPar2().replace(0x0A, 0x0B));
2691 m_rWW8Export.m_pChpPlc->AppendFkpEntry(m_rWW8Export.Strm().Tell());
2697 m_rWW8Export.m_pChpPlc->AppendFkpEntry(m_rWW8Export.Strm().Tell(),
sizeof(
aArr), aArr);
2703 const OUString &rVar = pSet->
GetPar2();
2705 sal_uLong nFrom = m_rWW8Export.Fc2Cp(m_rWW8Export.Strm().Tell());
2718 m_rWW8Export.MoveFieldMarks(nFrom,m_rWW8Export.Fc2Cp(m_rWW8Export.Strm().Tell()));
2720 if (!rVar.isEmpty())
2730 m_rWW8Export.m_pAtn->Append( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ), pPField );
2731 m_rWW8Export.WritePostItBegin( m_rWW8Export.m_pO.get() );
2737 uno::Sequence<OUString> aItems =
2739 GetExport().DoComboBox(rField2.
GetName(),
2757 if ( !sVar.isEmpty() )
2773 OUString EscapeToken(
const OUString& rCommand)
2775 bool bWasEscaped =
false;
2777 const int nBufferLen = rCommand.getLength()*1.5;
2778 OUStringBuffer sResult(nBufferLen);
2779 sResult.append(
'"');
2780 for (sal_Int32 i = 0;
i < rCommand.getLength(); ++
i)
2789 sResult.append(
'\\');
2801 sResult.append(
'"');
2802 return sResult.makeStringAndClear();
2812 bool bWriteExpand =
false;
2813 const sal_uInt16 nSubType = pField->
GetSubType();
2824 bWriteExpand =
true;
2830 if (GetExport().FieldsQuoted())
2835 GetExport().OutputField(pField,
ww::eSEQ, sStr);
2839 bool bShowAsWell =
false;
2842 const OUString sVar = pSet->
GetPar2();
2861 SetField( *pField, eFieldNo, sStr );
2864 RefField( *pSet, pSet->
GetPar1() );
2867 bWriteExpand =
true;
2873 GetExport().OutputField(pField,
ww::ePAGE, sStr);
2887 + EscapeToken(static_cast<SwDBFieldType *>(pField->
GetTyp())->GetColumnName()) +
" ";
2905 GetExport().OutputField(pField, eField,
FieldString(eField));
2913 bWriteExpand =
true;
2918 switch (0xff & nSubType)
2941 else if (GetExport().GetNumberFormat(*pField, sStr) || sStr.isEmpty())
2945 bWriteExpand =
false;
2954 else if (GetExport().GetNumberFormat(*pField, sStr) || sStr.isEmpty())
2960 (GetExport().GetNumberFormat(*pField, sStr) || sStr.isEmpty()))
2969 if (pDocInfoField !=
nullptr)
2970 sStr =
"\"" + pDocInfoField->
GetName() +
"\"";
2972 bWriteExpand =
false;
2979 if (!bWriteExpand && eField !=
ww::eNONE)
2981 GetExport().OutputField(pField, eField,
FieldString(eField) + sStr);
2984 bWriteExpand =
true;
2990 if (!GetExport().GetNumberFormat(*pField, sStr))
2991 bWriteExpand =
true;
2995 GetExport().OutputField(pField, eField,
FieldString(eField) + sStr);
3020 GetExport().OutputField(pField, eField, sStr);
3023 bWriteExpand =
true;
3029 switch (0xFF & nSubType)
3048 GetExport().OutputField(pField, eField,
FieldString(eField));
3051 bWriteExpand =
true;
3056 OUString sRet(static_cast<SwAuthorityField const*>(pField)
3072 PostitField( pField );
3080 GetExport().DoFormText(pInputField);
3086 GetExport().OutputField(pField,
ww::eFILLIN, sStr);
3130 if(GetExport().GetExportFormat() == MSWordExportBase::ExportFormat::RTF)
3155 sName +=
"_label_and_number";
3158 sName +=
"_caption_only";
3161 sName +=
"_number_only";
3209 sStr +=
" \\p \\h ";
3212 sStr +=
" \\n \\h ";
3218 GetExport().OutputField(pField, eField, sStr);
3221 bWriteExpand =
true;
3243 tools::Long nHeight = GetExport().GetItem(nFontHeightWhich).GetHeight();
3245 nHeight = (nHeight + 10) / 20;
3252 const sal_Int32 nAbove = (pField->
GetPar1().getLength()+1)/2;
3255 + OUString::number(nHeight/2)
3257 + pField->
GetPar1().subView(0, nAbove)
3259 + OUString::number(nHeight/5)
3261 + pField->
GetPar1().subView(nAbove)
3263 GetExport().OutputField(pField,
ww::eEQ, sStr);
3267 bWriteExpand = DropdownField( pField );
3270 bWriteExpand =
true;
3273 const SwTextNode *pTextNd = GetExport().GetHdFtPageRoot();
3276 pTextNd = GetExport().m_pCurPam->GetNode().
GetTextNode();
3281 SwChapterField aCopy(*static_cast<const SwChapterField*>(pField));
3285 + OUString::number(aCopy.
GetLevel() + 1)
3286 +
" \\* MERGEFORMAT ";
3288 bWriteExpand =
false;
3294 OUString sExpand(pField->
GetPar2());
3295 if (!sExpand.isEmpty())
3297 HiddenField( *pField );
3302 bWriteExpand = PlaceholderField( pField );
3306 const OUString sStr =
" MACROBUTTON "
3307 + pField->
GetPar1().replaceFirst(
"StarOffice.Standard.Modul1.",
"")
3317 GetExport().OutputField(pField, eField, aExpand);
3324 GetExport().OutputField(pField, eField, aExpand);
3328 bWriteExpand =
true;
3333 WriteExpand( pField );
3338 if (
auto pTextNd = dynamic_cast< const SwContentNode *>( GetExport().m_pOutFormatNode ) )
3341 Point aLayPos = pTextNd->FindLayoutRect(
false, &origin ).Pos();
3346 OutputFlyFrame_Impl( aFrame, aLayPos );
3363 m_rWW8Export.m_pO->push_back( rHyphenZone.
IsHyphen() ? 0 : 1 );
3369 m_rWW8Export.m_pO->push_back( rScriptSpace.
GetValue() ? 1 : 0 );
3375 m_rWW8Export.m_pO->push_back( rItem.
GetValue() ? 1 : 0 );
3381 m_rWW8Export.m_pO->push_back( rItem.
GetValue() ? 1 : 0 );
3389 m_rWW8Export.m_pO->push_back( rGrid.GetValue() ? 1 : 0 );
3419 OSL_FAIL(
"Unknown vert alignment" );
3422 m_rWW8Export.InsUInt16( nVal );
3432 const bool bAutoNum = rFootnote.
GetNumStr().isEmpty();
3437 0x03, 0x6a, 0, 0, 0, 0,
3441 aAttrArr.insert(aAttrArr.end(), aSpec, aSpec+
sizeof(aSpec));
3459 m_pChpPlc->AppendFkpEntry( Strm().Tell() );
3470 pOutArr->insert( pOutArr->begin(), aAttrArr.begin(), aAttrArr.end() );
3474 std::unique_ptr<ww::bytes> pOwnOutArr(
new ww::bytes);
3478 pOwnOutArr->insert(pOwnOutArr->begin(), aAttrArr.begin(), aAttrArr.end());
3484 std::unique_ptr<ww::bytes> pOld = std::move(m_pO);
3485 m_pO = std::move(pOwnOutArr);
3500 pOwnOutArr = std::move(m_pO);
3501 m_pO = std::move(pOld);
3503 m_pChpPlc->AppendFkpEntry( Strm().Tell(), pOwnOutArr->size(),
3504 pOwnOutArr->data() );
3534 if ( GetExport().m_bEndAtTextEnd )
3540 if ( GetExport().m_bFootnoteAtTextEnd )
3551 GetExport().AppendBookmark( sBkmkNm );
3554 TextFootnote_Impl( rFootnote );
3556 if ( !sBkmkNm.isEmpty() )
3557 GetExport().AppendBookmark( sBkmkNm );
3564 pFootnoteEnd = m_rWW8Export.m_pEdn.get();
3566 pFootnoteEnd = m_rWW8Export.m_pFootnote.get();
3568 pFootnoteEnd->
Append( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ), rFootnote );
3569 m_rWW8Export.WriteFootnoteBegin( rFootnote, m_rWW8Export.m_pO.get() );
3578 m_rWW8Export.InsUInt16( m_rWW8Export.GetId( rCharFormat.
GetCharFormat() ) );
3592 m_rWW8Export.m_pO->push_back(
sal_uInt8(0x06) );
3593 m_rWW8Export.m_pO->push_back(
sal_uInt8(0x02) );
3613 if (!cStart && !cEnd)
3615 else if ((cStart ==
'{') || (cEnd ==
'}'))
3617 else if ((cStart ==
'<') || (cEnd ==
'>'))
3619 else if ((cStart ==
'[') || (cEnd ==
']'))
3623 m_rWW8Export.InsUInt16( nType );
3624 static const sal_uInt8 aZeroArr[ 3 ] = { 0, 0, 0 };
3625 m_rWW8Export.m_pO->insert( m_rWW8Export.m_pO->end(), aZeroArr, aZeroArr+3);
3630 sal_uInt16 nOutLvl = rItem.
GetValue();
3634 if (
auto pNd = dynamic_cast<const SwContentNode*>(GetExport().m_pOutFormatNode))
3636 else if (GetExport().m_bStyDef && GetExport().m_pCurrentStyle && GetExport().m_pCurrentStyle->DerivedFrom())
3638 if ((pInherited && pInherited->
GetValue() == nOutLvl)
3639 || (!pInherited && !nOutLvl))
3642 ParaOutlineLevel(rItem);
3650 ParaNumRule_Impl(pTextNd, 0, 0);
3653 const SwNumRule* pRule = GetExport().m_rDoc.FindNumRulePtr(
3658 sal_uInt16 nNumId = GetExport().GetNumberingId(*pRule) + 1;
3661 if (!GetExport().m_pOutFormatNode)
3663 ParaNumRule_Impl(pTextNd, nLvl, nNumId);
3667 if ( dynamic_cast< const SwContentNode *>( GetExport().m_pOutFormatNode ) !=
nullptr )
3669 pTextNd =
static_cast<const SwTextNode*
>(GetExport().m_pOutFormatNode);
3681 nLvl =
static_cast< sal_uInt8 >(nLevel);
3686 OUString
const listId(pTextNd->
GetListId());
3687 if (!listId.isEmpty()
3692 SwList const*
const pList(
3698 pList->GetDefaultListStyleName()));
3699 assert(pAbstractRule);
3703 nNumId = GetExport().DuplicateAbsNum(listId, *pAbstractRule) + 1;
3707 nNumId = GetExport().OverrideNumRule(
3708 *pRule, listId, *pAbstractRule) + 1;
3724 nNumId = GetExport().DuplicateNumRule(pRule, nLvl, nStartWith);
3725 if (USHRT_MAX != nNumId)
3737 else if (
auto pC = dynamic_cast< const SwTextFormatColl *>( GetExport().m_pOutFormatNode ) )
3739 if ( pC && pC->IsAssignedToListLevelOfOutlineStyle() )
3740 nLvl = static_cast< sal_uInt8 >( pC->GetAssignedOutlineStyleLevel() );
3743 const SfxItemSet* pSet = GetExport().m_pISet;
3755 ParaNumRule_Impl( pTextNd, nLvl, nNumId);
3759 sal_Int32
const nLvl, sal_Int32
const nNumId)
3761 if (USHRT_MAX == nNumId)
3766 m_rWW8Export.m_pO->push_back( ::sal::static_int_cast<sal_uInt8>(nLvl) );
3775 if( m_rWW8Export.m_bOutFlyFrameAttrs )
3777 if( m_rWW8Export.m_bOutGrf )
3785 m_rWW8Export.InsUInt16( o3tl::narrowing<sal_uInt16>(rSize.
GetWidth()) );
3798 default: nH = o3tl::narrowing<sal_uInt16>(rSize.
GetHeight()) | 0x8000;
break;
3800 m_rWW8Export.InsUInt16( nH );
3803 else if( m_rWW8Export.m_bOutPageDescs )
3805 if( m_rWW8Export.m_pCurrentPageDesc->GetLandscape() )
3809 m_rWW8Export.m_pO->push_back( 2 );
3814 m_rWW8Export.InsUInt16(
3819 m_rWW8Export.InsUInt16(
3835 OSL_ENSURE( nChar,
"replaced with 0 crashes WW97/95" );
3837 bool bReplaced =
false;
3839 sal_uInt64 nRetPos = 0,
nPos = rStrm.
Tell();
3843 sal_uInt16 nUCode=0;
3850 if ((nChar == 0x0c) &&
3863 if( nUCode == 0x0d )
3872 else if ((nUCode == 0x0c) && (nChar == 0x0e))
3886 m_pPiece->SetParaBreak();
3887 m_pPapPlc->AppendFkpEntry(rStrm.
Tell());
3888 m_pChpPlc->AppendFkpEntry(rStrm.
Tell());
3889 nRetPos = rStrm.
Tell();
3897 m_rWW8Export.WriteChar( 0x07 );
3898 else if ( nDepth > 1 )
3899 m_rWW8Export.WriteChar( 0x0d );
3909 if ( GetExport().m_bStyDef )
3910 if (
auto pC = dynamic_cast< const SwTextFormatColl *>( GetExport().m_pOutFormatNode ) )
3922 m_rWW8Export.m_pO->push_back( bBreak ? 1 : 0 );
3932 if ( GetExport().m_bStyDef )
3936 case SvxBreak::NONE:
3937 case SvxBreak::PageBefore:
3938 case SvxBreak::PageBoth:
3939 PageBreakBefore( rBreak.GetValue() != SvxBreak::NONE );
3945 else if ( !GetExport().m_pParentFrame )
3948 bool bBefore =
false;
3950 bool bCheckForFollowPageDesc =
false;
3954 case SvxBreak::NONE:
3955 if ( !GetExport().m_bBreakBefore )
3956 PageBreakBefore(
false );
3959 case SvxBreak::ColumnBefore:
3962 case SvxBreak::ColumnAfter:
3963 case SvxBreak::ColumnBoth:
3965 || GetExport().Sections().CurrentNumberOfColumns( GetExport().
m_rDoc ) > 1 )
3971 case SvxBreak::PageBefore:
3976 if (GetExport().PreferPageBreakBefore())
3978 if (!GetExport().m_bBreakBefore)
3979 PageBreakBefore(
true);
3987 case SvxBreak::PageAfter:
3988 case SvxBreak::PageBoth:
3992 if ( dynamic_cast< const SwTextNode* >( GetExport().m_pOutFormatNode ) &&
3993 GetExport().GetCurItemSet() )
3995 bCheckForFollowPageDesc =
true;
4003 if ( ( bBefore == GetExport().m_bBreakBefore ) && nC )
4006 bool bFollowPageDescWritten =
false;
4007 if ( bCheckForFollowPageDesc )
4009 bFollowPageDescWritten =
4010 GetExport().OutputFollowPageDesc( GetExport().GetCurItemSet(),
4011 dynamic_cast<const SwTextNode*>( GetExport().m_pOutFormatNode ) );
4013 if ( !bFollowPageDescWritten )
4015 SectionBreak(nC, !bBefore);
4023 m_rWW8Export.ReplaceCr( nC );
4031 sal_uInt32 nPageCharSize = 0;
4033 if (pSwFormat !=
nullptr)
4040 sal_Int32 nCharWidth = nPitch - nPageCharSize;
4041 sal_Int32 nFraction = nCharWidth % 20;
4042 if ( nCharWidth < 0 )
4043 nFraction = 20 + nFraction;
4044 nFraction = ( nFraction * 0xFFF ) / 20;
4045 nFraction = ( nFraction & 0x00000FFF );
4047 sal_Int32 nMain = nCharWidth / 20;
4048 if ( nCharWidth < 0 )
4050 nMain = nMain * 0x1000;
4051 nMain = ( nMain & 0xFFFFF000 );
4053 return sal_uInt32( nFraction + nMain );
4058 if (!m_rWW8Export.m_bOutPageDescs)
4061 sal_uInt16 nGridType = 0;
4065 OSL_FAIL(
"Unknown grid type");
4081 m_rWW8Export.InsUInt16( nGridType );
4085 m_rWW8Export.InsUInt16( nHeight );
4088 m_rWW8Export.InsUInt32( GridCharacterPitch( rGrid ) );
4093 if ( !m_rWW8Export.m_bOutPageDescs )
4097 switch ( rPaperBin.GetValue() )
4099 case 0: nVal = 15;
break;
4100 case 1: nVal = 1;
break;
4101 case 2: nVal = 4;
break;
4102 default: nVal = 0;
break;
4107 m_rWW8Export.InsUInt16( m_rWW8Export.m_bOutFirstPage
4110 m_rWW8Export.InsUInt16( nVal );
4118 if ( m_rWW8Export.m_bOutFlyFrameAttrs )
4123 m_rWW8Export.InsUInt16( o3tl::narrowing<sal_uInt16>( ( rLR.
GetLeft() + rLR.
GetRight() ) / 2 ) );
4125 else if ( m_rWW8Export.m_bOutPageDescs )
4127 m_pageMargins.nLeft = 0;
4128 m_pageMargins.nRight = 0;
4132 m_pageMargins.nLeft = pBoxItem->CalcLineSpace( SvxBoxItemLine::LEFT,
true );
4133 m_pageMargins.nRight = pBoxItem->CalcLineSpace( SvxBoxItemLine::RIGHT,
true );
4136 m_pageMargins.nLeft += sal::static_int_cast<sal_uInt16>(rLR.
GetLeft());
4137 m_pageMargins.nRight += sal::static_int_cast<sal_uInt16>(rLR.
GetRight());
4142 m_rWW8Export.InsUInt16( m_pageMargins.nLeft );
4146 m_rWW8Export.InsUInt16( m_pageMargins.nRight );
4152 m_rWW8Export.InsUInt16(nGutter);
4158 m_rWW8Export.InsUInt16( 0x845E );
4159 m_rWW8Export.InsUInt16( o3tl::narrowing<sal_uInt16>(rLR.
GetTextLeft()) );
4162 m_rWW8Export.InsUInt16( 0x845D );
4163 m_rWW8Export.InsUInt16( o3tl::narrowing<sal_uInt16>(rLR.
GetRight()) );
4166 m_rWW8Export.InsUInt16( 0x8460 );
4180 m_rWW8Export.m_pO->push_back(1);
4186 m_rWW8Export.WriteChar(0x0b);
4190 m_rWW8Export.m_pO->push_back(rLineBreak.
GetEnumValue());
4197 if ( m_rWW8Export.m_bOutFlyFrameAttrs )
4202 m_rWW8Export.InsUInt16( o3tl::narrowing<sal_uInt16>( ( rUL.
GetUpper() + rUL.
GetLower() ) / 2 ) );
4204 else if ( m_rWW8Export.m_bOutPageDescs )
4206 OSL_ENSURE( m_rWW8Export.GetCurItemSet(),
"Impossible" );
4207 if ( !m_rWW8Export.GetCurItemSet() )
4212 if ( aDistances.HasHeader() )
4216 m_rWW8Export.InsUInt16( aDistances.dyaHdrTop );
4221 m_rWW8Export.InsUInt16( aDistances.dyaTop );
4222 m_pageMargins.nTop = aDistances.
dyaTop;
4224 if ( aDistances.HasFooter() )
4228 m_rWW8Export.InsUInt16( aDistances.dyaHdrBottom );
4233 m_rWW8Export.InsUInt16( aDistances.dyaBottom );
4234 m_pageMargins.nBottom = aDistances.dyaBottom;
4240 m_rWW8Export.InsUInt16( rUL.
GetUpper() );
4243 m_rWW8Export.InsUInt16( rUL.
GetLower() );
4250 if (
auto pNd = dynamic_cast<const SwContentNode*>(m_rWW8Export.m_pOutFormatNode))
4251 pInherited = &static_cast<SwTextFormatColl&>(pNd->GetAnyFormatColl()).GetAttrSet().GetULSpace();
4252 else if (m_rWW8Export.m_bStyDef && m_rWW8Export.m_pCurrentStyle && m_rWW8Export.m_pCurrentStyle->DerivedFrom())
4253 pInherited = &m_rWW8Export.m_pCurrentStyle->DerivedFrom()->GetULSpace();
4258 m_rWW8Export.m_pO->push_back( static_cast<sal_uInt8>(rUL.
GetContext()) );
4267 if ( m_rWW8Export.m_bOutFlyFrameAttrs )
4271 m_rWW8Export.m_pO->push_back(
4272 ( css::text::WrapTextMode_NONE != rSurround.
GetSurround() ) ? 2 : 1 );
4280 if ( !m_rWW8Export.m_bOutFlyFrameAttrs )
4287 nPos =
static_cast<short>(rFlyVert.
GetPos());
4289 case text::VertOrientation::CENTER:
4290 case text::VertOrientation::LINE_CENTER:
4293 case text::VertOrientation::BOTTOM:
4294 case text::VertOrientation::LINE_BOTTOM:
4297 case text::VertOrientation::TOP:
4298 case text::VertOrientation::LINE_TOP:
4306 m_rWW8Export.InsUInt16( nPos );
4311 if ( !m_rWW8Export.m_pParentFrame )
4313 OSL_ENSURE( m_rWW8Export.m_pParentFrame,
"HoriOrient without mpParentFrame !!" );
4318 if ( !m_rWW8Export.m_bOutFlyFrameAttrs )
4325 nPos =
static_cast<short>(rFlyHori.
GetPos());
4329 case text::HoriOrientation::LEFT:
4332 case text::HoriOrientation::RIGHT:
4335 case text::HoriOrientation::CENTER:
4336 case text::HoriOrientation::FULL:
4344 m_rWW8Export.InsUInt16( nPos );
4349 OSL_ENSURE( m_rWW8Export.m_pParentFrame,
"Anchor without mpParentFrame !!" );
4351 if ( !m_rWW8Export.m_bOutFlyFrameAttrs )
4357 case RndStdIds::FLY_AT_PAGE:
4359 nP |= (1 << 4) | (2 << 6);
4362 case RndStdIds::FLY_AT_FLY:
4363 case RndStdIds::FLY_AT_CHAR:
4364 case RndStdIds::FLY_AT_PARA:
4365 case RndStdIds::FLY_AS_CHAR:
4367 nP |= (2 << 4) | (0 << 6);
4375 m_rWW8Export.m_pO->push_back( nP );
4381 if ( m_rWW8Export.m_bOutPageDescs )
4388 m_rWW8Export.InsUInt16( aSHD.
GetValue() );
4391 m_rWW8Export.m_pO->push_back( 10 );
4392 m_rWW8Export.InsUInt32( 0xFF000000 );
4394 m_rWW8Export.InsUInt16( 0x0000 );
4400 if ( m_rWW8Export.m_bOutPageDescs )
4404 if ( rFillStyle.GetValue() != drawing::FillStyle_NONE )
4409 m_rWW8Export.InsUInt16( 0xffff );
4413 m_rWW8Export.m_pO->push_back( 10 );
4414 m_rWW8Export.InsUInt32( 0xFF000000 );
4415 m_rWW8Export.InsUInt32( 0xFF000000 );
4416 m_rWW8Export.InsUInt16( 0x0000 );
4424 sal_uInt16 nDist,
bool bShadow)
4426 sal_uInt32 nColBGR = 0;
4427 sal_uInt16 nWidth = ::editeng::ConvertBorderWidthToWord(
4428 rLine.GetBorderLineStyle(), rLine.GetWidth());
4437 switch (rLine.GetBorderLineStyle())
4439 case SvxBorderLineStyle::SOLID:
4447 case SvxBorderLineStyle::DOTTED:
4450 case SvxBorderLineStyle::DASHED:
4453 case SvxBorderLineStyle::DOUBLE:
4454 case SvxBorderLineStyle::DOUBLE_THIN:
4457 case SvxBorderLineStyle::THINTHICK_SMALLGAP:
4460 case SvxBorderLineStyle::THINTHICK_MEDIUMGAP:
4463 case SvxBorderLineStyle::THINTHICK_LARGEGAP:
4466 case SvxBorderLineStyle::THICKTHIN_SMALLGAP:
4469 case SvxBorderLineStyle::THICKTHIN_MEDIUMGAP:
4472 case SvxBorderLineStyle::THICKTHIN_LARGEGAP:
4475 case SvxBorderLineStyle::EMBOSSED:
4478 case SvxBorderLineStyle::ENGRAVED:
4481 case SvxBorderLineStyle::OUTSET:
4484 case SvxBorderLineStyle::INSET:
4487 case SvxBorderLineStyle::FINE_DASHED:
4490 case SvxBorderLineStyle::DASH_DOT:
4493 case SvxBorderLineStyle::DASH_DOT_DOT:
4501 nWidth = (( nWidth * 8 ) + 10 ) / 20;
4513 sal_uInt16 nLDist = rtl::math::round(nDist / 20.0);
4528 sal_uInt16 nDist, sal_uInt16 nSprmNo, sal_uInt16 nSprmNoVer9,
bool bShadow)
4530 OSL_ENSURE( ( nSprmNo == 0 ) ||
4531 ( nSprmNo >= 38 && nSprmNo <= 41 ) ||
4536 "Sprm for border out is of range" );
4541 if( pLine && pLine->GetBorderLineStyle() != SvxBorderLineStyle::NONE )
4543 aBrcVer9 = TranslateBorderLine( *pLine, nDist, bShadow );
4553 rO.insert( rO.end(), aBrcVer8.
aBits1, aBrcVer8.
aBits2+2 );
4555 if ( nSprmNoVer9 != 0 )
4559 rO.insert( rO.end(), aBrcVer9.
aBits1, aBrcVer9.
aBits2+4);
4573 SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT
4575 static const sal_uInt16 aPBrc[] =
4584 static const sal_uInt16 aSBrc[] =
4595 for( sal_uInt16
i = 0;
i < 4; ++
i, ++pBrd )
4597 const SvxBorderLine* pLn = rBox.
GetLine( *pBrd );
4599 sal_uInt16 nSprmNo, nSprmNoVer9 = 0;
4600 if (m_bOutPageDescs)
4603 nSprmNoVer9 = aSBrc[
i+4];
4608 nSprmNoVer9 = aPBrc[
i+4];
4611 Out_BorderLine( *m_pO, pLn, rBox.
GetDistance( *pBrd ), nSprmNo,
4612 nSprmNoVer9, bShadow );
4629 SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT
4631 static const SvxBorderLine aBorderLine;
4635 const SvxBorderLine* pLn;
4636 if (pBox !=
nullptr)
4637 pLn = pBox->
GetLine( rBorder );
4639 pLn = & aBorderLine;
4641 Out_BorderLine(rO, pLn, 0, 0, 0,
false);
4653 SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::RIGHT
4656 for(
int i = 0;
i < 4; ++
i )
4658 const SvxBorderLine* pLn = pBox->
GetLine( aBorders[
i] );
4663 m_pO->push_back( 11 );
4664 m_pO->push_back( nStart );
4665 m_pO->push_back( nLimit );
4666 m_pO->push_back( 1<<i );
4667 WW8_BRCVer9 aBrcVer9 = TranslateBorderLine( *pLn, 0,
false );
4668 m_pO->insert( m_pO->end(), aBrcVer9.
aBits1, aBrcVer9.
aBits2+4 );
4676 if ( m_rWW8Export.m_bOutGrf )
4679 bool bShadow =
false;
4683 bShadow = ( pShadowItem->
GetLocation() != SvxShadowLocation::NONE )
4684 && ( pShadowItem->
GetWidth() != 0 );
4688 if (m_rWW8Export.m_bOutPageDescs)
4701 m_rWW8Export.Out_SwFormatBox( aBox, bShadow );
4706 const SwFrameFormat* pFormat = m_pCurrentPageDesc ? &m_pCurrentPageDesc->GetMaster()
4720 m_rWW8Export.InsUInt16( nCols - 1 );
4734 m_rWW8Export.m_pO->push_back( bEven ? 1 : 0 );
4739 for ( sal_uInt16
n = 0;
n < nCols; ++
n )
4743 m_rWW8Export.m_pO->push_back( static_cast<sal_uInt8>(
n) );
4744 m_rWW8Export.InsUInt16( rCol.
4746 o3tl::narrowing<sal_uInt16>(nPageSize) ) );
4748 if (
n + 1 != nCols )
4752 m_rWW8Export.m_pO->push_back( static_cast<sal_uInt8>(
n) );
4753 m_rWW8Export.InsUInt16( rColumns[
n].GetRight( ) +
4754 rColumns[
n + 1].GetLeft( ) );
4763 sal_uInt16 nCols = rColumns.size();
4764 if (1 >= nCols || GetExport( ).m_bOutFlyFrameAttrs)
4769 const SwFrameFormat* pFormat = GetExport( ).m_pCurrentPageDesc ? &GetExport( ).m_pCurrentPageDesc->GetMaster() : &
const_cast<const SwDoc&
>(GetExport().m_rDoc).GetPageDesc(0).GetMaster();
4772 if ( frameDirection.GetValue() == SvxFrameDirection::Vertical_RL_TB || frameDirection.GetValue() == SvxFrameDirection::Vertical_LR_TB )
4813 sal_uInt16 nColWidth = rCol.
CalcPrtColWidth( 0, o3tl::narrowing<sal_uInt16>(nPageSize) );
4814 for ( n = 1; n < nCols; n++ )
4816 short nDiff = nColWidth -
4819 if ( nDiff > 10 || nDiff < -10 )
4827 FormatColumns_Impl( nCols, rCol, bEven, nPageSize );
4836 m_rWW8Export.m_pO->push_back( rKeep.GetValue() ? 1 : 0 );
4845 m_rWW8Export.m_pO->push_back( rNumbering.
IsCount() ? 0 : 1 );
4855 m_rWW8Export.InsUInt16( nSpace );
4856 m_rWW8Export.InsUInt16( nMulti );
4861 short nSpace = 240, nMulti = 0;
4867 case SvxLineSpaceRule::Fix:
4870 case SvxLineSpaceRule::Min:
4873 case SvxLineSpaceRule::Auto:
4879 sal_uInt16 nScript =
4880 i18n::ScriptType::LATIN;
4882 if (
auto pFormat = dynamic_cast< const SwFormat *>( GetExport().m_pOutFormatNode ) )
4884 pSet = &pFormat->GetAttrSet();
4886 else if (
auto pNd = dynamic_cast< const SwTextNode *>( GetExport().m_pOutFormatNode ) )
4888 pSet = &pNd->GetSwAttrSet();
4891 OSL_ENSURE( pSet,
"No attrset for lineheight :-(" );
4901 nSpace = static_cast<short>( ( 240L * rSpacing.
GetPropLineSpace() ) / 100L );
4910 ParaLineSpacing_Impl( nSpace, nMulti );
4920 case SvxAdjust::Left:
4924 case SvxAdjust::Right:
4928 case SvxAdjust::BlockLine:
4929 case SvxAdjust::Block:
4930 nAdj = nAdjBiDi = 3;
4932 case SvxAdjust::Center:
4933 nAdj = nAdjBiDi = 1;
4940 m_rWW8Export.m_pO->push_back(nAdj);
4948 bool bBiDiSwap =
false;
4949 if (m_rWW8Export.m_pOutFormatNode)
4952 if (
auto pTN = dynamic_cast<const SwTextNode*>(m_rWW8Export.m_pOutFormatNode))
4955 nDirection = m_rWW8Export.m_rDoc.GetTextDirection(aPos);
4957 else if (
auto pC = dynamic_cast<const SwTextFormatColl*>(m_rWW8Export.m_pOutFormatNode))
4960 nDirection = rItem.GetValue();
4962 if ( ( nDirection == SvxFrameDirection::Horizontal_RL_TB ) ||
4970 m_rWW8Export.m_pO->push_back(nAdjBiDi);
4972 m_rWW8Export.m_pO->push_back(nAdj);
4977 sal_uInt16 nTextFlow=0;
4981 if ( nDir == SvxFrameDirection::Environment )
4982 nDir = GetExport( ).GetDefaultFrameDirection( );
4989 OSL_FAIL(
"Unknown frame direction");
4991 case SvxFrameDirection::Horizontal_LR_TB:
4994 case SvxFrameDirection::Horizontal_RL_TB:
4998 case SvxFrameDirection::Vertical_LR_TB:
4999 case SvxFrameDirection::Vertical_RL_TB:
5004 if ( m_rWW8Export.m_bOutPageDescs )
5007 m_rWW8Export.InsUInt16( nTextFlow );
5009 m_rWW8Export.m_pO->push_back( bBiDi ? 1 : 0 );
5011 else if ( !m_rWW8Export.m_bOutFlyFrameAttrs )
5014 m_rWW8Export.m_pO->push_back( bBiDi ? 1 : 0 );
5030 nOutLvl = nOutLvl ? nOutLvl - 1 : 9;
5032 m_rWW8Export.m_pO->push_back( nOutLvl );
5040 m_rWW8Export.m_pO->push_back( rSplit.GetValue() ? 0 : 1 );
5052 m_rWW8Export.m_pO->push_back( rWidows.GetValue() ? 1 : 0 );
5059 std::unique_ptr<sal_uInt8[]> pDel;
5060 std::unique_ptr<sal_uInt8[]> pAddPos;
5061 std::unique_ptr<sal_uInt8[]> pAddTyp;
5065 SwWW8WrTabu(
const SwWW8WrTabu&) =
delete;
5066 SwWW8WrTabu& operator=(
const SwWW8WrTabu&) =
delete;
5069 SwWW8WrTabu(sal_uInt16 nDelMax, sal_uInt16 nAddMax);
5078 SwWW8WrTabu::SwWW8WrTabu(sal_uInt16 nDelMax, sal_uInt16 nAddMax)
5082 pDel.reset(
new sal_uInt8[nDelMax * 2] );
5083 pAddPos.reset(
new sal_uInt8[nAddMax * 2] );
5084 pAddTyp.reset(
new sal_uInt8[nAddMax] );
5093 ShortToSVBT16(msword_cast<sal_Int16>(rTS.
GetTabPos() + nAdjustment),
5094 pAddPos.get() + (nAdd * 2));
5100 case SvxTabAdjust::Right:
5103 case SvxTabAdjust::Center:
5106 case SvxTabAdjust::Decimal:
5135 pAddTyp[nAdd] = nPara;
5145 ShortToSVBT16(msword_cast<sal_Int16>(rTS.
GetTabPos() + nAdjustment),
5146 pDel.get() + (nDel * 2));
5153 void SwWW8WrTabu::PutAll(
WW8Export& rWrt)
5157 OSL_ENSURE(nAdd <= 255,
"more than 255 added tabstops?");
5158 OSL_ENSURE(nDel <= 255,
"more than 244 removed tabstops?");
5164 sal_uInt16 nSiz = 2 * nDel + 3 * nAdd + 2;
5170 rWrt.
m_pO->push_back(msword_cast<sal_uInt8>(nSiz));
5172 rWrt.
m_pO->push_back(msword_cast<sal_uInt8>(nDel));
5175 rWrt.
m_pO->push_back(msword_cast<sal_uInt8>(nAdd));
5184 SwWW8WrTabu aTab( 0, rTStops.
Count());
5186 for( sal_uInt16
n = 0;
n < rTStops.
Count();
n++ )
5191 aTab.Add(rTS, nLParaMgn);
5193 aTab.PutAll( rWrt );
5200 nOneLeft == nTwoLeft &&
5213 SwWW8WrTabu aTab(rTStyle.
Count(), rTNew.
Count());
5221 if( nO < rTStyle.
Count() )
5223 pTO = &rTStyle[ nO ];
5239 if( nN < rTNew.
Count() )
5261 aTab.Del(*pTO, nLStypeMgn);
5264 else if( nNP < nOP )
5267 aTab.Add(*pTN, nLParaMgn);
5277 aTab.Del(*pTO, nLStypeMgn);
5278 aTab.Add(*pTN, nLParaMgn);
5284 aTab.PutAll( rWrt );
5292 if ( bTabsRelativeToIndex )
5296 if(
const auto pLR = pItem->DynamicWhichCast(
RES_LR_SPACE))
5297 nCurrentLeft = pLR->GetTextLeft();
5300 SAL_WARN(
"sw.ww8",
"m_rWW8Export has an RES_LR_SPACE item, but it's of the wrong type.");
5314 aParentTabs.
Insert( pParentTabs );
5320 if ( bTabsRelativeToIndex )
5343 if ( bTabsRelativeToIndex )
5350 *pStyleTabs, nStyleLeft,
5351 rTabStops, nCurrentLeft);
5358 switch ( rHt.
Which() )
5410 CharFontCJK( static_cast< const SvxFontItem& >( rHt ) );
5422 CharWeightCJK( static_cast< const SvxWeightItem& >( rHt ) );
5426 CharFontCTL( static_cast< const SvxFontItem& >( rHt ) );