24 #include <com/sun/star/i18n/ScriptType.hpp>
42 #include <section.hxx>
53 #include <lineinfo.hxx>
71 #include <unordered_set>
115 sal_uInt16
Count()
const {
return aPos.size(); }
122 #define WW8_RESERVED_SLOTS 15
128 sal_uInt16 nRet = m_pStyles->GetSlot( pFormat );
129 return ( nRet != 0x0fff ) ? nRet : 10;
136 sal_uInt16 nRet = m_pStyles->GetSlot( &rColl );
137 return ( nRet != 0xfff ) ? nRet : 0;
142 : m_rExport( rExport ),
143 m_bListStyles(bListStyles)
286 for(
size_t n = 1;
n < rArr.
size();
n++ )
294 for(
size_t n = 1;
n < rArr2.
size();
n++ )
311 for (
size_t i = 0;
i < rNumRuleTable.
size(); ++
i)
323 OStringBuffer aStyleIdBuf(rName.getLength());
324 for (
int i = 0;
i < rName.getLength(); ++
i)
327 if ((
'0' <= nChar && nChar <=
'9') ||
328 (
'a' <= nChar && nChar <=
'z') ||
329 (
'A' <= nChar && nChar <=
'Z'))
332 if (aStyleIdBuf.isEmpty() &&
'a' <= nChar && nChar <=
'z')
333 aStyleIdBuf.append(
char(nChar - (
'a' -
'A')));
335 aStyleIdBuf.append(
char(nChar));
338 return aStyleIdBuf.makeStringAndClear();
343 std::unordered_set<OString> aUsed;
346 aUsed.insert(
"normal");
358 if (aStyleId.isEmpty())
361 OString aLower(aStyleId.toAsciiLowerCase());
364 if (aUsed.insert(aLower).second)
371 while (!aUsed.insert(aLower + OString::number(nFree)).second)
374 m_aStyleIds.emplace_back(aStyleId + OString::number(nFree));
385 static void impl_SkipOdd(std::unique_ptr<ww::bytes>
const& pO, std::size_t nTableStrmTell)
387 if ( ( nTableStrmTell + pO->size() ) & 1 )
397 ShortToSVBT16( nLen, p );
399 ShortToSVBT16( nLen, p );
406 sal_uInt16 nWwNext, sal_uInt16 nWwId, sal_uInt16 ,
bool bAutoUpdate )
411 sal_uInt16 nBit16 = 0x1000;
415 nBit16 = nWwBase << 4;
419 nBit16 = nWwNext << 4;
423 pData +=
sizeof( sal_uInt16 );
425 nBit16 = bAutoUpdate ? 1 : 0;
432 sal_uInt16 nLen =
static_cast< sal_uInt16
>( ( pData - aWW8_STD ) + 1 +
433 (2 * (rName.getLength() + 1)) );
453 sal_uInt16 nStt, nEnd,
n;
467 for( n = nStt; n < nEnd; ++n )
488 for ( n = nStt; n < nEnd; ++n, ++pFlags )
497 i18n::ScriptType::LATIN, n) )
512 sal_uInt16 nLen = bParProp ? 2 : 0;
526 bool bInsDefCharSiz )
539 if ( bInsDefCharSiz )
549 ShortToSVBT16( nLen, pUpxLen );
594 sal_uInt16 nBase, nWwNext;
607 else if (aName.equalsIgnoreAsciiCase(
"Normal"))
610 const OUString aBaseName =
"LO-" + aName;
613 for (
int nSuffix = 0; ; ++nSuffix ) {
617 m_pFormatA[
n]->GetName().equalsIgnoreAsciiCase(aName) )
625 aName = aBaseName + OUString::number(++nSuffix);
634 else if (aName.equalsIgnoreAsciiCase(
"Internet Link"))
638 else if (aName.equalsIgnoreAsciiCase(
"Visited Internet Link"))
640 aName =
"FollowedHyperlink";
644 nBase, nWwNext,
GetWWId( *pFormat ), nPos,
671 0x0F, 0x00, 0x0A, 0x00, 0x01, 0x00, 0x5B, 0x00,
672 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
716 std::map<sal_uInt16, const SwNumRule*>::const_iterator it =
m_aNumRules.find(nId);
724 rtl_TextEncoding eChrSet)
725 : mbAlt(false), mePitch(ePitch), meFamily(eFamily), meChrSet(eChrSet)
849 std::map<wwFont, sal_uInt16>::const_iterator aIter =
maFonts.find(rFont);
851 nRet = aIter->second;
854 nRet = static_cast< sal_uInt16 >(
maFonts.size());
866 RTL_TEXTENCODING_SYMBOL));
869 RTL_TEXTENCODING_MS_1252));
878 if (
nullptr != pFont)
888 for (
const sal_uInt16* pId = aTypes; *pId; ++pId)
908 std::vector<const wwFont *> aFontList(
maFonts.size() );
910 for (
const auto& aFont :
maFonts )
911 aFontList[aFont.second] = &aFont.first;
928 std::vector<const wwFont *> aFontList(
AsVector() );
933 for (
auto aFont : aFontList )
934 aFont->Write(pTableStream);
945 std::vector<const wwFont *> aFontList(
AsVector() );
947 for (
auto aFont : aFontList )
948 aFont->WriteDocx(&rAttrOutput);
953 std::vector<const wwFont *> aFontList(
AsVector() );
955 for (
auto aFont : aFontList )
956 aFont->WriteRtf(&rAttrOutput);
966 aPos.push_back( nStartCpOrFc -
nOfs );
971 for(
const auto& rPos :
aPos )
981 : mbDocumentIsProtected( false )
1010 rExport.
m_pCurPam->GetPoint()->nNode = *pNd;
1027 AppendSection( *static_cast<const SwFormatPageDesc*>(pI), *pNd, pFormat, nRstLnNum );
1035 , m_bHeaderFooterWritten( false )
1039 aCps.push_back( 0 );
1062 OSL_ENSURE( !
aSects.empty(),
"no segment inserted yet" );
1077 aSet.SetParent( &rSet );
1085 return rColumns.size();
1102 aSects.emplace_back( pPd, pSectionFormat, nLnNumRestartNo, std::nullopt,
nullptr, bIsFirstParagraph );
1112 aCps.push_back( nStartCp );
1135 aCps.push_back( nStartCp );
1143 if( !rInfo.
m_aErgoSum.isEmpty() ) nInfoFlags |= 0x02;
1144 if( !rInfo.
m_aQuoVadis.isEmpty() ) nInfoFlags |= 0x04;
1151 if( 0x02 & nInfoFlags )
1161 if( 0x04 & nInfoFlags )
1174 while( 6 > nEmptyStt++ )
1205 rHeadFootFlags |= nFlag;
1215 rHeadFootFlags |= nFlag;
1222 if ( nFlag & nHFFlags )
1252 (reinterpret_cast<SwSectionFormat*>(sal_IntPtr(-1)) !=
pSectionFormat)
1269 sal_uInt16 nEnd = 0;
1272 if( !rSepInfo.pSectionFormat )
1283 else if( !( 1 & nEnd ) &&
1291 rWrt.
pDop->fFacingPages = rWrt.
pDop->fMirrorMargins =
true;
1295 if( !( 1 & nEnd ) &&
1298 rWrt.
pDop->fFacingPages =
true;
1301 if( !( 2 & nEnd ) &&
1304 rWrt.
pDop->fSwapBordersFacingPgs =
1305 rWrt.
pDop->fMirrorMargins =
true;
1319 (
static_cast<const SvxBoxItem*
>(pItem)->GetTop() ||
1320 static_cast<const SvxBoxItem*
>(pItem)->GetBottom() ||
1321 static_cast<const SvxBoxItem*
>(pItem)->GetLeft() ||
1322 static_cast<const SvxBoxItem*
>(pItem)->GetRight() );
1397 if ( pPdFormat != pPdFirstPgFormat )
1409 else if ( !nPgBorder )
1415 nPgBorder |= (1<<5);
1438 if ( oPageRestartNumber )
1452 if ( 2 != nBreakCode )
1469 memcpy( pA->
m_pData.get(),
pO->data(),
pO->size() );
1481 if ( drawing::TextVerticalAdjust_TOP == nVA )
1487 case drawing::TextVerticalAdjust_CENTER:
1490 case drawing::TextVerticalAdjust_BOTTOM:
1493 case drawing::TextVerticalAdjust_BLOCK:
1510 pSepx->OutHeaderFooter( *
this,
true, rFormat, nCpPos, nHeadFootFlags,
WW8_HEADER_ODD, nBreakCode );
1512 pSepx->OutHeaderFooter( *
this,
true, rLeftFormat, nCpPos, nHeadFootFlags, WW8_HEADER_EVEN, nBreakCode );
1514 pSepx->OutHeaderFooter( *
this,
true, rFormat, nCpPos, nHeadFootFlags,
WW8_HEADER_ODD, nBreakCode );
1518 pSepx->OutHeaderFooter( *
this,
false, rFormat, nCpPos, nHeadFootFlags,
WW8_FOOTER_ODD, nBreakCode );
1520 pSepx->OutHeaderFooter( *
this,
false, rLeftFormat, nCpPos, nHeadFootFlags, WW8_FOOTER_EVEN, nBreakCode );
1522 pSepx->OutHeaderFooter( *
this,
false, rFormat, nCpPos, nHeadFootFlags,
WW8_FOOTER_ODD, nBreakCode );
1527 pSepx->OutHeaderFooter( *
this,
true, rFirstPageFormat, nCpPos, nHeadFootFlags,
WW8_HEADER_FIRST, nBreakCode );
1528 pSepx->OutHeaderFooter( *
this,
false, rFirstPageFormat, nCpPos, nHeadFootFlags,
WW8_FOOTER_FIRST, nBreakCode );
1540 if (nBreakCode != 0)
1557 if (pSection == reinterpret_cast<SwSectionFormat*>(sal_IntPtr(-1)))
1568 SwPaM aPaM(*pSectionStart);
1570 if (!aPaM.GetNode().IsTextNode())
1578 if (nCharHeight > 20)
1584 if (!aPaM.GetNode().IsTextNode())
1626 bool bOutPgDscSet =
true, bLeftRightPgChain =
false, bOutputStyleItemSet =
false;
1629 bool bUsePrevSectionNextStyle =
false;
1645 if ( reinterpret_cast<SwSectionFormat*>(sal_IntPtr(-1)) == rSepInfo.
pSectionFormat )
1649 if ( nBreakCode == 0 )
1650 bOutPgDscSet =
false;
1657 && UsePrevSectionNextStyle(nBreakCode, pPd, rSepInfo);
1658 if (bUsePrevSectionNextStyle)
1665 aSet.SetParent( pPdSet );
1688 aSet.Put( aResultLR );
1697 bOutputStyleItemSet =
true;
1741 pPdFormat = &rFollowFormat;
1754 if ( titlePage && SfxItemState::SET ==
1771 bLeftRightPgChain =
true;
1786 if (!bOutputStyleItemSet)
1807 if ( 2 == nBreakCode )
1830 if ( nBreakCode != 0 || bEnsureHeaderFooterWritten )
1868 if (bUsePrevSectionNextStyle && nHeadFootFlags == 0)
1876 WriteHeadersFooters( nHeadFootFlags, *pPdFormat, *pPdLeftFormat, *pPdFirstPgFormat, nBreakCode );
1890 OSL_ENSURE( !
pTextPos,
"who set the pointer?" );
1901 auto pAttrDesc = std::make_shared<WW8_PdAttrDesc>();
1919 if ( nCpEnd > nCpStart )
1927 rWrt.
pFib->m_ccpHdr = nCpEnd - nCpStart;
1934 return rWrt.
pFib->m_ccpHdr != 0;
1940 ,
"WriteSepx(): arrays out of sync!");
1956 ,
"WritePlcSed(): arrays out of sync!");
1957 OSL_ENSURE(
aCps.size() ==
aSects.size() + 1,
"WrPlcSepx: DeSync" );
1962 sal_uInt32 nP =
aCps[
i];
1966 static WW8_SED aSed = {{4, 0},{0, 0, 0, 0},{0, 0},{0xff, 0xff, 0xff, 0xff}};
1971 UInt32ToSVBT32( rSectionAttribute->m_nSepxFcPos, aSed.fcSepx );
1974 rWrt.
pFib->m_fcPlcfsed = nFcStart;
1986 rWrt.
pFib->m_fcPlcfhdd;
2018 if ( nStart < nEnd )
2032 OSL_ENSURE( pSttIdx,
"Header/Footer text is not really present" );
2051 aCps.push_back( nCp );
2058 m_nRangeStart(nRangeStart),
2059 m_nRangeEnd(nRangeEnd)
2071 mpRichText(nullptr),
2072 msSimpleText(pRedline->GetComment()),
2073 msOwner(
SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor())),
2098 aCps.push_back( nCp );
2117 aCps.push_back( nCp );
2147 for ( i = 0; i < nLen; i++ )
2166 for ( i = 0; i < nLen; i++ )
2170 aCps.insert(
aCps.begin()+i, nCP );
2184 else if( dynamic_cast<const SdrTextObj*>( &rObj) !=
nullptr )
2189 OSL_ENSURE( pFormat,
"where is the format?" );
2192 OSL_ENSURE( pNdIdx,
"where is the StartNode of the Textbox?" );
2201 bool bContainsOnlyTables =
true;
2208 bContainsOnlyTables =
false;
2211 if ( bContainsOnlyTables )
2237 for ( i = 0; i < nLen; i++ )
2246 OSL_ENSURE( pIdx,
"Where is the start node of Foot-/Endnote?" );
2254 OSL_ENSURE(
false,
"What kind of SubDocType is that?" );
2263 rCount = nCpEnd - nCpStart;
2265 return ( rCount != 0 );
2268 static bool lcl_AuthorComp(
const std::pair<OUString,OUString>& aFirst,
const std::pair<OUString,OUString>& aSecond)
2270 return aFirst.first < aSecond.first;
2273 static bool lcl_PosComp(
const std::pair<WW8_CP, int>& aFirst,
const std::pair<WW8_CP, int>& aSecond)
2275 return aFirst.first < aSecond.first;
2279 WW8_FC& rTextStart, sal_Int32& rTextCount,
WW8_FC& rRefStart, sal_Int32& rRefCount )
const
2283 sal_uInt16 nLen =
aCps.size();
2287 OSL_ENSURE(
aCps.size() + 2 ==
pTextPos->Count(),
"WritePlc: DeSync" );
2289 std::vector<std::pair<OUString,OUString> > aStrArr;
2291 bool bWriteCP =
true;
2297 std::vector< std::pair<WW8_CP, int> > aRangeStartPos;
2298 std::vector< std::pair<WW8_CP, int> > aRangeEndPos;
2299 std::map<int, int> aAtnStartMap;
2300 std::map<int, int> aStartAtnMap;
2301 std::map<int, int> aStartEndMap;
2304 for ( sal_uInt16
i = 0;
i < nLen; ++
i )
2312 aRangeEndPos.emplace_back(rAtn.
m_nRangeEnd, nIdx);
2319 auto aIter = std::unique(aStrArr.begin(), aStrArr.end());
2320 aStrArr.erase(aIter, aStrArr.end());
2326 std::sort(aRangeStartPos.begin(), aRangeStartPos.end(), &
lcl_PosComp);
2327 for (decltype(aRangeStartPos)::size_type
i = 0; i < aRangeStartPos.size(); ++i)
2329 aAtnStartMap[aRangeStartPos[i].second] = i;
2330 aStartAtnMap[i] = aRangeStartPos[i].second;
2332 std::sort(aRangeEndPos.begin(), aRangeEndPos.end(), &
lcl_PosComp);
2333 for (decltype(aRangeEndPos)::size_type i = 0; i < aRangeEndPos.size(); ++i)
2334 aStartEndMap[aAtnStartMap[ aRangeEndPos[i].second ]] = i;
2336 for ( decltype(aStrArr)::size_type i = 0; i < aStrArr.size(); ++i )
2338 const OUString& sAuthor = aStrArr[i].first;
2349 if( !aRangeStartPos.empty() )
2353 for ( decltype(aRangeStartPos)::size_type i = 0; i < aRangeStartPos.size(); ++i )
2360 for ( decltype(aRangeStartPos)::size_type i = 0; i < aRangeStartPos.size(); ++i )
2371 for ( decltype(aRangeEndPos)::size_type i = 0; i < aRangeEndPos.size(); ++i )
2386 for ( decltype(aRangeStartPos)::size_type i = 0; i < aRangeStartPos.size(); ++i )
2400 for( sal_uInt16 i = 0; i < nLen; ++i )
2425 OSL_ENSURE( pShapeIds,
"Where are the ShapeIds?" );
2427 for ( sal_uInt16
i = 0;
i < nLen; ++
i )
2433 if (dynamic_cast< const SdrTextObj *>( pObj ))
2447 if(
nullptr == pObj )
2486 for ( sal_uInt16
i = 0;
i < nLen;
i++ )
2496 sal_uInt16 nlTag = 0;
2497 for ( sal_uInt16 i = 0; i < nLen; ++i )
2502 auto aIter = std::lower_bound(aStrArr.begin(),
2503 aStrArr.end(), std::pair<OUString,OUString>(rAtn.
msOwner,OUString()),
2505 OSL_ENSURE(aIter != aStrArr.end() && aIter->first == rAtn.
msOwner,
2507 sal_uInt16 nFndPos =
static_cast< sal_uInt16
>(aIter - aStrArr.begin());
2508 OUString sInitials( aIter->second );
2510 if ( nInitialsLen > 9 )
2512 sInitials = sInitials.copy( 0, 9 );
2522 (9 - nInitialsLen) * 2 );
2546 for ( sal_uInt16 i = 0; i < nLen; ++i )
2550 !pFootnote->
GetNumStr().isEmpty() ? 0 : ++nNo );
2554 rRefStart = nFcStart;
2556 rRefCount = nFcStart - rRefStart;
2564 for ( sal_uInt16
i = 0;
i < nLen; ++
i )
2579 rTextStart = nFcStart;
std::map< wwFont, sal_uInt16 > maFonts
Keep track of fonts that need to be exported.
virtual void EndStyleProperties(bool bParProp) override
End of (paragraph or run) properties of a style.
o3tl::sorted_vector< const SwRedlineData * > maProcessedRedlines
bool WriteGenericText(WW8Export &rWrt, sal_uInt8 nTTyp, WW8_CP &rCount)
sal_uInt16 CurrentNumberOfColumns(const SwDoc &rDoc) const
Number of columns based on the most recent WW8_SepInfo.
SwSectionNode * FindSectionNode()
Search section node, in which it is.
SvxNumType GetNumberingType() const
const SwEndNode * EndOfSectionNode() const
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
static sal_uInt16 GetWWId(const SwFormat &rFormat)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
SwCharFormat * GetAnchorCharFormat(SwDoc &rDoc) const
const ::std::optional< sal_uInt16 > & GetNumOffset() const
Exporter of the binary Word file formats.
static bool lcl_AuthorComp(const std::pair< OUString, OUString > &aFirst, const std::pair< OUString, OUString > &aSecond)
virtual AttributeOutputBase & AttrOutput() const =0
Access to the attribute output class.
void SetHdFtIndex(unsigned int nHdFtIndex)
const sw::BroadcastingModify * m_pOutFormatNode
void WriteProperties(const SwFormat *pFormat, bool bPap, sal_uInt16 nPos, bool bInsDefCharSiz)
Outputs attributes of one style.
const HdFtFlags WW8_FOOTER_FIRST
virtual void SectionTitlePage()=0
Has different headers/footers for the title page.
Class to collect and output the sections/headers/footers.
int GetAssignedOutlineStyleLevel() const
virtual void EndStyles(sal_uInt16 nNumberOfStyles)=0
End of the styles table.
std::unique_ptr< ww::bytes > pO
Buffer.
Represents the style of a paragraph.
unsigned int GetHdFtIndex() const
The class that has handlers for various resource types when exporting as DOCX.
void AddRangeStartPosition(const OUString &rName, WW8_CP nStartCp, bool bIgnoreEmpty)
#define WW8_RESERVED_SLOTS
std::vector< SwColumn > SwColumns
const SvxFontHeightItem & GetSize(bool=true) const
bool IsSectionNode() const
std::unique_ptr< WW8Fib > pFib
File Information Block.
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CTL_FONT(27)
std::unique_ptr< WW8_WrPlcField > m_pFieldHdFt
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
SwFrameFormat & GetLeft()
void SetStyleDefaults(const SwFormat &rFormat, bool bPap)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
void WriteStringAsPara(const OUString &rText)
SwPageDesc * GetPageDesc()
const SwLineNumberInfo & GetLineNumberInfo() const
bool HasRange() const
An annotation has a range if start != end or the m_bIgnoreEmpty flag is cleared.
void OutputStyle(SwFormat *pFormat, sal_uInt16 nPos)
Outputs one style - called (in a loop) from OutputStylesTable().
virtual void StartStyleProperties(bool bParProp, sal_uInt16 nStyle) override
Start of (paragraph or run) properties of a style.
void Append(sal_uLong nStartCpOrFc)
sal_uInt16 GetId(const SwTextFormatColl &rColl) const
Return the numeric id of the style.
bool m_bFootnoteAtTextEnd
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(96)
sal_uInt16 m_nStyleLenPos
std::unique_ptr< ContentProperties > pData
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
sal_uInt16 m_nStyleStartSize
For output of styles.
sal_uInt16 GetCountBy() const
virtual void EndStyles(sal_uInt16 nNumberOfStyles) override
End of the styles table.
const SfxPoolItem * GetPoolDefaultItem(sal_uInt16 nWhich) const
virtual void SectFootnoteEndnotePr() override
for footnote/endnote section properties
void OutputStylesTable()
Output the styles table.
std::vector< const SwFrameFormat * > aSpareFormats
virtual void EndSection()=0
End of the section properties.
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
tools::Long GetRight() const
void EndFont() const
End the font.
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
void WriteFontTable(SvStream *pTableStream, WW8Fib &pFib)
constexpr TypedWhichId< SvxPaperBinItem > RES_PAPER_BIN(90)
SwFrameFormat & GetFirstMaster()
void WritePlcHdd(WW8Export &rWrt) const
void WriteFootnoteEndText(WW8Export &rWrt, sal_uLong nCpStt)
bool m_bOutPageDescs
PageDescs (section properties) are being written.
tools::Time GetTime() const
void StartFont(const OUString &rFamilyName) const
Start the font.
virtual bool CollapseScriptsforWordOk(sal_uInt16 nScript, sal_uInt16 nWhich)=0
Guess the script (asian/western).
virtual OUString GetPar1() const override
Author.
const_iterator find(const Value &x) const
void WriteRtf(const RtfAttributeOutput *rAttrOutput) const
const OUString & GetName() const
virtual void StartStyles() override
Start of the styles table.
Content, content of frame (header, footer, fly).
SwSectionFormat * GetFormat()
WW8_CP Fc2Cp(sal_uLong nFc) const
void BuildStyleIds()
Based on pFormatA, fill in m_aStyleIds with unique, MS-like names.
MSWordStyles(const MSWordStyles &)=delete
static constexpr sal_uInt16 val
virtual void SectionFormProtection(bool bProtected) override
Protection of forms.
virtual const std::vector< sal_uInt32 > * GetShapeIdArr() const
virtual bool HeaderFooterWritten() override
std::vector< const wwFont * > AsVector() const
Convert from fast insertion map to linear vector in the order that we want to write.
std::vector< sal_uLong > aPos
const SwNumRule * GetSwNumRule(sal_uInt16 nId) const
Get numbering rule of the nId-th style.
::std::optional< sal_uInt16 > oPgRestartNo
const SfxItemSet * GetCurItemSet() const
Getter for pISet.
sal_uInt16 nPOPosStdLen1
For output of styles.
FontPitch GetPitch() const
rtl_TextEncoding meChrSet
virtual ExportFormat GetExportFormat() const =0
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
SwTableFormat * GetFrameFormat()
OString const & GetStyleId(sal_uInt16 nId) const
Get styleId of the nId-th style (nId is its position in pFormatA).
FontFamily GetFamily() const
sal_uInt32 m_lcbAtrdExtra
sal_uLong m_nStyleCountPos
For output of styles.
static void SetHeaderFlag(sal_uInt8 &rHeadFootFlags, const SwFormat &rFormat, sal_uInt8 nFlag)
#define MSWORD_MAX_STYLES_LIMIT
const SwSection & GetSection() const
void SectionProperties(const WW8_SepInfo &rSectionInfo, WW8_PdAttrDesc *pA=nullptr)
Write section properties.
std::vector< WW8_SepInfo > aSects
bool IsAssignedToListLevelOfOutlineStyle() const
bool IsRestartEachPage() const
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
void FontCharset(sal_uInt8 nCharSet) const
Font charset.
void FontPitchType(FontPitch ePitch) const
Font pitch.
bool IsFollowNextPageOfNode(const SwNode &rNd) const
virtual void EndStyle()=0
End of a style in the styles table.
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
const SwFrameFormat * m_pFirstPageFormat
void OutputFormat(const SwFormat &rFormat, bool bPapFormat, bool bChpFormat, bool bFlyFormat=false)
Output attributes.
rtl_TextEncoding GetCharSet() const
const SwTextFormatColl * GetDfltTextFormatColl() const
virtual void SectionLineNumbering(sal_uLong nRestartNo, const SwLineNumberInfo &rLnNumInfo) override
Numbering of the lines in the document.
void StartFont(const OUString &rFamilyName) const
Start the font.
The class that has handlers for various resource types when exporting as RTF.
sal_uLong GetIndex() const
const OUString & GetText() const
std::shared_ptr< SwUnoCursor > & m_pCurPam
SvStream & WriteUInt32(sal_uInt32 nUInt32)
void Append(WW8_CP nCp, const SwPostItField *pPostIt)
void WritePostItBegin(ww::bytes *pO=nullptr)
const SwTable & GetTable() const
const HdFtFlags WW8_FOOTER_EVEN
void Set_UInt16(sal_uInt8 *&p, sal_uInt16 n)
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
void Write(SvStream *pTableStram) const
void FontAlternateName(const OUString &rName) const
Alternate name for the font.
virtual void SectFootnoteEndnotePr()
for footnote/endnote section properties
std::map< sal_uInt16, const SwNumRule * > m_aNumRules
Slot <-> List style map.
bool IsNewRedlineComment(const SwRedlineData *pRedLine)
virtual void EndStyle() override
End of a style in the styles table.
void OutputItem(const SfxPoolItem &rHt)
Call the right virtual function according to the type of the item.
bool m_bHeaderFooterWritten
SwAttrPool * GetPool() const
virtual void SectionBiDi(bool bBiDi) override
Columns populated from right/numbers on the right side?
virtual void DefaultStyle() override
Write default style.
Collects and outputs fonts.
virtual void TextVerticalAdjustment(const css::drawing::TextVerticalAdjust) override
virtual void SetupSectionPositions(WW8_PdAttrDesc *)
Setup the pA's info.
constexpr TypedWhichId< SvxHyphenZoneItem > RES_PARATR_HYPHENZONE(69)
const HdFtFlags WW8_HEADER_ODD
void Write(SvStream &rStrm)
sal_Int32 m_lcbGrpStAtnOwners
void ExportControl(WW8Export &rWrt, const SdrUnoObj &rFormObj)
SwMSConvertControls & GetOCXExp()
static void WriteString16(SvStream &rStrm, const OUString &rStr, bool bAddZero)
virtual void SetupSectionPositions(WW8_PdAttrDesc *pA) override
Setup the pA's info.
bool IsContentNode() const
PaM is Point and Mark: a selection of the document model.
bool IsHeaderShared() const
const SwTextNode * GetHdFtPageRoot() const
Top node of host page when in header/footer.
void FontFamilyType(FontFamily eFamily, const wwFont &rFont) const
Font family.
sal_uInt16 GetPosFromLeft() const
virtual ~MSWordSections()
WW8Export & m_rWW8Export
Reference to the export, where to get the data from.
virtual ~WW8_WrPlcSubDoc()
void EndFont() const
End the font.
const OutlinerParaObject * mpRichText
virtual void SectionType(sal_uInt8 nBreakCode)=0
The type of breaking.
void WritePlcSed(WW8Export &rWrt) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
void SetCurItemSet(const SfxItemSet *pS)
Setter for pISet.
const SwSectionFormat * pSectionFormat
void BuildStylesTable()
Create the style table, called from the constructor.
static sal_uInt16 NumberOfColumns(const SwDoc &rDoc, const WW8_SepInfo &rInfo)
Number of columns of the provided WW8_SepInfo.
std::unique_ptr< WW8_WrPlcSepx > pSepx
Sections/headers/footers.
std::vector< WW8_CP > aCps
const SwStartNode * StartOfSectionNode() const
WW8_WrPlcSepx(const WW8_WrPlcSepx &)=delete
For the output of sections.
sal_Int32 m_lcbSttbfAtnbkmk
const SwPageDesc & GetPageDesc(const size_t i) const
void WriteDocx(DocxAttributeOutput *rAttrOutput) const
void FontAlternateName(const OUString &rName) const
Alternate name for the font.
void CheckForFacinPg(const WW8Export &rWrt) const
virtual void DefaultStyle()=0
Write default style.
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.
std::unique_ptr< WW8Dop > pDop
Document Properties.
bool m_bFirstTOCNodeWithSection
std::unique_ptr< WW8_WrPlc0 > pTextPos
sal_uInt16 m_nFootnoteOffset
static bool lcl_PosComp(const std::pair< WW8_CP, int > &aFirst, const std::pair< WW8_CP, int > &aSecond)
bool mbDocumentIsProtected
SwContentNode * GetContentNode()
static void WriteShort(SvStream &rStrm, sal_Int16 nVal)
std::unique_ptr< SwFormat *[]> m_pFormatA
Slot <-> Character and paragraph style array (0 for list styles).
tools::Long GetLeft() const
UseOnPage ReadUseOn() const
std::vector< const void * > aContent
static sal_uInt8 GetNumId(sal_uInt16 eNumType)
Converts the SVX numbering type to MSONFC.
virtual void SectionPageNumbering(sal_uInt16 nNumType, const ::std::optional< sal_uInt16 > &oPageRestartNumber)=0
The style of the page numbers.
WW8_FC m_fcGrpStAtnOwners
const WW8_SepInfo * CurrentSectionInfo()
The most recent WW8_SepInfo.
std::size_t WriteBytes(const void *pData, std::size_t nSize)
::rtl::Reference< Content > pContent
void EmbedFont(std::u16string_view name, FontFamily family, FontPitch pitch)
Write out the font into the document, if it's an embedded font.
virtual bool HeaderFooterWritten()
void AppendSep(WW8_CP nStartCp, const SwPageDesc *pPd, const SwSectionFormat *pSectionFormat, sal_uLong nLnNumRestartNo)
virtual void StartSection()=0
Start of the section properties.
bool operator<(const wwFont &r1, const wwFont &r2)
virtual void SectionTitlePage() override
Has different headers/footers for the title page.
std::vector< OString > m_aStyleIds
We need to build style id's for DOCX export; ideally we should roundtrip that, but this is good enoug...
sal_uLong nLnNumRestartNo
Marks a node in the document model.
std::unique_ptr< sal_uInt8[]> m_pData
bool IsFooterShared() const
wwFont(const OUString &rFamilyName, FontPitch ePitch, FontFamily eFamily, rtl_TextEncoding eChrSet)
static void SetFooterFlag(sal_uInt8 &rHeadFootFlags, const SwFormat &rFormat, sal_uInt8 nFlag)
bool m_bListStyles
If list styles are requested to be exported as well.
void WriteGenericPlc(WW8Export &rWrt, sal_uInt8 nTTyp, WW8_FC &rTextStt, sal_Int32 &rTextCnt, WW8_FC &rRefStt, sal_Int32 &rRefCnt) const
const_iterator end() const
MSWordExportBase & m_rExport
void InsUInt16(sal_uInt16 n)
Find suitable names for exporting this font.
virtual void SectionPageNumbering(sal_uInt16 nNumType, const ::std::optional< sal_uInt16 > &oPageRestartNumber) override
The style of the page numbers.
static bool HasBorderItem(const SwFormat &rFormat)
Should we output borders?
virtual void SectionPageBorders(const SwFrameFormat *pFormat, const SwFrameFormat *pFirstPageFormat)=0
Description of the page borders.
void SetHdFtPageRoot(const SwTextNode *pNd)
Top node of host page when in header/footer.
SfxItemPool * GetPool() const
void OutHeaderFooter(WW8Export &rWrt, bool bHeader, const SwFormat &rFormat, sal_uLong &rCpPos, sal_uInt8 nHFFlags, sal_uInt8 nFlag, sal_uInt8 nBreakCode)
Text body first line indent.
const OUString & GetName() const
virtual SdrInventor GetObjInventor() const
< purpose of derivation from SwClient: character style for displaying the numbers.
virtual void StartStyle(const OUString &rName, StyleType eType, sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 nWwIdi, sal_uInt16 nId, bool bAutoUpdate) override
Start of a style in the styles table.
static OString CreateStyleId(const OUString &rName)
create style id using only ASCII characters of the style name
virtual void EndStyleProperties(bool bParProp)=0
End of (paragraph or run) properties of a style.
std::vector< std::shared_ptr< WW8_PdAttrDesc > > m_SectionAttributes
virtual void SectionFormProtection(bool bProtected)=0
Protection of forms.
const SwPageDesc * GetFollow() const
const SwNodeIndex * GetContentIdx() const
void FontPitchType(FontPitch ePitch) const
Font pitch.
virtual ~WW8_WrPlcAnnotations() override
void WriteHeaderFooterText(const SwFormat &rFormat, bool bHeader)
Write header/footer text.
void AppendSection(const SwPageDesc *pPd, const SwSectionFormat *pSectionFormat, sal_uLong nLnNumRestartNo, bool bIsFirstParagraph=false)
void NeedsDocumentProtected(const WW8_SepInfo &rInfo)
const OUString & GetFamilyName() const
constexpr sal_uInt16 RES_FRMATR_END(131)
SwFrameFormat & GetMaster()
sal_uLong EndOfSectionIndex() const
sal_uInt16 BuildGetSlot(const SwFormat &rFormat)
Get slot number during building the style table.
SwTextNode is a paragraph in the document model.
const OutlinerParaObject * GetTextObject() const
drawing::TextVerticalAdjust GetVerticalAdjustment() const
constexpr sal_uInt16 RES_TXTATR_END(RES_TXTATR_NOEND_END)
virtual void StartStyleProperties(bool bParProp, sal_uInt16 nStyle)=0
Start of (paragraph or run) properties of a style.
sal_uInt32 GetHeight() const
const SwPageDesc * m_pCurrentPageDesc
const SwPageDesc * pPageDesc
const SwCharFormats * GetCharFormats() const
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
const SwFrameFormat * GetPageFormatOfNode(const SwNode &rNd, bool bCheckForThisPgDc=true) const
SwCharFormat * GetCharFormat(SwDoc &rDoc) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
bool IsPaintLineNumbers() const
const SwTextFormatColls * GetTextFormatColls() const
sal_uInt16 m_aHeadingParagraphStyles[MAXLEVEL]
void GetStyleData(SwFormat *pFormat, bool &bFormatColl, sal_uInt16 &nBase, sal_uInt16 &nNext)
Return information about one style.
void WriteSpecialText(sal_uLong nStart, sal_uLong nEnd, sal_uInt8 nTTyp)
Set the pCurPam appropriately and call WriteText().
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.
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
SwFrameFormat & GetFirstLeft()
const SwNumRuleTable & GetNumRuleTable() const
constexpr TypedWhichId< SwTextFormatColl > RES_TXTFMTCOLL(155)
bool bLoadAllFonts
If true, all fonts are loaded before processing the document.
bool WriteKFText(WW8Export &rWrt)
const HdFtFlags WW8_HEADER_FIRST
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
virtual ~WW8_WrPlcSepx() override
void FontCharset(sal_uInt8 nCharSet, rtl_TextEncoding nEncoding) const
Font charset.
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
void WriteFootnoteBegin(const SwFormatFootnote &rFootnote, ww::bytes *pO=nullptr)
WW8_WrPlc0(WW8_WrPlc0 const &)=delete
static void impl_SkipOdd(std::unique_ptr< ww::bytes > const &pO, std::size_t nTableStrmTell)
For WW8 only - extend pO so that the size of pTableStrm is even.
WW8_Annotation(const SwPostItField *pPostIt, WW8_CP nRangeStart, WW8_CP nRangeEnd)
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
void WriteSdrTextObj(const SdrTextObj &rObj, sal_uInt8 nTyp)
void IncrementHdFtIndex()
virtual void EmptyParagraph()=0
Empty paragraph.
sal_uInt16 GetId(const SvxFontItem &rFont)
FIB - the File Information Block.
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(158)
void WriteSepx(SvStream &rStrm) const
std::unique_ptr< WW8_WrPlc0 > pTextPos
virtual void StartSection() override
Start of the section properties.
sal_uInt16 GetSlot(const SwFormat *pFormat) const
Get id of the style (rFormat).
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
bool IsPlausableSingleWordSection(const SwFrameFormat &rTitleFormat, const SwFrameFormat &rFollowFormat)
See if two page formats can be expressed as a single word section.
virtual void SectionBiDi(bool bBiDi)=0
Columns populated from right/numbers on the right side?
std::vector< WW8_CP > aCps
SvStream & WriteChar(char nChar)
static void InsUInt16(ww::bytes &rO, sal_uInt16 n)
void OutputStyleItemSet(const SfxItemSet &rSet, bool bTestForDefault)
Use OutputItem() on an item set - for styles.
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
SwMoveFnCollection const & fnMoveBackward
void InitFontTable(const SwDoc &rDoc)
rDoc used only to get the initial standard font(s) in use.
const sal_uInt16 * GetRanges() const
virtual void SectionLineNumbering(sal_uLong nRestartNo, const SwLineNumberInfo &rLnNumInfo)=0
Numbering of the lines in the document.
virtual bool ignoreAttributeForStyleDefaults(sal_uInt16) const
Used to filter out attributes that can be e.g. written to .doc but not to .docx.
constexpr TypedWhichId< SwFormatFooter > RES_FOOTER(97)
SwFootnoteIdxs & GetFootnoteIdxs()
const SwFormat * m_pCurrentStyle
Base class for WW8Export and DocxExport.
constexpr TypedWhichId< SwFormatLineNumber > RES_LINENUMBER(116)
virtual void StartStyle(const OUString &rName, StyleType eType, sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 nWwId, sal_uInt16 nId, bool bAutoUpdate)=0
Start of a style in the styles table.
Subgroup table of contents.
virtual void WriteHeadersFooters(sal_uInt8 nHeadFootFlags, const SwFrameFormat &rFormat, const SwFrameFormat &rLeftFormat, const SwFrameFormat &rFirstPageFormat, sal_uInt8 nBreakCode)=0
Output the actual headers and footers.
SwSectionNode * GetSectionNode()
virtual void StartStyles()=0
Start of the styles table.
virtual void WriteHeadersFooters(sal_uInt8 nHeadFootFlags, const SwFrameFormat &rFormat, const SwFrameFormat &rLeftFormat, const SwFrameFormat &rFirstPageFormat, sal_uInt8 nBreakCode) override
Output the actual headers and footers.
virtual void SectionPageBorders(const SwFrameFormat *pFormat, const SwFrameFormat *pFirstPageFormat) override
Description of the page borders.
const SfxItemSet * m_pISet
bool IsFirstShared() const
void WriteOutliner(const OutlinerParaObject &rOutliner, sal_uInt8 nTyp)
SectionType GetType() const
static bool NoPageBreakSection(const SfxItemSet *pSet)
std::map< const OUString, std::pair< WW8_CP, bool > > m_aRangeStartPositions
const OUString & GetInitials() const
std::pair< const_iterator, bool > insert(Value &&x)
MSWordSections(const MSWordSections &)
static void WriteLong(SvStream &rStrm, sal_Int32 nVal)
static void FillCount(SvStream &rStrm, sal_uLong nCount)
virtual void TextVerticalAdjustment(const css::drawing::TextVerticalAdjust)
const SwFootnoteInfo & GetFootnoteInfo() const
SvxFrameDirection TrueFrameDirection(const SwFrameFormat &rFlyFormat) const
Right to left?
static void InsAsString16(ww::bytes &rO, const OUString &rStr)
const SwEndNoteInfo & GetEndNoteInfo() const
virtual void SectionType(sal_uInt8 nBreakCode) override
The type of breaking.
constexpr TypedWhichId< SvxWidowsItem > RES_PARATR_WIDOWS(67)
sal_Int32 m_lcbPlcfAtnbkl
const HdFtFlags WW8_FOOTER_ODD
sal_Int32 m_lcbPlcfAtnbkf
const SwAttrPool & GetAttrPool() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
std::unique_ptr< MSWordStyles > m_pStyles
const HdFtFlags WW8_HEADER_EVEN
void FontFamilyType(FontFamily eFamily) const
Font family.
Base class of the Writer document model elements.
const SvxNumberType & GetNumType() const