50 sal_Int32 m_nCurrentSwPos;
52 sal_Int32 SearchNext( sal_Int32 nStartPos );
57 void NextPos() { m_nCurrentSwPos = SearchNext(m_nCurrentSwPos + 1); }
59 sal_Int32 WhereNext()
const {
return m_nCurrentSwPos; }
61 bool OutAttr( sal_Int32 nSwPos );
71 m_nCurrentSwPos = SearchNext(nStt + 1);
74sal_Int32 SwASC_AttrIter::SearchNext( sal_Int32 nStartPos )
77 const SwpHints* pTextAttrs = m_rNd.GetpSwpHints();
82 for (
size_t i = 0;
i < pTextAttrs->
Count(); ++
i )
89 if( nPos >= nStartPos && nPos <= nMinPos )
92 if( ( ++nPos ) >= nStartPos && nPos < nMinPos )
97 const sal_Int32 nHintStart = pHt->
GetStart();
98 if ( nHintStart >= nStartPos && nHintStart <= nMinPos )
100 nMinPos = nHintStart;
104 if ( nHintEnd >= nStartPos && nHintEnd < nMinPos )
114bool SwASC_AttrIter::OutAttr( sal_Int32 nSwPos )
117 const SwpHints* pTextAttrs = m_rNd.GetpSwpHints();
120 for(
size_t i = 0;
i < pTextAttrs->
Count(); ++
i )
129 switch( pHt->
Which() )
134 sOut = static_txtattr_cast<SwTextField const*>(pHt)
135 ->GetFormatField().GetField()->ExpandField(
true,
nullptr);
144 sOut = m_rWrt.m_pDoc->GetEndNoteInfo().m_aFormat.GetNumStr(
147 sOut = m_rWrt.m_pDoc->GetFootnoteInfo().m_aFormat.GetNumStr(
158 if( !sOut.isEmpty() )
159 m_rWrt.Strm().WriteUnicodeOrByteText(sOut);
161 else if( nSwPos < pHt->GetStart() )
170class SwASC_RedlineIter
180 , m_rIDRA(rNode.GetDoc().getIDocumentRedlineAccess())
181 , m_nextRedline(rWriter.m_bHideDeleteRedlines
187 bool CheckNodeDeleted()
194 return pRedline->Start()->GetNodeIndex() < m_rNode.
GetIndex()
195 && m_rNode.
GetIndex() < pRedline->End()->GetNodeIndex();
198 std::pair<sal_Int32, sal_Int32> GetNextRedlineSkip()
205 if (pRedline->GetType() != RedlineType::Delete)
209 auto [pStart, pEnd] = pRedline->StartEnd();
210 if (m_rNode.
GetIndex() < pStart->GetNodeIndex())
217 nRedlineStart = pStart->GetNodeIndex() == m_rNode.
GetIndex()
218 ? pStart->GetContentIndex()
223 if (pStart->GetContentIndex() != nRedlineEnd)
225 assert(nRedlineEnd < pStart->GetContentIndex());
229 nRedlineEnd = pEnd->GetNodeIndex() == m_rNode.
GetIndex()
230 ? pEnd->GetContentIndex()
233 return std::make_pair(nRedlineStart, nRedlineEnd);
245 sal_Int32 nStrPos = rWrt.
m_pCurrentPam->GetPoint()->GetContentIndex();
246 const sal_Int32 nNodeEnd = rNd.
Len();
247 sal_Int32 nEnd = nNodeEnd;
254 SwASC_AttrIter aAttrIter(
static_cast<SwASCWriter&
>(rWrt), rNd, nStrPos );
255 SwASC_RedlineIter redlineIter(
static_cast<SwASCWriter&
>(rWrt), rNd);
257 if (redlineIter.CheckNodeDeleted())
269 if (!bIsOutlineNumRule)
277 if (numString.isEmpty() && !bIsOutlineNumRule)
287 if (!level.isEmpty() || !numString.isEmpty())
298 std::pair<sal_Int32, sal_Int32> curRedline(redlineIter.GetNextRedlineSkip());
300 const sal_Int32 nNextAttr =
std::min(aAttrIter.WhereNext(), nEnd);
302 bool isOutAttr(
false);
303 if (nStrPos < curRedline.first || curRedline.second <= nStrPos)
305 isOutAttr = aAttrIter.OutAttr(nStrPos);
313 if (nNextAttr <= curRedline.first)
315 buf.append(
aStr.subView(nStrPos, nNextAttr - nStrPos));
318 else if (nStrPos < curRedline.second)
320 if (nStrPos < curRedline.first)
322 buf.append(
aStr.subView(nStrPos, curRedline.first - nStrPos));
324 if (curRedline.second <= nNextAttr)
326 nStrPos = curRedline.second;
327 curRedline = redlineIter.GetNextRedlineSkip();
337 curRedline = redlineIter.GetNextRedlineSkip();
340 OUString aOutStr(buf.makeStringAndClear());
341 if ( !bExportSoftHyphens )
370 && !nStrPos && nEnd == nNodeEnd ) )
static Writer & OutASC_SwTextNode(Writer &rWrt, SwContentNode &rNode)
SwNodeFnTab aASCNodeFnTab
virtual const SwRedlineTable & GetRedlineTable() const =0
bool WriteUnicodeOrByteText(std::u16string_view rStr, rtl_TextEncoding eDestCharSet)
rtl_TextEncoding GetCharSet() const
SwNumRule * GetOutlineNumRule() const
SwNodeOffset GetIndex() const
const SwPosition * End() const
const SwPosition * Start() const
static constexpr size_type npos
vector_type::size_type size_type
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
const sal_Int32 * End() const
const SwFormatFootnote & GetFootnote() const
sal_Int32 GetStart() const
bool HasDummyChar() const
SwTextNode is a paragraph in the document model.
bool HasBullet() const
Returns if this text node has a bullet.
virtual sal_Int32 Len() const override
bool HasVisibleNumberingOrBullet() const
Returns if the paragraph has a visible numbering or bullet.
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
int GetActualListLevel(SwListRedlineType eRedline=SwListRedlineType::SHOW) const
Returns the actual list level of this text node, when it is a list item.
OUString GetNumString(const bool _bInclPrefixAndSuffixStrings=true, const unsigned int _nRestrictToThisLevel=MAXLEVEL, SwRootFrame const *pLayout=nullptr, SwListRedlineType eRedline=SwListRedlineType::SHOW) const
Returns outline of numbering string.
const OUString & GetText() const
An SwTextAttr container, stores all directly formatted text portions for a text node.
SwTextAttr * Get(size_t nPos) const
const SwAsciiOptions & GetAsciiOptions() const
std::shared_ptr< SwUnoCursor > m_pCurrentPam
bool m_bExportParagraphNumbering
bool m_bASCII_NoLastLineEnd
bool m_bWriteClipboardDoc
bool m_bASCII_ParaAsBlank
#define CH_TXT_ATR_FIELDSEP
#define CH_TXT_ATR_INPUTFIELDSTART
#define CH_TXT_ATR_FORMELEMENT
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(59)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(60)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
constexpr TypedWhichId< SwFormatLineBreak > RES_TXTATR_LINEBREAK(61)
#define CH_TXT_ATR_INPUTFIELDEND
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
#define CH_TXT_ATR_FIELDEND
#define CH_TXT_ATR_FIELDSTART
#define CH_TXTATR_BREAKWORD
OUString removeAny(std::u16string_view rIn, sal_Unicode const *const pChars)
sal_Unicode GetBulletChar(sal_uInt8 nLevel)
retrieve unicode of character used for the default bullet list for the given list level
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
constexpr sal_Int32 COMPLETE_STRING
sal_Unicode GetCharOfTextAttr(const SwTextAttr &rAttr)
FnNodeOut SwNodeFnTab[RES_NODE_END - RES_NODE_BEGIN]