accessibility/inc/extended/textwindowaccessibility.hxx      |    6 +
 accessibility/source/extended/textwindowaccessibility.cxx   |   14 ++--
 comphelper/source/misc/accessibletexthelper.cxx             |   37 +++++-------
 editeng/source/accessibility/AccessibleEditableTextPara.cxx |    9 --
 include/comphelper/accessibletexthelper.hxx                 |    4 -
 include/editeng/AccessibleEditableTextPara.hxx              |    7 --
 6 files changed, 37 insertions(+), 40 deletions(-)

New commits:
commit 84958e1a1bd9a3019300f558c66e468f8accf279
Author: Arnaud Versini <arnaud.vers...@gmail.com>
Date:   Sun Mar 25 13:49:42 2018 +0200

    accessibility: more simplifiation in OCommonAccessibleText.
    
    Change-Id: If1284f2e50be08372dda08a8250263c9ec435923
    Reviewed-on: https://gerrit.libreoffice.org/51825
    Tested-by: Jenkins <c...@libreoffice.org>
    Tested-by: Arnaud Versini <arnaud.vers...@libreoffice.org>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/accessibility/inc/extended/textwindowaccessibility.hxx 
b/accessibility/inc/extended/textwindowaccessibility.hxx
index 8487da9d9da7..7299b3954a9f 100644
--- a/accessibility/inc/extended/textwindowaccessibility.hxx
+++ b/accessibility/inc/extended/textwindowaccessibility.hxx
@@ -161,9 +161,11 @@ public:
 
 private:
     // OCommonAccessibleText
-    virtual void implGetParagraphBoundary( css::i18n::Boundary& rBoundary,
+    virtual void implGetParagraphBoundary( const OUString& rText,
+                                           css::i18n::Boundary& rBoundary,
                                            ::sal_Int32 nIndex ) override;
-    virtual void implGetLineBoundary( css::i18n::Boundary& rBoundary,
+    virtual void implGetLineBoundary( const OUString& rText,
+                                      css::i18n::Boundary& rBoundary,
                                       ::sal_Int32 nIndex ) override;
 
     virtual css::uno::Reference< css::accessibility::XAccessibleContext >
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx 
b/accessibility/source/extended/textwindowaccessibility.cxx
index 4c5309795867..50ea92f78238 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -634,10 +634,11 @@ void Paragraph::implGetSelection(::sal_Int32 & 
rStartIndex,
 }
 
 // virtual
-void Paragraph::implGetParagraphBoundary( css::i18n::Boundary& rBoundary,
-                                              ::sal_Int32 nIndex )
+void Paragraph::implGetParagraphBoundary( const OUString& rText,
+                                          css::i18n::Boundary& rBoundary,
+                                          ::sal_Int32 nIndex )
 {
-    ::sal_Int32 nLength = implGetText().getLength();
+    ::sal_Int32 nLength = rText.getLength();
 
     if ( implIsValidIndex( nIndex, nLength ) )
     {
@@ -652,10 +653,11 @@ void Paragraph::implGetParagraphBoundary( 
css::i18n::Boundary& rBoundary,
 }
 
 // virtual
-void Paragraph::implGetLineBoundary( css::i18n::Boundary& rBoundary,
-                                         ::sal_Int32 nIndex )
+void Paragraph::implGetLineBoundary( const OUString& rText,
+                                     css::i18n::Boundary& rBoundary,
+                                     ::sal_Int32 nIndex )
 {
-    ::sal_Int32 nLength = implGetText().getLength();
+    ::sal_Int32 nLength = rText.getLength();
 
     if ( implIsValidIndex( nIndex, nLength ) || nIndex == nLength )
     {
diff --git a/comphelper/source/misc/accessibletexthelper.cxx 
b/comphelper/source/misc/accessibletexthelper.cxx
index 202be72977af..35fe769c1700 100644
--- a/comphelper/source/misc/accessibletexthelper.cxx
+++ b/comphelper/source/misc/accessibletexthelper.cxx
@@ -175,20 +175,18 @@ namespace comphelper
     }
 
 
-    void OCommonAccessibleText::implGetParagraphBoundary( i18n::Boundary& 
rBoundary, sal_Int32 nIndex )
+    void OCommonAccessibleText::implGetParagraphBoundary( const OUString& 
rText, i18n::Boundary& rBoundary, sal_Int32 nIndex )
     {
-        OUString sText( implGetText() );
-
-        if ( implIsValidIndex( nIndex, sText.getLength() ) )
+        if ( implIsValidIndex( nIndex, rText.getLength() ) )
         {
             rBoundary.startPos = 0;
-            rBoundary.endPos = sText.getLength();
+            rBoundary.endPos = rText.getLength();
 
-            sal_Int32 nFound = sText.lastIndexOf( '\n', nIndex );
+            sal_Int32 nFound = rText.lastIndexOf( '\n', nIndex );
             if ( nFound != -1 )
                 rBoundary.startPos = nFound + 1;
 
-            nFound = sText.indexOf( '\n', nIndex );
+            nFound = rText.indexOf( '\n', nIndex );
             if ( nFound != -1 )
                 rBoundary.endPos = nFound + 1;
         }
@@ -200,10 +198,9 @@ namespace comphelper
     }
 
 
-    void OCommonAccessibleText::implGetLineBoundary( i18n::Boundary& 
rBoundary, sal_Int32 nIndex )
+    void OCommonAccessibleText::implGetLineBoundary( const OUString& rText, 
i18n::Boundary& rBoundary, sal_Int32 nIndex )
     {
-        OUString sText( implGetText() );
-        sal_Int32 nLength = sText.getLength();
+        sal_Int32 nLength = rText.getLength();
 
         if ( implIsValidIndex( nIndex, nLength ) || nIndex == nLength )
         {
@@ -344,7 +341,7 @@ namespace comphelper
             case AccessibleTextType::PARAGRAPH:
             {
                 // get paragraph at index
-                implGetParagraphBoundary( aBoundary, nIndex );
+                implGetParagraphBoundary( sText, aBoundary, nIndex );
                 if ( implIsValidBoundary( aBoundary, nLength ) )
                 {
                     aResult.SegmentText = sText.copy( aBoundary.startPos, 
aBoundary.endPos - aBoundary.startPos );
@@ -356,7 +353,7 @@ namespace comphelper
             case AccessibleTextType::LINE:
             {
                 // get line at index
-                implGetLineBoundary( aBoundary, nIndex );
+                implGetLineBoundary( sText, aBoundary, nIndex );
                 if ( implIsValidBoundary( aBoundary, nLength ) )
                 {
                     aResult.SegmentText = sText.copy( aBoundary.startPos, 
aBoundary.endPos - aBoundary.startPos );
@@ -462,11 +459,11 @@ namespace comphelper
             case AccessibleTextType::PARAGRAPH:
             {
                 // get paragraph at index
-                implGetParagraphBoundary( aBoundary, nIndex );
+                implGetParagraphBoundary( sText, aBoundary, nIndex );
                 // get previous paragraph
                 if ( aBoundary.startPos > 0 )
                 {
-                    implGetParagraphBoundary( aBoundary, aBoundary.startPos - 
1 );
+                    implGetParagraphBoundary( sText, aBoundary, 
aBoundary.startPos - 1 );
                     if ( implIsValidBoundary( aBoundary, nLength ) )
                     {
                         aResult.SegmentText = sText.copy( aBoundary.startPos, 
aBoundary.endPos - aBoundary.startPos );
@@ -479,11 +476,11 @@ namespace comphelper
             case AccessibleTextType::LINE:
             {
                 // get line at index
-                implGetLineBoundary( aBoundary, nIndex );
+                implGetLineBoundary( sText, aBoundary, nIndex );
                 // get previous line
                 if ( aBoundary.startPos > 0 )
                 {
-                    implGetLineBoundary( aBoundary, aBoundary.startPos - 1 );
+                    implGetLineBoundary( sText, aBoundary, aBoundary.startPos 
- 1 );
                     if ( implIsValidBoundary( aBoundary, nLength ) )
                     {
                         aResult.SegmentText = sText.copy( aBoundary.startPos, 
aBoundary.endPos - aBoundary.startPos );
@@ -590,11 +587,11 @@ namespace comphelper
             case AccessibleTextType::PARAGRAPH:
             {
                 // get paragraph at index
-                implGetParagraphBoundary( aBoundary, nIndex );
+                implGetParagraphBoundary( sText, aBoundary, nIndex );
                 // get next paragraph
                 if ( aBoundary.endPos < nLength )
                 {
-                    implGetParagraphBoundary( aBoundary, aBoundary.endPos );
+                    implGetParagraphBoundary( sText, aBoundary, 
aBoundary.endPos );
                     if ( implIsValidBoundary( aBoundary, nLength ) )
                     {
                         aResult.SegmentText = sText.copy( aBoundary.startPos, 
aBoundary.endPos - aBoundary.startPos );
@@ -607,11 +604,11 @@ namespace comphelper
             case AccessibleTextType::LINE:
             {
                 // get line at index
-                implGetLineBoundary( aBoundary, nIndex );
+                implGetLineBoundary( sText, aBoundary, nIndex );
                 // get next line
                 if ( aBoundary.endPos < nLength )
                 {
-                    implGetLineBoundary( aBoundary, aBoundary.endPos );
+                    implGetLineBoundary( sText, aBoundary, aBoundary.endPos );
                     if ( implIsValidBoundary( aBoundary, nLength ) )
                     {
                         aResult.SegmentText = sText.copy( aBoundary.startPos, 
aBoundary.endPos - aBoundary.startPos );
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx 
b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index baa37e112cf6..145212939f2c 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -184,18 +184,15 @@ namespace accessibility
         }
     }
 
-    void AccessibleEditableTextPara::implGetParagraphBoundary( 
css::i18n::Boundary& rBoundary, sal_Int32 /*nIndex*/ )
+    void AccessibleEditableTextPara::implGetParagraphBoundary( const OUString& 
rText, css::i18n::Boundary& rBoundary, sal_Int32 /*nIndex*/ )
     {
         SAL_INFO( "editeng", 
"AccessibleEditableTextPara::implGetParagraphBoundary: only a base 
implementation, ignoring the index" );
 
         rBoundary.startPos = 0;
-        //rBoundary.endPos = GetTextLen();
-        OUString sText( implGetText() );
-        sal_Int32 nLength = sText.getLength();
-        rBoundary.endPos = nLength;
+        rBoundary.endPos = rText.getLength();
     }
 
-    void AccessibleEditableTextPara::implGetLineBoundary( css::i18n::Boundary& 
rBoundary, sal_Int32 nIndex )
+    void AccessibleEditableTextPara::implGetLineBoundary( const OUString&, 
css::i18n::Boundary& rBoundary, sal_Int32 nIndex )
     {
         SvxTextForwarder&   rCacheTF = GetTextForwarder();
         const sal_Int32     nParaIndex = GetParagraphIndex();
diff --git a/include/comphelper/accessibletexthelper.hxx 
b/include/comphelper/accessibletexthelper.hxx
index 0f78e9084bde..4f400f5d79e4 100644
--- a/include/comphelper/accessibletexthelper.hxx
+++ b/include/comphelper/accessibletexthelper.hxx
@@ -61,8 +61,8 @@ namespace comphelper
         void                             implGetGlyphBoundary( const OUString& 
rText, css::i18n::Boundary& rBoundary, sal_Int32 nIndex );
         bool                             implGetWordBoundary( const OUString& 
rText, css::i18n::Boundary& rBoundary, sal_Int32 nIndex );
         void                             implGetSentenceBoundary( const 
OUString& rText, css::i18n::Boundary& rBoundary, sal_Int32 nIndex );
-        virtual void                     implGetParagraphBoundary( 
css::i18n::Boundary& rBoundary, sal_Int32 nIndex );
-        virtual void                     implGetLineBoundary( 
css::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+        virtual void                     implGetParagraphBoundary( const 
OUString& rText, css::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+        virtual void                     implGetLineBoundary( const OUString& 
rText, css::i18n::Boundary& rBoundary, sal_Int32 nIndex );
 
         /** non-virtual versions of the methods
 
diff --git a/include/editeng/AccessibleEditableTextPara.hxx 
b/include/editeng/AccessibleEditableTextPara.hxx
index d55872e0b634..b7af3caec422 100644
--- a/include/editeng/AccessibleEditableTextPara.hxx
+++ b/include/editeng/AccessibleEditableTextPara.hxx
@@ -58,16 +58,15 @@ namespace accessibility
 
     /** This class implements the actual text paragraphs for the 
EditEngine/Outliner UAA
      */
-    class EDITENG_DLLPUBLIC AccessibleEditableTextPara : public 
::cppu::BaseMutex, public AccessibleTextParaInterfaceBase, public 
::comphelper::OCommonAccessibleText
+    class EDITENG_DLLPUBLIC AccessibleEditableTextPara final : public 
::cppu::BaseMutex, public AccessibleTextParaInterfaceBase, private 
::comphelper::OCommonAccessibleText
     {
 
-    protected:
         // override OCommonAccessibleText methods
         virtual OUString                 implGetText() override;
         virtual css::lang::Locale        implGetLocale() override;
         virtual void                     implGetSelection( sal_Int32& 
nStartIndex, sal_Int32& nEndIndex ) override;
-        virtual void                     implGetParagraphBoundary( 
css::i18n::Boundary& rBoundary, sal_Int32 nIndex ) override;
-        virtual void                     implGetLineBoundary( 
css::i18n::Boundary& rBoundary, sal_Int32 nIndex ) override;
+        virtual void                     implGetParagraphBoundary( const 
OUString& rtext, css::i18n::Boundary& rBoundary, sal_Int32 nIndex ) override;
+        virtual void                     implGetLineBoundary( const OUString& 
rtext, css::i18n::Boundary& rBoundary, sal_Int32 nIndex ) override;
 
     public:
         /// Create accessible object for given parent
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to