[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - editeng/qa editeng/source include/editeng sw/source

Michael Stahl mstahl at redhat.com
Sat Feb 8 04:32:53 PST 2014


 editeng/qa/unit/core-test.cxx       |    4 ++--
 editeng/source/editeng/edtspell.cxx |    8 ++++----
 editeng/source/editeng/edtspell.hxx |    2 +-
 editeng/source/misc/svxacorr.cxx    |    6 +++---
 include/editeng/svxacorr.hxx        |    2 +-
 sw/source/core/edit/acorrect.cxx    |    9 +++++----
 sw/source/core/inc/acorrect.hxx     |    2 +-
 7 files changed, 17 insertions(+), 16 deletions(-)

New commits:
commit 2b3605bc8b2390bdde0d5ea52996fb4db42b0ce7
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Feb 8 00:23:10 2014 +0100

    fdo#74363: fix auto correct of initial capitals on start of first para
    
    The GetPrevPara() method apparently has to return 0 when there is no
    previous paragraph.
    
    (regression from ac85b6cff11d193f5f71d11b1f3cc1c474653f59)
    
    Change-Id: I09a3e1d3a3adb33562e4e03c0755447047cbd433
    (cherry picked from commit ebd0d0056d89a6a69d2cb75e28758132cb5c236b)
    Reviewed-on: https://gerrit.libreoffice.org/7940
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx
index 053e647..338a6cb7 100644
--- a/editeng/qa/unit/core-test.cxx
+++ b/editeng/qa/unit/core-test.cxx
@@ -267,10 +267,10 @@ private:
         //fprintf(stderr, "TestAutoCorrDoc::SetINetAttr\n");
         return true;
     }
-    virtual OUString GetPrevPara( sal_Bool )
+    virtual OUString const* GetPrevPara(bool)
     {
         //fprintf(stderr, "TestAutoCorrDoc::GetPrevPara\n");
-        return OUString();
+        return 0;
     }
     virtual bool ChgAutoCorrWord( sal_Int32& rSttPos,
                 sal_Int32 nEndPos, SvxAutoCorrect& rACorrect,
diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx
index 68628f7..413435d 100644
--- a/editeng/source/editeng/edtspell.cxx
+++ b/editeng/source/editeng/edtspell.cxx
@@ -691,7 +691,7 @@ sal_Bool EdtAutoCorrDoc::SetINetAttr( sal_uInt16 nStt, sal_uInt16 nEnd,
     return true;
 }
 
-OUString EdtAutoCorrDoc::GetPrevPara( sal_Bool )
+OUString const* EdtAutoCorrDoc::GetPrevPara(bool const)
 {
     // Return previous paragraph, so that it can be determined,
     // whether the current word is at the beginning of a sentence.
@@ -714,16 +714,16 @@ OUString EdtAutoCorrDoc::GetPrevPara( sal_Bool )
             bBullet = true;
     }
     if ( bBullet )
-        return OUString();
+        return 0;
 
     for ( sal_Int32 n = nPos; n; )
     {
         n--;
         ContentNode* pNode = rNodes[n];
         if ( pNode->Len() )
-            return pNode->GetString();
+            return & pNode->GetString();
     }
-    return OUString();
+    return 0;
 
 }
 
diff --git a/editeng/source/editeng/edtspell.hxx b/editeng/source/editeng/edtspell.hxx
index 21d18bb..4f11774 100644
--- a/editeng/source/editeng/edtspell.hxx
+++ b/editeng/source/editeng/edtspell.hxx
@@ -147,7 +147,7 @@ public:
     virtual sal_Bool    SetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, sal_uInt16 nSlotId, SfxPoolItem& );
     virtual sal_Bool    SetINetAttr( sal_uInt16 nStt, sal_uInt16 nEnd, const OUString& rURL );
 
-    virtual OUString    GetPrevPara( sal_Bool bAtNormalPos );
+    virtual OUString const* GetPrevPara(bool bAtNormalPos) SAL_OVERRIDE;
 
     virtual bool        ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
                                   SvxAutoCorrect& rACorrect, OUString* pPara );
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 83a4707..667f561 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -873,8 +873,8 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc,
     {
         // Check out the previous paragraph, if it exists.
         // If so, then check to paragraph separator at the end.
-        OUString aPrevPara = rDoc.GetPrevPara( bNormalPos );
-        if( !aPrevPara.isEmpty() )
+        OUString const*const pPrevPara = rDoc.GetPrevPara(bNormalPos);
+        if (!pPrevPara)
         {
             // valid separator -> replace
             OUString sChar( *pWordStt );
@@ -883,7 +883,7 @@ sal_Bool SvxAutoCorrect::FnCptlSttSntnc( SvxAutoCorrDoc& rDoc,
                     rDoc.ReplaceRange( xub_StrLen( pWordStt - pStart ), 1, sChar );
         }
 
-        aText = aPrevPara;
+        aText = *pPrevPara;
         bAtStart = sal_False;
         pStart = aText.getStr();
         pStr = pStart + aText.getLength();
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx
index 2e3d5b3..82b76ce 100644
--- a/include/editeng/svxacorr.hxx
+++ b/include/editeng/svxacorr.hxx
@@ -101,7 +101,7 @@ public:
     //      TRUE: before the normal insertion position (TRUE)
     //      FALSE: in which the corrected word was inserted.
     //             (Does not to have to be the same paragraph !!!!)
-    virtual OUString GetPrevPara( sal_Bool bAtNormalPos ) = 0;
+    virtual OUString const* GetPrevPara(bool bAtNormalPos) = 0;
 
     virtual bool ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
                                   SvxAutoCorrect& rACorrect,
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index 4bf22c5..d8f1980 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -270,9 +270,9 @@ sal_Bool SwAutoCorrDoc::SetINetAttr( xub_StrLen nStt, xub_StrLen nEnd, const OUS
  *                     corrected word was inserted. (Doesn't need to be the same paragraph!)
  * @return text or 0, if previous paragraph does not exists or there are only blankness
  */
-OUString SwAutoCorrDoc::GetPrevPara( sal_Bool bAtNormalPos )
+OUString const* SwAutoCorrDoc::GetPrevPara(bool const bAtNormalPos)
 {
-    OUString aStr;
+    OUString const* pStr(0);
 
     if( bAtNormalPos || !pIdx )
         pIdx = new SwNodeIndex( rCrsr.GetPoint()->nNode, -1 );
@@ -286,11 +286,12 @@ OUString SwAutoCorrDoc::GetPrevPara( sal_Bool bAtNormalPos )
         pTNd = pIdx->GetNode().GetTxtNode();
     }
     if( pTNd && 0 == pTNd->GetAttrOutlineLevel() )
-        aStr = pTNd->GetTxt();
+        pStr = & pTNd->GetTxt();
 
     if( bUndoIdInitialized )
         bUndoIdInitialized = true;
-    return aStr;
+
+    return pStr;
 }
 
 bool SwAutoCorrDoc::ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
diff --git a/sw/source/core/inc/acorrect.hxx b/sw/source/core/inc/acorrect.hxx
index c022499..77e02044 100644
--- a/sw/source/core/inc/acorrect.hxx
+++ b/sw/source/core/inc/acorrect.hxx
@@ -72,7 +72,7 @@ public:
     //  - sal_True:  paragraph before "normal" insertion position
     //  - sal_False: paragraph in that the corrected word was inserted
     //               (does not need to be the same paragraph)
-    virtual OUString GetPrevPara( sal_Bool bAtNormalPos );
+    virtual OUString const* GetPrevPara(bool bAtNormalPos) SAL_OVERRIDE;
 
     virtual bool ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
                                   SvxAutoCorrect& rACorrect,


More information about the Libreoffice-commits mailing list