[Libreoffice-commits] core.git: 2 commits - cui/source editeng/source include/editeng sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Sat Mar 20 12:47:53 UTC 2021
cui/source/inc/autocdlg.hxx | 6 ++++++
cui/source/tabpages/autocdlg.cxx | 13 ++++---------
editeng/source/editeng/editview.cxx | 8 ++++++++
include/editeng/editview.hxx | 2 ++
sw/source/uibase/shells/langhelper.cxx | 8 +-------
5 files changed, 21 insertions(+), 16 deletions(-)
New commits:
commit 9b3ce3a3192eb960341fc0d24423657f0559eff2
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Mar 19 20:39:39 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Mar 20 13:47:25 2021 +0100
add GetInputLanguage to EditView
and hide the need to expose its vcl::Window
Change-Id: Ide8a2e2500116af412a8717052a300e8ef4d1a48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112782
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index b101f7f08b85..5f3fb49e7a08 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -351,6 +351,14 @@ OutputDevice& EditView::GetOutputDevice() const
return pImpEditView->GetOutputDevice();
}
+LanguageType EditView::GetInputLanguage() const
+{
+ // it might make sense to add this to getEditViewCallbacks
+ if (const vcl::Window* pWindow = GetWindow())
+ return pWindow->GetInputLanguage();
+ return LANGUAGE_DONTKNOW;
+}
+
bool EditView::HasOtherViewWindow( vcl::Window* pWin )
{
OutWindowSet& rOutWindowSet = pImpEditView->aOutWindowSet;
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 379218b1c619..6e06cdd77a97 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -171,6 +171,8 @@ public:
vcl::Window* GetWindow() const;
OutputDevice& GetOutputDevice() const;
+ LanguageType GetInputLanguage() const;
+
bool HasOtherViewWindow( vcl::Window* pWin );
bool AddOtherViewWindow( vcl::Window* pWin );
bool RemoveOtherViewWindow( vcl::Window* pWin );
diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx
index aa7f5ae06089..b5ceb23e5ddb 100644
--- a/sw/source/uibase/shells/langhelper.cxx
+++ b/sw/source/uibase/shells/langhelper.cxx
@@ -19,8 +19,6 @@
#include <string.h>
-#include <vcl/window.hxx>
-
#include <wrtsh.hxx>
#include <doc.hxx>
#include <docary.hxx>
@@ -67,11 +65,7 @@ namespace SwLangHelper
// get keyboard language
OUString aKeyboardLang;
- LanguageType nLang = LANGUAGE_DONTKNOW;
-
- vcl::Window* pWin = rEditView.GetWindow();
- if(pWin)
- nLang = pWin->GetInputLanguage();
+ LanguageType nLang = rEditView.GetInputLanguage();
if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
aKeyboardLang = SvtLanguageTable::GetLanguageString( nLang );
commit beafe72de3427f20c0cb59f7c7ff7852ebcc7427
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Mar 19 15:59:46 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Mar 20 13:45:32 2021 +0100
cid#1473926 Uninitialized scalar variable
Change-Id: I75911b7eff074b684a7f9c854fe8e63d102ae01a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112780
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx
index 86218a58a581..b084bdbd685a 100644
--- a/cui/source/inc/autocdlg.hxx
+++ b/cui/source/inc/autocdlg.hxx
@@ -135,6 +135,12 @@ struct DoubleString
OUString sShort;
OUString sLong;
void* pUserData; ///< CheckBox -> form. Text Bool -> selection text
+ DoubleString(const OUString& rShort, const OUString& rLong)
+ : sShort(rShort)
+ , sLong(rLong)
+ , pUserData(nullptr)
+ {
+ }
};
typedef std::vector<DoubleString> DoubleStringArray;
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 00ac479bac09..55fee3ede945 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -802,10 +802,9 @@ void OfaAutocorrReplacePage::RefillReplaceBox(bool bFromReset,
}
m_xReplaceTLB->all_foreach([this, &pArray](weld::TreeIter& rIter) {
- pArray->push_back(DoubleString());
+ pArray->push_back(DoubleString(m_xReplaceTLB->get_text(rIter, 0),
+ m_xReplaceTLB->get_text(rIter, 1)));
DoubleString& rDouble = pArray->back();
- rDouble.sShort = m_xReplaceTLB->get_text(rIter, 0);
- rDouble.sLong = m_xReplaceTLB->get_text(rIter, 1);
rDouble.pUserData = reinterpret_cast<void*>(m_xReplaceTLB->get_id(rIter).toInt64());
return false;
});
@@ -961,9 +960,7 @@ void OfaAutocorrReplacePage::NewEntry(const OUString& sShort, const OUString& sL
}
}
- DoubleString aNewString;
- aNewString.sShort = sShort;
- aNewString.sLong = sLong;
+ DoubleString aNewString(sShort, sLong);
rNewArray.push_back(aNewString);
if (bKeepSourceFormatting)
rNewArray.back().pUserData = &bHasSelectionText;
@@ -991,9 +988,7 @@ void OfaAutocorrReplacePage::DeleteEntry(const OUString& sShort, const OUString&
}
}
- DoubleString aDeletedString;
- aDeletedString.sShort = sShort;
- aDeletedString.sLong = sLong;
+ DoubleString aDeletedString(sShort, sLong);
rDeletedArray.push_back(aDeletedString);
}
More information about the Libreoffice-commits
mailing list