[Libreoffice-commits] .: 2 commits - accessibility/source
David Tardon
dtardon at kemper.freedesktop.org
Sun Feb 6 01:54:11 PST 2011
accessibility/source/extended/textwindowaccessibility.cxx | 45 +++++++-------
1 file changed, 25 insertions(+), 20 deletions(-)
New commits:
commit 93997fb7fa58ef343e9ac8bdc39eb761695114f6
Author: David Tardon <dtardon at redhat.com>
Date: Sun Feb 6 10:52:15 2011 +0100
make (hopefully) more understandable
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
index 99e41a6..0422996 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -1722,33 +1722,38 @@ Document::getAccessibleChild(Paragraphs::iterator const & rIt)
void Document::determineVisibleRange()
{
- m_aVisibleBegin = m_xParagraphs->end();
- m_aVisibleEnd = m_aVisibleBegin;
+ Paragraphs::iterator const aEnd = m_xParagraphs->end();
+
+ m_aVisibleBegin = aEnd;
+ m_aVisibleEnd = aEnd;
+ m_nVisibleBeginOffset = 0;
+
::sal_Int32 nPos = 0;
- for (Paragraphs::iterator aIt = m_xParagraphs->begin();;)
+ for (Paragraphs::iterator aIt = m_xParagraphs->begin(); m_aVisibleEnd == aEnd && aIt != aEnd; ++aIt)
{
- if (aIt == m_xParagraphs->end())
- {
- m_nVisibleBeginOffset = 0;
- break;
- }
- ::sal_Int32 nOldPos = nPos;
+ ::sal_Int32 const nOldPos = nPos;
nPos += aIt->getHeight(); // XXX numeric overflow
- if (m_aVisibleBegin == m_xParagraphs->end() && nPos >= m_nViewOffset)
+ if (m_aVisibleBegin == aEnd)
{
- m_aVisibleBegin = aIt;
- m_nVisibleBeginOffset = m_nViewOffset - nOldPos;
+ if (nPos >= m_nViewOffset)
+ {
+ m_aVisibleBegin = aIt;
+ m_nVisibleBeginOffset = m_nViewOffset - nOldPos;
+ }
}
- ++aIt;
- if (m_aVisibleBegin != m_xParagraphs->end()
- && (aIt == m_xParagraphs->end()
- || nPos >= m_nViewOffset + m_nViewHeight))
- // XXX numeric overflow
+ else
{
- m_aVisibleEnd = aIt;
- break;
+ if (nPos >= m_nViewOffset + m_nViewHeight) // XXX numeric overflow
+ {
+ m_aVisibleEnd = aIt;
+ }
}
}
+
+ OSL_POSTCOND(
+ (m_aVisibleBegin == m_xParagraphs->end() && m_aVisibleEnd == m_xParagraphs->end() && m_nVisibleBeginOffset == 0)
+ || (m_aVisibleBegin < m_aVisibleEnd && m_nVisibleBeginOffset >= 0),
+ "invalid visible range");
}
void Document::notifyVisibleRangeChanges(
commit 529b35cdd05bb07b65275d20832a154ce366c817
Author: David Tardon <dtardon at redhat.com>
Date: Sun Feb 6 10:48:10 2011 +0100
use the right paragraph for notification
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
index 6bf22d4..99e41a6 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -1957,7 +1957,7 @@ void Document::handleParagraphNotifications()
NotifyAccessibleEvent(
::css::accessibility::AccessibleEventId::
CHILD,
- ::css::uno::makeAny(getAccessibleChild(aIt)),
+ ::css::uno::makeAny(xStrong),
::css::uno::Any());
::css::uno::Reference< ::css::lang::XComponent > xComponent(
More information about the Libreoffice-commits
mailing list