21#include <osl/diagnose.h>
68 OSL_ENSURE( bSuccess,
"Doc->Insert() failed." );
94 OSL_ENSURE( bSuccess,
"Doc->Insert() failed." );
102 rCurrentCursor.GetPoint()->GetNode().
GetTextNode();
103 if( pTextNode && pTextNode->
Len() == 1)
114 const bool bDoNotSetBidiLevel = ! pTmpCursor ||
115 (
dynamic_cast<SwUnoCursor*
>(pTmpCursor) !=
nullptr );
117 if ( ! bDoNotSetBidiLevel )
128 static_cast<SwTextNode&
>(rNode), &pFrame,
true);
135 std::pair<Point, bool>
const tmp(aPt,
false);
137 static_cast<SwTextNode&
>(rNode).getLayoutFrame(
145 nLevel = aScriptInfo.
DirType( iPrevPos );
156 nLevel = pSI->
DirType(iPrevPos);
175 OSL_FAIL(
"Doc->getIDocumentContentOperations().Overwrite(Str) failed." );
241 const Graphic* pGrf(
nullptr );
260 return pGrfNode ? &(pGrfNode->
GetGrfObj()) :
nullptr;
267 return pGrfNode ? &(pGrfNode->
GetGraphicAttr( rGA, pFrame )) :
nullptr;
282 if( ( !pCurrentCursor->
HasMark()
298 mxDoc->getIDocumentContentOperations().ReRead( *
GetCursor(), rGrfName, rFltName, pGraphic );
307 OSL_ENSURE( pGrfName || pFltName,
"No parameters" );
339 OSL_ENSURE( pNd,
"is no NoTextNode!" );
364 "GetOLEObj: no OLENode." );
367 OSL_ENSURE( pOLENode,
"GetOLEObj: no OLENode." );
393 OSL_ENSURE( pONd,
"ChartNode not found" );
468 SwPaM* pLast = pCursor;
469 SwPaM* pTemp = pCursor;
473 bPrev = ( pPrev2 && pPrev2 != pLast );
492 SAL_WARN_IF(!pTextFrame,
"sw.core",
"GetDropText cursor has no frame?");
496 aText = pTextFrame->
GetText().copy(0, sal_Int32(nDropLen));
513 SwPaM aPam( rNd, rStr.getLength(), rNd, 0 );
524 OSL_FAIL(
"Doc->getIDocumentContentOperations().Overwrite(Str) failed." );
532 OUStringBuffer aFormel;
541 const SwPosition *pStart = rCurrentPaM.Start(), *pEnd = rCurrentPaM.End();
544 nStt, pEnd->GetContentIndex() - nStt);
548 bool bValidFields =
false;
556 sal_Int32 nTmpStt =
nPos-1;
560 ch ==
'_'||
ch ==
'.' ))
566 OUString sVar =
aStr.copy( nTmpStt,
nPos - nTmpStt );
581 aFormel.append(sVar);
594 return mxDoc->getIDocumentLinksAdministration().GetLinkManager();
640 bool bInsText =
true;
642 if( !rStr.isEmpty() )
648 bool bDelText =
true;
654 bDelText = bInsText =
false;
656 else if( rFormat.
GetValue() == rStr )
657 bDelText = bInsText =
false;
692 for(
auto n = pFormats->
size(); 1 <
n; )
697 SwTextNode const*
const pTextNd(pFnd->GetpTextNode());
701 if (
nullptr != pTextNd &&
nullptr != pFrame
709 if (!bIncludeInToxContent)
723 sText = sText.replaceAll(
"\x0a",
"");
726 if( !sText.isEmpty() )
728 rArr.emplace_back(sText, rAttr);
775 for(
int i = 0;
i < 2;
i++)
784 if( nCurrNd <= nEndNd )
796 if(
nullptr != pContentFrame )
811 ( pNumRule && pTextNd->
GetNum() &&
826 pNumRule->
Get( o3tl::narrowing<sal_uInt16>(nListLevel) ).GetStart();
845 bGoOn = nCurrNd < nEndNd;
867 &aStart,
true,
false )) )
877 aStart = *pMerged->pLastNode;
1017 bool bLeft = nDiff < 0;
1018 sal_Int32 nMaxGuard =
std::abs(nDiff);
1029 if (nNewPos == nNewCursorPos)
1032 if (nNewPos == nOldPos)
1035 SAL_WARN(
"sw.core",
"IM cursor move failed");
1039 if (--nMaxGuard == 0)
1043 SAL_WARN(
"sw.core",
"IM abandoning cursor positioning");
1065 if( pCursor->
GetNext() != pCursor )
1070 if( rPaM.HasMark() )
1085 if( rPaM.HasMark() )
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...
CalcOp * FindOperator(const OUString &rSrch)
OUString lowercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
bool isLetter(const OUString &rStr, sal_Int32 nPos) const
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
sal_Int32 GetCursorPos() const
bool IsOnlyCursorChanged() const
bool IsCursorOverwrite() const
bool IsCursorVisible() const
GraphicType GetType() const
GraphicType GetType() const
virtual bool AppendTextNode(SwPosition &rPos)=0
virtual bool SplitNode(const SwPosition &rPos, bool bChkTableStart)=0
Split a node at rPos (implemented only for TextNode).
virtual void TransliterateText(const SwPaM &rPaM, utl::TransliterationWrapper &)=0
change text to Upper/Lower/Hiragana/Katakana/...
virtual void SetIME(bool bIME)=0
States that the last inserted string came from IME.
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
virtual void FieldsToCalc(SwCalc &rCalc, SwNodeOffset nLastNd, sal_Int32 nLastCnt)=0
virtual sal_uInt16 getLinkUpdateMode(bool bGlobalSettings) const =0
Get the current link update mode.
virtual void setLinkUpdateMode(sal_uInt16 nMode)=0
Set the current link update mode.
virtual void SetModified()=0
Must be called manually at changes of format.
virtual void UpdateDocStat(bool bCompleteAsync, bool bFields)=0
Updates the internal document's statistics.
virtual const SwDocStat & GetUpdatedDocStat(bool bCompleteAsync, bool bFields)=0
Updates the document statistics if the document has been modified and returns a reference to the resu...
OUString GetStrResult(const SwSbxValue &rValue)
SwHashTable< SwCalcExp > & GetVarTable()
SwSbxValue Calculate(const OUString &rStr)
SwCalcExp * VarLook(const OUString &rStr, bool bIns=false)
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
bool Pop(PopMode, ::std::optional< SwCallLink > &roLink)
void Push()
store a copy of the current cursor on the cursor stack
void SetOverwriteCursor(bool bFlag)
void ClearTableBoxContent()
SwShellCursor * GetCursor_()
bool HasSelection() const
Does the current cursor create a selection?
bool IsMultiSelection() const
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
OUString GetSelText() const
get selected text of a node at current cursor
bool ExtendSelection(bool bEnd=true, sal_Int32 nCount=1)
extend current SSelection by n characters
bool SelectTextAttr(sal_uInt16 nWhich, bool bExpand, const SwTextAttr *pAttr=nullptr)
SwMoveFnCollection const & MakeFindRange(SwDocPositions, SwDocPositions, SwPaM *) const
void EndAction(const bool bIdleEnd=false)
bool Right(sal_uInt16 nCnt, SwCursorSkipMode nMode, bool bAllowVisual=false)
SwContentFrame * GetCurrFrame(const bool bCalcFrame=true) const
Get current frame in which the cursor is positioned.
bool SetInFrontOfLabel(bool bNew)
bool IsOverwriteCursor() const
SwShellCursor * getShellCursor(bool bBlock)
Delivers the current shell cursor.
bool Left(sal_uInt16 nCnt, SwCursorSkipMode nMode, bool bAllowVisual=false)
bool IsCursorPtAtEnd() const
void SaveTableBoxContent(const SwPosition *pPos=nullptr)
void SetCursorBidiLevel(sal_uInt8 nNewLevel)
tools::Long CompareDoc(const SwDoc &rDoc)
void UpdateCharts(const OUString &rName) const
const SwFootnoteInfo & GetFootnoteInfo() const
static void CountWords(const SwPaM &rPaM, SwDocStat &rStat)
IDocumentState const & getIDocumentState() const
void SetTableName(SwFrameFormat &rTableFormat, const OUString &rNewName)
void UpdateRsid(const SwPaM &rRg, sal_Int32 nLen)
Set the rsid of the next nLen symbols of rRg to the current session number.
SwExtTextInput * GetExtTextInput(const SwNode &rNd, sal_Int32 nContentPos=-1) const
const SwCharFormats * GetCharFormats() const
sal_uInt16 GetRefMarks(std::vector< OUString > *=nullptr) const
void DeleteExtTextInput(SwExtTextInput *pDel)
const SwLineNumberInfo & GetLineNumberInfo() const
void SetFootnoteInfo(const SwFootnoteInfo &rInfo)
IDocumentContentOperations const & getIDocumentContentOperations() const
IDocumentUndoRedo & GetIDocumentUndoRedo()
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
void SetNumRuleStart(const SwPosition &rPos, bool bFlag=true)
static void GetGrfNms(const SwFlyFrameFormat &rFormat, OUString *pGrfName, OUString *pFltName)
const SwEndNoteInfo & GetEndNoteInfo() const
void SetEndNoteInfo(const SwEndNoteInfo &rInfo)
bool ConvertFieldsToText(SwRootFrame const &rLayout)
const SwFormatRefMark * GetRefMark(std::u16string_view rName) const
bool UpdateParRsid(SwTextNode *pTextNode, sal_uInt32 nVal=0)
void SetLineNumberInfo(const SwLineNumberInfo &rInfo)
void ClearBoxNumAttrs(SwNode &rNode)
SwExtTextInput * CreateExtTextInput(const SwPaM &rPam)
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
IDocumentStatistics const & getIDocumentStatistics() const
tools::Long MergeDoc(const SwDoc &rDoc)
Merge two documents.
void CountWords(SwDocStat &rStat) const
Count words in current selection.
sal_uInt16 GetCntType() const
Determine form of content. Return Type at CurrentCursor->SPoint.
void GetINetAttrs(SwGetINetAttrs &rArr, bool bIncludeInToxContent=true)
virtual void CalcLayout() override
To enable set up of StartActions and EndActions.
OUString DeleteExtTextInput(bool bInsText=true)
void SetChartName(const OUString &rName)
void StartAllAction()
For all views of this document.
void SplitNode(bool bAutoFormat=false, bool bCheckTableStart=true)
void SetLineNumberInfo(const SwLineNumberInfo &rInfo)
bool HasOLEObj(std::u16string_view rName) const
Is there an OLEObject with this name (SwFormat)?
virtual void ApplyViewOptions(const SwViewOption &rOpt) override
Apply ViewOptions with Start-/EndAction.
SAL_DLLPRIVATE void DeleteSel(SwPaM &rPam, bool isArtificialSelection, bool *pUndo=nullptr)
tools::Long MergeDoc(const SwDoc &rDoc)
Merge two documents.
GraphicType GetGraphicType() const
void DelINetAttrWithText()
If cursor is in an INetAttribute it will be deleted completely including the descriptive text (needed...
void GetGrfNms(OUString *pGrfName, OUString *pFltName, const SwFlyFrameFormat *=nullptr) const
Returns the name and the filter name of a graphic if the pointer is on a graphic.
void SetLinkUpdMode(sal_uInt16 nMode)
void SetExtTextInputData(const CommandExtTextInputData &)
bool Delete(bool isArtificialSelection=false)
Delete content of all ranges.
void AutoFormatBySplitNode()
void UpdateDocStat()
Document - Statistics.
bool GetGrfSize(Size &) const
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
OUString Calculate()
Calculates selection.
SvNumberFormatter * GetNumberFormatter()
Query NumberFormatter from document.
const SwFootnoteInfo & GetFootnoteInfo() const
Footnote attributes global to document.
const SwEndNoteInfo & GetEndNoteInfo() const
void SetEndNoteInfo(const SwEndNoteInfo &rInfo)
void CreateExtTextInput(LanguageType eInputLanguage)
Interface for TextInputData - (for input of Japanese/Chinese chars.)
void Overwrite(const OUString &)
bool InsertURL(const SwFormatINetFormat &rFormat, const OUString &rStr, bool bKeepSelection=false)
tools::Long CompareDoc(const SwDoc &rDoc)
Compare two documents.
Graphic GetIMapGraphic() const
Remove default parameter, because method always called this default value.
svt::EmbeddedObjectRef & GetOLEObject() const
Get OLE object at pointer.
void Insert2(const OUString &, const bool bForceExpandHints=false)
void ClearAutomaticContour()
If there's an automatic, not manipulated polygon at the selected notxtnode, it has to be deleted,...
void Insert(sal_Unicode, bool bOnlyCurrCursor=false)
Edit (all selected ranges).
const SwDocStat & GetUpdatedDocStat()
bool IsLinkedGrfSwapOut() const
bool DontExpandFormat()
If Cursor is at the end of a character style in which the DontExpand-flag is not yet set,...
OUString GetDropText(const sal_Int32 nChars) const
SAL_DLLPRIVATE SwGrfNode * GetGrfNode_() const
Returns pointer to a SwGrfNode that will be used by GetGraphic() and GetGraphicSize().
bool ConvertFieldsToText()
Replace fields by text - mailmerge support.
sal_uInt16 GetRefMarks(std::vector< OUString > *=nullptr) const
get the names of all references in a Doc
void UpdateCharts(const OUString &rName)
Update content of all charts for table with given name.
void SetNumberingRestart()
Set all numbering start points to a fixed value - mailmerge support.
const GraphicAttr * GetGraphicAttr(GraphicAttr &rGA) const
void SetGraphicPolygon(const tools::PolyPolygon *pPoly)
void SetFootnoteInfo(const SwFootnoteInfo &rInfo)
void SetTableName(SwFrameFormat &rTableFormat, const OUString &rNewName)
change table name
void ReplaceDropText(const OUString &rStr, SwPaM *pPaM=nullptr)
const GraphicObject * GetGraphicObj() const
sfx2::LinkManager & GetLinkManager()
const SwLineNumberInfo & GetLineNumberInfo() const
const Graphic * GetGraphic(bool bWait=true) const
void * GetIMapInventor() const
Unique identification of object (for ImageMapDlg).
OUString GetCurWord() const
request current word
const tools::PolyPolygon * GetGraphicPolygon() const
void TransliterateText(TransliterationFlags nType)
Change text to Upper/Lower/Hiragana/Katakana/...
void ReRead(const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic=nullptr)
Re-read if graphic is not ok. Current graphic is replaced by the new one.
sal_uInt16 GetLinkUpdMode() const
Embeds all local links (ranges/graphics).
const SwFormatRefMark * GetRefMark(std::u16string_view rName) const
get the reference of a given name in the Doc
void SetLanguage(LanguageType eSet)
bool IsOverwriteCursor() const
void SetInputData(const CommandExtTextInputData &rData)
void SetOverwriteCursor(bool bFlag)
void SetInsText(bool bFlag)
general base class for all free-flowing frames
virtual const SwFlyFrameFormat * GetFormat() const override
Base class of the Writer layout elements.
SwFlyFrame * FindFlyFrame()
bool IsRightToLeft() const
SwLayoutFrame * GetUpper()
bool IsLinkedFile() const
GraphicAttr & GetGraphicAttr(GraphicAttr &, const SwFrame *pFrame) const
Returns the with our graphic attributes filled Graphic-Attr-Structure.
const GraphicObject & GetGrfObj(bool bWait=false) const
const Graphic & GetGrf(bool bWait=false) const
bool GetFileFilterNms(OUString *pFileNm, OUString *pFilterNm) const
T * Find(std::u16string_view aStr, sal_uInt32 *pPos=nullptr) const
< purpose of derivation from SwClient: character style for displaying the numbers.
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
void SetContour(const tools::PolyPolygon *pPoly, bool bAutomatic=false)
bool HasAutomaticContour() const
const tools::PolyPolygon * HasContour() const
virtual Size GetTwipSize() const =0
Marks a node in the document model.
SwNodeIndex & Assign(SwNodes const &rNds, SwNodeOffset nIdx)
Base class of the Writer document model elements.
SwStartNode * GetStartNode()
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwNodes & GetNodes()
Node is in which nodes-array/doc?
SwSectionNode * FindSectionNode()
Search section node, in which it is.
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
SwNodeOffset EndOfSectionIndex() const
SwContentNode * GetContentNode()
SwNoTextNode * GetNoTextNode()
SwNodeType GetNodeType() const
const SwEndNode * EndOfSectionNode() const
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc....
const SwNumFormat & Get(sal_uInt16 i) const
SwNumberTree::tSwNumTreeNumber GetNumber(bool bValidate=true) const
Returns number of this node.
const SwOLEObj & GetOLEObj() const
void SetChartTableName(const OUString &rNm)
const OUString & GetChartTableName() const
svt::EmbeddedObjectRef & GetObject()
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
SwNode & GetPointNode() const
bool IsMultiSelection() const
const SwPosition * End() const
SwNode & GetMarkNode() const
const SwPosition * GetPoint() const
const SwPosition * Start() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
sal_uInt8 DirType(const TextFrameIndex nPos) const
TextFrameIndex GetInvalidityA() 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,...
void InitScriptInfo(const SwTextNode &rNode, sw::MergedPara const *pMerged, bool bRTL)
A section node represents the start of a section on the UI, i.e.
Starts a section of nodes in the document model.
virtual const sal_Int32 * GetEnd() const override
end position
sal_Int32 GetStart() const
Represents the visualization of a paragraph.
TextFrameIndex GetDropLen(TextFrameIndex nWishLen) const
nWishLen = 0 indicates that we want a whole word
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
sw::MergedPara * GetMergedPara()
TextFrameIndex MapModelToView(SwTextNode const *pNode, sal_Int32 nIndex) const
bool IsHiddenNow() const
Hidden.
sal_Int32 GetLineCount(TextFrameIndex nPos)
Determines the line count.
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
OUString GetCurWord(SwPosition const &) const
SwTextAttr subclass that tracks the location of the wrapped SwFormatURL.
SwTextNode is a paragraph in the document model.
bool HasBullet() const
Returns if this text node has a bullet.
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
const SwNodeNum * GetNum(SwRootFrame const *pLayout=nullptr, SwListRedlineType eRedline=SwListRedlineType::SHOW) const
bool IsCountedInList() const
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
bool HasNumber(SwRootFrame const *pLayout=nullptr) const
Returns if this text node has a number.
int GetActualListLevel(SwListRedlineType eRedline=SwListRedlineType::SHOW) const
Returns the actual list level of this text node, when it is a list item.
bool IsListRestart() const
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
const SwNodes & GetNodes() const
virtual void ApplyViewOptions(const SwViewOption &rOpt)
bool AddPaintRect(const SwRect &rRect)
IDocumentContentOperations & getIDocumentContentOperations()
Provides access to the content operations interface.
rtl::Reference< SwDoc > mxDoc
The document; never 0.
SwRootFrame * GetLayout() const
ring_container GetRingContainer()
std::vector< SwGetINetAttr > SwGetINetAttrs
constexpr OUStringLiteral IsHidden(u"IsHidden")
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
CharClass & GetAppCharClass()
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
void GetTextFromPam(SwPaM &rPam, OUString &rBuffer, SwRootFrame const *pLayout=nullptr)
OString strip(const OString &rIn, char c)
OString stripEnd(const OString &rIn, char c)
@ Section
SwSectionNode is derived from SwStartNode.
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
SwNodeOffset abs(const SwNodeOffset &a)
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
Marks a position in the document model.
SwNodeOffset GetNodeIndex() const
sal_Int32 GetContentIndex() const
constexpr sal_Int32 COMPLETE_STRING
constexpr sal_uInt8 MAXLEVEL