chart2/source/controller/main/ChartController_Window.cxx |    3 
 comphelper/source/misc/lok.cxx                           |  108 +++++---
 desktop/CppunitTest_desktop_lib.mk                       |    1 
 desktop/qa/data/sheet_with_image.ods                     |binary
 desktop/qa/desktop_lib/test_desktop_lib.cxx              |   76 ++++++
 desktop/source/lib/init.cxx                              |   96 +++----
 editeng/source/editeng/editeng.cxx                       |    9 
 editeng/source/editeng/editview.cxx                      |    8 
 editeng/source/editeng/impedit3.cxx                      |    6 
 editeng/source/outliner/outliner.cxx                     |    7 
 include/LibreOfficeKit/LibreOfficeKit.h                  |    2 
 include/LibreOfficeKit/LibreOfficeKit.hxx                |    4 
 include/comphelper/lok.hxx                               |   11 
 include/editeng/editeng.hxx                              |    6 
 include/sfx2/lokhelper.hxx                               |   36 ++
 include/sfx2/sfxsids.hrc                                 |    2 
 include/sfx2/sidebar/Deck.hxx                            |    2 
 include/sfx2/sidebar/SidebarChildWindow.hxx              |    5 
 include/sfx2/sidebar/SidebarDockingWindow.hxx            |    8 
 include/sfx2/viewfrm.hxx                                 |    1 
 include/sfx2/viewsh.hxx                                  |   22 +
 include/svl/zforlist.hxx                                 |    2 
 include/svx/svxids.hrc                                   |    5 
 include/vcl/ITiledRenderable.hxx                         |   11 
 include/vcl/event.hxx                                    |   15 +
 include/vcl/settings.hxx                                 |    1 
 include/vcl/svapp.hxx                                    |    6 
 sc/inc/docuno.hxx                                        |    2 
 sc/source/core/data/validat.cxx                          |    7 
 sc/source/ui/app/inputhdl.cxx                            |   89 ++++++-
 sc/source/ui/app/inputwin.cxx                            |   73 +++--
 sc/source/ui/condformat/condformatdlg.cxx                |    2 
 sc/source/ui/condformat/condformatdlgentry.cxx           |    2 
 sc/source/ui/drawfunc/fudraw.cxx                         |    2 
 sc/source/ui/drawfunc/fuins2.cxx                         |    4 
 sc/source/ui/drawfunc/fusel.cxx                          |    7 
 sc/source/ui/inc/inputhdl.hxx                            |    2 
 sc/source/ui/inc/inputwin.hxx                            |    7 
 sc/source/ui/sidebar/AlignmentPropertyPanel.cxx          |    3 
 sc/source/ui/unoobj/docuno.cxx                           |   12 
 sc/source/ui/view/cellsh3.cxx                            |  121 +++++++++
 sc/source/ui/view/gridwin.cxx                            |    7 
 sc/source/ui/view/tabvwshc.cxx                           |    7 
 sc/source/ui/view/viewfun5.cxx                           |    3 
 sd/inc/strings.hrc                                       |    9 
 sd/qa/unit/tiledrendering/tiledrendering.cxx             |  185 ++++++++++++++-
 sd/source/core/sdpage.cxx                                |   53 +++-
 sd/source/ui/func/futext.cxx                             |    4 
 sd/source/ui/inc/unomodel.hxx                            |    5 
 sd/source/ui/unoidl/unomodel.cxx                         |    5 
 sfx2/sdi/frmslots.sdi                                    |   10 
 sfx2/sdi/sfx.sdi                                         |   36 ++
 sfx2/source/control/unoctitm.cxx                         |    4 
 sfx2/source/dialog/basedlgs.cxx                          |    5 
 sfx2/source/dialog/tabdlg.cxx                            |    5 
 sfx2/source/sidebar/Deck.cxx                             |   51 ----
 sfx2/source/sidebar/SidebarChildWindow.cxx               |    1 
 sfx2/source/sidebar/SidebarController.cxx                |   19 +
 sfx2/source/sidebar/SidebarDockingWindow.cxx             |  138 ++++++++---
 sfx2/source/view/lokcharthelper.cxx                      |    5 
 sfx2/source/view/lokhelper.cxx                           |  139 +++++++++--
 sfx2/source/view/viewfrm.cxx                             |   26 +-
 sfx2/source/view/viewsh.cxx                              |   15 +
 svl/source/numbers/zforlist.cxx                          |   10 
 svx/source/sidebar/text/TextPropertyPanel.cxx            |    3 
 sw/source/core/crsr/bookmrk.cxx                          |    8 
 sw/source/ui/dialog/wordcountdialog.cxx                  |    4 
 sw/source/uibase/uiview/viewstat.cxx                     |   14 +
 sw/source/uibase/uno/unotxdoc.cxx                        |    4 
 unotools/source/misc/syslocale.cxx                       |    2 
 vcl/inc/svdata.hxx                                       |   26 +-
 vcl/source/app/help.cxx                                  |    8 
 vcl/source/app/salvtables.cxx                            |    2 
 vcl/source/app/settings.cxx                              |    5 
 vcl/source/app/stdtext.cxx                               |   10 
 vcl/source/app/svapp.cxx                                 |   44 +--
 vcl/source/app/svdata.cxx                                |   62 ++++-
 vcl/source/app/svmain.cxx                                |   26 +-
 vcl/source/outdev/font.cxx                               |    4 
 vcl/source/outdev/map.cxx                                |    4 
 vcl/source/uitest/logger.cxx                             |    6 
 vcl/source/uitest/uitest.cxx                             |    6 
 vcl/source/window/brdwin.cxx                             |    2 
 vcl/source/window/cursor.cxx                             |   10 
 vcl/source/window/dialog.cxx                             |   38 +--
 vcl/source/window/event.cxx                              |   16 -
 vcl/source/window/floatwin.cxx                           |   32 +-
 vcl/source/window/menu.cxx                               |    7 
 vcl/source/window/menubarwindow.cxx                      |   12 
 vcl/source/window/menufloatingwindow.cxx                 |    2 
 vcl/source/window/mouse.cxx                              |   36 +-
 vcl/source/window/msgbox.cxx                             |   82 ++++++
 vcl/source/window/scrwnd.cxx                             |    6 
 vcl/source/window/stacking.cxx                           |    2 
 vcl/source/window/syswin.cxx                             |    4 
 vcl/source/window/taskpanelist.cxx                       |    4 
 vcl/source/window/toolbox.cxx                            |    4 
 vcl/source/window/window.cxx                             |   85 +++---
 vcl/source/window/window2.cxx                            |   60 ++--
 vcl/source/window/winproc.cxx                            |  173 +++++++-------
 vcl/source/window/wrkwin.cxx                             |   11 
 vcl/unx/generic/window/salframe.cxx                      |   16 -
 vcl/unx/gtk3/gtk3gtkframe.cxx                            |    6 
 103 files changed, 1700 insertions(+), 674 deletions(-)

New commits:
commit 13bcdb3ece6db1c1538435f75f6e2296fdbbfb71
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Thu May 28 09:38:56 2020 +0100
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 11:28:49 2020 +0100

    Cleanup to match API changes.
    
    Change-Id: I5dd37e3afb3bd55fe945b18474faa35a282156de

diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 4471db3bab26..915680a776f9 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -407,11 +407,12 @@ bool ScValidationData::DoError(weld::Window* pParent, 
const OUString& rInput,
             break;
     }
 
-    bool bIsMobile = comphelper::LibreOfficeKit::isActive()
-                        && 
comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView());
+    bool bIsMobilePhone = (comphelper::LibreOfficeKit::isActive() &&
+                      SfxViewShell::Current() &&
+                      SfxViewShell::Current()->isLOKMobilePhone());
 
     std::unique_ptr<weld::MessageDialog> 
xBox(Application::CreateMessageDialog(pParent, eType,
-                                              eStyle, aMessage, bIsMobile));
+                                              eStyle, aMessage, 
bIsMobilePhone));
     xBox->set_title(aTitle);
 
     switch (eErrorStyle)
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 19487e808b6a..fbc0f4260520 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -2592,9 +2592,9 @@ OUString SdPage::GetPresObjText(PresObjKind eObjKind) 
const
     OUString aString;
 
 #if defined(IOS) || defined(ANDROID)
-    bool isMobile = true;
+    bool isMobileDevice = true;
 #else
-    bool isMobile = false;
+    bool isMobileDevice = false;
     if (const SfxViewShell* pCurrentViewShell = SfxViewShell::Current())
         isMobileDevice = pCurrentViewShell->isLOKMobilePhone() || 
pCurrentViewShell->isLOKMobilePhone();
 #endif
@@ -2605,20 +2605,20 @@ OUString SdPage::GetPresObjText(PresObjKind eObjKind) 
const
         {
             if (mePageKind != PageKind::Notes)
             {
-                if (isMobile)
+                if (isMobileDevice)
                     aString = SdResId(STR_PRESOBJ_MPTITLE_MOBILE);
                 else
                     aString = SdResId(STR_PRESOBJ_MPTITLE);
             }
             else
             {
-                if (isMobile)
+                if (isMobileDevice)
                     aString = SdResId(STR_PRESOBJ_MPNOTESTITLE_MOBILE);
                 else
                     aString = SdResId(STR_PRESOBJ_MPNOTESTITLE);
             }
         }
-        else if (isMobile)
+        else if (isMobileDevice)
             aString = SdResId(STR_PRESOBJ_TITLE_MOBILE);
         else
             aString = SdResId(STR_PRESOBJ_TITLE);
@@ -2627,12 +2627,12 @@ OUString SdPage::GetPresObjText(PresObjKind eObjKind) 
const
     {
         if (mbMaster)
         {
-            if (isMobile)
+            if (isMobileDevice)
                 aString = SdResId(STR_PRESOBJ_MPOUTLINE_MOBILE);
             else
                 aString = SdResId(STR_PRESOBJ_MPOUTLINE);
         }
-        else if (isMobile)
+        else if (isMobileDevice)
             aString = SdResId(STR_PRESOBJ_OUTLINE_MOBILE);
         else
             aString = SdResId(STR_PRESOBJ_OUTLINE);
@@ -2641,19 +2641,19 @@ OUString SdPage::GetPresObjText(PresObjKind eObjKind) 
const
     {
         if (mbMaster)
         {
-            if (isMobile)
+            if (isMobileDevice)
                 aString = SdResId(STR_PRESOBJ_MPNOTESTEXT_MOBILE);
             else
                 aString = SdResId(STR_PRESOBJ_MPNOTESTEXT);
         }
-        else if (isMobile)
+        else if (isMobileDevice)
             aString = SdResId(STR_PRESOBJ_NOTESTEXT_MOBILE);
         else
             aString = SdResId(STR_PRESOBJ_NOTESTEXT);
     }
     else if (eObjKind == PRESOBJ_TEXT)
     {
-        if (isMobile)
+        if (isMobileDevice)
             aString = SdResId(STR_PRESOBJ_TEXT_MOBILE);
         else
             aString = SdResId(STR_PRESOBJ_TEXT);
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 2b6af7084f62..a5ea026f137f 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -412,8 +412,9 @@ void SfxFloatingWindow::FillInfo(SfxChildWinInfo& rInfo) 
const
 SfxDialogController::SfxDialogController(weld::Widget* pParent, const 
OUString& rUIFile,
                                          const OString& rDialogId)
     : GenericDialogController(pParent, rUIFile, rDialogId,
-                                    comphelper::LibreOfficeKit::isActive()
-                                    && 
comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
+                              comphelper::LibreOfficeKit::isActive() &&
+                              SfxViewShell::Current() &&
+                              SfxViewShell::Current()->isLOKMobilePhone())
 {
     m_xDialog->SetInstallLOKNotifierHdl(LINK(this, SfxDialogController, 
InstallLOKNotifierHdl));
     m_xDialog->connect_toplevel_focus_changed(LINK(this, SfxDialogController, 
FocusChangeHdl));
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index a0370e292c6b..8a69523c0e8d 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -142,8 +142,9 @@ css::uno::Reference< css::frame::XFrame > 
SfxTabPage::GetFrame() const
 
 SfxTabPage::SfxTabPage(weld::Container* pPage, weld::DialogController* 
pController, const OUString& rUIXMLDescription, const OString& rID, const 
SfxItemSet *rAttrSet)
     : BuilderPage(pPage, pController, rUIXMLDescription, rID,
-                    comphelper::LibreOfficeKit::isActive()
-                    && 
comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
+                  comphelper::LibreOfficeKit::isActive() &&
+                  SfxViewShell::Current() &&
+                  SfxViewShell::Current()->isLOKMobilePhone())
     , pSet                ( rAttrSet )
     , bHasExchangeSupport ( false )
     , pImpl               ( new TabPageImpl )
commit 7603e4591cb6cbbf55bc8a6302e63c02ffc9a645
Author:     Andras Timar <andras.ti...@collabora.com>
AuthorDate: Sun May 10 08:22:42 2020 +0200
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:33:55 2020 +0100

    fix broken build caused by change in internal LOK API
    
    Change-Id: I1a9f34bbd0cd66d97c92d09cd6bfb8f3a18b6abc

diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index dc36defa200d..e12cd66dadc1 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -670,7 +670,13 @@ namespace sw { namespace mark
 
     void DropDownFieldmark::SendLOKMessage(const OString& sAction)
     {
-        if (comphelper::LibreOfficeKit::isActive() && 
!comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
+        const SfxViewShell* pViewShell = SfxViewShell::Current();
+        if (pViewShell && pViewShell->isLOKMobilePhone())
+        {
+              return;
+        }
+
+        if (comphelper::LibreOfficeKit::isActive())
         {
             if (!m_pButton)
               return;
commit df6c2dc47b74a14d24325ee4a4ecb5301667ba66
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Mon Dec 16 11:48:06 2019 +0000
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:30:08 2020 +0100

    Revert "jsdialogs: send JSON to the client"
    
    This reverts commit 8f5f2ec5d1055f2bb81ad05e23280c51f5e6eb27.
    
    Change-Id: I8420813797352a3ab6a00adfb484170c75619b0c

diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 0a0a14c4af30..f25d5015fe8f 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -40,8 +40,6 @@
 #include <tools/svborder.hxx>
 #include <boost/property_tree/ptree.hpp>
 #include <sal/log.hxx>
-#include <boost/property_tree/json_parser.hpp>
-#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 using namespace css;
 using namespace css::uno;
@@ -190,16 +188,11 @@ void Deck::Resize()
 
     if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
     {
-        try
-        {
-            std::stringstream aStream;
-            boost::property_tree::write_json(aStream, DumpAsPropertyTree());
-            pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, 
aStream.str().c_str());
-        }
-        catch(boost::property_tree::json_parser::json_parser_error& rError)
-        {
-            SAL_WARN("sfx.sidebar", rError.message());
-        }
+        std::vector<vcl::LOKPayloadItem> aItems;
+        aItems.emplace_back("type", "deck");
+        aItems.emplace_back(std::make_pair("position", 
Point(GetOutOffXPixel(), GetOutOffYPixel()).toString()));
+        aItems.emplace_back(std::make_pair("size", GetSizePixel().toString()));
+        pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
     }
 }
 
commit b9392919da8772df676efa5b5bbdd7f993a6eebe
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Mon Dec 16 11:45:37 2019 +0000
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:29:51 2020 +0100

    Revert "lok: only generate sidebar JSON for mobile views, for now."
    
    This reverts commit 2d7d3cc936cb5b0a242ad7a5c714ebde03df574d.

diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index a67f164cc191..0a0a14c4af30 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -188,10 +188,7 @@ void Deck::Resize()
 {
     Window::Resize();
 
-    const vcl::ILibreOfficeKitNotifier *pNotifier;
-    if (comphelper::LibreOfficeKit::isActive() &&
-        comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()) &&
-        (pNotifier = GetLOKNotifier()))
+    if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
     {
         try
         {
commit 3e927a031e898fe934a9c2376992787af452c81d
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Mon Dec 16 11:45:17 2019 +0000
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:29:31 2020 +0100

    Revert "jsdialogs: emit JSON at idle to avoid repeated emission."
    
    This reverts commit 7d9932ade30464abf297f2e3c3690cca68d6bf71.
    
    Change-Id: Iec1f59458302e81bef9ef87dd074c83e7a227e1f

diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx
index dba93a7fd34b..98738d814a7e 100644
--- a/include/sfx2/sidebar/Deck.hxx
+++ b/include/sfx2/sidebar/Deck.hxx
@@ -29,7 +29,6 @@ namespace sfx2 { namespace sidebar {
 
 class DeckDescriptor;
 class DeckTitleBar;
-class DeckNotifyIdle;
 
 /** This is the parent window of the panels.
     It displays the deck title.
@@ -91,7 +90,6 @@ private:
     sal_Int32 mnMinimalWidth;
     sal_Int32 mnMinimalHeight;
     SharedPanelContainer maPanels;
-    std::unique_ptr<DeckNotifyIdle> mpIdleNotify;
     VclPtr<DeckTitleBar> mpTitleBar;
     VclPtr<vcl::Window> mpScrollClipWindow;
     VclPtr<ScrollContainerWindow> mpScrollContainer;
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 64f0267d5374..a67f164cc191 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -46,35 +46,8 @@
 using namespace css;
 using namespace css::uno;
 
-
 namespace sfx2 { namespace sidebar {
 
-class DeckNotifyIdle : public Idle
-{
-    Deck &mrDeck;
-public:
-    DeckNotifyIdle(Deck &rDeck) :
-        Idle("Deck notify"),
-        mrDeck(rDeck)
-    {
-        SetPriority(TaskPriority::POST_PAINT);
-    }
-    void Invoke() override
-    {
-        auto pNotifier = mrDeck.GetLOKNotifier();
-        try
-        {
-            std::stringstream aStream;
-            boost::property_tree::write_json(aStream, 
mrDeck.DumpAsPropertyTree());
-            pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, 
aStream.str().c_str());
-        }
-        catch(boost::property_tree::json_parser::json_parser_error& rError)
-        {
-            SAL_WARN("sfx.sidebar", rError.message());
-        }
-    }
-};
-
 Deck::Deck(const DeckDescriptor& rDeckDescriptor, vcl::Window* pParentWindow,
            const std::function<void()>& rCloserAction)
     : Window(pParentWindow, 0)
@@ -82,7 +55,6 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, 
vcl::Window* pParentWindow,
     , mnMinimalWidth(0)
     , mnMinimalHeight(0)
     , maPanels()
-    , mpIdleNotify(new DeckNotifyIdle(*this))
     , mpTitleBar(VclPtr<DeckTitleBar>::Create(rDeckDescriptor.msTitle, this, 
rCloserAction))
     , mpScrollClipWindow(VclPtr<vcl::Window>::Create(this))
     , 
mpScrollContainer(VclPtr<ScrollContainerWindow>::Create(mpScrollClipWindow.get()))
@@ -216,11 +188,21 @@ void Deck::Resize()
 {
     Window::Resize();
 
+    const vcl::ILibreOfficeKitNotifier *pNotifier;
     if (comphelper::LibreOfficeKit::isActive() &&
-        comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()) &&
-        GetLOKNotifier())
+        comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()) &&
+        (pNotifier = GetLOKNotifier()))
     {
-        mpIdleNotify->Start();
+        try
+        {
+            std::stringstream aStream;
+            boost::property_tree::write_json(aStream, DumpAsPropertyTree());
+            pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, 
aStream.str().c_str());
+        }
+        catch(boost::property_tree::json_parser::json_parser_error& rError)
+        {
+            SAL_WARN("sfx.sidebar", rError.message());
+        }
     }
 }
 
commit f9bee99fcbfe7b1b28b6e3f406c58409accacb29
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Mon Dec 16 11:44:25 2019 +0000
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:28:10 2020 +0100

    Revert "jsdialogs: set LOKNotifier in Deck"
    
    This reverts commit 5db9bfee77e560c46457a40aee3d2b0752ab2fd8.

diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index ade850c6388d..64f0267d5374 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -100,11 +100,6 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, 
vcl::Window* pParentWindow,
     mpVerticalScrollBar->SetLineSize(10);
     mpVerticalScrollBar->SetPageSize(100);
 
-    if (comphelper::LibreOfficeKit::isActive())
-    {
-        SetLOKNotifier(SfxViewShell::Current());
-    }
-
 #ifdef DEBUG
     SetText(OUString("Deck"));
     mpScrollClipWindow->SetText(OUString("ScrollClipWindow"));
commit 2e063333696e45fd246f57df5bf0a9c813810aad
Author:     Jan Holesovsky <ke...@collabora.com>
AuthorDate: Thu May 7 15:47:49 2020 +0200
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:19:40 2020 +0100

    formula bar: Change completeFunction() to accept string instead of index.
    
    The 'index' is unsafe, because the set it tries to index can change in
    the meantime.  Instead, use the function name and search for it in the
    set, to get the recent index.
    
    Change-Id: Id2a021c32f421057c87b6f7f4fffcc1c98009acb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93666
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93910
    Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 648e7421c54f..060a36581223 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1143,7 +1143,7 @@ static size_t 
doc_renderShapeSelection(LibreOfficeKitDocument* pThis, char** pOu
 static void doc_resizeWindow(LibreOfficeKitDocument* pThis, unsigned 
nLOKWindowId,
                              const int nWidth, const int nHeight);
 
-static void doc_completeFunction(LibreOfficeKitDocument* pThis, int nIndex);
+static void doc_completeFunction(LibreOfficeKitDocument* pThis, const char*);
 
 
 static void doc_sendFormFieldEvent(LibreOfficeKitDocument* pThis,
@@ -5529,7 +5529,7 @@ static void doc_resizeWindow(LibreOfficeKitDocument* 
/*pThis*/, unsigned nLOKWin
     pWindow->SetSizePixel(Size(nWidth, nHeight));
 }
 
-static void doc_completeFunction(LibreOfficeKitDocument* pThis, int nIndex)
+static void doc_completeFunction(LibreOfficeKitDocument* pThis, const char* 
pFunctionName)
 {
     SolarMutexGuard aGuard;
     SetLastExceptionMsg();
@@ -5541,7 +5541,7 @@ static void doc_completeFunction(LibreOfficeKitDocument* 
pThis, int nIndex)
         return;
     }
 
-    pDoc->completeFunction(nIndex);
+    pDoc->completeFunction(OUString::fromUtf8(pFunctionName));
 }
 
 
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h 
b/include/LibreOfficeKit/LibreOfficeKit.h
index 309744522004..8b68452697b3 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -437,7 +437,7 @@ struct _LibreOfficeKitDocumentClass
                                 int viewId);
 
     /// @see lok::Document::completeFunction().
-    void (*completeFunction) (LibreOfficeKitDocument* pThis, int nIndex);
+    void (*completeFunction) (LibreOfficeKitDocument* pThis, const char* 
pFunctionName);
 
     /// @see lok::Document::setWindowTextSelection
     void (*setWindowTextSelection) (LibreOfficeKitDocument* pThis,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx 
b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 8be29ff1e192..91ece38c96a4 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -762,9 +762,9 @@ public:
      *
      * @param nIndex is the index of the selected function
      */
-    void completeFunction(int nIndex)
+    void completeFunction(const char* pFunctionName)
     {
-        mpDoc->pClass->completeFunction(mpDoc, nIndex);
+        mpDoc->pClass->completeFunction(mpDoc, pFunctionName);
     }
 
     /**
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 5bd83d5ef2d4..833f76c0dcde 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -287,7 +287,7 @@ public:
     virtual void moveSelectedParts(int /*nPosition*/, bool /*bDuplicate*/) {}
 
     /// @see lok::Document::completeFunction().
-    virtual void completeFunction(int /*nIndex*/)
+    virtual void completeFunction(const OUString& /*rFunctionName*/)
     {
     }
 
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index f2adcda7a80f..0f74bd9451b5 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -385,7 +385,7 @@ public:
     OUString getPostItsPos() override;
 
     /// @see vcl::ITiledRenderable::completeFunction().
-    virtual void completeFunction(int nIndex) override;
+    virtual void completeFunction(const OUString& rFunctionName) override;
 };
 
 class ScDrawPagesObj final : public cppu::WeakImplHelper<
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 2e47b1205025..7547a5240dfe 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1625,7 +1625,7 @@ void ScInputHandler::PasteFunctionData()
         pActiveView->ShowCursor();
 }
 
-void ScInputHandler::LOKPasteFunctionData( sal_uInt32 nIndex )
+void ScInputHandler::LOKPasteFunctionData(const OUString& rFunctionName)
 {
     if (pActiveViewSh && (pTopView || pTableView))
     {
@@ -1648,12 +1648,16 @@ void ScInputHandler::LOKPasteFunctionData( sal_uInt32 
nIndex )
             InputReplaceSelection( aNewFormula );
         }
 
-        if (pFormulaData && nIndex < pFormulaData->size())
+        if (pFormulaData)
         {
-            auto aPos = pFormulaData->begin();
-            std::advance(aPos, nIndex);
-            miAutoPosFormula = aPos;
-            PasteFunctionData();
+            OUString aNew;
+            ScTypedCaseStrSet::const_iterator aPos = findText(*pFormulaData, 
pFormulaData->begin(), rFunctionName, aNew, /* backward = */false);
+
+            if (aPos != pFormulaData->end())
+            {
+                miAutoPosFormula = aPos;
+                PasteFunctionData();
+            }
         }
     }
 }
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index 71dfec832de5..6faee3c8f646 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -288,7 +288,7 @@ public:
                                     long nX1, long nX2, long nY1, long nY2,
                                     long nTab, const Color& rColor );
 
-    void            LOKPasteFunctionData( sal_uInt32 nIndex );
+    void            LOKPasteFunctionData(const OUString& rFunctionName);
 };
 
 //  ScInputHdlState
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index e64bf7052b30..a1256c17f0b2 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1077,13 +1077,13 @@ OUString ScModelObj::getPostItsPos()
     return OUString::fromUtf8(aStream.str().c_str());
 }
 
-void ScModelObj::completeFunction(int nIndex)
+void ScModelObj::completeFunction(const OUString& rFunctionName)
 {
     ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
     if (pHdl)
     {
-        assert(nIndex >= 0);
-        pHdl->LOKPasteFunctionData(nIndex);
+        assert(!rFunctionName.isEmpty());
+        pHdl->LOKPasteFunctionData(rFunctionName);
     }
 }
 
commit 7da01b39dc0a27400e098a84f6babcc753039790
Author:     Marco Cecchetti <marco.cecche...@collabora.com>
AuthorDate: Mon Apr 20 13:48:06 2020 +0200
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:19:37 2020 +0100

    lok: calc: input bar: send number of text lines to client
    
    Change-Id: Iec919ef11e22ae5d02009570f446064e3f7bfe01
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92690
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93345
    Tested-by: Jenkins

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 04d6143ec900..d8a5c32c0660 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -514,6 +514,7 @@ void ScInputWindow::Resize()
     {
         std::vector<vcl::LOKPayloadItem> aItems;
         aItems.emplace_back("size", GetSizePixel().toString());
+        aItems.emplace_back("lines", 
OString::number(aTextWindow.GetNumLines()));
         pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems);
     }
 
@@ -534,6 +535,7 @@ void ScInputWindow::NotifyLOKClient()
             aItems.emplace_back("type", "calc-input-win");
             aItems.emplace_back(std::make_pair("position", 
Point(GetOutOffXPixel(), GetOutOffYPixel()).toString()));
             aItems.emplace_back(std::make_pair("size", aSize.toString()));
+            aItems.emplace_back("lines", 
OString::number(aTextWindow.GetNumLines()));
             pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
         }
 
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index d831cfe0e3b1..9150096fec72 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -57,6 +57,7 @@ public:
     virtual void            SetFormulaMode( bool bSet ) = 0;
     virtual bool            IsInputActive() = 0;
     virtual void            TextGrabFocus() = 0;
+    virtual long            GetNumLines() const = 0;
 };
 
 class ScTextWnd : public ScTextWndBase, public DragSourceHelper     // edit 
window
@@ -95,7 +96,7 @@ public:
     long GetPixelHeightForLines(long nLines);
     long GetEditEngTxtHeight() const;
 
-    long GetNumLines() const { return mnLines; }
+    virtual long GetNumLines() const override { return mnLines; }
     void SetNumLines(long nLines);
     long GetLastNumExpandedLines() const { return mnLastExpandedLines; }
 
@@ -191,7 +192,7 @@ public:
     virtual void            
InsertAccessibleTextData(ScAccessibleEditLineTextData& rTextData) override;
     virtual EditView*       GetEditView() override;
     long                    GetLastNumExpandedLines() const;
-    long                    GetNumLines() const;
+    virtual long            GetNumLines() const override;
     long                    GetPixelHeightForLines(long nLines);
     ScrollBar&              GetScrollBar();
     virtual const OUString& GetTextString() const override;
@@ -236,7 +237,7 @@ public:
     bool                    IsInputActive() override;
     void                    IncrementVerticalSize();
     void                    DecrementVerticalSize();
-    long                    GetNumLines() const { return 
maTextWndGroup->GetNumLines(); }
+    virtual long            GetNumLines() const override { return 
maTextWndGroup->GetNumLines(); }
     long                    GetVertOffset() const { return  mnVertOffset; }
 
 private:
commit d6e27bc7bdc367689def211e771b1c304c70a2ec
Author:     Marco Cecchetti <marco.cecche...@collabora.com>
AuthorDate: Tue Feb 25 14:07:28 2020 +0100
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:19:35 2020 +0100

    lok: remove sum and equal buttons from the formula bar
    
    This patch removes sum and equal buttons from the formula bar in the
    lok case. A tentative to limit that to the mobile case has been done
    however the formula input bar is created before than the client view
    so we are not able to use the LibreOfficeKit::isMobile check.
    
    Change-Id: Icb820a0d77eb9295046997d2f3690d7f8b39680d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89453
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 626c5b2d0a71..04d6143ec900 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -192,10 +192,16 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, const 
SfxBindings* pBind ) :
         InsertSeparator (1);
         InsertItem      (SID_INPUT_FUNCTION, Image(StockImage::Yes, 
RID_BMP_INPUT_FUNCTION), ToolBoxItemBits::NONE, 2);
     }
-    InsertItem      (SID_INPUT_SUM,      Image(StockImage::Yes, 
RID_BMP_INPUT_SUM), ToolBoxItemBits::DROPDOWNONLY, 3);
-    InsertItem      (SID_INPUT_EQUAL,    Image(StockImage::Yes, 
RID_BMP_INPUT_EQUAL), ToolBoxItemBits::NONE, 4);
-    InsertItem      (SID_INPUT_CANCEL,   Image(StockImage::Yes, 
RID_BMP_INPUT_CANCEL), ToolBoxItemBits::NONE, 5);
-    InsertItem      (SID_INPUT_OK,       Image(StockImage::Yes, 
RID_BMP_INPUT_OK), ToolBoxItemBits::NONE, 6);
+
+    // sigma and euqal buttons
+    if (!mpViewShell->isLOKMobilePhone())
+    {
+        InsertItem      (SID_INPUT_SUM,      Image(StockImage::Yes, 
RID_BMP_INPUT_SUM), ToolBoxItemBits::DROPDOWNONLY, 3);
+        InsertItem      (SID_INPUT_EQUAL,    Image(StockImage::Yes, 
RID_BMP_INPUT_EQUAL), ToolBoxItemBits::NONE, 4);
+        InsertItem      (SID_INPUT_CANCEL,   Image(StockImage::Yes, 
RID_BMP_INPUT_CANCEL), ToolBoxItemBits::NONE, 5);
+        InsertItem      (SID_INPUT_OK,       Image(StockImage::Yes, 
RID_BMP_INPUT_OK), ToolBoxItemBits::NONE, 6);
+    }
+
     if (!comphelper::LibreOfficeKit::isActive())
     {
         InsertSeparator (7);
@@ -218,23 +224,27 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, const 
SfxBindings* pBind ) :
         SetHelpId   (SID_INPUT_FUNCTION, HID_INSWIN_CALC);
     }
 
-    SetItemText (SID_INPUT_SUM, ScResId( SCSTR_QHELP_BTNSUM ) );
-    SetHelpId   (SID_INPUT_SUM, HID_INSWIN_SUMME);
+    // sigma and euqal buttons
+    if (!mpViewShell->isLOKMobilePhone())
+    {
+        SetItemText (SID_INPUT_SUM, ScResId( SCSTR_QHELP_BTNSUM ) );
+        SetHelpId   (SID_INPUT_SUM, HID_INSWIN_SUMME);
 
-    SetItemText (SID_INPUT_EQUAL, ScResId( SCSTR_QHELP_BTNEQUAL ) );
-    SetHelpId   (SID_INPUT_EQUAL, HID_INSWIN_FUNC);
+        SetItemText (SID_INPUT_EQUAL, ScResId( SCSTR_QHELP_BTNEQUAL ) );
+        SetHelpId   (SID_INPUT_EQUAL, HID_INSWIN_FUNC);
 
-    SetItemText ( SID_INPUT_CANCEL, ScResId( SCSTR_QHELP_BTNCANCEL ) );
-    SetHelpId   ( SID_INPUT_CANCEL, HID_INSWIN_CANCEL );
+        SetItemText ( SID_INPUT_CANCEL, ScResId( SCSTR_QHELP_BTNCANCEL ) );
+        SetHelpId   ( SID_INPUT_CANCEL, HID_INSWIN_CANCEL );
 
-    SetItemText ( SID_INPUT_OK, ScResId( SCSTR_QHELP_BTNOK ) );
-    SetHelpId   ( SID_INPUT_OK, HID_INSWIN_OK );
+        SetItemText ( SID_INPUT_OK, ScResId( SCSTR_QHELP_BTNOK ) );
+        SetHelpId   ( SID_INPUT_OK, HID_INSWIN_OK );
 
-    EnableItem( SID_INPUT_CANCEL, false );
-    EnableItem( SID_INPUT_OK, false );
+        EnableItem( SID_INPUT_CANCEL, false );
+        EnableItem( SID_INPUT_OK, false );
 
-    HideItem( SID_INPUT_CANCEL );
-    HideItem( SID_INPUT_OK );
+        HideItem( SID_INPUT_CANCEL );
+        HideItem( SID_INPUT_OK );
+    }
 
     SetHelpId( HID_SC_INPUTWIN ); // For the whole input row
 
commit 8c669a916e905289bb4cdae82a59129b31bbcbef
Author:     Marco Cecchetti <marco.cecche...@collabora.com>
AuthorDate: Wed Feb 12 15:01:19 2020 +0100
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:19:33 2020 +0100

    lok: formula bar: send whole function list
    
    Change-Id: Ibbd142652f3190387700f820e56c494b61bfa658
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93341
    Tested-by: Jenkins
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index db6286f431d3..2e47b1205025 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1306,6 +1306,10 @@ void ScInputHandler::ShowFuncList( const ::std::vector< 
OUString > & rFuncStrVec
     {
         if (rFuncStrVec.size())
         {
+            auto aPos = pFormulaData->begin();
+            sal_uInt32 nCurIndex = std::distance(aPos, miAutoPosFormula);
+            const sal_uInt32 nSize = pFormulaData->size();
+
             OUString aFuncNameStr;
             OUString aDescFuncNameStr;
             OStringBuffer aPayload;
@@ -1332,6 +1336,9 @@ void ScInputHandler::ShowFuncList( const ::std::vector< 
OUString > & rFuncStrVec
                     if ( !ppFDesc->getFunctionName().isEmpty() )
                     {
                         aPayload.append("{");
+                        aPayload.append("\"index\": ");
+                        aPayload.append(OString::number(nCurIndex));
+                        aPayload.append(", ");
                         aPayload.append("\"signature\": \"");
                         aPayload.append(escapeJSON(ppFDesc->getSignature()));
                         aPayload.append("\", ");
@@ -1340,6 +1347,9 @@ void ScInputHandler::ShowFuncList( const ::std::vector< 
OUString > & rFuncStrVec
                         aPayload.append("\"}, ");
                     }
                 }
+                ++nCurIndex;
+                if (nCurIndex == nSize)
+                    nCurIndex = 0;
             }
             sal_Int32 nLen = aPayload.getLength();
             aPayload[nLen - 2] = ' ';
@@ -1502,6 +1512,34 @@ void completeFunction( EditView* pView, const OUString& 
rInsert, bool& rParInser
     {
         ESelection aSel = pView->GetSelection();
 
+        bool bNoInitialLetter = false;
+        OUString aOld = pView->GetEditEngine()->GetText(0);
+        // in case we want just insert a function and not completing
+        if ( comphelper::LibreOfficeKit::isActive() )
+        {
+            ESelection aSelRange = aSel;
+            --aSelRange.nStartPos;
+            --aSelRange.nEndPos;
+            pView->SetSelection(aSelRange);
+            pView->SelectCurrentWord();
+
+            if ( aOld == "=" )
+            {
+                bNoInitialLetter = true;
+                aSelRange.nStartPos = 1;
+                aSelRange.nEndPos = 1;
+                pView->SetSelection(aSelRange);
+            }
+            else if ( pView->GetSelected().startsWith("()") )
+            {
+                bNoInitialLetter = true;
+                ++aSelRange.nStartPos;
+                ++aSelRange.nEndPos;
+                pView->SetSelection(aSelRange);
+            }
+        }
+
+        if(!bNoInitialLetter)
         {
             const sal_Int32 nMinLen = std::max(aSel.nEndPos - aSel.nStartPos, 
sal_Int32(1));
             // Since transliteration service is used to test for match, the 
replaced string could be
@@ -1531,7 +1569,6 @@ void completeFunction( EditView* pView, const OUString& 
rInsert, bool& rParInser
             // Do not insert parentheses after function names if there already 
are some
             // (e.g. if the function name was edited).
             ESelection aWordSel = pView->GetSelection();
-            OUString aOld = pView->GetEditEngine()->GetText(0);
 
             // aWordSel.EndPos points one behind string if word at end
             if (aWordSel.nEndPos < aOld.getLength())
@@ -1590,16 +1627,34 @@ void ScInputHandler::PasteFunctionData()
 
 void ScInputHandler::LOKPasteFunctionData( sal_uInt32 nIndex )
 {
-    if (pFormulaData  && miAutoPosFormula != pFormulaData->end() && nIndex < 
pFormulaData->size())
-    {
-        auto aPos = pFormulaData->begin();
-        sal_uInt32 nCurIndex = std::distance(aPos, miAutoPosFormula);
-        nIndex += nCurIndex;
-        if (nIndex >= pFormulaData->size())
-            nIndex -= pFormulaData->size();
-        std::advance(aPos, nIndex);
-        miAutoPosFormula = aPos;
-        PasteFunctionData();
+    if (pActiveViewSh && (pTopView || pTableView))
+    {
+        bool bEdit = false;
+        OUString aFormula;
+        EditView* pEditView = pTopView ? pTopView : pTableView;
+        const EditEngine* pEditEngine = pEditView->GetEditEngine();
+        if (pEditEngine)
+        {
+            aFormula = pEditEngine->GetText(0);
+            bEdit = aFormula.getLength() > 1 && (aFormula[0] == '=' || 
aFormula[0] == '+' || aFormula[0] == '-');
+        }
+
+        if ( !bEdit )
+        {
+            OUString aNewFormula('=');
+            if ( aFormula.startsWith("=") )
+                aNewFormula = aFormula;
+
+            InputReplaceSelection( aNewFormula );
+        }
+
+        if (pFormulaData && nIndex < pFormulaData->size())
+        {
+            auto aPos = pFormulaData->begin();
+            std::advance(aPos, nIndex);
+            miAutoPosFormula = aPos;
+            PasteFunctionData();
+        }
     }
 }
 
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 3d903ea83a12..15d6fce90c0b 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -20,6 +20,7 @@
 #include <scitems.hxx>
 #include <editeng/editview.hxx>
 #include <editeng/editeng.hxx>
+#include <formula/formulahelper.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/bindings.hxx>
 #include <sfx2/dispatch.hxx>
@@ -40,6 +41,7 @@
 #include <cellsh.hxx>
 #include <inputhdl.hxx>
 #include <editable.hxx>
+#include <funcdesc.hxx>
 #include <markdata.hxx>
 #include <scabstdlg.hxx>
 #include <columnspanset.hxx>
@@ -55,6 +57,103 @@
 using sc::HMMToTwips;
 using sc::TwipsToEvenHMM;
 
+namespace
+{
+/// Rid ourselves of unwanted " quoted json characters.
+OString escapeJSON(const OUString &aStr)
+{
+    OUString aEscaped = aStr;
+    aEscaped = aEscaped.replaceAll("\n", " ");
+    aEscaped = aEscaped.replaceAll("\"", "'");
+    return OUStringToOString(aEscaped, RTL_TEXTENCODING_UTF8);
+}
+
+void lcl_lokGetWholeFunctionList()
+{
+    const SfxViewShell* pViewShell = SfxViewShell::Current();
+    if (comphelper::LibreOfficeKit::isActive()
+        && pViewShell && pViewShell->isLOKMobilePhone())
+    {
+        const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
+        sal_uInt32 nListCount = pFuncList->GetCount();
+        std::set<OUString> aFuncNameOrderedSet;
+        for(sal_uInt32 i = 0; i < nListCount; ++i)
+        {
+            const ScFuncDesc* pDesc = pFuncList->GetFunction( i );
+            if ( pDesc->mxFuncName )
+            {
+                aFuncNameOrderedSet.insert(*pDesc->mxFuncName);
+            }
+        }
+        ScFunctionMgr* pFuncManager = ScGlobal::GetStarCalcFunctionMgr();
+        if (pFuncManager && aFuncNameOrderedSet.size())
+        {
+            OStringBuffer aPayload;
+            aPayload.append("{ \"wholeList\": true, ");
+            aPayload.append("\"categories\": [ ");
+
+            formula::FormulaHelper aHelper(pFuncManager);
+            sal_uInt32 nCategoryCount = pFuncManager->getCount();
+            for (sal_uInt32 i = 0; i < nCategoryCount; ++i)
+            {
+                OUString sCategoryName = ScFunctionMgr::GetCategoryName(i);
+                aPayload.append("{");
+                aPayload.append("\"name\": \"");
+                aPayload.append(escapeJSON(sCategoryName));
+                aPayload.append("\"}, ");
+            }
+            sal_Int32 nLen = aPayload.getLength();
+            aPayload[nLen - 2] = ' ';
+            aPayload[nLen - 1] = ']';
+            aPayload.append(", ");
+
+            OUString aDescFuncNameStr;
+            aPayload.append("\"functions\": [ ");
+            sal_uInt32 nCurIndex = 0;
+            for (const OUString& aFuncNameStr : aFuncNameOrderedSet)
+            {
+                aDescFuncNameStr = aFuncNameStr + "()";
+                sal_Int32 nNextFStart = 0;
+                const formula::IFunctionDescription* ppFDesc;
+                ::std::vector< OUString > aArgs;
+                OUString eqPlusFuncName = "=" + aDescFuncNameStr;
+                if ( aHelper.GetNextFunc( eqPlusFuncName, false, nNextFStart, 
nullptr, &ppFDesc, &aArgs ) )
+                {
+                    if ( ppFDesc && !ppFDesc->getFunctionName().isEmpty() )
+                    {
+                        if (ppFDesc->getCategory())
+                        {
+                            aPayload.append("{");
+                            aPayload.append("\"index\": ");
+                            aPayload.append(OString::number(nCurIndex));
+                            aPayload.append(", ");
+                            aPayload.append("\"category\": ");
+                            
aPayload.append(OString::number(ppFDesc->getCategory()->getNumber()));
+                            aPayload.append(", ");
+                            aPayload.append("\"signature\": \"");
+                            
aPayload.append(escapeJSON(ppFDesc->getSignature()));
+                            aPayload.append("\", ");
+                            aPayload.append("\"description\": \"");
+                            
aPayload.append(escapeJSON(ppFDesc->getDescription()));
+                            aPayload.append("\"}, ");
+                        }
+                    }
+                }
+                ++nCurIndex;
+            }
+            nLen = aPayload.getLength();
+            aPayload[nLen - 2] = ' ';
+            aPayload[nLen - 1] = ']';
+            aPayload.append(" }");
+
+            OString s = aPayload.makeStringAndClear();
+            
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CALC_FUNCTION_LIST, 
s.getStr());
+        }
+    }
+}
+
+} // end namespace
+
 void ScCellShell::Execute( SfxRequest& rReq )
 {
     ScTabViewShell* pTabViewShell   = GetViewData()->GetViewShell();
@@ -315,11 +414,23 @@ void ScCellShell::Execute( SfxRequest& rReq )
 
         case SID_OPENDLG_FUNCTION:
             {
-                sal_uInt16 nId = SID_OPENDLG_FUNCTION;
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
-                bool bVis = comphelper::LibreOfficeKit::isActive() || pWnd == 
nullptr;
-                pScMod->SetRefDialog( nId, bVis );
+                const SfxViewShell* pViewShell = SfxViewShell::Current();
+                if (comphelper::LibreOfficeKit::isActive()
+                    && pViewShell && pViewShell->isLOKMobilePhone())
+                {
+                    // not set the dialog id in the mobile case or we would
+                    // not be able to get cell address pasted in the edit view
+                    // by just tapping on them
+                    lcl_lokGetWholeFunctionList();
+                }
+                else
+                {
+                    sal_uInt16 nId = SID_OPENDLG_FUNCTION;
+                    SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
+                    SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                    bool bVis = comphelper::LibreOfficeKit::isActive() || pWnd 
== nullptr;
+                    pScMod->SetRefDialog( nId, bVis );
+                }
                 rReq.Ignore();
             }
             break;
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index b8fb79fcd69e..37c33f8e2930 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -394,8 +394,11 @@ std::unique_ptr<SfxModelessDialogController> 
ScTabViewShell::CreateRefDialogCont
         }
         case SID_OPENDLG_FUNCTION:
         {
-            // dialog checks, what is in the cell
-            xResult.reset(new ScFormulaDlg(pB, pCW, pParent, 
&GetViewData(),ScGlobal::GetStarCalcFunctionMgr()));
+            if (!isLOKMobilePhone())
+            {
+                // dialog checks, what is in the cell
+                xResult.reset(new ScFormulaDlg(pB, pCW, pParent, 
&GetViewData(),ScGlobal::GetStarCalcFunctionMgr()));
+            }
             break;
         }
         case WID_CONDFRMT_REF:
commit 38f31adea6596e1303821df06ba481b850508490
Author:     Marco Cecchetti <marco.cecche...@collabora.com>
AuthorDate: Mon Apr 20 21:26:26 2020 +0200
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:19:31 2020 +0100

    lok: set device form factor of the client on view creation
    
    This patch allows the lok core to know about the device form facor of
    the client requesting the creation of new view, immediately instead of
    a later time.
    When a new view is needed a "DeviceFormFactor" parameter is forwarded
    to lo_documentLoadWithOptions and doc_createViewWithOptions from the
    client.
    This parameter can have one of the following values: 'desktop',
    'tablet','mobile' and it is used to set a global variable accessible
    by SfxLokHelper::setDeviceFormFactor and
    SfxLokHelper::getDeviceFormFactor.
    This global variable is retrived in the SfxViewShell constructor for
    setting SfxViewShell::maLOKDeviceFormFactor attribute.
    In SfxViewShell we have the following 3 methods:
    - bool isLOKDesktop()
    - bool isLOKTablet()
    - bool isLOKMobilePhone()
    which replace the following boolean functions:
    - comphelper::LibreOfficeKit::isTablet
    - comphelper::LibreOfficeKit::::isMobilePhone
    
    Change-Id: I9b36f354278df8c216fcb90f6a9da8256ec9c1e3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93340
    Tested-by: Jenkins
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/chart2/source/controller/main/ChartController_Window.cxx 
b/chart2/source/controller/main/ChartController_Window.cxx
index 396b5ab69a88..622052d9af38 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -931,7 +931,8 @@ void ChartController::execute_MouseButtonUp( const 
MouseEvent& rMEvt )
 
 void ChartController::execute_DoubleClick( const Point* pMousePixel )
 {
-    bool isMobilePhone = 
comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView());
+    const SfxViewShell* pViewShell = SfxViewShell::Current();
+    bool isMobilePhone = pViewShell && pViewShell->isLOKMobilePhone();
     if (isMobilePhone)
         return;
 
diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index c58a1aa6f547..0f665f1be202 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -91,12 +91,6 @@ static LanguageAndLocale g_aLanguageAndLocale;
 /// Scaling of the cairo canvas painting for hi-dpi
 static double g_fDPIScale(1.0);
 
-/// Which views are on mobile phones?
-static std::map<int, bool> g_vIsViewMobilePhone;
-
-/// Which views are on tablets?
-static std::map<int, bool> g_vIsViewTablet;
-
 void setActive(bool bActive)
 {
     g_bActive = bActive;
@@ -107,36 +101,6 @@ bool isActive()
     return g_bActive;
 }
 
-void setMobilePhone(int nViewId)
-{
-    assert(!isMobilePhone(nViewId));
-    assert(!isTablet(nViewId));
-    g_vIsViewMobilePhone[nViewId] = true;
-}
-
-bool isMobilePhone(int nViewId)
-{
-    if (g_vIsViewMobilePhone.find(nViewId) != g_vIsViewMobilePhone.end())
-        return g_vIsViewMobilePhone[nViewId];
-    else
-        return false;
-}
-
-void setTablet(int nViewId)
-{
-    assert(!isMobilePhone(nViewId));
-    assert(!isTablet(nViewId));
-    g_vIsViewTablet[nViewId] = true;
-}
-
-bool isTablet(int nViewId)
-{
-    if (g_vIsViewTablet.find(nViewId) != g_vIsViewTablet.end())
-        return g_vIsViewTablet[nViewId];
-    else
-        return false;
-}
-
 void setPartInInvalidation(bool bPartInInvalidation)
 {
     g_bPartInInvalidation = bPartInInvalidation;
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 3de57d8cee3c..648e7421c54f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2170,6 +2170,9 @@ static LibreOfficeKitDocument* 
lo_documentLoadWithOptions(LibreOfficeKit* pThis,
             SvNumberFormatter::resetTheCurrencyTable();
         }
 
+        const OUString aDeviceFormFactor = extractParameter(aOptions, 
"DeviceFormFactor");
+        SfxLokHelper::setDeviceFormFactor(aDeviceFormFactor);
+
         uno::Sequence<css::beans::PropertyValue> aFilterOptions(2);
         aFilterOptions[0] = css::beans::PropertyValue( "FilterOptions",
                                                        0,
@@ -3766,17 +3769,7 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* 
pThis, const char* pComma
     if (nView < 0)
         return;
 
-    if (gImpl && (aCommand == ".uno:LOKSetMobile" || aCommand == 
".uno:LOKSetMobilePhone"))
-    {
-        comphelper::LibreOfficeKit::setMobilePhone(nView);
-        return;
-    }
-    else if (gImpl && aCommand == ".uno:LOKSetTablet")
-    {
-        comphelper::LibreOfficeKit::setTablet(nView);
-        return;
-    }
-    else if (gImpl && aCommand == ".uno:ToggleOrientation")
+    if (gImpl && aCommand == ".uno:ToggleOrientation")
     {
         ExecuteOrientationChange();
         return;
@@ -5029,6 +5022,9 @@ static int 
doc_createViewWithOptions(LibreOfficeKitDocument* pThis,
         comphelper::LibreOfficeKit::setLocale(LanguageTag(aLanguage));
     }
 
+    const OUString aDeviceFormFactor = extractParameter(aOptions, 
"DeviceFormFactor");
+    SfxLokHelper::setDeviceFormFactor(aDeviceFormFactor);
+
     int nId = SfxLokHelper::createView();
 
 #ifdef IOS
diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index a5770473356c..52c5668ccb84 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1083,11 +1083,11 @@ void EditView::ExecuteSpellPopup( const Point& 
rPosPixel, Link<SpellCallbackInfo
         EPaM aP = pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM);
         EPaM aP2 = 
pImpEditView->pEditEngine->pImpEditEngine->CreateEPaM(aPaM2);
 
-
         if (comphelper::LibreOfficeKit::isActive())
         {
-            // For mobile phone, send the context menu structure
-            if 
(comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
+            // For mobile phones, send the context menu structure
+            const SfxViewShell* pViewShell = SfxViewShell::Current();
+            if (pViewShell && pViewShell->isLOKMobilePhone())
             {
                 LOKSendSpellPopupMenu(aPopupMenu, nGuessLangWord, 
nGuessLangPara, nWords);
                 return;
diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx
index 09d4f682341e..88901a24d991 100644
--- a/include/comphelper/lok.hxx
+++ b/include/comphelper/lok.hxx
@@ -49,12 +49,6 @@ COMPHELPER_DLLPUBLIC void setStatusIndicatorCallback(void 
(*callback)(void *data
 // Check whether the code is running as invoked through LibreOfficeKit.
 COMPHELPER_DLLPUBLIC bool isActive();
 
-// Check whether we are serving to a mobile phone
-COMPHELPER_DLLPUBLIC bool isMobilePhone(int nViewId);
-
-// Check whether we are serving to a tablet
-COMPHELPER_DLLPUBLIC bool isTablet(int nViewId);
-
 /// Shift the coordinates before rendering each bitmap.
 /// Used by Calc to render each tile separately.
 /// This should be unnecessary (and removed) once Calc
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 01eebfe9e8b1..89b4972d8914 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -62,6 +62,10 @@ public:
     static void setDefaultLanguage(const OUString& rBcp47LanguageTag);
     /// Set the locale for the given view.
     static void setViewLocale(int nId, const OUString& rBcp47LanguageTag);
+    /// Get the device form factor that should be used for a new view.
+    static LOKDeviceFormFactor getDeviceFormFactor();
+    /// Set the device form factor that should be used for a new view.
+    static void setDeviceFormFactor(const OUString& rDeviceFormFactor);
     /// Iterate over any view shell, except pThisViewShell, passing it to the 
f function.
     template<typename ViewShellType, typename FunctionType>
     static void forEachOtherView(ViewShellType* pThisViewShell, FunctionType 
f);
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index e81d2db11b7b..f416dcf07706 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -109,6 +109,13 @@ namespace o3tl
     <SfxViewShell>.
 */
 
+enum class LOKDeviceFormFactor
+{
+    UNKNOWN     = 0,
+    DESKTOP     = 1,
+    TABLET      = 2,
+    MOBILE      = 3
+};
 
 class SfxViewFactory;
 #define SFX_DECL_VIEWFACTORY(Class) \
@@ -152,6 +159,7 @@ friend class SfxPrinterController;
     bool                        mbPrinterSettingsModified;
     LanguageTag                 maLOKLanguageTag;
     LanguageTag                 maLOKLocale;
+    LOKDeviceFormFactor         maLOKDeviceFormFactor;
 
 protected:
     virtual void                Activate(bool IsMDIActivate) override;
@@ -352,6 +360,14 @@ public:
     void SetLOKLocale(const OUString& rBcp47LanguageTag);
     /// Get the LibreOfficeKit locale of this view.
     const LanguageTag& GetLOKLocale() const { return maLOKLocale; }
+    /// Get the form factor of the device where the lok client is running.
+    LOKDeviceFormFactor GetLOKDeviceFormFactor() const { return 
maLOKDeviceFormFactor; }
+    /// Check if the lok client is running on a desktop machine.
+    bool isLOKDesktop() const { return maLOKDeviceFormFactor == 
LOKDeviceFormFactor::DESKTOP; }
+    /// Check if the lok client is running on a tablet.
+    bool isLOKTablet() const  { return maLOKDeviceFormFactor == 
LOKDeviceFormFactor::TABLET; }
+    /// Check if the lok client is running on a mobile device.
+    bool isLOKMobilePhone() const { return maLOKDeviceFormFactor == 
LOKDeviceFormFactor::MOBILE; }
 };
 
 
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index f50d41e029ae..db6286f431d3 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1300,11 +1300,11 @@ namespace {
 
 void ScInputHandler::ShowFuncList( const ::std::vector< OUString > & 
rFuncStrVec )
 {
+    const SfxViewShell* pViewShell = SfxViewShell::Current();
     if (comphelper::LibreOfficeKit::isActive() &&
-        comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
+            pViewShell && pViewShell->isLOKMobilePhone())
     {
-        SfxViewShell* pViewShell = SfxViewShell::Current();
-        if (pViewShell && rFuncStrVec.size())
+        if (rFuncStrVec.size())
         {
             OUString aFuncNameStr;
             OUString aDescFuncNameStr;
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 55e6613d5256..626c5b2d0a71 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -821,7 +821,8 @@ ScInputBarGroup::ScInputBarGroup(vcl::Window* pParent, 
ScTabViewShell* pViewSh)
     maButton->SetSymbol(SymbolType::SPIN_DOWN);
     maButton->SetQuickHelpText(ScResId(SCSTR_QHELP_EXPAND_FORMULA));
     // disable the multiline toggle on the mobile phones
-    if (!comphelper::LibreOfficeKit::isActive() || 
!comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()))
+    const SfxViewShell* pViewShell = SfxViewShell::Current();
+    if (!comphelper::LibreOfficeKit::isActive() || !(pViewShell && 
pViewShell->isLOKMobilePhone()))
         maButton->Show();
 }
 
diff --git a/sc/source/ui/condformat/condformatdlg.cxx 
b/sc/source/ui/condformat/condformatdlg.cxx
index 2ebfaee33d27..921e3715310d 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -412,7 +412,7 @@ ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, 
SfxChildWindow* pCW,
     weld::Window* pParent, ScViewData* pViewData,
     const ScCondFormatDlgItem* pItem)
         : ScAnyRefDlgController(pB, pCW, pParent,
-                        
(comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView())?OUString("modules/scalc/ui/conditionalformatdialogmobile.ui"):OUString("modules/scalc/ui/conditionalformatdialog.ui")),
+                        (SfxViewShell::Current() && 
SfxViewShell::Current()->isLOKMobilePhone())?OUString("modules/scalc/ui/conditionalformatdialogmobile.ui"):OUString("modules/scalc/ui/conditionalformatdialog.ui"),
                         "ConditionalFormatDialog")
     , mpViewData(pViewData)
     , mpDlgItem(static_cast<ScCondFormatDlgItem*>(pItem->Clone()))
diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx 
b/sc/source/ui/condformat/condformatdlgentry.cxx
index fea85d23506e..5ada364b730a 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -47,7 +47,7 @@
 
 ScCondFrmtEntry::ScCondFrmtEntry(ScCondFormatList* pParent, ScDocument* pDoc, 
const ScAddress& rPos)
     : mpParent(pParent)
-    , mxBuilder(Application::CreateBuilder(pParent->GetContainer(), 
(comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView())?OUString("modules/scalc/ui/conditionalentrymobile.ui"):OUString("modules/scalc/ui/conditionalentry.ui"))))
+    , mxBuilder(Application::CreateBuilder(pParent->GetContainer(), 
(SfxViewShell::Current() && 
SfxViewShell::Current()->isLOKMobilePhone())?OUString("modules/scalc/ui/conditionalentrymobile.ui"):OUString("modules/scalc/ui/conditionalentry.ui")))
     , mxBorder(mxBuilder->weld_widget("border"))
     , mxGrid(mxBuilder->weld_container("grid"))
     , mxFtCondNr(mxBuilder->weld_label("number"))
diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx
index eb05faccc730..a07f60d6679a 100644
--- a/sc/source/ui/drawfunc/fudraw.cxx
+++ b/sc/source/ui/drawfunc/fudraw.cxx
@@ -246,7 +246,7 @@ bool FuDraw::KeyInput(const KeyEvent& rKEvt)
                 if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() )
                 {
                     SdrObject* pObj = rMarkList.GetMark( 0 
)->GetMarkedSdrObj();
-                    bool isMobilePhone = 
comphelper::LibreOfficeKit::isActive() && 
comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView());
+                    bool isMobilePhone = 
comphelper::LibreOfficeKit::isActive() && rViewShell.isLOKMobilePhone();
                     // Double tapping on charts on phone may result in 
activating the edit mode which is not wanted.
                     // It happens due to the delay of selection message of the 
object from kit to javascript
                     // in that case F2 is sent instead of double click
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index db92bb27766b..0dec8ec99270 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -609,7 +609,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, 
vcl::Window* pWin, ScDrawV
         if( xChartModel.is() )
             xChartModel->unlockControllers();
     }
-    else if 
(!comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
+    else if (!rViewSh.isLOKMobilePhone())
     {
         //the controller will be unlocked by the dialog when the dialog is 
told to do so
 
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx 
b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index e69356709fa9..8fdb2673e6c4 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -170,7 +170,8 @@ boost::property_tree::ptree 
AlignmentPropertyPanel::DumpAsPropertyTree()
 {
     boost::property_tree::ptree aTree = PanelLayout::DumpAsPropertyTree();
 
-    if (comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
+    const SfxViewShell* pViewShell = SfxViewShell::Current();
+    if (pViewShell && pViewShell->isLOKMobilePhone())
     {
         eraseNode(aTree, "textorientbox");
     }
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 8360419b0bff..4e90c3c26127 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2218,11 +2218,10 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& 
rMEvt )
                 }
                 // On a mobile device view there is no ctrl+click and for 
hyperlink popup
                 // the cell coordinates must be sent along with click position 
for elegance
-                if (isTiledRendering &&
-                    
(comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()) ||
-                     
comphelper::LibreOfficeKit::isTablet(SfxLokHelper::getView())))
+                ScTabViewShell* pViewShell = pViewData->GetViewShell();
+                if (isTiledRendering && pViewShell &&
+                    (pViewShell->isLOKMobilePhone() || 
pViewShell->isLOKTablet()))
                 {
-                    ScTabViewShell* pViewShell = pViewData->GetViewShell();
                     Point aPos = rMEvt.GetPosPixel();
                     SCCOL nPosX;
                     SCROW nPosY;
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 44122ae91f43..facb25c9ddb1 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -336,8 +336,9 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId 
nFormatId,
                     && aDataHelper.GetString( nFormatId, *pStrBuffer ))
             {
                 // Do CSV dialog if more than one line. But not if invoked 
from Automation.
+                const SfxViewShell* pViewShell = SfxViewShell::Current();
                 sal_Int32 nDelim = pStrBuffer->indexOf('\n');
-                if 
(!comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()) && 
!comphelper::Automation::AutomationInvokedZone::isActive()
+                if (!(pViewShell && pViewShell->isLOKMobilePhone()) && 
!comphelper::Automation::AutomationInvokedZone::isActive()
                     && nDelim >= 0 && nDelim != pStrBuffer->getLength () - 1)
                 {
                     vcl::Window* pParent = GetActiveWin();
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 6c9cbe0d9e42..19487e808b6a 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -2594,7 +2594,9 @@ OUString SdPage::GetPresObjText(PresObjKind eObjKind) 
const
 #if defined(IOS) || defined(ANDROID)
     bool isMobile = true;
 #else
-    bool isMobile = 
comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView());
+    bool isMobile = false;
+    if (const SfxViewShell* pCurrentViewShell = SfxViewShell::Current())
+        isMobileDevice = pCurrentViewShell->isLOKMobilePhone() || 
pCurrentViewShell->isLOKMobilePhone();
 #endif
 
     if (eObjKind == PRESOBJ_TITLE)
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index 1f693e7356cb..7e3b351f9ebe 100644
--- a/sd/source/ui/func/futext.cxx
+++ b/sd/source/ui/func/futext.cxx
@@ -524,7 +524,8 @@ void FuText::ImpSetAttributesForNewTextObject(SdrTextObj* 
pTxtObj)
             pTxtObj->AdjustTextFrameWidthAndHeight();
             
aSet.Put(makeSdrTextMaxFrameHeightItem(pTxtObj->GetLogicRect().GetSize().Height()));
             pTxtObj->SetMergedItemSet(aSet);
-            if (comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()))
+            const SfxViewShell* pCurrentViewShell = SfxViewShell::Current();
+            if (pCurrentViewShell && (pCurrentViewShell->isLOKMobilePhone() || 
pCurrentViewShell->isLOKTablet()))
                 pTxtObj->SetText(SdResId(STR_PRESOBJ_TEXT_EDIT_MOBILE));
         }
         else if( nSlotId == SID_ATTR_CHAR_VERTICAL )
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 940b8dddbdad..693e11746349 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -1147,7 +1147,8 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, 
SfxViewFrame* pViewFra
              aEvent.FeatureURL.Path == "TransformWidth" ||
              aEvent.FeatureURL.Path == "TransformHeight")
     {
-        if (aEvent.IsEnabled && 
comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
+        const SfxViewShell* pViewShell = SfxViewShell::Current();
+        if (aEvent.IsEnabled && pViewShell && pViewShell->isLOKMobilePhone())
         {
             boost::property_tree::ptree aTree;
             boost::property_tree::ptree aState;
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 110e331065ff..ade850c6388d 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -347,8 +347,9 @@ void Deck::RequestLayout()
             aParentSize.setHeight(mnMinimalHeight);
             bChangeNeeded = true;
         }
+        const SfxViewShell* pViewShell = SfxViewShell::Current();
         if (mnMinimalWidth > 0 && (mnMinimalWidth != aParentSize.Width() || 
GetSizePixel().Width() != mnMinimalWidth)
-                && 
comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
+                && pViewShell && pViewShell->isLOKMobilePhone())
         {
             aParentSize.setWidth(mnMinimalWidth);
             bChangeNeeded = true;
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 93c56b1b92b9..ba61d0c23a11 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -1228,7 +1228,8 @@ void SidebarController::RequestCloseDeck()
     {
         const vcl::ILibreOfficeKitNotifier* pNotifier = 
mpCurrentDeck->GetLOKNotifier();
         auto pMobileNotifier = SfxViewShell::Current();
-        if (pMobileNotifier && 
comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()))
+        const SfxViewShell* pViewShell = SfxViewShell::Current();
+        if (pMobileNotifier && pViewShell && pViewShell->isLOKMobilePhone())
         {
             // Mobile.
             std::stringstream aStream;
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx 
b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index dd23ffbca51f..0544c998b8aa 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -65,7 +65,7 @@ public:
 
         try
         {
-            if (comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()))
+            if (pMobileNotifier && pMobileNotifier->isLOKMobilePhone())
             {
                 // Mobile.
                 std::stringstream aStream;
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 576c364e72c5..0f78af7ebb74 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -65,6 +65,7 @@ int DisableCallbacks::m_nDisabled = 0;
 namespace
 {
 static LanguageTag g_defaultLanguageTag("en-US", true);
+static LOKDeviceFormFactor g_deviceFormFactor = LOKDeviceFormFactor::UNKNOWN;
 }
 
 int SfxLokHelper::createView()
@@ -209,6 +210,23 @@ void SfxLokHelper::setViewLocale(int nId, const OUString& 
rBcp47LanguageTag)
     }
 }
 
+LOKDeviceFormFactor SfxLokHelper::getDeviceFormFactor()
+{
+    return g_deviceFormFactor;
+}
+
+void SfxLokHelper::setDeviceFormFactor(const OUString& rDeviceFormFactor)
+{
+    if (rDeviceFormFactor == "desktop")
+        g_deviceFormFactor = LOKDeviceFormFactor::DESKTOP;
+    else if (rDeviceFormFactor == "tablet")
+        g_deviceFormFactor = LOKDeviceFormFactor::TABLET;
+    else if (rDeviceFormFactor == "mobile")
+        g_deviceFormFactor = LOKDeviceFormFactor::MOBILE;
+    else
+        g_deviceFormFactor = LOKDeviceFormFactor::UNKNOWN;
+}
+
 static OString lcl_escapeQuotes(const OString &rStr)
 {
     if (rStr.getLength() < 1)
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 0109448d1b79..50549d2ddb3e 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1083,8 +1083,8 @@ SfxViewShell::SfxViewShell
 ,   mbPrinterSettingsModified(false)
 ,   maLOKLanguageTag(LANGUAGE_NONE)
 ,   maLOKLocale(LANGUAGE_NONE)
+,   maLOKDeviceFormFactor(LOKDeviceFormFactor::UNKNOWN)
 {
-
     SetMargin( pViewFrame->GetMargin_Impl() );
 
     SetPool( &pViewFrame->GetObjectShell()->GetPool() );
@@ -1099,6 +1099,8 @@ SfxViewShell::SfxViewShell
         maLOKLanguageTag = SfxLokHelper::getDefaultLanguage();
         maLOKLocale = SfxLokHelper::getDefaultLanguage();
 
+        maLOKDeviceFormFactor = SfxLokHelper::getDeviceFormFactor();
+
         vcl::Window* pFrameWin = pViewFrame->GetWindow().GetFrameWindow();
         if (pFrameWin && !pFrameWin->GetLOKNotifier())
             pFrameWin->SetLOKNotifier(this, true);
diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx 
b/svx/source/sidebar/text/TextPropertyPanel.cxx
index f2b3d9ae492d..9accfcdd0c6a 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.cxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -50,8 +50,9 @@ TextPropertyPanel::TextPropertyPanel ( vcl::Window* pParent, 
const css::uno::Ref
     get(mpSetDefault, "defaultattr");
 
     bool isMobilePhone = false;
+    const SfxViewShell* pViewShell = SfxViewShell::Current();
     if (comphelper::LibreOfficeKit::isActive() &&
-        comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
+            pViewShell && pViewShell->isLOKMobilePhone())
         isMobilePhone = true;
     VclPtr<ToolBox> xSpacingBar;
     get(xSpacingBar, "spacingbar");
diff --git a/sw/source/ui/dialog/wordcountdialog.cxx 
b/sw/source/ui/dialog/wordcountdialog.cxx
index b7ef6dda23ca..3dd7149b558e 100644
--- a/sw/source/ui/dialog/wordcountdialog.cxx
+++ b/sw/source/ui/dialog/wordcountdialog.cxx
@@ -34,7 +34,7 @@
 #include <comphelper/lok.hxx>
 #include <sfx2/lokhelper.hxx>
 
-#define IS_MOBILE (comphelper::LibreOfficeKit::isActive() && 
comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
+#define IS_MOBILE_PHONE (comphelper::LibreOfficeKit::isActive() && 
SfxViewShell::Current() && SfxViewShell::Current()->isLOKMobilePhone())
 
 SwWordCountFloatDlg::~SwWordCountFloatDlg()
 {
@@ -107,7 +107,7 @@ SwWordCountFloatDlg::SwWordCountFloatDlg(SfxBindings* 
_pBindings,
                                          SfxChildWindow* pChild,
                                          weld::Window *pParent,
                                          SfxChildWinInfo const * pInfo)
-    : SfxModelessDialogController(_pBindings, pChild, pParent, IS_MOBILE ? 
OUString("modules/swriter/ui/wordcount-mobile.ui") : 
OUString("modules/swriter/ui/wordcount.ui"), "WordCountDialog")
+    : SfxModelessDialogController(_pBindings, pChild, pParent, IS_MOBILE_PHONE 
? OUString("modules/swriter/ui/wordcount-mobile.ui") : 
OUString("modules/swriter/ui/wordcount.ui"), "WordCountDialog")
     , m_xCurrentWordFT(m_xBuilder->weld_label("selectwords"))
     , m_xCurrentCharacterFT(m_xBuilder->weld_label("selectchars"))
     , 
m_xCurrentCharacterExcludingSpacesFT(m_xBuilder->weld_label("selectcharsnospaces"))
commit 8e53cb9471f9b793c462bb0675548d262917d3b5
Author:     Muhammet Kara <muhammet.k...@collabora.com>
AuthorDate: Thu Apr 16 23:01:54 2020 +0300
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:19:29 2020 +0100

    Move uno:Text param from core to online - core part
    
    Change-Id: Idf51a688a868c2d140fcf5eb54e1bfdefc3690b1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92394
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Muhammet Kara <muhammet.k...@collabora.com>
    (cherry picked from commit d9a0e2fe5bf95bf0bfba424a3625d7f952884932)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92304
    Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index fd37b16101b6..3de57d8cee3c 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3781,10 +3781,6 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* 
pThis, const char* pComma
         ExecuteOrientationChange();
         return;
     }
-    else if (gImpl && aCommand == ".uno:Text")
-    {
-        aCommand = ".uno:Text?CreateDirectly:bool=true";
-    }
 
     // handle potential interaction
     if (gImpl && aCommand == ".uno:Save")
commit 0150fab727dd48f329d987ef2a1e64668830bca7
Author:     Mert Tumer <mert.tu...@collabora.com>
AuthorDate: Tue Apr 14 18:19:09 2020 +0300
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:19:27 2020 +0100

    send state changes of .uno:NumberFormatDecimal command to LOK
    
    Change-Id: I7872c0a0c123865c77d3aa8937775116368f1ffa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92203
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    (cherry picked from commit 2f6cbb67099edde535a81e7b0a32c1418805d6d6)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92290
    Tested-by: Jenkins

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index b4eea5068bd4..fd37b16101b6 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2654,6 +2654,7 @@ static void doc_iniUnoCommands ()
         OUString(".uno:ToggleMergeCells"),
         OUString(".uno:NumberFormatCurrency"),
         OUString(".uno:NumberFormatPercent"),
+        OUString(".uno:NumberFormatDecimal"),
         OUString(".uno:NumberFormatDate"),
         OUString(".uno:FrameLineColor"),
         OUString(".uno:SortAscending"),
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 26581dabbd35..940b8dddbdad 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -1185,6 +1185,7 @@ static void InterceptLOKStateChangeEvent(sal_uInt16 nSID, 
SfxViewFrame* pViewFra
              aEvent.FeatureURL.Path == "WrapText" ||
              aEvent.FeatureURL.Path == "NumberFormatCurrency" ||
              aEvent.FeatureURL.Path == "NumberFormatPercent" ||
+             aEvent.FeatureURL.Path == "NumberFormatDecimal" ||
              aEvent.FeatureURL.Path == "NumberFormatDate")
     {
         bool aBool;
commit 13ae49b1c96fe2881cb27529cd10319671f56f30
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Mar 1 14:08:20 2020 -0500
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:19:25 2020 +0100

    editeng: lok: send cursor visibility event when restoring update mode
    
    When the default text is removed from a TextBox within a slide,
    the cursor visibility is inadvertendly set to false and never
    restored (because the LOK notification is disabled due to treating
    the ShowCursor during SetUpdateMode as an activation of the TextBox,
    and that is supressed to avoid messing up the cursor when creating
    a new view).
    
    We add a new flag to SetUpdateMode to flag whether this is an
    activation or we are restoring a previously active window (TextBox)
    due to a temporary disabling (to clear the default text).
    
    Four unit-tests added not just to check and validate the fix,
    but to also simulate two different ways of entering edit mode,
    first by single-clicking on the text and then double-clicking
    outside the text, but within the TextBox.
    
    Change-Id: Icaaabc2a897f614f5ce162b71fadccff22ecda02
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90301
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    (cherry picked from commit 6b84dfabbb5f6930f9ac582f8c1dd9f467fd068c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90298
    Tested-by: Jenkins
    Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index 2b600871c27d..5a91e29f0074 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1447,11 +1447,14 @@ sal_uInt32 EditEngine::CalcTextWidth()
     return nWidth;
 }
 
-void EditEngine::SetUpdateMode( bool bUpdate )
+void EditEngine::SetUpdateMode(bool bUpdate, bool bRestoring)
 {
     pImpEditEngine->SetUpdateMode( bUpdate );
-    if ( pImpEditEngine->pActiveView )
-        pImpEditEngine->pActiveView->ShowCursor( false, false, 
/*bActivate=*/true );
+    if (pImpEditEngine->pActiveView)
+    {
+        // Not an activation if we are restoring the previous update mode.
+        pImpEditEngine->pActiveView->ShowCursor(false, false, 
/*bActivate=*/!bRestoring);
+    }
 }
 
 bool EditEngine::GetUpdateMode() const
diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index be91080cceb8..a5770473356c 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -500,7 +500,7 @@ void EditView::ShowCursor( bool bGotoCursor, bool 
bForceVisCursor, bool bActivat
             if (pParent && pParent->GetLOKWindowId() != 0)
                 return;
 
-            OString aPayload = OString::boolean(true);
+            static const OString aPayload = OString::boolean(true);
             
pImpEditView->mpViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE,
 aPayload.getStr());
             
pImpEditView->mpViewShell->NotifyOtherViews(LOK_CALLBACK_VIEW_CURSOR_VISIBLE, 
"visible", aPayload);
         }
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index ad09f1d543dc..05f75e1167f8 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -3928,12 +3928,12 @@ EditPaM ImpEditEngine::ConnectContents( sal_Int32 
nLeftNode, bool bBackward )
 
 void ImpEditEngine::SetUpdateMode( bool bUp, EditView* pCurView, bool 
bForceUpdate )
 {
-    bool bChanged = ( GetUpdateMode() != bUp );
+    const bool bChanged = (GetUpdateMode() != bUp);
 
-    // When switching from sal_True to sal_False, all selections were visible,
+    // When switching from true to false, all selections were visible,
     // => paint over
     // the other hand, were all invisible => paint
-    // If !bFormatted, e.g. after SetText, then if UpdateMode=sal_True
+    // If !bFormatted, e.g. after SetText, then if UpdateMode=true
     // formatting is not needed immediately, probably because more text is 
coming.
     // At latest it is formatted at a Paint/CalcTextWidth.
     bUpdate = bUp;
diff --git a/editeng/source/outliner/outliner.cxx 
b/editeng/source/outliner/outliner.cxx
index 16a3833eeea2..bc8db284b505 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -407,7 +407,7 @@ void Outliner::SetText( const OUString& rText, Paragraph* 
pPara )
 {
     DBG_ASSERT(pPara,"SetText:No Para");
 
-    sal_Int32 nPara = pParaList->GetAbsPos( pPara );
+    const sal_Int32 nPara = pParaList->GetAbsPos( pPara );
 
     if (pEditEngine->GetText( nPara ) == rText)
     {
@@ -416,7 +416,7 @@ void Outliner::SetText( const OUString& rText, Paragraph* 
pPara )
         return;
     }
 
-    bool bUpdate = pEditEngine->GetUpdateMode();
+    const bool bUpdate = pEditEngine->GetUpdateMode();
     pEditEngine->SetUpdateMode( false );
     ImplBlockInsertionCallbacks( true );
 
@@ -490,7 +490,8 @@ void Outliner::SetText( const OUString& rText, Paragraph* 
pPara )
     
DBG_ASSERT(pParaList->GetParagraphCount()==pEditEngine->GetParagraphCount(),"SetText
 failed!");
     bFirstParaIsEmpty = false;
     ImplBlockInsertionCallbacks( false );
-    pEditEngine->SetUpdateMode( bUpdate );
+    // Restore the update mode.
+    pEditEngine->SetUpdateMode(bUpdate, /*bRestoring=*/true);
 }
 
 // pView == 0 -> Ignore tabs
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index 1f77ce661020..4c603a1b8b07 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -207,7 +207,11 @@ public:
     void            SetRefMapMode( const MapMode& rMapMode );
     MapMode const & GetRefMapMode() const;
 
-    void            SetUpdateMode( bool bUpdate );
+    /// Change the update mode per bUpdate and potentially trigger 
FormatAndUpdate.
+    /// bRestoring is used for LOK to update cursor visibility, specifically,
+    /// when true, it means we are restoring the update mode after internally
+    /// disabling it (f.e. during SetText to set/delete default text in 
Impress).
+    void            SetUpdateMode(bool bUpdate, bool bRestoring = false);
     bool            GetUpdateMode() const;
 
     void            SetBackgroundColor( const Color& rColor );
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index ff379531338f..53e403f4b550 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -98,6 +98,10 @@ public:
     void testViewCursors();
     void testViewCursorParts();
     void testCursorViews();
+    void testCursorVisibility_SingleClick();
+    void testCursorVisibility_DoubleClick();
+    void testCursorVisibility_MultiView();
+    void testCursorVisibility_Escape();
     void testViewLock();
     void testUndoLimiting();
     void testCreateViewGraphicSelection();
@@ -149,6 +153,10 @@ public:
     CPPUNIT_TEST(testViewCursors);
     CPPUNIT_TEST(testViewCursorParts);
     CPPUNIT_TEST(testCursorViews);
+    CPPUNIT_TEST(testCursorVisibility_SingleClick);
+    CPPUNIT_TEST(testCursorVisibility_DoubleClick);
+    CPPUNIT_TEST(testCursorVisibility_MultiView);
+    CPPUNIT_TEST(testCursorVisibility_Escape);
     CPPUNIT_TEST(testViewLock);
     CPPUNIT_TEST(testUndoLimiting);
     CPPUNIT_TEST(testCreateViewGraphicSelection);
@@ -956,6 +964,7 @@ public:
     /// Our current part, to be able to decide if a view cursor/selection is 
relevant for us.
     int m_nPart;
     bool m_bCursorVisibleChanged;
+    bool m_bCursorVisible;
     bool m_bViewLock;
     bool m_bTilesInvalidated;
     std::vector<tools::Rectangle> m_aInvalidations;
@@ -969,6 +978,7 @@ public:
           m_bGraphicViewSelectionInvalidated(false),
           m_nPart(0),
           m_bCursorVisibleChanged(false),
+          m_bCursorVisible(false),
           m_bViewLock(false),
           m_bTilesInvalidated(false),
           m_bViewSelectionSet(false)
@@ -1028,6 +1038,7 @@ public:
         case LOK_CALLBACK_CURSOR_VISIBLE:
         {
             m_bCursorVisibleChanged = true;
+            m_bCursorVisible = (OString("true") == pPayload);
         }
         break;
         case LOK_CALLBACK_VIEW_LOCK:
@@ -1052,7 +1063,7 @@ public:
             std::stringstream aStream(pPayload);
             boost::property_tree::ptree aTree;
             boost::property_tree::read_json(aStream, aTree);
-            int nViewId = aTree.get_child("viewId").get_value<int>();
+            const int nViewId = aTree.get_child("viewId").get_value<int>();
             m_aViewCursorVisibilities[nViewId] = OString("true") == pPayload;
         }
         break;
@@ -1169,6 +1180,178 @@ void SdTiledRenderingTest::testCursorViews()
     CPPUNIT_ASSERT(aView2.m_bTilesInvalidated);
 }
 
+void SdTiledRenderingTest::testCursorVisibility_SingleClick()
+{
+    // Single-clicking in a text box enters editing only
+    // when it's on the text, even if it's the default text.
+
+    // Load doc.
+    SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
+    ViewCallback aView1;
+
+    // Begin text edit on the only object on the slide.
+    sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
+    SdPage* pActualPage = pViewShell->GetActualPage();
+    SdrObject* pObject1 = pActualPage->GetObj(0);
+    CPPUNIT_ASSERT(pObject1 != nullptr);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_TITLETEXT), 
pObject1->GetObjIdentifier());
+    SdrTextObj* pTextObject = static_cast<SdrTextObj*>(pObject1);
+
+    // Click once outside of the text (in the first quartile) => no editing.
+    const ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect();
+    const auto cornerX = convertMm100ToTwip(aRect.getX() + (aRect.getWidth() / 
4));
+    const auto cornerY = convertMm100ToTwip(aRect.getY() + (aRect.getHeight() 
/ 4));
+    pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
+                                      cornerX, cornerY,
+                                      1, MOUSE_LEFT, 0);
+    pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP,
+                                      cornerX, cornerY,
+                                      1, MOUSE_LEFT, 0);
+    Scheduler::ProcessEventsToIdle();
+
+    // No editing.
+    CPPUNIT_ASSERT(!pViewShell->GetView()->IsTextEdit());
+    CPPUNIT_ASSERT(!aView1.m_bCursorVisible);
+
+    // Click again, now on the text, in the center, to start editing.
+    const auto centerX = convertMm100ToTwip(aRect.getX() + (aRect.getWidth() / 
2));
+    const auto centerY = convertMm100ToTwip(aRect.getY() + (aRect.getHeight() 
/ 2));
+    pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
+                                      centerX, centerY,
+                                      1, MOUSE_LEFT, 0);
+    pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP,
+                                      centerX, centerY,
+                                      1, MOUSE_LEFT, 0);
+    Scheduler::ProcessEventsToIdle();
+
+    // We must be in text editing mode and have cursor visible.
+    CPPUNIT_ASSERT(pViewShell->GetView()->IsTextEdit());
+    CPPUNIT_ASSERT(aView1.m_bCursorVisible);
+}
+
+
+void SdTiledRenderingTest::testCursorVisibility_DoubleClick()
+{
+    // Double-clicking anywhere in the TextBox should start editing.
+
+    // Create the first view.
+    SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
+    ViewCallback aView1;
+
+    // Begin text edit on the only object on the slide.
+    sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
+    SdPage* pActualPage = pViewShell->GetActualPage();
+    SdrObject* pObject1 = pActualPage->GetObj(0);
+    CPPUNIT_ASSERT(pObject1 != nullptr);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_TITLETEXT), 
pObject1->GetObjIdentifier());
+    SdrTextObj* pTextObject = static_cast<SdrTextObj*>(pObject1);
+
+    // Double-click outside the text to enter edit mode.
+    const ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect();
+    const auto cornerX = convertMm100ToTwip(aRect.getX() + (aRect.getWidth() / 
4));
+    const auto cornerY = convertMm100ToTwip(aRect.getY() + (aRect.getHeight() 
/ 4));
+    pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
+                                      cornerX, cornerY,
+                                      2, MOUSE_LEFT, 0);
+    pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP,
+                                      cornerX, cornerY,
+                                      2, MOUSE_LEFT, 0);
+    Scheduler::ProcessEventsToIdle();
+
+    // We must be in text editing mode and have cursor visible.
+    CPPUNIT_ASSERT(pViewShell->GetView()->IsTextEdit());
+    CPPUNIT_ASSERT(aView1.m_bCursorVisible);
+}
+
+void SdTiledRenderingTest::testCursorVisibility_MultiView()
+{
+    // Create the first view.
+    SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
+    const int nView1 = SfxLokHelper::getView();
+    ViewCallback aView1;
+
+    // Begin text edit on the only object on the slide.
+    sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
+    SdPage* pActualPage = pViewShell->GetActualPage();
+    SdrObject* pObject1 = pActualPage->GetObj(0);
+    CPPUNIT_ASSERT(pObject1);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_TITLETEXT), 
pObject1->GetObjIdentifier());
+    SdrTextObj* pTextObject = static_cast<SdrTextObj*>(pObject1);
+
+    // Make sure that cursor state is not changed just because we create a 
second view.
+    SfxLokHelper::createView();
+    
pXImpressDocument->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
+    const int nView2 = SfxLokHelper::getView();
+    Scheduler::ProcessEventsToIdle();
+    CPPUNIT_ASSERT_EQUAL(false, aView1.m_bCursorVisibleChanged);
+    CPPUNIT_ASSERT_EQUAL(false, aView1.m_aViewCursorVisibilities[nView2]);
+
+    // Also check that the second view gets the notifications.
+    ViewCallback aView2;
+
+    SfxLokHelper::setView(nView1);
+
+    ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect();
+    const auto centerX = convertMm100ToTwip(aRect.getX() + (aRect.getWidth() / 
2));
+    const auto centerY = convertMm100ToTwip(aRect.getY() + (aRect.getHeight() 
/ 2));
+    pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
+                                      centerX, centerY,
+                                      2, MOUSE_LEFT, 0);
+    pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP,
+                                      centerX, centerY,
+                                      2, MOUSE_LEFT, 0);
+    Scheduler::ProcessEventsToIdle();
+
+    // We must be in text editing mode and have cursor visible.
+    CPPUNIT_ASSERT(pViewShell->GetView()->IsTextEdit());
+    CPPUNIT_ASSERT(aView1.m_bCursorVisible);
+    CPPUNIT_ASSERT_EQUAL(false, aView1.m_aViewCursorVisibilities[nView2]);
+
+    CPPUNIT_ASSERT_EQUAL(false, aView2.m_bCursorVisible);
+    CPPUNIT_ASSERT_EQUAL(false, aView2.m_aViewCursorVisibilities[nView1]);
+    CPPUNIT_ASSERT_EQUAL(false, aView2.m_aViewCursorVisibilities[nView2]);
+}
+
+void SdTiledRenderingTest::testCursorVisibility_Escape()
+{
+    // Load doc.
+    SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
+    ViewCallback aView1;
+
+    // Begin text edit on the only object on the slide.
+    sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
+    SdPage* pActualPage = pViewShell->GetActualPage();
+    SdrObject* pObject1 = pActualPage->GetObj(0);
+    CPPUNIT_ASSERT(pObject1 != nullptr);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(OBJ_TITLETEXT), 
pObject1->GetObjIdentifier());
+    SdrTextObj* pTextObject = static_cast<SdrTextObj*>(pObject1);
+
+    // Click once on the text to start editing.
+    const ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect();
+    const auto centerX = convertMm100ToTwip(aRect.getX() + (aRect.getWidth() / 
2));
+    const auto centerY = convertMm100ToTwip(aRect.getY() + (aRect.getHeight() 
/ 2));
+    pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN,
+                                      centerX, centerY,
+                                      1, MOUSE_LEFT, 0);
+    pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP,
+                                      centerX, centerY,
+                                      1, MOUSE_LEFT, 0);
+    Scheduler::ProcessEventsToIdle();
+
+    // We must be in text editing mode and have cursor visible.
+    CPPUNIT_ASSERT(pViewShell->GetView()->IsTextEdit());
+    CPPUNIT_ASSERT(aView1.m_bCursorVisible);
+
+    // End editing by pressing the escape key.
+    pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, 
awt::Key::ESCAPE);
+    pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::ESCAPE);
+    Scheduler::ProcessEventsToIdle();
+
+    // We must be in text editing mode and have cursor visible.
+    CPPUNIT_ASSERT(!pViewShell->GetView()->IsTextEdit());
+    CPPUNIT_ASSERT_EQUAL(false, aView1.m_bCursorVisible);
+}
+
 void SdTiledRenderingTest::testViewLock()
 {
     // Load a document that has a shape and create two views.
commit 9f71b36b340250db75edf4dc55a3ce81de59f1dd
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Wed Feb 26 16:03:47 2020 +0100
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:19:23 2020 +0100

    change SAL_WARN to SAL_INFO when language is not set
    
    Change this, so we don't fill the console with warnings.
    
    Change-Id: I089113207be99b50b15cf292cae3e929f9edff26
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89556
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    Tested-by: Andras Timar <andras.ti...@collabora.com>
    (cherry picked from commit af17b2cd26a1e36edf0b995f81a2e0757086dad1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89676
    Tested-by: Jenkins
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index 95c628dbbf61..c58a1aa6f547 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -229,7 +229,7 @@ void setLocale(const LanguageTag& rLanguageTag)
 const LanguageTag& getLocale()
 {
     const LanguageTag& rLocale = g_aLanguageAndLocale.getLocale();
-    SAL_WARN_IF(rLocale.getLanguageType() == LANGUAGE_NONE, "comphelper.lok", 
"Locale not set");
+    SAL_INFO_IF(rLocale.getLanguageType() == LANGUAGE_NONE, "comphelper.lok", 
"Locale not set");
     return rLocale;
 }
 
@@ -241,7 +241,7 @@ void setLanguageTag(const LanguageTag& rLanguageTag)
 const LanguageTag& getLanguageTag()
 {
     const LanguageTag& rLanguage = g_aLanguageAndLocale.getLanguage();
-    SAL_WARN_IF(rLanguage.getLanguageType() == LANGUAGE_NONE, 
"comphelper.lok", "Language not set");
+    SAL_INFO_IF(rLanguage.getLanguageType() == LANGUAGE_NONE, 
"comphelper.lok", "Language not set");
     return rLanguage;
 }
 
commit 4a0ad6f35578396011c4c5935793eb314e6deb31
Author:     Muhammet Kara <muhammet.k...@collabora.com>
AuthorDate: Mon Feb 24 17:03:12 2020 +0300
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:19:21 2020 +0100

    lok: Set default text for new text box on mobile
    
    Change-Id: I0b6056e9dbf5fb81d092092cc183b05120b95d70
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89352
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89710
    Tested-by: Jenkins
    Reviewed-by: Muhammet Kara <muhammet.k...@collabora.com>

diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc
index 1e9d0214afe6..245e2159b700 100644
--- a/sd/inc/strings.hrc
+++ b/sd/inc/strings.hrc
@@ -313,6 +313,7 @@
 #define STR_PRESOBJ_TITLE_MOBILE                        
NC_("STR_PRESOBJ_TITLE_MOBILE", "Double-tap to add Title" )
 #define STR_PRESOBJ_OUTLINE_MOBILE                      
NC_("STR_PRESOBJ_OUTLINE_MOBILE", "Double-tap to add Text" )
 #define STR_PRESOBJ_TEXT_MOBILE                         
NC_("STR_PRESOBJ_TEXT_MOBILE", "Double-tap to add Text" )
+#define STR_PRESOBJ_TEXT_EDIT_MOBILE                    
NC_("STR_PRESOBJ_TEXT_MOBILE", "Tap to edit text" )
 #define STR_PRESOBJ_NOTESTEXT_MOBILE                    
NC_("STR_PRESOBJ_NOTESTEXT_MOBILE", "Double-tap to add Notes" )
 #define STR_PRESOBJ_GRAPHIC                             
NC_("STR_PRESOBJ_GRAPHIC", "Double-click to add an Image" )
 #define STR_PRESOBJ_OBJECT                              
NC_("STR_PRESOBJ_OBJECT", "Double-click to add an Object" )
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index 75a1867a6574..1f693e7356cb 100644
--- a/sd/source/ui/func/futext.cxx
+++ b/sd/source/ui/func/futext.cxx
@@ -36,6 +36,7 @@
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/bindings.hxx>
+#include <sfx2/lokhelper.hxx>
 #include <sfx2/request.hxx>
 #include <editeng/editeng.hxx>
 #include <svx/svdoutl.hxx>
@@ -523,6 +524,8 @@ void FuText::ImpSetAttributesForNewTextObject(SdrTextObj* 
pTxtObj)
             pTxtObj->AdjustTextFrameWidthAndHeight();
             
aSet.Put(makeSdrTextMaxFrameHeightItem(pTxtObj->GetLogicRect().GetSize().Height()));
             pTxtObj->SetMergedItemSet(aSet);
+            if (comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()))
+                pTxtObj->SetText(SdResId(STR_PRESOBJ_TEXT_EDIT_MOBILE));
         }
         else if( nSlotId == SID_ATTR_CHAR_VERTICAL )
         {
commit bde2adc84f4e2c6b98a5829aecf77eba7b4a73c7
Author:     Muhammet Kara <muhammet.k...@collabora.com>
AuthorDate: Mon Feb 24 16:04:37 2020 +0300
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:19:19 2020 +0100

    lok: Create Text boxes directly
    
    Change-Id: I281d4648d0e91f74d6f0f5880945d8e7e8659efe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89344
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89709
    Tested-by: Jenkins
    Reviewed-by: Muhammet Kara <muhammet.k...@collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 57227e377cc8..b4eea5068bd4 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3780,6 +3780,10 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* 
pThis, const char* pComma
         ExecuteOrientationChange();
         return;
     }
+    else if (gImpl && aCommand == ".uno:Text")
+    {
+        aCommand = ".uno:Text?CreateDirectly:bool=true";
+    }
 
     // handle potential interaction
     if (gImpl && aCommand == ".uno:Save")
commit 1d0bee586523cb90fcf4546cc4b3960019888a69
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Mon Feb 24 08:07:12 2020 +0100
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu May 28 09:19:17 2020 +0100

    Fix currency symbol selection in Calc on mobile
    
    In LOK we use one language identifier for both - UI language and
    the locale used. This is a problem when we determine that we a
    language for UI is not available and fall-back to the default
    "en-US" langauge, which also changes the locale. This introduces
    a separate variable that stores the language tag for the locale
    independently to the language.
    
    Another problem is that in some cases we don't reset the staticly
    initialized data, when the new document is loaded, which is on
    the other hand used to define which currency symbol is used as
    SYSTEM locale. That can in some cases select the wrong currency
    symbol even when we changed the locale to something else. This fix
    introduces a reset function, which is triggered on every document
    load.
    
    Change-Id: I55c7f467600a832895f94346f8bf11a6ef6a1e49
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89320
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89343
    Tested-by: Jenkins

diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index 097622b3c4eb..95c628dbbf61 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -38,7 +38,55 @@ static bool g_bLocalRendering(false);
 
 static Compat g_eCompatFlags(Compat::none);
 
-static LanguageTag g_aLanguageTag("en-US", true);
+namespace
+{
+
+class LanguageAndLocale
+{
+private:
+    LanguageTag maLanguageTag;
+    LanguageTag maLocaleLanguageTag;
+
+public:
+
+    LanguageAndLocale()
+        : maLanguageTag(LANGUAGE_NONE)
+        , maLocaleLanguageTag(LANGUAGE_NONE)
+    {}
+
+    const LanguageTag& getLanguage()
+    {
+        return maLanguageTag;
+    }
+
+    void setLanguage(const LanguageTag& rLanguageTag)
+    {
+        if (maLanguageTag != rLanguageTag)
+        {
+            SAL_INFO("comphelper.lok", "Setting language from " << 
maLanguageTag.getBcp47() << " to " << rLanguageTag.getBcp47());
+            maLanguageTag = rLanguageTag;
+        }
+    }
+
+    const LanguageTag& getLocale()
+    {
+        return maLocaleLanguageTag;
+    }
+
+    void setLocale(const LanguageTag& rLocaleLanguageTag)
+    {
+        if (maLocaleLanguageTag != rLocaleLanguageTag)
+        {
+            SAL_INFO("comphelper.lok", "Setting locale from " << 
maLanguageTag.getBcp47() << " to " << rLocaleLanguageTag.getBcp47());
+            maLocaleLanguageTag = rLocaleLanguageTag;
+        }
+    }
+
+};
+
+}
+
+static LanguageAndLocale g_aLanguageAndLocale;
 
 /// Scaling of the cairo canvas painting for hi-dpi
 static double g_fDPIScale(1.0);
@@ -173,23 +221,28 @@ void setCompatFlag(Compat flag) { g_eCompatFlags = 
static_cast<Compat>(g_eCompat
 
 bool isCompatFlagSet(Compat flag) { return (g_eCompatFlags & flag) == flag; }
 
-void setLanguageTag(const OUString& lang, bool bCanonicalize)
+void setLocale(const LanguageTag& rLanguageTag)
 {
-    g_aLanguageTag = LanguageTag(lang, bCanonicalize);
+    g_aLanguageAndLocale.setLocale(rLanguageTag);
 }
 
-void setLanguageTag(const LanguageTag& languageTag)
+const LanguageTag& getLocale()
 {
-    if (g_aLanguageTag != languageTag)
-    {
-        SAL_INFO("comphelper.lok", "setLanguageTag: from " << 
g_aLanguageTag.getBcp47() << " to " << languageTag.getBcp47());
-        g_aLanguageTag = languageTag;
-    }
+    const LanguageTag& rLocale = g_aLanguageAndLocale.getLocale();
+    SAL_WARN_IF(rLocale.getLanguageType() == LANGUAGE_NONE, "comphelper.lok", 
"Locale not set");
+    return rLocale;
+}
+
+void setLanguageTag(const LanguageTag& rLanguageTag)
+{
+    g_aLanguageAndLocale.setLanguage(rLanguageTag);
 }
 
 const LanguageTag& getLanguageTag()
 {
-    return g_aLanguageTag;
+    const LanguageTag& rLanguage = g_aLanguageAndLocale.getLanguage();
+    SAL_WARN_IF(rLanguage.getLanguageType() == LANGUAGE_NONE, 
"comphelper.lok", "Language not set");
+    return rLanguage;
 }
 
 bool isWhitelistedLanguage(const OUString& lang)
diff --git a/desktop/CppunitTest_desktop_lib.mk 
b/desktop/CppunitTest_desktop_lib.mk
index 5caca176e532..8b375235b05d 100644
--- a/desktop/CppunitTest_desktop_lib.mk
+++ b/desktop/CppunitTest_desktop_lib.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_CppunitTest_use_libraries,desktop_lib, \
        comphelper \
        cppu \
        cppuhelper \
+       i18nlangtag \
        sal \
        sc \
        scfilt \
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index a3f3ddac0cc4..0123037ec75d 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2816,7 +2816,7 @@ void DesktopLOKTest::testSpellcheckerMultiView()
     SvtSysLocaleOptions aSysLocaleOptions;
     aSysLocaleOptions.SetLocaleConfigString(aLangISO);
     aSysLocaleOptions.SetUILocaleConfigString(aLangISO);
-    comphelper::LibreOfficeKit::setLanguageTag(aLangISO, true);

... etc. - the rest is truncated
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to