24#include <com/sun/star/i18n/ScriptType.hpp>
25#include <com/sun/star/i18n/XBreakIterator.hpp>
26#include <osl/diagnose.h>
60 const bool bMergeIndentValuesOfNumRule )
const
76 if (rCurrentPaM.IsInFrontOfLabel())
79 rCurrentPaM.GetPoint()->GetNode());
95 const OUString & aCharFormatName =
108 SwNodeOffset nSttNd = rCurrentPaM.Start()->GetNodeIndex(),
109 nEndNd = rCurrentPaM.End()->GetNodeIndex();
110 sal_Int32 nSttCnt = rCurrentPaM.Start()->GetContentIndex();
111 sal_Int32 nEndCnt = rCurrentPaM.End()->GetContentIndex();
129 const sal_Int32 nStt = (
n == nSttNd) ? nSttCnt : 0;
130 const sal_Int32 nEnd = (
n == nEndNd)
134 static_cast<SwTextNode*
>(pNd)->GetParaAttr(*pSet, nStt, nEnd,
136 bMergeIndentValuesOfNumRule,
172 const bool bMergeIndentValuesOfNumRule )
const
185 sal_uInt16 numberOfLookup = 0;
194 SwNodeOffset nSttNd = rCurrentPaM.GetMark()->GetNodeIndex(),
195 nEndNd = rCurrentPaM.GetPoint()->GetNodeIndex();
198 if( nSttNd > nEndNd )
199 std::swap(nSttNd, nEndNd);
246 sal_uInt16 numberOfLookup = 0;
252 SwNodeOffset nSttNd = rCurrentPaM.Start()->GetNodeIndex(),
253 nEndNd = rCurrentPaM.End()->GetNodeIndex();
274 if( pFormat !=
nullptr )
287 std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM> >> vItem;
292 SwNodeOffset nSttNd = rCurrentPaM.Start()->GetNodeIndex(),
293 nEndNd = rCurrentPaM.End()->GetNodeIndex();
294 sal_Int32 nSttCnt = rCurrentPaM.Start()->GetContentIndex();
295 sal_Int32 nEndCnt = rCurrentPaM.End()->GetContentIndex();
297 SwPaM* pNewPaM =
nullptr;
307 const sal_Int32 nStt = (
n == nSttNd) ? nSttCnt : 0;
308 const sal_Int32 nEnd = (
n == nEndNd)
309 ? nEndCnt : pTextNd->
GetText().getLength();
318 : css::i18n::ScriptType::WEAK;
324 pNewPaM =
new SwPaM(*pNd, nStt, *pNd, nEnd);
326 vItem.emplace_back( pItem, std::unique_ptr<SwPaM>(pNewPaM) );
334 for(
size_t m = 0;
m < nSize;
m++ )
341 const sal_Int32 nAttrStart = pHt->
GetStart();
342 const sal_Int32* pAttrEnd = pHt->
End();
345 if( nAttrStart > nEnd )
347 if( *pAttrEnd <= nStt )
350 nScript = pScriptInfo
352 : css::i18n::ScriptType::WEAK;
361 if( pItem->
Which() == nWhich )
363 sal_Int32 nStart = 0, nStop = 0;
364 if( nAttrStart < nStt )
368 if( *pAttrEnd > nEnd )
372 pNewPaM =
new SwPaM(*pNd, nStart, *pNd, nStop);
373 vItem.emplace_back( pItem, std::unique_ptr<SwPaM>(pNewPaM) );
381 pNewPaM =
new SwPaM(*pNd, nStt, *pNd, nEnd);
383 vItem.emplace_back( pItem, std::unique_ptr<SwPaM>(pNewPaM) );
404 if( pFootnote && pFillFootnote )
411 return nullptr != pFootnote;
433 for (
auto pIdx : rIdxs )
436 if ( bEndNotes == rFootnote.
IsEndNote() )
449 const size_t nFootnoteCnt =
mxDoc->GetFootnoteIdxs().size();
451 for(
size_t n = 0;
n < nFootnoteCnt; ++
n )
453 pTextFootnote =
mxDoc->GetFootnoteIdxs()[
n ];
455 if ( rFootnote.
IsEndNote() != bEndNotes )
475 if( !sText.isEmpty() )
486 return rList.
Count();
498 sal_uInt16 nDefDist = o3tl::narrowing<sal_uInt16>(
499 rTabItem.
Count() ? rTabItem[0].GetTabPos() : constTwips_2cm);
507 nEndNd = rPaM.End()->GetNodeIndex();
513 if(
nullptr != pCNd )
521 nNext = ( nNext / nDefDist ) * nDefDist;
549 if( pCursor->
GetNext() != pCursor )
553 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
568 case css::i18n::ScriptType::LATIN:
569 return SvtScriptType::LATIN;
570 case css::i18n::ScriptType::ASIAN:
571 return SvtScriptType::ASIAN;
572 case css::i18n::ScriptType::COMPLEX:
573 return SvtScriptType::COMPLEX;
575 return SvtScriptType::NONE;
594 "<lcl_IsNoEndTextAttrAtPos(..)> - no list style found at text node. Serious defect." );
606 const SwNumFormat &rNumFormat = pNumRule->
Get( o3tl::narrowing<sal_uInt16>(nListLevel) );
612 sExp = OUString(&cBullet, 1);
640 const sal_Int32 nEnd = sExp.getLength();
646 for( sal_Int32
n = 0;
n < nEnd;
655 getScriptType( sExp, nEnd-1 ));
669 auto [pStt, pEnd] = rPaM.StartEnd();
670 if( pStt == pEnd || *pStt == *pEnd )
680 sal_Int32
nPos = pStt->GetContentIndex();
685 SwContentIndex aIdx( pStt->GetContentNode(), pStt->GetContentIndex() );
692 if (!pTNd->
GetText().isEmpty())
694 nScript = pScriptInfo
709 for( ; aIdx.
GetIndex() <= nEndIdx; ++aIdx )
713 const OUString& rText = pTNd->
GetText();
720 sal_Int32 nChg = aIdx == pStt->
GetNode()
721 ? pStt->GetContentIndex()
723 sal_Int32 nEndPos = aIdx == nEndIdx
724 ? pEnd->GetContentIndex()
727 OSL_ENSURE( nEndPos <= rText.getLength(),
728 "Index outside the range - endless loop!" );
729 if (nEndPos > rText.getLength())
730 nEndPos = rText.getLength();
732 bool const isUntilEnd(pScriptInfo
734 : rText.getLength() == nEndPos);
736 while( nChg < nEndPos )
741 nScript = pScriptInfo ?
752 if( (SvtScriptType::LATIN | SvtScriptType::ASIAN |
753 SvtScriptType::COMPLEX) == nRet )
756 sal_Int32 nFieldPos = nChg+1;
767 std::pair<SwTextNode*, sal_Int32>
const tmp(
769 nChg = (tmp.first == pTNd)
777 rText, nChg, nScript );
780 nFieldPos = rText.indexOf(
782 if ((-1 != nFieldPos) && (nFieldPos < nChg))
785 if( (SvtScriptType::LATIN | SvtScriptType::ASIAN |
786 SvtScriptType::COMPLEX) == nRet )
790 if( (SvtScriptType::LATIN | SvtScriptType::ASIAN |
791 SvtScriptType::COMPLEX) == nRet )
796 if( nRet == SvtScriptType::NONE )
826 OSL_ENSURE( pTNd,
"no textnode available" );
828 sal_uInt16 nScaleWidth;
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
const SfxPoolItem * GetPoolDefaultItem(sal_uInt16 nWhich) const
void MergeValues(const SfxItemSet &rSet)
const WhichRangesContainer & GetRanges() const
SfxItemPool * GetPool() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
void InvalidateAllItems()
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
tools::Long GetTextLeft() const
SvxNumType GetNumberingType() const
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
Marks a character position inside a document model content node (SwContentNode)
sal_Int32 GetIndex() const
bool HasSwAttrSet() const
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
const SfxPoolItem & GetAttr(sal_uInt16 nWhich, bool bInParent=true) const
SS for PoolItems: hard attributation.
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
bool GoPrevious(SwContentIndex *, SwCursorSkipMode nMode) const
sal_uInt16 GetCursorCnt(bool bAll=true) const
Get the number of elements in the ring of cursors.
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
SwCharFormat * FindCharFormatByName(const OUString &rName) const
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
void MoveLeftMargin(const SwPaM &rPam, bool bRight, bool bModulus, SwRootFrame const *pLayout=nullptr)
Adjust left margin via object bar (similar to adjustment of numerations).
bool HasFootnotes(bool bEndNotes=false) const
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
void StartAllAction()
For all views of this document.
sal_uInt16 GetScalingOfSelectedText() const
std::vector< std::pair< const SfxPoolItem *, std::unique_ptr< SwPaM > > > GetItemWithPaM(sal_uInt16 nWhich)
Get RES_CHRATR_* items of one type in the current selection.
bool IsMoveLeftMargin(bool bRight, bool bModulus=true) const
Adjust left margin via object bar (similar to adjustment of numerations).
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
bool SetCurFootnote(const SwFormatFootnote &rFillFootnote)
size_t GetSeqFootnoteList(SwSeqFieldList &rList, bool bEndNotes=false)
Give a List of all footnotes and their beginning texts.
void GetPaMParAttr(SwPaM *pPaM, SfxItemSet &rSet) const
Get the paragraph format attribute(s) of the selection(s) described by a SwPaM.
SvtScriptType GetScriptType() const
returns the script type of the selection
bool GetPaMAttr(SwPaM *pPaM, SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Apply / remove attributes.
bool GetCurFootnote(SwFormatFootnote *pToFillFootnote=nullptr)
Query and set footnote-text/number. Set... to current SSelection!
SwTextFormatColl * GetPaMTextFormatColl(SwPaM *pPaM) const
Get the named paragraph format of the selection(s) described by a SwPaM.
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
SwTextFormatColl * GetCurTextFormatColl() const
Get the named paragraph format of the current selection.
void MoveLeftMargin(bool bRight, bool bModulus=true)
LanguageType GetCurLang() const
void GetCurParAttr(SfxItemSet &rSet) const
Get the paragraph format attribute(s) of the current selection.
Base class of all fields.
OUString ExpandField(bool bCached, SwRootFrame const *pLayout) const
expand the field.
const SwRect & getFrameArea() const
Base class of the Writer layout elements.
Marks a node in the document model.
SwNodeOffset GetIndex() const
Base class of the Writer document model elements.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Merge GetRedlineMergeFlag() const
SwNodeType GetNodeType() const
const SwNumFormat & Get(sal_uInt16 i) const
PaM is Point and Mark: a selection of the document model.
SwNode & GetPointNode() const
const SwPosition * End() const
const SwPosition * GetPoint() const
const SwPosition * Start() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
SwPaM & SetPam(size_t nArrPos, SwPaM &rPam)
void Height(tools::Long nNew)
void Width(tools::Long nNew)
The root element of a Writer document layout.
bool HasMergedParas() const
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
sal_Int16 ScriptType(const TextFrameIndex nPos) const
static SwScriptInfo * GetScriptInfo(const SwTextNode &rNode, SwTextFrame const **o_pFrame=nullptr, bool bAllowInvalid=false)
return a frame for the node, ScriptInfo is its member... (many clients need both frame and SI,...
TextFrameIndex NextScriptChg(TextFrameIndex nPos) const
bool InsertSort(SeqFieldLstElem aNew)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
const SfxPoolItem & GetAttr() const
const sal_Int32 * End() const
const SwFormatFootnote & GetFootnote() const
sal_Int32 GetStart() const
const SwFormatField & GetFormatField() const
Represents the style of a paragraph.
Represents the visualization of a paragraph.
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
std::pair< SwTextNode *, sal_Int32 > MapViewToModel(TextFrameIndex nIndex) const
map position in potentially merged text frame to SwPosition
TextFrameIndex MapModelToView(SwTextNode const *pNode, sal_Int32 nIndex) const
sal_uInt16 GetScalingOfSelectedText(TextFrameIndex nStt, TextFrameIndex nEnd)
Calculates the width of the text part specified by nStart and nEnd, the height of the line containing...
TextFrameIndex MapModelToViewPos(SwPosition const &rPos) const
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
SwTextNode is a paragraph in the document model.
OUString GetExpandText(SwRootFrame const *pLayout, const sal_Int32 nIdx=0, const sal_Int32 nLen=-1, const bool bWithNum=false, const bool bAddSpaceAfterListLabelStr=false, const bool bWithSpacesForLevel=false, const ExpandMode eAdditionalMode=ExpandMode::ExpandFootnote|ExpandMode::HideFieldmarkCommands) const
add 4th optional parameter <bAddSpaceAfterListLabelStr> indicating, when <bWithNum = true> that a spa...
virtual sal_Int32 Len() const override
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.
SwpHints * GetpSwpHints()
const OUString & GetText() const
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
SwTextAttr * GetTextAttrForCharAt(const sal_Int32 nIndex, const sal_uInt16 nWhich=RES_TXTATR_END) const
get the text attribute at position nIndex which owns the dummy character CH_TXTATR_* at that position...
SwTextFormatColl * GetTextColl() const
rtl::Reference< SwDoc > mxDoc
The document; never 0.
SwRootFrame * GetLayout() const
SwTextAttr * Get(size_t nPos) const
ring_container GetRingContainer()
static SvtScriptType lcl_SetScriptFlags(sal_uInt16 nType)
static sal_uInt16 getMaxLookup()
static bool lcl_IsNoEndTextAttrAtPos(SwRootFrame const &rLayout, const SwTextNode &rTNd, sal_Int32 const nPos, SvtScriptType &rScrpt, bool bInSelection, bool bNum)
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(59)
bool isCHRATR(const sal_uInt16 nWhich)
constexpr TypedWhichId< SwFormatAutoFormat > RES_TXTATR_AUTOFMT(50)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
#define CH_TXTATR_BREAKWORD
sal_uInt16 GetWhichOfScript(sal_uInt16 nWhich, sal_uInt16 nScript)
LanguageType GetAppLanguage()
#define LANGUAGE_DONTKNOW
SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
sal_Int16 GetI18NScriptTypeOfLanguage(LanguageType nLang)
constexpr auto toTwips(N number, Length from)
bool IsFootnoteDeleted(IDocumentRedlineAccess const &rIDRA, SwTextFootnote const &rTextFootnote)
bool FrameContainsNode(SwContentFrame const &rFrame, SwNodeOffset nNodeIndex)
SwTextNode const & GetAttrMerged(SfxItemSet &rFormatSet, SwTextNode const &rNode, SwRootFrame const *pLayout)
SwTextNode * GetParaPropsNode(SwRootFrame const &rLayout, SwNode const &rNode)
constexpr tools::Long constTwips_5mm
static LanguageType nLang
Marks a position in the document model.
SwNodeOffset GetNodeIndex() const
sal_Int32 GetContentIndex() const
constexpr sal_Int32 COMPLETE_STRING
constexpr sal_uInt8 MAXLEVEL