diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2020-04-20 21:26:26 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2020-05-10 07:36:46 +0200 |
commit | 247f92b02072d6ded919b844b5064f43118bc0ab (patch) | |
tree | 7a22ff0b0ce713249f39acb20d1f6eaa8e11649c /sc | |
parent | e3fb5da905017c9cf6bd67da80d1cc72e67c36dd (diff) |
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.timar@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformatdlg.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformatdlgentry.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/fudraw.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/fuins2.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/sidebar/AlignmentPropertyPanel.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun5.cxx | 3 |
9 files changed, 16 insertions, 14 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 530ad88ab0b7..e0073b6e5a80 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1308,11 +1308,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 4c186610e0ad..0b4280855399 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -823,7 +823,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::isMobilePhone(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 c6f3530bbac5..d38d70d2a213 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, - "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(pItem->Clone()) diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 2d8cbef47848..9ba1e652c280 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(), "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 6b3cc310e98c..82b1e10b0244 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -608,7 +608,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 9a4fa19684fd..4d7183d5f31f 100644 --- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx @@ -175,7 +175,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 26c2d6eb7b7f..e88027b6d754 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2227,11 +2227,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 758c0621478d..7aa96e344dbb 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(); |