[Libreoffice-commits] .: 2 commits - cui/source shell/inc

Caolán McNamara caolan at kemper.freedesktop.org
Tue May 29 14:35:16 PDT 2012


 cui/source/dialogs/SpellDialog.cxx   |   51 +++++++++++++++++++++--------------
 shell/inc/internal/stream_helper.hxx |    2 -
 2 files changed, 33 insertions(+), 20 deletions(-)

New commits:
commit a3c47760e122baaf55f39107597aff2f5957aecd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 29 22:27:11 2012 +0100

    Resolves: fdo#50476 Dots inside quoted sentences get removed on "Correct All"
    
    refactor the dodgy dot replacement code so that all the replacement paths go
    through the same logic so that "Change All" does the same thing as repeated
    "Change"s
    
    Change-Id: Id63968e03409f676200a9ac546f7baa398f2eff8

diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 602289e..eec15d5 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -632,22 +632,39 @@ void SpellDialog::StartSpellOptDlg_Impl()
             OfaTreeOptionsDialog::ApplyLanguageOptions(*pOutSet);
     }
     delete pDlg;
+}
+
+namespace
+{
+    String getDotReplacementString(const String &rErrorText, const String &rSuggestedReplacement)
+    {
+        String aString = rErrorText;
+
+        //dots are sometimes part of the spelled word but they are not necessarily part of the replacement
+        bool bDot = aString.Len() && aString.GetChar(aString.Len() - 1 ) == '.';
 
+        aString = rSuggestedReplacement;
+
+        if(bDot && (!aString.Len() || aString.GetChar(aString.Len() - 1 ) != '.'))
+            aString += '.';
+
+        return aString;
+    }
 }
 
+
 String SpellDialog::getReplacementString() const
 {
-    String aString = aSentenceED.GetErrorText();
-    //dots are sometimes part of the spelled word but they are not necessarily part of the replacement
-    bool bDot = aString.Len() && aString.GetChar(aString.Len() - 1 ) == '.';
+    String sOrigString = aSentenceED.GetErrorText();
+
+    String sReplacement(sOrigString);
+
     if(aSuggestionLB.IsEnabled() &&
             aSuggestionLB.GetSelectEntryCount()>0 &&
             aNoSuggestionsST != aSuggestionLB.GetSelectEntry())
-        aString = aSuggestionLB.GetSelectEntry();
-    if(bDot && (!aString.Len() || aString.GetChar(aString.Len() - 1 ) != '.'))
-        aString += '.';
+        sReplacement = aSuggestionLB.GetSelectEntry();
 
-    return aString;
+    return getDotReplacementString(sOrigString, sReplacement);
 }
 
 // -----------------------------------------------------------------------
@@ -1304,20 +1321,13 @@ bool SpellDialog::ApplyChangeAllList_Impl(SpellPortions& rSentence, bool &bHasRe
     {
         if(aStart->xAlternatives.is())
         {
-            rtl::OUString &rString = aStart->sText;
+            const rtl::OUString &rString = aStart->sText;
 
-            //dots are sometimes part of the spelled word but they are not necessarily part of the replacement
-            bool bDot = !rString.isEmpty() && rString[rString.getLength() - 1] == '.';
-
-            Reference<XDictionaryEntry> xEntry = xChangeAll->getEntry( rString );
+            Reference<XDictionaryEntry> xEntry = xChangeAll->getEntry(rString);
 
             if(xEntry.is())
             {
-                rString = xEntry->getReplacementText();
-
-                if(bDot && (rString.isEmpty() || rString[rString.getLength() - 1] != '.'))
-                    rString = rString + rtl::OUString(static_cast<sal_Unicode>('.'));
-
+                aStart->sText = getDotReplacementString(rString, xEntry->getReplacementText());
                 aStart->xAlternatives = 0;
                 bHasReplaced = true;
             }
@@ -1731,8 +1741,11 @@ bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError )
         {
             m_nErrorStart = pNextError->GetStart();
             m_nErrorEnd = pNextError->GetEnd();
-            ChangeMarkedWord(xEntry->getReplacementText(),
-                    SvxLocaleToLanguage( pSpellErrorDescription->aLocale ));
+
+            String sReplacement(getDotReplacementString(GetErrorText(), xEntry->getReplacementText()));
+
+            ChangeMarkedWord(sReplacement, SvxLocaleToLanguage( pSpellErrorDescription->aLocale ));
+
             aCursor.GetIndex() = aCursor.GetIndex() + (sal_uInt16)(xEntry->getReplacementText().getLength());
         }
         else
commit 5713c054c569593e21d2d9db8680d5304f3063f9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 29 21:14:13 2012 +0100

    WaE: C4099: type name first seen using struct now using class
    
    Change-Id: I31772243349f1e3fcbea6b0d0aea9786b19d0fcc

diff --git a/shell/inc/internal/stream_helper.hxx b/shell/inc/internal/stream_helper.hxx
index b1949fd..f0d41bb 100644
--- a/shell/inc/internal/stream_helper.hxx
+++ b/shell/inc/internal/stream_helper.hxx
@@ -31,7 +31,7 @@
 
 #include "internal/types.hxx"
 
-class IStream;
+struct IStream;
 
 class BufferStream : public StreamInterface
 {


More information about the Libreoffice-commits mailing list