[Libreoffice-commits] core.git: 2 commits - sw/qa vcl/source vcl/unx

Caolán McNamara caolanm at redhat.com
Tue May 30 08:51:12 UTC 2017


 sw/qa/extras/tiledrendering/tiledrendering.cxx |   18 ++++++++++++------
 vcl/source/app/svmain.cxx                      |   11 +++++++++++
 vcl/unx/gtk/gtkinst.cxx                        |    6 ------
 3 files changed, 23 insertions(+), 12 deletions(-)

New commits:
commit f55eeb7a45998d16eb0fe49088e172ce45ac4f2b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 30 09:44:43 2017 +0100

    make LANGUAGE setting universal, not just gtk specific
    
    Change-Id: I5ff01f0232391933ad3704af6f2c2100d923c1fd

diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 2a89d80f60f3..0e0a2a9bbbff 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -318,6 +318,17 @@ bool InitVCL()
         // soffice/sfx implementation creates the global service manager
         pSVData->mpApp->Init();
 
+    //Now that uno has been bootstrapped we can ask the config what the UI language is so that we can
+    //force that in as $LANGUAGE. That way we can get gtk to render widgets RTL
+    //if we have a RTL UI in an otherwise LTR locale and get gettext using externals (e.g. python)
+    //to match their translations to our preferred UI language
+    OUString aLocaleString(Application::GetSettings().GetUILanguageTag().getGlibcLocaleString(".UTF-8"));
+    if (!aLocaleString.isEmpty())
+    {
+        OUString envVar("LANGUAGE");
+        osl_setEnvironment(envVar.pData, aLocaleString.pData);
+    }
+
     pSVData->mpDefInst->AfterAppInit();
 
     // Fetch AppFileName and make it absolute before the workdir changes...
diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx
index e01a267b6131..a22ea9c93f87 100644
--- a/vcl/unx/gtk/gtkinst.cxx
+++ b/vcl/unx/gtk/gtkinst.cxx
@@ -167,12 +167,6 @@ GtkInstance::GtkInstance( SalYieldMutex* pMutex )
 //UI in a LTR locale
 void GtkInstance::AfterAppInit()
 {
-    OUString aLocaleString(Application::GetSettings().GetUILanguageTag().getGlibcLocaleString(".UTF-8"));
-    if (!aLocaleString.isEmpty())
-    {
-        OUString envVar("LANGUAGE");
-        osl_setEnvironment(envVar.pData, aLocaleString.pData);
-    }
     EnsureInit();
 }
 
commit 1c965f6aec81816170aaf8f9fa378ab6adcb91af
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 30 09:20:21 2017 +0100

    coverity#1411566 Unchecked dynamic_cast
    
    and
    
    coverity#1411567 Unchecked dynamic_cast
    coverity#1411568 Unchecked dynamic_cast
    coverity#1411569 Unchecked dynamic_cast
    
    Change-Id: If1bb74941f2571ec3bdcb705bf2c9a87b54fe78d

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 22d010796da9..38e131f0b8b8 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1734,10 +1734,12 @@ void SwTiledRenderingTest::testDisableUndoRepair()
     SwXTextDocument* pXTextDocument = createDoc("dummy.fodt");
     ViewCallback aView1;
     SwView* pView1 = dynamic_cast<SwView*>(SfxViewShell::Current());
+    CPPUNIT_ASSERT(pView1);
     int nView1 = SfxLokHelper::getView();
     SfxLokHelper::createView();
     ViewCallback aView2;
     SwView* pView2 = dynamic_cast<SwView*>(SfxViewShell::Current());
+    CPPUNIT_ASSERT(pView2);
     int nView2 = SfxLokHelper::getView();
 
     {
@@ -1756,12 +1758,14 @@ void SwTiledRenderingTest::testDisableUndoRepair()
         // first view, undo enabled
         pView1->GetState(aItemSet1);
         CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aItemSet1.GetItemState(SID_UNDO));
-        CPPUNIT_ASSERT(!dynamic_cast< const SfxUInt32Item * >(aItemSet1.GetItem(SID_UNDO)));
+        const SfxUInt32Item *pUnsetItem = dynamic_cast<const SfxUInt32Item*>(aItemSet1.GetItem(SID_UNDO));
+        CPPUNIT_ASSERT(!pUnsetItem);
         // second view, undo conflict
         pView2->GetState(aItemSet2);
         CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aItemSet2.GetItemState(SID_UNDO));
-        CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item * >(aItemSet2.GetItem(SID_UNDO)));
-        CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SwUndoId::CONFLICT), dynamic_cast< const SfxUInt32Item * >(aItemSet2.GetItem(SID_UNDO))->GetValue());
+        const SfxUInt32Item *pSetItem = dynamic_cast<const SfxUInt32Item*>(aItemSet2.GetItem(SID_UNDO));
+        CPPUNIT_ASSERT(pSetItem);
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SwUndoId::CONFLICT), pSetItem->GetValue());
     };
 
     // Insert a character in the first view.
@@ -1782,12 +1786,14 @@ void SwTiledRenderingTest::testDisableUndoRepair()
         // second view, undo enabled
         pView2->GetState(aItemSet2);
         CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aItemSet2.GetItemState(SID_UNDO));
-        CPPUNIT_ASSERT(!dynamic_cast< const SfxUInt32Item * >(aItemSet2.GetItem(SID_UNDO)));
+        const SfxUInt32Item *pUnsetItem = dynamic_cast<const SfxUInt32Item*>(aItemSet2.GetItem(SID_UNDO));
+        CPPUNIT_ASSERT(!pUnsetItem);
         // first view, undo conflict
         pView1->GetState(aItemSet1);
         CPPUNIT_ASSERT_EQUAL(SfxItemState::SET, aItemSet1.GetItemState(SID_UNDO));
-        CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item * >(aItemSet1.GetItem(SID_UNDO)));
-        CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SwUndoId::CONFLICT), dynamic_cast< const SfxUInt32Item * >(aItemSet1.GetItem(SID_UNDO))->GetValue());
+        const SfxUInt32Item *pSetItem = dynamic_cast<const SfxUInt32Item*>(aItemSet1.GetItem(SID_UNDO));
+        CPPUNIT_ASSERT(pSetItem);
+        CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SwUndoId::CONFLICT), pSetItem->GetValue());
     }
 
     // Insert a character in the first view.


More information about the Libreoffice-commits mailing list