summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accessibility/source/extended/textwindowaccessibility.cxx1
-rw-r--r--include/vcl/textdata.hxx1
-rw-r--r--include/vcl/vclmedit.hxx2
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.cxx13
-rw-r--r--vcl/source/control/edit.cxx6
-rw-r--r--vcl/source/edit/textview.cxx18
-rw-r--r--vcl/source/edit/vclmedit.cxx18
7 files changed, 49 insertions, 10 deletions
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
index d13525df8a2c..a37effaebeab 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -1659,6 +1659,7 @@ void Document::Notify(::SfxBroadcaster &, ::SfxHint const & rHint)
break;
}
case TEXT_HINT_VIEWSELECTIONCHANGED:
+ case TEXT_HINT_VIEWCARETCHANGED:
{
::osl::MutexGuard aInternalGuard(GetMutex());
if (!isAlive())
diff --git a/include/vcl/textdata.hxx b/include/vcl/textdata.hxx
index 925efff957ac..d05f2f7170b6 100644
--- a/include/vcl/textdata.hxx
+++ b/include/vcl/textdata.hxx
@@ -121,6 +121,7 @@ inline sal_Bool TextSelection::operator != ( const TextSelection& rSel ) const
#define TEXT_HINT_VIEWSCROLLED 100
#define TEXT_HINT_VIEWSELECTIONCHANGED 101
+#define TEXT_HINT_VIEWCARETCHANGED 102
class VCL_DLLPUBLIC TextHint : public SfxSimpleHint
{
diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx
index 83c50c68d409..097d9e862680 100644
--- a/include/vcl/vclmedit.hxx
+++ b/include/vcl/vclmedit.hxx
@@ -63,6 +63,8 @@ public:
virtual ~VclMultiLineEdit();
+ void SelectionChanged();
+ void CaretChanged();
virtual void Modify();
virtual void UpdateData();
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index bdb084880cd7..18b97076239c 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -1293,13 +1293,16 @@ AddressMultiLineEdit::~AddressMultiLineEdit()
EndListening(*GetTextEngine());
}
-void AddressMultiLineEdit::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+void AddressMultiLineEdit::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
{
- if(rHint.ISA(TextHint) &&
- static_cast<const TextHint&>(rHint).GetId() == TEXT_HINT_VIEWSELECTIONCHANGED &&
- m_aSelectionLink.IsSet())
+ if (m_aSelectionLink.IsSet() && rHint.ISA(TextHint))
{
- m_aSelectionLink.Call(this);
+ const TextHint& rTextHint = static_cast<const TextHint&>(rHint);
+ if (rTextHint.GetId() == TEXT_HINT_VIEWSELECTIONCHANGED ||
+ rTextHint.GetId() == TEXT_HINT_VIEWCARETCHANGED)
+ {
+ m_aSelectionLink.Call(this);
+ }
}
}
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index f923c51e32d3..cd75e6b46009 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2642,13 +2642,13 @@ void Edit::ImplSetSelection( const Selection& rSelection, sal_Bool bPaint )
ImplInvalidateOrRepaint();
ImplShowCursor();
- sal_Bool bCaret = sal_False, bSelection = sal_False;
+ bool bCaret = false, bSelection = false;
long nB=aNew.Max(), nA=aNew.Min(),oB=aTemp.Max(), oA=aTemp.Min();
long nGap = nB-nA, oGap = oB-oA;
if (nB != oB)
- bCaret = sal_True;
+ bCaret = true;
if (nGap != 0 || oGap != 0)
- bSelection = sal_True;
+ bSelection = true;
if (bSelection)
{
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index cd5a9b3907c3..53d49cc0138c 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -463,10 +463,24 @@ void TextView::ImpHighlight( const TextSelection& rSel )
void TextView::ImpSetSelection( const TextSelection& rSelection )
{
- if ( rSelection != mpImpl->maSelection )
+ if (rSelection != mpImpl->maSelection)
{
+ bool bCaret = false, bSelection = false;
+ const TextPaM &rEnd = rSelection.GetEnd();
+ const TextPaM &rOldEnd = mpImpl->maSelection.GetEnd();
+ bool bGap = rSelection.HasRange(), bOldGap = mpImpl->maSelection.HasRange();
+ if (rEnd != rOldEnd)
+ bCaret = true;
+ if (bGap || bOldGap)
+ bSelection = true;
+
mpImpl->maSelection = rSelection;
- mpImpl->mpTextEngine->Broadcast( TextHint( TEXT_HINT_VIEWSELECTIONCHANGED ) );
+
+ if (bSelection)
+ mpImpl->mpTextEngine->Broadcast(TextHint(TEXT_HINT_VIEWSELECTIONCHANGED));
+
+ if (bCaret)
+ mpImpl->mpTextEngine->Broadcast(TextHint(TEXT_HINT_VIEWCARETCHANGED));
}
}
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index c468468013a1..ca5e548418f5 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -561,6 +561,14 @@ void ImpVclMEdit::Notify( SfxBroadcaster&, const SfxHint& rHint )
ImpUpdateSrollBarVis(pVclMultiLineEdit->GetStyle());
pVclMultiLineEdit->Modify();
}
+ else if( rTextHint.GetId() == TEXT_HINT_VIEWSELECTIONCHANGED )
+ {
+ pVclMultiLineEdit->SelectionChanged();
+ }
+ else if( rTextHint.GetId() == TEXT_HINT_VIEWCARETCHANGED )
+ {
+ pVclMultiLineEdit->CaretChanged();
+ }
}
}
@@ -1053,6 +1061,16 @@ void VclMultiLineEdit::Modify()
pUpdateDataTimer->Start();
}
+void VclMultiLineEdit::SelectionChanged()
+{
+ CallEventListeners(VCLEVENT_EDIT_SELECTIONCHANGED);
+}
+
+void VclMultiLineEdit::CaretChanged()
+{
+ CallEventListeners(VCLEVENT_EDIT_CARETCHANGED);
+}
+
IMPL_LINK_NOARG(VclMultiLineEdit, ImpUpdateDataHdl)
{
UpdateData();