summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editview.cxx10
-rw-r--r--editeng/source/editeng/impedit.cxx23
-rw-r--r--editeng/source/editeng/impedit.hxx2
3 files changed, 35 insertions, 0 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 72e9aec2dc3d..72411fab6588 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -316,6 +316,16 @@ bool EditView::HasSelection() const
return pImpEditView->HasSelection();
}
+bool EditView::IsSelectionFullPara() const
+{
+ return pImpEditView->IsSelectionFullPara();
+}
+
+bool EditView::IsSelectionWithinSinglePara() const
+{
+ return pImpEditView->IsSelectionInSinglePara();
+}
+
bool EditView::IsSelectionAtPoint(const Point& rPointPixel)
{
return pImpEditView->IsSelectionAtPoint(rPointPixel);
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index f69b0d1cad82..8813376dacdd 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -2049,6 +2049,29 @@ bool ImpEditView::IsInSelection( const EditPaM& rPaM )
return false;
}
+bool ImpEditView::IsSelectionFullPara() const
+{
+ if (!IsSelectionInSinglePara())
+ return false;
+
+ sal_Int32 nSelectionStartPos = GetEditSelection().Min().GetIndex();
+ sal_Int32 nSelectionEndPos = GetEditSelection().Max().GetIndex();
+
+ if (nSelectionStartPos > nSelectionEndPos)
+ std::swap(nSelectionStartPos, nSelectionEndPos);
+
+ if (nSelectionStartPos != 0)
+ return false;
+
+ const ContentNode* pNode = GetEditSelection().Min().GetNode();
+ return pNode->Len() == nSelectionEndPos;
+}
+
+bool ImpEditView::IsSelectionInSinglePara() const
+{
+ return GetEditSelection().Min().GetNode() == GetEditSelection().Max().GetNode();
+}
+
void ImpEditView::CreateAnchor()
{
pEditEngine->SetInSelectionMode(true);
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 815c42328ba8..2fba7bd778f4 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -420,6 +420,8 @@ public:
bool IsSelectionAtPoint( const Point& rPosPixel );
bool IsInSelection( const EditPaM& rPaM );
+ bool IsSelectionFullPara() const;
+ bool IsSelectionInSinglePara() const;
void SetAnchorMode( EEAnchorMode eMode );
EEAnchorMode GetAnchorMode() const { return eAnchorMode; }