diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/unoctitm.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/sidebar/Deck.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarDockingWindow.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/view/lokhelper.cxx | 18 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 4 |
6 files changed, 28 insertions, 5 deletions
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); |