chart2/source/controller/main/ChartController_Window.cxx |    4 -
 comphelper/source/misc/lok.cxx                           |   31 ++++++++++-----
 desktop/source/lib/init.cxx                              |   20 +++++++--
 editeng/source/editeng/editview.cxx                      |    6 +-
 include/comphelper/lok.hxx                               |   14 ++++--
 sc/source/ui/condformat/condformatdlg.cxx                |    2 
 sc/source/ui/condformat/condformatdlgentry.cxx           |    2 
 sc/source/ui/drawfunc/fuins2.cxx                         |    2 
 sc/source/ui/view/gridwin.cxx                            |    5 +-
 sc/source/ui/view/viewfun5.cxx                           |    2 
 sfx2/source/dialog/basedlgs.cxx                          |    2 
 sfx2/source/sidebar/Deck.cxx                             |    4 -
 svx/source/sidebar/text/TextPropertyPanel.cxx            |   10 ++--
 sw/source/ui/dialog/wordcountdialog.cxx                  |    2 
 14 files changed, 68 insertions(+), 38 deletions(-)

New commits:
commit 659b5abc5987c5e4e63b014521e0cad5086356a8
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Mon Mar 16 13:50:00 2020 +0200
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Sun May 17 23:09:40 2020 +0200

    Rename isMobile to isMobilePhone and introduce a separate isTablet
    
    The intended semantics of isMobile() has been to say whether the
    device is a mobile phone ot not. Not whether it is a mobile device in
    general. So make that explicit.
    
    Adjust call sites as necessary. Also, in a couple of places where it
    is likely that what is relevant is whether it is a mobile device in
    general, not just whether it is a mobile phone, check both isMobile()
    and isTablet().
    
    For stable interoperability with current Online, keep accepting also
    the .uno:LOKSetMobile "command" (and .uno:LOKUnSetMobile, except that
    Online never sends that), but Online will be changed to use
    .uno:LOKSetMobilePhone.
    
    Also drop the default value for the bool parameter to
    setMobilePhone(). Default bool parameters can be quite confusing, and
    it was especially silly in this case as there is one (1) call site.
    
    Change-Id: I2a71c37323ee151cbc671bd8e714e1dee10f8b1c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90560
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tor Lillqvist <t...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94390
    Tested-by: Tor Lillqvist <t...@collabora.com>

diff --git a/chart2/source/controller/main/ChartController_Window.cxx 
b/chart2/source/controller/main/ChartController_Window.cxx
index 9266e61005c7..46de790c4f68 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -931,8 +931,8 @@ void ChartController::execute_MouseButtonUp( const 
MouseEvent& rMEvt )
 
 void ChartController::execute_DoubleClick( const Point* pMousePixel )
 {
-    bool isMobile = 
comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView());
-    if (isMobile)
+    bool isMobilePhone = 
comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView());
+    if (isMobilePhone)
         return;
 
     bool bEditText = false;
diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx
index 4c1337dd927e..16996d885bf7 100644
--- a/comphelper/source/misc/lok.cxx
+++ b/comphelper/source/misc/lok.cxx
@@ -43,8 +43,11 @@ static LanguageTag g_aLanguageTag("en-US", true);
 /// Scaling of the cairo canvas painting for hi-dpi
 static double g_fDPIScale(1.0);
 
-/// List of <viewid, bMobile> pairs
-static std::map<int, bool> g_vIsViewMobile;
+/// 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)
 {
@@ -56,18 +59,28 @@ bool isActive()
     return g_bActive;
 }
 
-void setMobile(int nViewId, bool bMobile)
+void setMobilePhone(int nViewId, bool bIsMobilePhone)
+{
+    g_vIsViewMobilePhone[nViewId] = bIsMobilePhone;
+}
+
+bool isMobilePhone(int nViewId)
 {
-    if (g_vIsViewMobile.find(nViewId) != g_vIsViewMobile.end())
-        g_vIsViewMobile[nViewId] = bMobile;
+    if (g_vIsViewMobilePhone.find(nViewId) != g_vIsViewMobilePhone.end())
+        return g_vIsViewMobilePhone[nViewId];
     else
-        g_vIsViewMobile.insert(std::make_pair(nViewId, bMobile));
+        return false;
+}
+
+void setTablet(int nViewId, bool bIsTablet)
+{
+    g_vIsViewTablet[nViewId] = bIsTablet;
 }
 
-bool isMobile(int nViewId)
+bool isTablet(int nViewId)
 {
-    if (g_vIsViewMobile.find(nViewId) != g_vIsViewMobile.end())
-        return g_vIsViewMobile[nViewId];
+    if (g_vIsViewTablet.find(nViewId) != g_vIsViewTablet.end())
+        return g_vIsViewTablet[nViewId];
     else
         return false;
 }
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 1ca1d6e7144a..1fd899a61829 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3658,15 +3658,25 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* 
pThis, const char* pComma
     if (nView < 0)
         return;
 
-    // Set/unset mobile view for LOK
-    if (gImpl && aCommand == ".uno:LOKSetMobile")
+    // Set/unset mobile phone view for LOK
+    if (gImpl && (aCommand == ".uno:LOKSetMobile" || aCommand == 
".uno:LOKSetMobilePhone"))
     {
-        comphelper::LibreOfficeKit::setMobile(nView);
+        comphelper::LibreOfficeKit::setMobilePhone(nView, true);
         return;
     }
-    else if (gImpl && aCommand == ".uno:LOKUnSetMobile")
+    else if (gImpl && (aCommand == ".uno:LOKUnSetMobile" || aCommand == 
".uno:LOKUnSetMobilePhone"))
     {
-        comphelper::LibreOfficeKit::setMobile(nView, false);
+        comphelper::LibreOfficeKit::setMobilePhone(nView, false);
+        return;
+    }
+    else if (gImpl && aCommand == ".uno:LOKSetTablet")
+    {
+        comphelper::LibreOfficeKit::setTablet(nView, true);
+        return;
+    }
+    else if (gImpl && aCommand == ".uno:LOKUnSetTablet")
+    {
+        comphelper::LibreOfficeKit::setTablet(nView, false);
         return;
     }
     else if (gImpl && aCommand == ".uno:ToggleOrientation")
diff --git a/editeng/source/editeng/editview.cxx 
b/editeng/source/editeng/editview.cxx
index ec4aae63b63a..eaa9fe05e932 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1076,13 +1076,13 @@ void EditView::ExecuteSpellPopup( const Point& 
rPosPixel, Link<SpellCallbackInfo
 
         if (comphelper::LibreOfficeKit::isActive())
         {
-            // For mobile, send the context menu structure
-            if (comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()))
+            // For mobile phone, send the context menu structure
+            if 
(comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
             {
                 LOKSendSpellPopupMenu(aPopupMenu, nGuessLangWord, 
nGuessLangPara, nWords);
                 return;
             }
-            else // For desktop, we use the tunneled dialog
+            else // For desktop or tablet, we use the tunneled dialog
                 aPopupMenu->SetLOKNotifier(SfxViewShell::Current());
         }
         sal_uInt16 nId = aPopupMenu->Execute(pImpEditView->GetWindow(), 
aTempRect, PopupMenuFlags::NoMouseUpClose);
diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx
index b4658913f0d1..4c43f55e7721 100644
--- a/include/comphelper/lok.hxx
+++ b/include/comphelper/lok.hxx
@@ -29,8 +29,11 @@ namespace LibreOfficeKit
 
 COMPHELPER_DLLPUBLIC void setActive(bool bActive = true);
 
-// Set LOK view to mobile
-COMPHELPER_DLLPUBLIC void setMobile(int nViewId, bool bIsMobile = true);
+// Tell that LOK view is on a mobile phone (regardless what its pixel 
resolution is, whether its form factor is "phablet" or not)
+COMPHELPER_DLLPUBLIC void setMobilePhone(int nViewId, bool bIsMobilePhone);
+
+// Tell that LOK view is on a tablet
+COMPHELPER_DLLPUBLIC void setTablet(int nViewId, bool bIsTablet);
 
 enum class statusIndicatorCallbackType { Start, SetValue, Finish };
 
@@ -42,8 +45,11 @@ 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 view/device
-COMPHELPER_DLLPUBLIC bool isMobile(int nViewId);
+// 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.
diff --git a/sc/source/ui/condformat/condformatdlg.cxx 
b/sc/source/ui/condformat/condformatdlg.cxx
index 9a86807f70ee..2ebfaee33d27 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::isMobile(SfxLokHelper::getView())?OUString("modules/scalc/ui/conditionalformatdialogmobile.ui"):OUString("modules/scalc/ui/conditionalformatdialog.ui")),
+                        
(comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView())?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 0e786698e214..fea85d23506e 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::isMobile(SfxLokHelper::getView())?OUString("modules/scalc/ui/conditionalentrymobile.ui"):OUString("modules/scalc/ui/conditionalentry.ui"))))
+    , mxBuilder(Application::CreateBuilder(pParent->GetContainer(), 
(comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView())?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/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index b70d7f685f9e..17fcf5ed6806 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::isMobile(SfxLokHelper::getView()))
+    else if 
(!comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
     {
         //the controller will be unlocked by the dialog when the dialog is 
told to do so
 
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index ed493192282b..37ea3a3d295c 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2203,10 +2203,11 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& 
rMEvt )
                         ScGlobal::OpenURL(aUrl, aTarget, isTiledRendering);
                         return;
                 }
-                // in mobile view there is no ctrl+click and for hyperlink 
popup
+                // 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::isMobile(SfxLokHelper::getView()))
+                    
(comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()) ||
+                     
comphelper::LibreOfficeKit::isTablet(SfxLokHelper::getView())))
                 {
                     ScTabViewShell* pViewShell = pViewData->GetViewShell();
                     Point aPos = rMEvt.GetPosPixel();
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index c80d6b059735..44122ae91f43 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -337,7 +337,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId 
nFormatId,
             {
                 // Do CSV dialog if more than one line. But not if invoked 
from Automation.
                 sal_Int32 nDelim = pStrBuffer->indexOf('\n');
-                if 
(!comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()) && 
!comphelper::Automation::AutomationInvokedZone::isActive()
+                if 
(!comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()) && 
!comphelper::Automation::AutomationInvokedZone::isActive()
                     && nDelim >= 0 && nDelim != pStrBuffer->getLength () - 1)
                 {
                     vcl::Window* pParent = GetActiveWin();
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 3008399895ac..2b6af7084f62 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -413,7 +413,7 @@ SfxDialogController::SfxDialogController(weld::Widget* 
pParent, const OUString&
                                          const OString& rDialogId)
     : GenericDialogController(pParent, rUIFile, rDialogId,
                                     comphelper::LibreOfficeKit::isActive()
-                                    && 
comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()))
+                                    && 
comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
 {
     m_xDialog->SetInstallLOKNotifierHdl(LINK(this, SfxDialogController, 
InstallLOKNotifierHdl));
     m_xDialog->connect_toplevel_focus_changed(LINK(this, SfxDialogController, 
FocusChangeHdl));
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 08cd76d991cc..3a0981719079 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -215,7 +215,7 @@ void Deck::Resize()
     Window::Resize();
 
     if (comphelper::LibreOfficeKit::isActive() &&
-        comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()) &&
+        comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()) &&
         GetLOKNotifier())
     {
         mpIdleNotify->Start();
@@ -341,7 +341,7 @@ void Deck::RequestLayout()
             bChangeNeeded = true;
         }
         if (mnMinimalWidth > 0 && (mnMinimalWidth != aParentSize.Width() || 
GetSizePixel().Width() != mnMinimalWidth)
-                && 
comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()))
+                && 
comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
         {
             aParentSize.setWidth(mnMinimalWidth);
             bChangeNeeded = true;
diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx 
b/svx/source/sidebar/text/TextPropertyPanel.cxx
index eae6f95aa366..6aa27cd3cd59 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.cxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -47,14 +47,14 @@ TextPropertyPanel::TextPropertyPanel ( vcl::Window* 
pParent, const css::uno::Ref
     get(mpToolBoxFontColor, "colorbar_others");
     get(mpToolBoxBackgroundColor, "colorbar_background");
 
-    bool isMobile = false;
+    bool isMobilePhone = false;
     if (comphelper::LibreOfficeKit::isActive() &&
-        comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()))
-        isMobile = true;
+        comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
+        isMobilePhone = true;
     VclPtr<ToolBox> xSpacingBar;
     get(xSpacingBar, "spacingbar");
-    xSpacingBar->Show(!isMobile);
-    xSpacingBar->ShowItem(0, !isMobile);
+    xSpacingBar->Show(!isMobilePhone);
+    xSpacingBar->ShowItem(0, !isMobilePhone);
 }
 
 TextPropertyPanel::~TextPropertyPanel()
diff --git a/sw/source/ui/dialog/wordcountdialog.cxx 
b/sw/source/ui/dialog/wordcountdialog.cxx
index 110f588d2cc3..b7ef6dda23ca 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::isMobile(SfxLokHelper::getView()))
+#define IS_MOBILE (comphelper::LibreOfficeKit::isActive() && 
comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()))
 
 SwWordCountFloatDlg::~SwWordCountFloatDlg()
 {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to