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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 28 15:17:07 UTC 2019


 sw/qa/extras/tiledrendering/tiledrendering.cxx |   18 ++++++++++++++++++
 sw/source/uibase/shells/textsh1.cxx            |   13 +++++++++++++
 2 files changed, 31 insertions(+)

New commits:
commit f38566826cdd257214298c583a1ce8ae6715713c
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Aug 28 15:22:20 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Aug 28 17:16:47 2019 +0200

    sw lok: extend language status with BCP 47 language tag info in here as well
    
    This brings Writer in sync with Calc, which does this since commit
    47025060e4474d23e3bd97053a77b3943eeae724 (Send Bcp47 codes with region,
    2019-08-28).
    
    Change-Id: I615af4a0692216f794c78955d337e6b8dbc8db5e
    Reviewed-on: https://gerrit.libreoffice.org/78230
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index fe2d1e510cab..b7d7c5d2bd28 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -44,6 +44,7 @@
 #include <vcl/scheduler.hxx>
 #include <vcl/vclevent.hxx>
 #include <vcl/bitmapaccess.hxx>
+#include <svx/svxids.hrc>
 #include <flddat.hxx>
 #include <basesh.hxx>
 
@@ -119,6 +120,7 @@ public:
     void testDeselectCustomShape();
     void testSemiTransparent();
     void testAnchorTypes();
+    void testLanguageStatus();
 
     CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
     CPPUNIT_TEST(testRegisterCallback);
@@ -179,6 +181,7 @@ public:
     CPPUNIT_TEST(testDeselectCustomShape);
     CPPUNIT_TEST(testSemiTransparent);
     CPPUNIT_TEST(testAnchorTypes);
+    CPPUNIT_TEST(testLanguageStatus);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2435,6 +2438,21 @@ void SwTiledRenderingTest::testAnchorTypes()
     CPPUNIT_ASSERT(!aSet.HasItem(FN_TOOL_ANCHOR_PAGE));
 }
 
+void SwTiledRenderingTest::testLanguageStatus()
+{
+    comphelper::LibreOfficeKit::setActive();
+    SwXTextDocument* pXTextDocument = createDoc("dummy.fodt");
+    SwView* pView = pXTextDocument->GetDocShell()->GetView();
+    std::unique_ptr<SfxPoolItem> pItem;
+    pView->GetViewFrame()->GetBindings().QueryState(SID_LANGUAGE_STATUS, pItem);
+    auto pStringListItem = dynamic_cast<SfxStringListItem*>(pItem.get());
+    CPPUNIT_ASSERT(pStringListItem);
+
+    uno::Sequence< OUString > aList;
+    pStringListItem->GetStringList(aList);
+    CPPUNIT_ASSERT_EQUAL(OUString("English (USA);en-US"), aList[0]);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 6bd22c3c919f..64deda9f1594 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1433,7 +1433,20 @@ void SwTextShell::GetState( SfxItemSet &rSet )
                 OUString aCurrentLang = "*";
                 nLang = SwLangHelper::GetCurrentLanguage( rSh );
                 if (nLang != LANGUAGE_DONTKNOW)
+                {
                     aCurrentLang = SvtLanguageTable::GetLanguageString( nLang );
+                    if (comphelper::LibreOfficeKit::isActive())
+                    {
+                        if (nLang == LANGUAGE_NONE)
+                        {
+                            aCurrentLang += ";-";
+                        }
+                        else
+                        {
+                            aCurrentLang += ";" + LanguageTag(nLang).getBcp47(false);
+                        }
+                    }
+                }
 
                 // build sequence for status value
                 uno::Sequence< OUString > aSeq( 4 );


More information about the Libreoffice-commits mailing list