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()->nNode);
95 const OUString & aCharFormatName =
108 sal_uLong nSttNd = rCurrentPaM.GetMark()->nNode.GetIndex(),
109 nEndNd = rCurrentPaM.GetPoint()->nNode.GetIndex();
110 sal_Int32 nSttCnt = rCurrentPaM.GetMark()->nContent.GetIndex();
111 sal_Int32 nEndCnt = rCurrentPaM.GetPoint()->nContent.GetIndex();
113 if( nSttNd > nEndNd || ( nSttNd == nEndNd && nSttCnt > nEndCnt ))
115 std::swap(nSttNd, nEndNd);
116 std::swap(nSttCnt, nEndCnt);
135 const sal_Int32 nStt = (
n == nSttNd) ? nSttCnt : 0;
136 const sal_Int32 nEnd = (
n == nEndNd)
140 static_cast<SwTextNode*
>(pNd)->GetParaAttr(*pSet, nStt, nEnd,
142 bMergeIndentValuesOfNumRule,
178 const bool bMergeIndentValuesOfNumRule )
const
191 sal_uInt16 numberOfLookup = 0;
200 sal_uLong nSttNd = rCurrentPaM.GetMark()->nNode.GetIndex(),
201 nEndNd = rCurrentPaM.GetPoint()->nNode.GetIndex();
204 if( nSttNd > nEndNd )
205 std::swap(nSttNd, nEndNd);
226 if( pSet != &rSet && aSet.
Count() )
254 sal_uInt16 numberOfLookup = 0;
260 sal_uLong nSttNd = rCurrentPaM.GetMark()->nNode.GetIndex(),
261 nEndNd = rCurrentPaM.GetPoint()->nNode.GetIndex();
264 if( nSttNd > nEndNd )
265 std::swap(nSttNd, nEndNd);
286 if( pFormat !=
nullptr )
299 std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM> >> vItem;
304 sal_uLong nSttNd = rCurrentPaM.Start()->nNode.GetIndex(),
305 nEndNd = rCurrentPaM.End()->nNode.GetIndex();
306 sal_Int32 nSttCnt = rCurrentPaM.Start()->nContent.GetIndex();
307 sal_Int32 nEndCnt = rCurrentPaM.End()->nContent.GetIndex();
309 SwPaM* pNewPaM =
nullptr;
319 const sal_Int32 nStt = (
n == nSttNd) ? nSttCnt : 0;
320 const sal_Int32 nEnd = (
n == nEndNd)
321 ? nEndCnt : pTextNd->
GetText().getLength();
330 : css::i18n::ScriptType::WEAK;
336 pNewPaM =
new SwPaM(*pNd, nStt, *pNd, nEnd);
338 vItem.emplace_back( pItem, std::unique_ptr<SwPaM>(pNewPaM) );
346 for(
size_t m = 0;
m < nSize;
m++ )
353 const sal_Int32 nAttrStart = pHt->
GetStart();
354 const sal_Int32* pAttrEnd = pHt->
End();
357 if( nAttrStart > nEnd )
359 if( *pAttrEnd <= nStt )
362 nScript = pScriptInfo
364 : css::i18n::ScriptType::WEAK;
373 if( pItem->
Which() == nWhich )
375 sal_Int32 nStart = 0, nStop = 0;
376 if( nAttrStart < nStt )
380 if( *pAttrEnd > nEnd )
384 pNewPaM =
new SwPaM(*pNd, nStart, *pNd, nStop);
385 vItem.emplace_back( pItem, std::unique_ptr<SwPaM>(pNewPaM) );
393 pNewPaM =
new SwPaM(*pNd, nStt, *pNd, nEnd);
395 vItem.emplace_back( pItem, std::unique_ptr<SwPaM>(pNewPaM) );
416 if( pFootnote && pFillFootnote )
423 return nullptr != pFootnote;
445 for (
auto pIdx : rIdxs )
448 if ( bEndNotes == rFootnote.
IsEndNote() )
461 const size_t nFootnoteCnt =
mxDoc->GetFootnoteIdxs().size();
463 for(
size_t n = 0;
n < nFootnoteCnt; ++
n )
465 pTextFootnote =
mxDoc->GetFootnoteIdxs()[
n ];
467 if ( rFootnote.
IsEndNote() != bEndNotes )
487 if( !sText.isEmpty() )
498 return rList.
Count();
507 sal_uInt16 nDefDist =
static_cast<sal_uInt16
>(rTabItem.
Count() ? rTabItem[0].GetTabPos() : 1134);
513 sal_uLong nSttNd = rPaM.GetMark()->nNode.GetIndex(),
514 nEndNd = rPaM.GetPoint()->nNode.GetIndex();
516 if( nSttNd > nEndNd )
517 std::swap(nSttNd, nEndNd);
520 for(
sal_uLong n = nSttNd; bRet &&
n <= nEndNd; ++n )
523 if(
nullptr != pCNd )
532 nNext = ( nNext / nDefDist ) * nDefDist;
536 const sal_uInt16 nFrameWidth =
static_cast<sal_uInt16
>( pFrame->
IsVertical() ?
539 bRet = nFrameWidth > ( nNext +
MM50 );
560 if( pCursor->
GetNext() != pCursor )
564 for(
size_t n = 0;
n < aRangeArr.
Count(); ++
n )
579 case css::i18n::ScriptType::LATIN:
580 return SvtScriptType::LATIN;
581 case css::i18n::ScriptType::ASIAN:
582 return SvtScriptType::ASIAN;
583 case css::i18n::ScriptType::COMPLEX:
584 return SvtScriptType::COMPLEX;
586 return SvtScriptType::NONE;
605 "<lcl_IsNoEndTextAttrAtPos(..)> - no list style found at text node. Serious defect." );
617 const SwNumFormat &rNumFormat = pNumRule->Get( static_cast<sal_uInt16>(nListLevel) );
623 sExp = OUString(&cBullet, 1);
651 const sal_Int32 nEnd = sExp.getLength();
657 for( sal_Int32
n = 0;
n < nEnd;
666 getScriptType( sExp, nEnd-1 ));
681 *pEnd = pStt == rPaM.GetMark()
684 if( pStt == pEnd || *pStt == *pEnd )
706 if (!pTNd->
GetText().isEmpty())
708 nScript = pScriptInfo
721 sal_uLong nEndIdx = pEnd->nNode.GetIndex();
723 for( ; aIdx.
GetIndex() <= nEndIdx; ++aIdx )
727 const OUString& rText = pTNd->
GetText();
734 sal_Int32 nChg = aIdx == pStt->
nNode
737 sal_Int32 nEndPos = aIdx == nEndIdx
741 OSL_ENSURE( nEndPos <= rText.getLength(),
742 "Index outside the range - endless loop!" );
743 if (nEndPos > rText.getLength())
744 nEndPos = rText.getLength();
746 bool const isUntilEnd(pScriptInfo
748 : rText.getLength() == nEndPos);
750 while( nChg < nEndPos )
755 nScript = pScriptInfo ?
766 if( (SvtScriptType::LATIN | SvtScriptType::ASIAN |
767 SvtScriptType::COMPLEX) == nRet )
770 sal_Int32 nFieldPos = nChg+1;
781 std::pair<SwTextNode*, sal_Int32>
const tmp(
783 nChg = (tmp.first == pTNd)
791 rText, nChg, nScript );
794 nFieldPos = rText.indexOf(
796 if ((-1 != nFieldPos) && (nFieldPos < nChg))
799 if( (SvtScriptType::LATIN | SvtScriptType::ASIAN |
800 SvtScriptType::COMPLEX) == nRet )
804 if( (SvtScriptType::LATIN | SvtScriptType::ASIAN |
805 SvtScriptType::COMPLEX) == nRet )
810 if( nRet == SvtScriptType::NONE )
826 if( nPos && !pCursor->
HasMark() )
840 OSL_ENSURE( pTNd,
"no textnode available" );
842 sal_uInt16 nScaleWidth;
845 SwTextFrame *
const pFrame(static_cast<SwTextFrame *>(
SvxNumType GetNumberingType() const
Base class of the Writer layout elements.
Represents the visualization of a paragraph.
SwNode & GetNode(bool bPoint=true) const
SwTextFormatColl * GetCurTextFormatColl() const
Get the named paragraph format of the current selection.
Represents the style of a paragraph.
Marks a position in the document model.
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
SwTextNode const & GetAttrMerged(SfxItemSet &rFormatSet, SwTextNode const &rNode, SwRootFrame const *pLayout)
TextFrameIndex NextScriptChg(TextFrameIndex nPos) const
SwPaM * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
SwCharFormat * FindCharFormatByName(std::u16string_view rName) const
bool isCHRATR(const sal_uInt16 nWhich)
const OUString & GetText() const
SwpHints * GetpSwpHints()
const SfxPoolItem * GetPoolDefaultItem(sal_uInt16 nWhich) const
virtual sal_Int32 Len() const override
Base class of all fields.
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) 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...
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
bool IsFootnoteDeleted(IDocumentRedlineAccess const &rIDRA, SwTextFootnote const &rTextFootnote)
static SvtScriptType lcl_SetScriptFlags(sal_uInt16 nType)
bool InsertSort(SeqFieldLstElem aNew)
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
void GetCurParAttr(SfxItemSet &rSet) const
Get the paragraph format attribute(s) of the current selection.
The root element of a Writer document layout.
int GetActualListLevel() const
Returns the actual list level of this text node, when it is a list item.
static LanguageType nLang
LanguageType GetCurLang() 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...
#define CH_TXTATR_BREAKWORD
const SfxPoolItem * NextItem()
SwNodeType GetNodeType() const
rtl::Reference< SwDoc > mxDoc
The document; never 0.
const SwRect & getFrameArea() const
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
sal_uLong GetIndex() const
sal_Int32 GetStart() const
void Width(tools::Long nNew)
static bool lcl_IsNoEndTextAttrAtPos(SwRootFrame const &rLayout, const SwTextNode &rTNd, sal_Int32 const nPos, SvtScriptType &rScrpt, bool bInSelection, bool bNum)
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
const SwFormatField & GetFormatField() const
static SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
constexpr TypedWhichId< SwFormatAutoFormat > RES_TXTATR_AUTOFMT(50)
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(58)
SwPaM & SetPam(size_t nArrPos, SwPaM &rPam)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
PaM is Point and Mark: a selection of the document model.
bool FrameContainsNode(SwContentFrame const &rFrame, sal_uLong nNodeIndex)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
tools::Long GetTextLeft() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
TextFrameIndex MapModelToViewPos(SwPosition const &rPos) const
SvtScriptType GetScriptType() const
returns the script type of the selection
SwTextAttr * Get(size_t nPos) const
const SwPosition * GetPoint() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
void MoveLeftMargin(bool bRight, bool bModulus=true)
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
static sal_Int16 GetI18NScriptTypeOfLanguage(LanguageType nLang)
Marks a character position inside a document model node.
sal_uInt16 GetWhichOfScript(sal_uInt16 nWhich, sal_uInt16 nScript)
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
#define LANGUAGE_DONTKNOW
sal_uInt16 GetCursorCnt(bool bAll=true) const
Get the number of elements in the ring of cursors.
Marks a node in the document model.
size_t GetSeqFootnoteList(SwSeqFieldList &rList, bool bEndNotes=false)
Give a List of all footnotes and their beginning texts.
bool HasSwAttrSet() const
ring_container GetRingContainer()
void MergeValues(const SfxItemSet &rSet)
SfxItemPool * GetPool() const
const SwFormatFootnote & GetFootnote() const
std::pair< SwTextNode *, sal_Int32 > MapViewToModel(TextFrameIndex nIndex) const
map position in potentially merged text frame to SwPosition
const SwPosition * Start() const
bool GetPaMParAttr(SwPaM *pPaM, SfxItemSet &rSet) const
Get the paragraph format attribute(s) of the selection(s) described by a SwPaM.
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 GetPaMAttr(SwPaM *pPaM, SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Apply / remove attributes.
SwTextNode * GetParaPropsNode(SwRootFrame const &rLayout, SwNodeIndex const &rNode)
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...
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
const SwNumFormat & Get(sal_uInt16 i) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
bool SetCurFootnote(const SwFormatFootnote &rFillFootnote)
SwTextNode is a paragraph in the document model.
OUString ExpandField(bool bCached, SwRootFrame const *pLayout) const
expand the field.
void MoveLeftMargin(const SwPaM &rPam, bool bRight, bool bModulus, SwRootFrame const *pLayout=nullptr)
Adjust left margin via object bar (similar to adjustment of numerations).
sal_Int16 ScriptType(const TextFrameIndex nPos) const
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) const
add 4th optional parameter indicating, when that a spa...
bool IsMoveLeftMargin(bool bRight, bool bModulus=true) const
Adjust left margin via object bar (similar to adjustment of numerations).
bool HasFootnotes(bool bEndNotes=false) const
TextFrameIndex MapModelToView(SwTextNode const *pNode, sal_Int32 nIndex) const
sal_Int32 GetIndex() const
LanguageType GetAppLanguage()
const SwPosition * End() const
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
const sal_Int32 * End() const
bool GetCurFootnote(SwFormatFootnote *pToFillFootnote=nullptr)
Query and set footnote-text/number. Set... to current SSelection!
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding)...
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
SwTextFormatColl * GetPaMTextFormatColl(SwPaM *pPaM) const
Get the named paragraph format of the selection(s) described by a SwPaM.
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
OUString GetNumString(const bool _bInclPrefixAndSuffixStrings=true, const unsigned int _nRestrictToThisLevel=MAXLEVEL, SwRootFrame const *pLayout=nullptr) const
Returns outline of numbering string.
const SfxPoolItem & GetAttr() const
static sal_uInt16 getMaxLookup()
const sal_uInt16 * GetRanges() const
const sal_uInt16 CRSR_SKIP_CHARS
void InvalidateAllItems()
bool HasMergedParas() const
const SfxPoolItem & GetAttr(sal_uInt16 nWhich, bool bInParent=true) const
SS for PoolItems: hard attributation.
void StartAllAction()
For all views of this document.
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
sal_uInt16 GetScalingOfSelectedText() const
SwRootFrame * GetLayout() const
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...
void Height(tools::Long nNew)
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
Merge GetRedlineMergeFlag() const
const sal_Int32 COMPLETE_STRING
bool GoPrevious(SwIndex *, sal_uInt16 nMode) const
const SfxPoolItem * GetCurItem() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Base class of the Writer document model elements.
SwTextFormatColl * GetTextColl() const