summaryrefslogtreecommitdiff
path: root/sd/source/ui/toolpanel
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-07-01 22:01:43 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-07-01 22:01:43 +0000
commite5d42d967f3f7d347d284697a3679c5c4c5485cb (patch)
tree14c4ae75b3cc5e707f05a93e84c39178cf58924d /sd/source/ui/toolpanel
parent61366eac48d313050b93aa383e6ddc925d996e23 (diff)
INTEGRATION: CWS impress143 (1.25.20); FILE MERGED
2008/05/15 15:42:30 af 1.25.20.2: #151108# Avoid crash when request has no arguments. 2008/05/15 11:13:02 af 1.25.20.1: #i83631# Hide 'insert slide' context menu entry when active shell does not support SID_INSERTPAGE slot.
Diffstat (limited to 'sd/source/ui/toolpanel')
-rw-r--r--sd/source/ui/toolpanel/LayoutMenu.cxx38
1 files changed, 28 insertions, 10 deletions
diff --git a/sd/source/ui/toolpanel/LayoutMenu.cxx b/sd/source/ui/toolpanel/LayoutMenu.cxx
index 3d9c8a22c41a..928af0b40023 100644
--- a/sd/source/ui/toolpanel/LayoutMenu.cxx
+++ b/sd/source/ui/toolpanel/LayoutMenu.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: LayoutMenu.cxx,v $
- * $Revision: 1.25 $
+ * $Revision: 1.26 $
*
* This file is part of OpenOffice.org.
*
@@ -516,6 +516,14 @@ void LayoutMenu::GetState (SfxItemSet& rItemSet)
rItemSet.DisableItem (SID_CUT);
rItemSet.DisableItem (SID_COPY);
rItemSet.DisableItem (SID_PASTE);
+
+ // The SID_INSERTPAGE_LAYOUT_MENU slot depends on the SID_INSERTPAGE
+ // slot being supported elsewhere.
+ const SfxPoolItem* pItem = NULL;
+ const SfxItemState aState (
+ mrBase.GetViewFrame()->GetDispatcher()->QueryState(SID_INSERTPAGE, pItem));
+ if (aState == SFX_ITEM_DISABLED)
+ rItemSet.DisableItem(SID_INSERTPAGE_LAYOUT_MENU);
}
@@ -524,17 +532,27 @@ void LayoutMenu::GetState (SfxItemSet& rItemSet)
void LayoutMenu::InsertPageWithLayout (AutoLayout aLayout)
{
ViewShell* pViewShell = mrBase.GetMainViewShell().get();
- if (pViewShell != NULL)
- {
- // Call SID_INSERTPAGE with the right arguments. This is because
- // the popup menu can not call this slot with arguments directly.
- SfxRequest aRequest (CreateRequest(SID_INSERTPAGE, aLayout));
- mrBase.GetViewFrame()->GetDispatcher()->Execute(
+ if (pViewShell == NULL)
+ return;
+
+ SfxViewFrame* pViewFrame = mrBase.GetViewFrame();
+ if (pViewFrame == NULL)
+ return;
+
+ SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher();
+ if (pDispatcher == NULL)
+ return;
+
+ // Call SID_INSERTPAGE with the right arguments. This is because
+ // the popup menu can not call this slot with arguments directly.
+ SfxRequest aRequest (CreateRequest(SID_INSERTPAGE, aLayout));
+ pDispatcher->Execute(
SID_INSERTPAGE,
SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
- *aRequest.GetArgs());
- UpdateSelection();
- }
+ aRequest.GetArgs() != NULL
+ ? *aRequest.GetArgs()
+ : pViewShell->GetPool());
+ UpdateSelection();
}