[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - desktop/qa desktop/source include/LibreOfficeKit

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Dec 13 15:42:01 UTC 2018


 desktop/qa/desktop_lib/test_desktop_lib.cxx |   37 ----------------------------
 desktop/source/lib/init.cxx                 |   23 -----------------
 include/LibreOfficeKit/LibreOfficeKit.h     |   10 -------
 include/LibreOfficeKit/LibreOfficeKit.hxx   |   29 ---------------------
 4 files changed, 99 deletions(-)

New commits:
commit d7533cbaf810b5d678678bb9d3b00e4c9e41a520
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Dec 13 17:21:46 2018 +0200
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Thu Dec 13 17:40:43 2018 +0200

    Revert "Add a localisation API to LibreOfficeKitClass"
    
    Was reverted in master, too. The functionality is implemented
    differently now in the iOS app, without requiring any new methods in
    LibreOfficeKitClass.
    
    This reverts commit 36beb79184e5f4153c8cc92b176b21b697594228.
    
    Change-Id: Ic0c42848c81a9b48e50a2b01a0a5a98ef5220870

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 7a5756e5ed35..2b571921738c 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -32,7 +32,6 @@
 #include <comphelper/propertysequence.hxx>
 #include <osl/conditn.hxx>
 #include <svl/srchitem.hxx>
-#include <svtools/strings.hrc>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include <unotools/tempfile.hxx>
 #include <sfx2/viewsh.hxx>
@@ -118,7 +117,6 @@ public:
     void testCommentsImpress();
     void testCommentsCallbacksWriter();
     void testRunMacro();
-    void testTranslate();
     void testExtractParameter();
     void testGetSignatureState_NonSigned();
     void testGetSignatureState_Signed();
@@ -166,7 +164,6 @@ public:
     CPPUNIT_TEST(testCommentsImpress);
     CPPUNIT_TEST(testCommentsCallbacksWriter);
     CPPUNIT_TEST(testRunMacro);
-    CPPUNIT_TEST(testTranslate);
     CPPUNIT_TEST(testExtractParameter);
     CPPUNIT_TEST(testGetSignatureState_Signed);
     CPPUNIT_TEST(testGetSignatureState_NonSigned);
@@ -2221,20 +2218,6 @@ void DesktopLOKTest::testRunMacro()
     comphelper::LibreOfficeKit::setActive(false);
 }
 
-void DesktopLOKTest::testTranslate()
-{
-    comphelper::LibreOfficeKit::setActive();
-
-    LibLibreOffice_Impl aOffice;
-
-    // Try translating to a non-existent locale, should return the English string
-    char *translated = aOffice.m_pOfficeClass->translateGet(&aOffice, STR_DESCRIPTION_FACTORY_WRITER, "svt", "foo");
-    CPPUNIT_ASSERT_EQUAL(0, strcmp(translated, "Text Document"));
-    free(translated);
-
-    comphelper::LibreOfficeKit::setActive(false);
-}
-
 void DesktopLOKTest::testExtractParameter()
 {
     comphelper::LibreOfficeKit::setActive();
@@ -2479,11 +2462,6 @@ void DesktopLOKTest::testInsertCertificatePEM()
 
 namespace {
 
-size_t classOffset(int i)
-{
-    return sizeof(static_cast<struct _LibreOfficeKitClass*>(nullptr)->nSize) + i * sizeof(void*);
-}
-
 size_t documentClassOffset(int i)
 {
     return sizeof(static_cast<struct _LibreOfficeKitDocumentClass*>(nullptr)->nSize) + i * sizeof(void*);
@@ -2494,21 +2472,6 @@ size_t documentClassOffset(int i)
 void DesktopLOKTest::testABI()
 {
     // STABLE ABI, NEVER CHANGE (unless there's a very good reason, agreed by ESC, etc.)
-
-    CPPUNIT_ASSERT_EQUAL(classOffset(0), offsetof(struct _LibreOfficeKitClass, destroy));
-    CPPUNIT_ASSERT_EQUAL(classOffset(1), offsetof(struct _LibreOfficeKitClass, documentLoad));
-    CPPUNIT_ASSERT_EQUAL(classOffset(2), offsetof(struct _LibreOfficeKitClass, getError));
-    CPPUNIT_ASSERT_EQUAL(classOffset(3), offsetof(struct _LibreOfficeKitClass, documentLoadWithOptions));
-    CPPUNIT_ASSERT_EQUAL(classOffset(4), offsetof(struct _LibreOfficeKitClass, freeError));
-    CPPUNIT_ASSERT_EQUAL(classOffset(5), offsetof(struct _LibreOfficeKitClass, registerCallback));
-    CPPUNIT_ASSERT_EQUAL(classOffset(6), offsetof(struct _LibreOfficeKitClass, getFilterTypes));
-    CPPUNIT_ASSERT_EQUAL(classOffset(7), offsetof(struct _LibreOfficeKitClass, setOptionalFeatures));
-    CPPUNIT_ASSERT_EQUAL(classOffset(8), offsetof(struct _LibreOfficeKitClass, setDocumentPassword));
-    CPPUNIT_ASSERT_EQUAL(classOffset(9), offsetof(struct _LibreOfficeKitClass, getVersionInfo));
-    CPPUNIT_ASSERT_EQUAL(classOffset(10), offsetof(struct _LibreOfficeKitClass, runMacro));
-    CPPUNIT_ASSERT_EQUAL(classOffset(11), offsetof(struct _LibreOfficeKitClass, translateGet));
-    CPPUNIT_ASSERT_EQUAL(classOffset(12), offsetof(struct _LibreOfficeKitClass, translateNGet));
-
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(0), offsetof(struct _LibreOfficeKitDocumentClass, destroy));
     CPPUNIT_ASSERT_EQUAL(documentClassOffset(1), offsetof(struct _LibreOfficeKitDocumentClass, saveAs));
 
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 2bb9ba95b3fd..42a06ce2be6c 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1423,8 +1423,6 @@ static void                    lo_setDocumentPassword(LibreOfficeKit* pThis,
                                                        const char* pPassword);
 static char*                   lo_getVersionInfo(LibreOfficeKit* pThis);
 static int                     lo_runMacro      (LibreOfficeKit* pThis, const char* pURL);
-static char*                   lo_translateGet  (LibreOfficeKit *pThis, const char* pId, const char* pPrefixName, const char* pBcp47LanguageTag);
-static char*                   lo_translateNGet (LibreOfficeKit *pThis, const char* pId, int n, const char* pPrefixName, const char* pBcp47LanguageTag);
 
 LibLibreOffice_Impl::LibLibreOffice_Impl()
     : m_pOfficeClass( gOfficeClass.lock() )
@@ -1448,8 +1446,6 @@ LibLibreOffice_Impl::LibLibreOffice_Impl()
         m_pOfficeClass->setDocumentPassword = lo_setDocumentPassword;
         m_pOfficeClass->getVersionInfo = lo_getVersionInfo;
         m_pOfficeClass->runMacro = lo_runMacro;
-        m_pOfficeClass->translateGet = lo_translateGet;
-        m_pOfficeClass->translateNGet = lo_translateNGet;
 
         gOfficeClass = m_pOfficeClass;
     }
@@ -1677,25 +1673,6 @@ static int lo_runMacro(LibreOfficeKit* pThis, const char *pURL)
     return false;
 }
 
-static char* lo_translateGet(LibreOfficeKit *, const char* pId, const char* pPrefixName, const char* pBcp47LanguageTag)
-{
-    LanguageTag tag(OUString::fromUtf8(pBcp47LanguageTag));
-    std::locale locale = Translate::Create(pPrefixName, tag);
-    OUString result = Translate::get(pId, locale);
-
-    return strdup(result.toUtf8().getStr());
-}
-
-static char* lo_translateNGet(LibreOfficeKit *, const char* pId, int, const char* pPrefixName, const char* pBcp47LanguageTag)
-{
-    LanguageTag tag(OUString::fromUtf8(pBcp47LanguageTag));
-    std::locale locale = Translate::Create(pPrefixName, tag);
-    // In this branch there is no Translate::nget().
-    OUString result = Translate::get(pId, locale);
-
-    return strdup(result.toUtf8().getStr());
-}
-
 static void lo_registerCallback (LibreOfficeKit* pThis,
                                  LibreOfficeKitCallback pCallback,
                                  void* pData)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 583e5b7f23d7..0581513d7701 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -94,16 +94,6 @@ struct _LibreOfficeKitClass
         @since LibreOffice 6.0
      */
     int (*runMacro) (LibreOfficeKit *pThis, const char* pURL);
-
-    /** @see lok::Office::translateGet().
-        @since LibreOffice 6.3
-     */
-    char* (*translateGet) (LibreOfficeKit *pThis, const char* pId, const char* pPrefixName, const char* pBcp47LanguageTag);
-
-    /** @see lok::Office::translateNGet().
-        @since LibreOffice 6.3
-     */
-    char* (*translateNGet) (LibreOfficeKit *pThis, const char* pId, int n, const char* pPrefixName, const char* pBcp47LanguageTag);
 };
 
 #define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index f0e77bdb40ec..ffcb87f4e5d0 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -763,35 +763,6 @@ public:
     {
         return mpThis->pClass->runMacro( mpThis, pURL );
     }
-
-    /**
-     * Fetch translation for a string.
-     *
-     * @since LibreOffice 6.3
-     * @returns the translated string, if available
-     * @param pId the context and string, separated by a '\004' character
-     * @param pPrefixName the prefix passed to Translate::Create()
-     * @param pBcp47LanguageTag the locale into which the string should be translated
-     */
-    char* translateGet( const char* pId, const char* pPrefixName, const char* pBcp47LanguageTag )
-    {
-        return mpThis->pClass->translateGet( mpThis, pId, pPrefixName, pBcp47LanguageTag );
-    }
-
-    /**
-     * In this branch this is equivalent to translateGet().
-     *
-     * @since LibreOffice 6.3
-     * @returns the translated string, if available
-     * @param pId the context and string, separated by a '\004' character
-     * @param n Ignored in this branch
-     * @param pPrefixName the prefix passed to Translate::Create()
-     * @param pBcp47LanguageTag the locale into which the string should be translated
-     */
-    char* translateNGet( const char* pId, int n, const char* pPrefixName, const char* pBcp47LanguageTag )
-    {
-        return mpThis->pClass->translateNGet( mpThis, pId, n, pPrefixName, pBcp47LanguageTag );
-    }
 };
 
 /// Factory method to create a lok::Office instance.


More information about the Libreoffice-commits mailing list