summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/customize/CustomNotebookbarGenerator.cxx13
-rw-r--r--desktop/source/lib/init.cxx12
2 files changed, 16 insertions, 9 deletions
diff --git a/cui/source/customize/CustomNotebookbarGenerator.cxx b/cui/source/customize/CustomNotebookbarGenerator.cxx
index 9fb71562160a..bae85525ebd6 100644
--- a/cui/source/customize/CustomNotebookbarGenerator.cxx
+++ b/cui/source/customize/CustomNotebookbarGenerator.cxx
@@ -74,11 +74,14 @@ static OUString lcl_getAppName(vcl::EnumContext::Application eApp)
static OUString getAppNameRegistryPath()
{
vcl::EnumContext::Application eApp = vcl::EnumContext::Application::Any;
- const Reference<frame::XFrame>& xFrame
- = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
- const Reference<frame::XModuleManager> xModuleManager
- = frame::ModuleManager::create(::comphelper::getProcessComponentContext());
- eApp = vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(xFrame));
+
+ if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
+ {
+ const Reference<frame::XFrame>& xFrame = pViewFrame->GetFrame().GetFrameInterface();
+ const Reference<frame::XModuleManager> xModuleManager
+ = frame::ModuleManager::create(::comphelper::getProcessComponentContext());
+ eApp = vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(xFrame));
+ }
OUString sAppName(lcl_getAppName(eApp));
return "org.openoffice.Office.UI.ToolbarMode/Applications/" + sAppName;
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 19937da00d6d..22efa304865a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -792,6 +792,10 @@ void ExecuteMarginULChange(
// Main function which toggles page orientation of the Writer doc. Needed by ToggleOrientation
void ExecuteOrientationChange()
{
+ SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+ if (!pViewFrm)
+ return;
+
std::unique_ptr<SvxPageItem> pPageItem(new SvxPageItem(SID_ATTR_PAGE));
// 1mm in twips rounded
@@ -799,22 +803,22 @@ void ExecuteOrientationChange()
constexpr tools::Long MINBODY = o3tl::toTwips(1, o3tl::Length::mm);
css::uno::Reference< css::document::XUndoManager > mxUndoManager(
- getUndoManager( SfxViewFrame::Current()->GetFrame().GetFrameInterface() ) );
+ getUndoManager( pViewFrm->GetFrame().GetFrameInterface() ) );
if ( mxUndoManager.is() )
mxUndoManager->enterUndoContext( "" );
const SvxSizeItem* pSizeItem;
- SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState(SID_ATTR_PAGE_SIZE, pSizeItem);
+ pViewFrm->GetBindings().GetDispatcher()->QueryState(SID_ATTR_PAGE_SIZE, pSizeItem);
std::unique_ptr<SvxSizeItem> pPageSizeItem(pSizeItem->Clone());
const SvxLongLRSpaceItem* pLRSpaceItem;
- SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState(SID_ATTR_PAGE_LRSPACE, pLRSpaceItem);
+ pViewFrm->GetBindings().GetDispatcher()->QueryState(SID_ATTR_PAGE_LRSPACE, pLRSpaceItem);
std::unique_ptr<SvxLongLRSpaceItem> pPageLRMarginItem(pLRSpaceItem->Clone());
const SvxLongULSpaceItem* pULSpaceItem;
- SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState(SID_ATTR_PAGE_ULSPACE, pULSpaceItem);
+ pViewFrm->GetBindings().GetDispatcher()->QueryState(SID_ATTR_PAGE_ULSPACE, pULSpaceItem);
std::unique_ptr<SvxLongULSpaceItem> pPageULMarginItem(pULSpaceItem->Clone());
{