// Release any listeners to the current text view. if (mpTextView)
{
mpTextView->GetCaret()->SetCaretMotionBroadcaster(
::std::function<void (sal_Int32,sal_Int32,sal_Int32,sal_Int32)>());
mpTextView->SetTextChangeBroadcaster(
::std::function<void ()>());
}
mpTextView = rpTextView;
if (!mpTextView) return;
// Create a new set of children, one for each paragraph. const sal_Int32 nParagraphCount (mpTextView->GetParagraphCount()); for (sal_Int32 nIndex=0; nIndex<nParagraphCount; ++nIndex)
{
rtl::Reference<AccessibleParagraph> pParagraph ( new AccessibleParagraph(
rpTextView->GetParagraph(nIndex),
nIndex));
pParagraph->LateInitialization();
pParagraph->SetWindow(mxContentWindow, mxBorderWindow);
pParagraph->SetAccessibleParent(this);
aChildren.emplace_back(pParagraph.get());
}
maChildren.swap(aChildren);
FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any());
// Dispose the old children. (This will remove them from the focus // manager). for (constauto& rxChild : aChildren)
{ if (rxChild.is())
rxChild->dispose();
}
// This class acts as a controller of who broadcasts caret motion // events and handles text changes. Register the corresponding // listeners here.
mpTextView->GetCaret()->SetCaretMotionBroadcaster(
[this](sal_Int32 a, sal_Int32 b, sal_Int32 c, sal_Int32 d)
{ returnthis->NotifyCaretChange(a, b, c, d); });
mpTextView->SetTextChangeBroadcaster(
[this]() { return SetTextView(mpTextView); });
}
// Set the windows at the children as well, so that every paragraph can // setup its geometry. for (auto& rxChild : maChildren)
{
rxChild->SetWindow(rxContentWindow, rxBorderWindow);
}
}
if (nOldParagraphIndex != nNewParagraphIndex)
{ // Moved caret from one paragraph to another (or showed or // hid the caret). Move focus from one accessible // paragraph to another. if (nOldParagraphIndex >= 0)
{
maChildren[nOldParagraphIndex]->FireAccessibleEvent(
AccessibleEventId::CARET_CHANGED,
Any(nOldCharacterIndex),
Any(sal_Int32(-1)));
} if (nNewParagraphIndex >= 0)
{
maChildren[nNewParagraphIndex]->FireAccessibleEvent(
AccessibleEventId::CARET_CHANGED,
Any(sal_Int32(-1)),
Any(nNewCharacterIndex));
}
} elseif (nNewParagraphIndex >= 0)
{ // Caret moved inside one paragraph.
maChildren[nNewParagraphIndex]->FireAccessibleEvent(
AccessibleEventId::CARET_CHANGED,
Any(nOldCharacterIndex),
Any(nNewCharacterIndex));
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.