21 #include <osl/diagnose.h>
55 #include <section.hxx>
66 for(
SwPaM& rPaM : GetCursor()->GetRingContainer())
68 const bool bSuccess = GetDoc()->getIDocumentContentOperations().InsertString(rPaM, OUString(c));
69 OSL_ENSURE( bSuccess,
"Doc->Insert() failed." );
71 SaveTableBoxContent( rPaM.GetPoint() );
93 GetDoc()->getIDocumentContentOperations().InsertString(rCurrentCursor, rStr, nInsertFlags);
94 OSL_ENSURE( bSuccess,
"Doc->Insert() failed." );
98 GetDoc()->UpdateRsid( rCurrentCursor, rStr.getLength() );
102 rCurrentCursor.GetPoint()->nNode.GetNode().
GetTextNode();
103 if( pTextNode && pTextNode->
Len() == 1)
104 GetDoc()->UpdateParRsid( pTextNode );
107 SaveTableBoxContent( rCurrentCursor.GetPoint() );
113 SwCursor* pTmpCursor = GetCursor_();
114 const bool bDoNotSetBidiLevel = ! pTmpCursor ||
115 (
dynamic_cast<SwUnoCursor*
>(pTmpCursor) !=
nullptr );
117 if ( ! bDoNotSetBidiLevel )
123 sal_Int32 nPrevPos = rIdx.
GetIndex();
129 static_cast<SwTextNode&>(rNode), &pFrame,
true);
136 std::pair<Point, bool>
const tmp(aPt,
false);
138 static_cast<SwTextNode&
>(rNode).getLayoutFrame(
139 GetLayout(), pTmpCursor->
GetPoint(), &tmp));
145 &static_cast<SwTextNode&>(rNode), nPrevPos));
146 nLevel = aScriptInfo.
DirType( iPrevPos );
156 &static_cast<SwTextNode&>(rNode), nPrevPos));
157 nLevel = pSI->
DirType(iPrevPos);
164 SetInFrontOfLabel(
false );
172 for(
SwPaM& rPaM : GetCursor()->GetRingContainer())
174 if( !GetDoc()->getIDocumentContentOperations().Overwrite(rPaM, rStr ) )
176 OSL_FAIL(
"Doc->getIDocumentContentOperations().Overwrite(Str) failed." );
178 SaveTableBoxContent( rPaM.GetPoint() );
188 for(
SwPaM& rPaM : GetCursor()->GetRingContainer())
191 GetDoc()->ClearBoxNumAttrs( rPaM.GetPoint()->nNode );
192 GetDoc()->getIDocumentContentOperations().SplitNode( *rPaM.GetPoint(), bCheckTableStart );
198 AutoFormatBySplitNode();
200 ClearTableBoxContent();
211 for(
SwPaM& rPaM : GetCursor()->GetRingContainer())
213 GetDoc()->ClearBoxNumAttrs( rPaM.GetPoint()->nNode );
214 bRet = GetDoc()->getIDocumentContentOperations().AppendTextNode( *rPaM.GetPoint()) || bRet;
219 ClearTableBoxContent();
229 SwPaM* pCursor = GetCursor();
242 const Graphic* pGrf(
nullptr );
261 return pGrfNode ? &(pGrfNode->
GetGrfObj()) :
nullptr;
267 const SwFrame* pFrame = GetCurrFrame(
false);
268 return pGrfNode ? &(pGrfNode->
GetGraphicAttr( rGA, pFrame )) :
nullptr;
282 SwPaM* pCurrentCursor = GetCursor();
283 if( ( !pCurrentCursor->
HasMark()
299 mxDoc->getIDocumentContentOperations().ReRead( *GetCursor(), rGrfName, rFltName, pGraphic );
308 OSL_ENSURE( pGrfName || pFltName,
"No parameters" );
333 GetDoc()->getIDocumentState().SetModified();
340 OSL_ENSURE( pNd,
"is no NoTextNode!" );
348 GetDoc()->getIDocumentState().SetModified();
361 OSL_ENSURE(
CNT_OLE == GetCntType(),
"GetOLEObj: no OLENode." );
362 OSL_ENSURE( !GetCursor()->HasMark() ||
363 (GetCursor()->HasMark() &&
364 GetCursor()->GetPoint()->nNode == GetCursor()->GetMark()->nNode),
365 "GetOLEObj: no OLENode." );
368 OSL_ENSURE( pOLENode,
"GetOLEObj: no OLENode." );
376 SwNodeIndex aIdx( *GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
382 rName ==
static_cast<SwOLENode&
>(rNd).GetChartTableName() &&
383 static_cast<SwOLENode&
>(rNd).getLayoutFrame( GetLayout() ) )
394 OSL_ENSURE( pONd,
"ChartNode not found" );
400 GetDoc()->UpdateCharts( rName );
406 GetDoc()->SetTableName( rTableFormat, rNewName );
412 const SwPaM& rPaM = *GetCursor();
429 GetDoc()->getIDocumentStatistics().UpdateDocStat(
false,
true );
436 const SwDocStat &rRet = GetDoc()->getIDocumentStatistics().GetUpdatedDocStat(
false,
true );
444 return GetDoc()->GetRefMark( rName );
450 return GetDoc()->GetRefMarks( pStrings );
462 SwPaM* pCursor = GetCursor();
463 if ( IsMultiSelection() )
469 SwPaM* pLast = pCursor;
470 SwPaM* pTemp = pCursor;
474 bPrev = ( pPrev2 && pPrev2 != pLast );
479 if ( nTemp < nIndex )
491 SwTextFrame const*
const pTextFrame(static_cast<SwTextFrame const*>(
493 SAL_WARN_IF(!pTextFrame,
"sw.core",
"GetDropText cursor has no frame?");
497 aText = pTextFrame->
GetText().copy(0, sal_Int32(nDropLen));
506 SwPaM* pCursor = pPaM ? pPaM : GetCursor();
514 SwPaM aPam( rNd, rStr.getLength(), rNd, 0 );
515 SwTextFrame const*
const pTextFrame(static_cast<SwTextFrame const*>(
519 *aPam.GetPoint() = pTextFrame->MapViewToModelPos(
TextFrameIndex(0));
521 std::min(rStr.getLength(), pTextFrame->GetText().getLength())));
523 if( !GetDoc()->getIDocumentContentOperations().Overwrite( aPam, rStr ) )
525 OSL_FAIL(
"Doc->getIDocumentContentOperations().Overwrite(Str) failed." );
533 OUStringBuffer aFormel;
534 SwCalc aCalc( *GetDoc() );
537 for(
SwPaM& rCurrentPaM : GetCursor()->GetNext()->GetRingContainer())
542 const SwPosition *pStart = rCurrentPaM.Start(), *pEnd = rCurrentPaM.End();
545 nStt, pEnd->nContent.GetIndex() - nStt);
549 bool bValidFields =
false;
552 while( nPos < aStr.getLength() )
555 if( rCC.
isLetter( aStr, nPos-1 ) || ch ==
'_' )
557 sal_Int32 nTmpStt = nPos-1;
558 while( nPos < aStr.getLength() &&
559 0 != ( ch = aStr[ nPos++ ]) &&
561 ch ==
'_'|| ch ==
'.' ))
564 if( nPos < aStr.getLength() )
567 OUString sVar = aStr.copy( nTmpStt, nPos - nTmpStt );
574 GetDoc()->getIDocumentFieldsAccess().FieldsToCalc( aCalc,
582 aFormel.append(sVar);
595 return mxDoc->getIDocumentLinksAdministration().GetLinkManager();
601 return static_cast<void*
>(&(GetCursor()->GetNode()));
608 CurrShell aCurr( const_cast<SwEditShell*>(
this) );
610 SwPaM* pCursor = GetCursor();
616 SwGrfNode & rGrfNode(static_cast<SwGrfNode&>(rNd));
621 if (
const Graphic* pGraphic = static_cast<SwOLENode&>(rNd).GetGraphic())
637 if( rFormat.
GetValue().isEmpty() || ( rStr.isEmpty() && !HasSelection() ) )
641 bool bInsText =
true;
643 if( !rStr.isEmpty() )
645 SwPaM* pCursor = GetCursor();
649 bool bDelText =
true;
655 bDelText = bInsText =
false;
657 else if( rFormat.
GetValue() == rStr )
658 bDelText = bInsText =
false;
670 ExtendSelection(
false, rStr.getLength() );
676 SetAttrItem( rFormat );
677 if (bInsText && !IsCursorPtAtEnd())
693 for(
auto n = pFormats->
size(); 1 <
n; )
698 SwTextNode const*
const pTextNd(pFnd->GetpTextNode());
700 ? static_cast<SwTextFrame const*>(pTextNd->getLayoutFrame(GetLayout()))
702 if (
nullptr != pTextNd &&
nullptr != pFrame
703 && pTextNd->GetNodes().IsDocNodes()
705 && pFrame->MapModelToView(pTextNd, pFnd->GetStart())
706 != pFrame->MapModelToView(pTextNd, *pFnd->GetEnd()))
709 OUString sText( pTextNd->GetExpandText(GetLayout(),
712 sText = sText.replaceAll(
"\x0a",
"");
715 if( !sText.isEmpty() )
717 rArr.emplace_back(sText, rAttr);
730 DeleteSel( *GetCursor() );
737 if( !IsTableMode() && GetDoc()->DontExpandFormat( *GetCursor()->GetPoint() ))
747 return GetDoc()->GetNumberFormatter();
753 bool bRet = GetDoc()->ConvertFieldsToText(*GetLayout());
763 SwPaM* pCursor = GetCursor();
764 for(
int i = 0;
i < 2;
i++)
772 sal_uLong nEndNd = pEndPos->nNode.GetIndex();
773 if( nCurrNd <= nEndNd )
784 pContentFrame =
static_cast<SwTextNode*
>(pNd)->getLayoutFrame( GetLayout() );
785 if(
nullptr != pContentFrame )
788 if( !static_cast<SwTextFrame*>(pContentFrame)->IsHiddenNow() )
796 SwNumRule* pNumRule( pTextNd->GetNumRule() );
800 ( pNumRule && pTextNd->GetNum() &&
801 ( pTextNd->HasNumber() || pTextNd->HasBullet() ) &&
802 pTextNd->IsCountedInList() &&
803 !pTextNd->IsListRestart() );
806 int nListLevel = pTextNd->GetActualListLevel();
814 bIsNodeNum = pTextNd->GetNum()->GetNumber() ==
815 pNumRule->Get( static_cast<sal_uInt16>(nListLevel) ).GetStart();
821 GetDoc()->SetNumRuleStart( aCurrentNode );
828 if(static_cast<SwSectionNode*>(pNd)->GetSection().
IsHidden() )
834 bGoOn = nCurrNd < nEndNd;
840 Pop(PopMode::DeleteCurrent);
848 SwPaM* pPam = GetCursor();
856 while(
nullptr != ( pCNd = GetDoc()->GetNodes().GoNextSection(
857 &aStart,
true,
false )) )
861 SwTextFrame *
const pFrame(static_cast<SwTextFrame*>(pContentFrame));
863 if (GetLayout()->HasMergedParas())
867 aStart = *pMerged->pLastNode;
893 return GetDoc()->GetFootnoteInfo();
900 GetDoc()->SetFootnoteInfo(rInfo);
907 return GetDoc()->GetEndNoteInfo();
914 GetDoc()->SetEndNoteInfo(rInfo);
920 return GetDoc()->GetLineNumberInfo();
927 GetDoc()->SetLineNumberInfo(rInfo);
928 AddPaintRect( GetLayout()->getFrameArea() );
934 return getIDocumentSettingAccess().getLinkUpdateMode(
false );
939 getIDocumentSettingAccess().setLinkUpdateMode( nMode );
945 SwExtTextInput* pRet = GetDoc()->CreateExtTextInput( *GetCursor() );
952 const SwPosition& rPos = *GetCursor()->GetPoint();
960 pDel = GetDoc()->GetExtTextInput();
973 GetDoc()->DeleteExtTextInput( pDel );
977 if ( ! bInsText && IsOverwriteCursor() )
978 *GetCursor()->GetPoint() = aPos;
987 SwPaM* pCurrentCursor = GetCursor();
1007 bool bLeft = nDiff < 0;
1008 sal_Int32 nMaxGuard = std::abs(nDiff);
1019 if (nNewPos == nNewCursorPos)
1022 if (nNewPos == nOldPos)
1025 SAL_WARN(
"sw.core",
"IM cursor move failed");
1029 if (--nMaxGuard == 0)
1033 SAL_WARN(
"sw.core",
"IM abandoning cursor positioning");
1054 SwPaM* pCursor = GetCursor();
1055 if( pCursor->
GetNext() != pCursor )
1058 for(
const SwPaM& rPaM : GetCursor()->GetRingContainer())
1060 if( rPaM.HasMark() )
1061 GetDoc()->getIDocumentContentOperations().TransliterateText( rPaM, aTrans );
1066 GetDoc()->getIDocumentContentOperations().TransliterateText( *pCursor, aTrans );
1073 for(
const SwPaM& rPaM : GetCursor()->GetRingContainer())
1075 if( rPaM.HasMark() )
const SwEndNoteInfo & GetEndNoteInfo() const
OString stripEnd(const OString &rIn, char c)
void SetExtTextInputData(const CommandExtTextInputData &)
const SwEndNode * EndOfSectionNode() const
Starts a section of nodes in the document model.
void SetFootnoteInfo(const SwFootnoteInfo &rInfo)
Base class of the Writer layout elements.
Represents the visualization of a paragraph.
SwNode & GetNode(bool bPoint=true) const
TextFrameIndex GetInvalidityA() const
sal_uInt16 GetLineCount()
virtual const SwFlyFrameFormat * GetFormat() const override
virtual void ApplyViewOptions(const SwViewOption &rOpt)
Marks a position in the document model.
bool IsMultiSelection() const
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
bool HasAutomaticContour() const
const SwOLEObj & GetOLEObj() const
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.
sfx2::LinkManager & GetLinkManager()
void * GetIMapInventor() const
Unique identification of object (for ImageMapDlg).
void SetLineNumberInfo(const SwLineNumberInfo &rInfo)
CalcOp * FindOperator(const OUString &rSrch)
const SwFormatRefMark * GetRefMark(std::u16string_view rName) const
get the reference of a given name in the Doc
void SetEndNoteInfo(const SwEndNoteInfo &rInfo)
virtual Size GetTwipSize() const =0
virtual sal_Int32 Len() const override
const SwPosition * GetMark() const
void CountWords(SwDocStat &rStat) const
Count words in current selection.
sw::MergedPara * GetMergedPara()
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
SwSectionNode is derived from SwStartNode.
static SwScriptInfo * GetScriptInfo(const SwTextNode &rNode, SwTextFrame const **o_pFrame=nullptr, bool bAllowInvalid=false)
return a frame for the node, ScriptInfo is its member...
bool IsLinkedFile() const
void UpdateCharts(std::u16string_view rName)
Update content of all charts for table with given name.
bool GetGrfSize(Size &) const
virtual const sal_Int32 * GetEnd() const override
end position
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
OUString DeleteExtTextInput(bool bInsText=true)
sal_uInt8 DirType(const TextFrameIndex nPos) const
void GetINetAttrs(SwGetINetAttrs &rArr)
const tools::PolyPolygon * HasContour() const
sal_uInt16 GetRefMarks(std::vector< OUString > *=nullptr) const
get the names of all references in a Doc
bool IsOnlyCursorChanged() const
OUString GetCurWord(SwPosition const &) const
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
virtual void ApplyViewOptions(const SwViewOption &rOpt) override
Apply ViewOptions with Start-/EndAction.
bool ConvertFieldsToText()
Replace fields by text - mailmerge support.
SwNodeType GetNodeType() const
GraphicAttr & GetGraphicAttr(GraphicAttr &, const SwFrame *pFrame) const
Returns the with our graphic attributes filled Graphic-Attr-Structure.
const tools::PolyPolygon * GetGraphicPolygon() const
svt::EmbeddedObjectRef & GetObject()
std::vector< SwGetINetAttr > SwGetINetAttrs
constexpr OUStringLiteral IsHidden(u"IsHidden")
sal_uLong GetIndex() const
sal_Int32 GetStart() const
SAL_DLLPRIVATE SwGrfNode * GetGrfNode_() const
Returns pointer to a SwGrfNode that will be used by GetGraphic() and GetGraphicSize().
void InitScriptInfo(const SwTextNode &rNode, sw::MergedPara const *pMerged, bool bRTL)
void GetTextFromPam(SwPaM &rPam, OUString &rBuffer, SwRootFrame const *pLayout=nullptr)
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. ...
SwFlyFrame * FindFlyFrame()
bool GetFileFilterNms(OUString *pFileNm, OUString *pFilterNm) const
bool IsCursorOverwrite() const
void SetLinkUpdMode(sal_uInt16 nMode)
void SetOverwriteCursor(bool bFlag)
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
void SetChartName(const OUString &rName)
PaM is Point and Mark: a selection of the document model.
const SwDocStat & GetUpdatedDocStat()
const SwLineNumberInfo & GetLineNumberInfo() const
void SetLanguage(LanguageType eSet)
GraphicType GetGraphicType() const
void Insert2(const OUString &, const bool bForceExpandHints=false)
const SwPosition * GetPoint() const
GraphicType GetType() const
void EndAction(const bool bIdleEnd=false, const bool DoSetPosX=false)
void DelINetAttrWithText()
If cursor is in an INetAttribute it will be deleted completely including the descriptive text (needed...
bool InsertURL(const SwFormatINetFormat &rFormat, const OUString &rStr, bool bKeepSelection=false)
svt::EmbeddedObjectRef & GetOLEObject() const
Get OLE object at pointer.
SwContentNode * GetContentNode()
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
SwNoTextNode * GetNoTextNode()
void SetInsText(bool bFlag)
const GraphicObject * GetGraphicObj() const
SwLayoutFrame * GetUpper()
bool DontExpandFormat()
If Cursor is at the end of a character style in which the DontExpand-flag is not yet set...
Marks a character position inside a document model node.
Marks a node in the document model.
SwNodes & GetNodes()
Node is in which nodes-array/doc?
T * Find(const OUString &rStr, sal_uInt16 *pPos=nullptr) const
bool IsOverwriteCursor() const
ring_container GetRingContainer()
void ClearAutomaticContour()
If there's an automatic, not manipulated polygon at the selected notxtnode, it has to be deleted...
Graphic GetIMapGraphic() const
Remove default parameter, because method always called this default value.
OUString lowercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
SwStartNode * GetStartNode()
const Graphic * GetGraphic(bool bWait=true) const
const GraphicObject & GetGrfObj(bool bWait=false) const
static void GetGrfNms(const SwFlyFrameFormat &rFormat, OUString *pGrfName, OUString *pFltName)
GraphicType GetType() const
const SwPosition * Start() const
< purpose of derivation from SwClient: character style for displaying the numbers.
SwHashTable< SwCalcExp > & GetVarTable()
OUString GetCurWord() const
request current word
void SetChartTableName(const OUString &rNm)
SwSbxValue Calculate(const OUString &rStr)
sal_uLong EndOfSectionIndex() const
TextFrameIndex GetDropLen(TextFrameIndex nWishLen) const
nWishLen = 0 indicates that we want a whole word
const SwFootnoteInfo & GetFootnoteInfo() const
Footnote attributes global to document.
SwTextNode is a paragraph in the document model.
sal_uInt16 GetLineCount(TextFrameIndex nPos)
Determines the line count.
tools::Long MergeDoc(const SwDoc &rDoc)
Merge two documents.
void SetGraphicPolygon(const tools::PolyPolygon *pPoly)
bool IsCursorVisible() 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...
general base class for all free-flowing frames
#define SAL_WARN_IF(condition, area, stream)
OUString GetDropText(const sal_Int32 nChars) const
TextFrameIndex MapModelToView(SwTextNode const *pNode, sal_Int32 nIndex) const
sal_Int32 GetIndex() const
OString strip(const OString &rIn, char c)
sal_Int32 GetCursorPos() const
const SwPosition * End() const
void SetCursorBidiLevel(sal_uInt8 nNewLevel)
bool IsRightToLeft() const
Reference< XComponentContext > getProcessComponentContext()
OUString GetStrResult(const SwSbxValue &rValue)
bool IsOverwriteCursor() const
SwCalcExp * VarLook(const OUString &rStr, bool bIns=false)
virtual void CallSwClientNotify(const SfxHint &rHint) const override
bool HasOLEObj(std::u16string_view rName) const
Is there an OLEObject with this name (SwFormat)?
void TransliterateText(TransliterationFlags nType)
Change text to Upper/Lower/Hiragana/Katakana/...
void Overwrite(const OUString &)
void UpdateDocStat()
Document - Statistics.
sal_uInt16 GetLinkUpdMode() const
Embeds all local links (ranges/graphics).
const sal_uInt16 CRSR_SKIP_CHARS
void SetTableName(SwFrameFormat &rTableFormat, const OUString &rNewName)
change table name
tools::Long CompareDoc(const SwDoc &rDoc)
Compare two documents.
#define SAL_WARN(area, stream)
void Insert(sal_Unicode, bool bOnlyCurrCursor=false)
Edit (all selected ranges).
void CreateExtTextInput(LanguageType eInputLanguage)
Interface for TextInputData - (for input of Japanese/Chinese chars.)
void SplitNode(bool bAutoFormat=false, bool bCheckTableStart=true)
const GraphicAttr * GetGraphicAttr(GraphicAttr &rGA) const
void SetNumberingRestart()
Set all numbering start points to a fixed value - mailmerge support.
bool IsLinkedGrfSwapOut() 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 SetInputData(const CommandExtTextInputData &rData)
CharClass & GetAppCharClass()
void ReplaceDropText(const OUString &rStr, SwPaM *pPaM=nullptr)
SvNumberFormatter * GetNumberFormatter()
Query NumberFormatter from document.
OUString Calculate()
Calculates selection.
bool isLetter(const OUString &rStr, sal_Int32 nPos) const
const sal_Int32 COMPLETE_STRING
const Graphic & GetGrf(bool bWait=false) const
static void CountWords(const SwPaM &rPaM, SwDocStat &rStat)
void SetContour(const tools::PolyPolygon *pPoly, bool bAutomatic=false)
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwNodeIndex & Assign(SwNodes const &rNds, sal_uLong)
Base class of the Writer document model elements.