From a73c98a708ee41b8c4cf4f2063c5bc4b30044284 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Fri, 9 Nov 2012 16:58:00 +0000 Subject: [PATCH] Better fix for fdo#56473, Crash when inserting a simple macro old code used to use XCell->setString, new code uses rDoc.SetString which by default tries to detect number formats. The ScColumn::SetString that eventually gets called seems to do lots of additional checks ( and apparently even if an ScSetStringParam instance with mbDetectNumberFormat ( false ) was passed it seems that it will still try to detect decimal number formats. With that in mind I restore and un-unoified version of what XCell->setString used do Change-Id: Ifaef74c78b198f492a390a3d5dc1721622a01ea4 --- .../extended/textwindowaccessibility.cxx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index 1e2da2e970c3..f25c46cf64f3 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include #include "comphelper/accessibleeventnotifier.hxx" #include "unotools/accessiblerelationsethelper.hxx" @@ -2124,18 +2123,19 @@ void Document::handleSelectionChangeNotification() void Document::notifySelectionChange( sal_Int32 nFirst, sal_Int32 nLast ) { - if ( nFirst < nLast ) + nFirst = std::max( nFirst, sal_Int32( 0 ) ); + nLast = std::min( nLast, sal_Int32( m_xParagraphs->size() ) ); + Paragraphs::iterator iFirst(m_xParagraphs->begin() + nFirst); + Paragraphs::iterator iLast(m_xParagraphs->begin() + nLast); + if ( iFirst < m_aVisibleBegin ) + iFirst = m_aVisibleBegin; + if ( iLast > m_aVisibleEnd ) + iLast = m_aVisibleEnd; + if ( iFirst < iLast ) { - Paragraphs::iterator aItBound1 = m_xParagraphs->begin(); - for (sal_Int32 i = 0; i < nLast && aItBound1 != m_xParagraphs->end() ; ++aItBound1, ++i); - Paragraphs::iterator aEnd( ::std::min( aItBound1, m_aVisibleEnd ) ); - - Paragraphs::iterator aItBound2 = m_xParagraphs->begin(); - for (sal_Int32 i = 0; i < nFirst && aItBound2 != m_xParagraphs->end() ; ++aItBound2, ++i); - - for ( Paragraphs::iterator aIt = ::std::max( aItBound2, m_aVisibleBegin ); aIt != aEnd; ++aIt ) + for ( Paragraphs::iterator i = iFirst; i != iLast; i++ ) { - ::rtl::Reference< ParagraphImpl > xParagraph( getParagraph( aIt ) ); + ::rtl::Reference< ParagraphImpl > xParagraph( getParagraph( i ) ); if ( xParagraph.is() ) { xParagraph->notifyEvent(