diff options
26 files changed, 84 insertions, 79 deletions
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 45a33d61d1b0..2ac9f4b7bbd5 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -933,7 +933,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 ff8c40798f22..236f326be09b 100644 --- a/comphelper/source/misc/lok.cxx +++ b/comphelper/source/misc/lok.cxx @@ -88,12 +88,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; @@ -104,36 +98,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 c7763b608a28..86212ed28e8e 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2163,6 +2163,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, @@ -3637,17 +3640,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; @@ -4897,6 +4890,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 34509b4d4e74..3ea3ac45f5c1 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -1083,13 +1083,14 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo if (comphelper::LibreOfficeKit::isActive()) { // For mobile phones, send the context menu structure - if (comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView())) + const SfxViewShell* pViewShell = SfxViewShell::Current(); + if (pViewShell && pViewShell->isLOKMobilePhone()) { LOKSendSpellPopupMenu(aPopupMenu, nGuessLangWord, nGuessLangPara, nWords); return; } else // For desktop and tablets, we use the tunneled dialog - aPopupMenu->SetLOKNotifier(SfxViewShell::Current()); + aPopupMenu->SetLOKNotifier(pViewShell); } sal_uInt16 nId = aPopupMenu->Execute(pImpEditView->GetWindow(), aTempRect, PopupMenuFlags::NoMouseUpClose); 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 e1827ef1967f..05a94c4862ea 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 243f1f1521ec..d4d7d2039c2c 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; @@ -347,6 +355,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 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(); diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 7f8178dea79f..39b59ca30ed6 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -2608,7 +2608,9 @@ OUString SdPage::GetPresObjText(PresObjKind eObjKind) const #if defined(IOS) || defined(ANDROID) bool isMobileDevice = true; #else - bool isMobileDevice = comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView()) || comphelper::LibreOfficeKit::isTablet(SfxLokHelper::getView()); + bool isMobileDevice = false; + if (const SfxViewShell* pCurrentViewShell = SfxViewShell::Current()) + isMobileDevice = pCurrentViewShell->isLOKMobilePhone() || pCurrentViewShell->isLOKMobilePhone(); #endif if (eObjKind == PresObjKind::Title) diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx index 67f86e54c53d..51e5494ac697 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::isMobilePhone(SfxLokHelper::getView()) || comphelper::LibreOfficeKit::isTablet(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 a95ae4f49ed5..3a27c38dc908 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -1116,7 +1116,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 d874ba59b92d..d96305c3e2df 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -308,8 +308,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 2935e2943aa8..5876c468d730 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -1222,7 +1222,8 @@ void SidebarController::RequestCloseDeck() { const vcl::ILibreOfficeKitNotifier* pNotifier = mpCurrentDeck->GetLOKNotifier(); auto pMobileNotifier = SfxViewShell::Current(); - if (pMobileNotifier && comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView())) + const SfxViewShell* pViewShell = SfxViewShell::Current(); + if (pMobileNotifier && pViewShell && pViewShell->isLOKMobilePhone()) { // Mobile phone. std::stringstream aStream; diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index faa135017633..7039983f9cfd 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.cxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -65,7 +65,7 @@ public: try { - if (pMobileNotifier && comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView())) + if (pMobileNotifier && pMobileNotifier->isLOKMobilePhone()) { // Mobile phone. std::stringstream aStream; diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index e70b511c2cbd..2b1791ddba22 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -68,6 +68,7 @@ int DisableCallbacks::m_nDisabled = 0; namespace { static LanguageTag g_defaultLanguageTag("en-US", true); +static LOKDeviceFormFactor g_deviceFormFactor = LOKDeviceFormFactor::UNKNOWN; } int SfxLokHelper::createView() @@ -212,6 +213,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 00a5e527599e..3c7e7bb719c8 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1074,8 +1074,8 @@ SfxViewShell::SfxViewShell , mbPrinterSettingsModified(false) , maLOKLanguageTag(LANGUAGE_NONE) , maLOKLocale(LANGUAGE_NONE) +, maLOKDeviceFormFactor(LOKDeviceFormFactor::UNKNOWN) { - SetMargin( pViewFrame->GetMargin_Impl() ); SetPool( &pViewFrame->GetObjectShell()->GetPool() ); @@ -1090,6 +1090,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 8b6a48f44f43..6c3b20cedef6 100644 --- a/svx/source/sidebar/text/TextPropertyPanel.cxx +++ b/svx/source/sidebar/text/TextPropertyPanel.cxx @@ -63,8 +63,9 @@ TextPropertyPanel::TextPropertyPanel ( vcl::Window* pParent, const css::uno::Ref , mxSpacingBarDispatch(new ToolbarUnoDispatcher(*mxSpacingBar, *m_xBuilder, rxFrame)) { bool isMobilePhone = false; + const SfxViewShell* pViewShell = SfxViewShell::Current(); if (comphelper::LibreOfficeKit::isActive() && - comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView())) + pViewShell && pViewShell->isLOKMobilePhone()) isMobilePhone = true; mxSpacingBar->set_visible(!isMobilePhone); } diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx index ab337a76b261..ba159d4e6aa6 100644 --- a/sw/source/ui/dialog/wordcountdialog.cxx +++ b/sw/source/ui/dialog/wordcountdialog.cxx @@ -32,7 +32,7 @@ #include <comphelper/lok.hxx> #include <sfx2/lokhelper.hxx> -#define IS_MOBILE_PHONE (comphelper::LibreOfficeKit::isActive() && comphelper::LibreOfficeKit::isMobilePhone(SfxLokHelper::getView())) +#define IS_MOBILE_PHONE (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() && SfxViewShell::Current()->isLOKMobilePhone()) SwWordCountFloatDlg::~SwWordCountFloatDlg() { |