summaryrefslogtreecommitdiff
path: root/sd/source/ui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-04-13 12:29:30 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-04-13 13:16:08 +0100
commitaf50fddf5e49514fd6f730521f9bd914af30fd1d (patch)
treec3a01d513d2dc60aec7bfaa62718819108c9cdbd /sd/source/ui
parent4682cd9a9409a9faa86e5d30bd778bef1459b4fc (diff)
convert effects menu to .ui
Change-Id: I7c6d060e8d8ccd033e5093fc03cb19d9efe7877d
Diffstat (limited to 'sd/source/ui')
-rw-r--r--sd/source/ui/animations/CustomAnimation.hrc9
-rw-r--r--sd/source/ui/animations/CustomAnimation.src41
-rw-r--r--sd/source/ui/animations/CustomAnimationList.cxx31
-rw-r--r--sd/source/ui/animations/CustomAnimationList.hxx5
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.cxx29
-rw-r--r--sd/source/ui/animations/CustomAnimationPane.hxx2
6 files changed, 34 insertions, 83 deletions
diff --git a/sd/source/ui/animations/CustomAnimation.hrc b/sd/source/ui/animations/CustomAnimation.hrc
index f6a6b0555c14..9124b4386eb1 100644
--- a/sd/source/ui/animations/CustomAnimation.hrc
+++ b/sd/source/ui/animations/CustomAnimation.hrc
@@ -26,7 +26,6 @@
// attention, we have 200 ids free after RID_CUSTOMANIMATION_START
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-#define RID_EFFECT_CONTEXTMENU RID_CUSTOMANIMATION_START+0
#define RID_CUSTOMANIMATION_ROTATION_POPUP RID_CUSTOMANIMATION_START+9
#define RID_CUSTOMANIMATION_FONTSIZE_POPUP RID_CUSTOMANIMATION_START+10
#define RID_CUSTOMANIMATION_SCALE_POPUP RID_CUSTOMANIMATION_START+11
@@ -75,14 +74,6 @@
#define STR_CUSTOMANIMATION_EXIT RID_CUSTOMANIMATION_START+41
#define STR_CUSTOMANIMATION_MOTION_PATHS RID_CUSTOMANIMATION_START+42
-#define CM_WITH_CLICK 1
-#define CM_WITH_PREVIOUS 2
-#define CM_AFTER_PREVIOUS 3
-#define CM_OPTIONS 4
-#define CM_DURATION 5
-#define CM_REMOVE 6
-#define CM_CREATE 7
-
#define CM_QUARTER_SPIN 1
#define CM_HALF_SPIN 2
#define CM_FULL_SPIN 3
diff --git a/sd/source/ui/animations/CustomAnimation.src b/sd/source/ui/animations/CustomAnimation.src
index c955cad124a2..34eedb138aad 100644
--- a/sd/source/ui/animations/CustomAnimation.src
+++ b/sd/source/ui/animations/CustomAnimation.src
@@ -19,47 +19,6 @@
#include "CustomAnimation.hrc"
-Menu RID_EFFECT_CONTEXTMENU
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = CM_WITH_CLICK ;
- Text [ en-US ] = "Start On ~Click" ;
- };
- MenuItem
- {
- Identifier = CM_WITH_PREVIOUS ;
- Text [ en-US ] = "Start ~With Previous" ;
- };
- MenuItem
- {
- Identifier = CM_AFTER_PREVIOUS;
- Text [ en-US ] = "Start ~After Previous" ;
- };
- MenuItem
- {
- Separator = TRUE ;
- };
- MenuItem
- {
- Identifier = CM_OPTIONS;
- Text [ en-US ] = "~Effect Options..." ;
- };
- MenuItem
- {
- Identifier = CM_DURATION;
- Text [ en-US ] = "~Timing..." ;
- };
- MenuItem
- {
- Identifier = CM_REMOVE;
- Text [ en-US ] = "~Remove" ;
- };
- };
-};
-
Menu RID_CUSTOMANIMATION_FONTSIZE_POPUP
{
ItemList =
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index ae782622bdc9..0477f54114d3 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -445,7 +445,6 @@ CustomAnimationList::CustomAnimationList( vcl::Window* pParent )
, mnLastGroupId(0)
, mpLastParentEntry(nullptr)
{
-
EnableContextMenuHandling();
SetSelectionMode( SelectionMode::Multiple );
SetOptimalImageIndent();
@@ -478,6 +477,10 @@ void CustomAnimationList::dispose()
mpMainSequence->removeListener( this );
clear();
+
+ mxMenu.disposeAndClear();
+ mxBuilder.reset();
+
SvTreeListBox::dispose();
}
@@ -486,8 +489,12 @@ void CustomAnimationList::KeyInput( const KeyEvent& rKEvt )
const int nKeyCode = rKEvt.GetKeyCode().GetCode();
switch( nKeyCode )
{
- case KEY_DELETE: mpController->onContextMenu( CM_REMOVE ); return;
- case KEY_INSERT: mpController->onContextMenu( CM_CREATE ); return;
+ case KEY_DELETE:
+ mpController->onContextMenu("remove");
+ return;
+ case KEY_INSERT:
+ mpController->onContextMenu("create");
+ return;
case KEY_SPACE:
{
const Point aPos;
@@ -892,7 +899,9 @@ bool CustomAnimationList::DoubleClickHdl()
VclPtr<PopupMenu> CustomAnimationList::CreateContextMenu()
{
- VclPtrInstance<PopupMenu> pMenu(SdResId( RID_EFFECT_CONTEXTMENU ));
+ mxMenu.disposeAndClear();
+ mxBuilder.reset(new VclBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/effectmenu.ui", ""));
+ mxMenu.set(mxBuilder->get_menu("menu"));
sal_Int16 nNodeType = -1;
sal_Int16 nEntries = 0;
@@ -921,18 +930,18 @@ VclPtr<PopupMenu> CustomAnimationList::CreateContextMenu()
pEntry = static_cast< CustomAnimationListEntry* >(NextSelected( pEntry ));
}
- pMenu->CheckItem( CM_WITH_CLICK, nNodeType == EffectNodeType::ON_CLICK );
- pMenu->CheckItem( CM_WITH_PREVIOUS, nNodeType == EffectNodeType::WITH_PREVIOUS );
- pMenu->CheckItem( CM_AFTER_PREVIOUS, nNodeType == EffectNodeType::AFTER_PREVIOUS );
- pMenu->EnableItem( CM_OPTIONS, nEntries == 1 );
- pMenu->EnableItem( CM_DURATION, nEntries == 1 );
+ mxMenu->CheckItem(mxMenu->GetItemId("onclick"), nNodeType == EffectNodeType::ON_CLICK);
+ mxMenu->CheckItem(mxMenu->GetItemId("withprev"), nNodeType == EffectNodeType::WITH_PREVIOUS);
+ mxMenu->CheckItem(mxMenu->GetItemId("afterprev"), nNodeType == EffectNodeType::AFTER_PREVIOUS);
+ mxMenu->EnableItem(mxMenu->GetItemId("options"), nEntries == 1);
+ mxMenu->EnableItem(mxMenu->GetItemId("timing"), nEntries == 1);
- return pMenu;
+ return mxMenu;
}
void CustomAnimationList::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry )
{
- mpController->onContextMenu( nSelectedPopupEntry );
+ mpController->onContextMenu(mxMenu->GetItemIdent(nSelectedPopupEntry));
}
void CustomAnimationList::notify_change()
diff --git a/sd/source/ui/animations/CustomAnimationList.hxx b/sd/source/ui/animations/CustomAnimationList.hxx
index 07303eedbb03..6f8cf8d78fea 100644
--- a/sd/source/ui/animations/CustomAnimationList.hxx
+++ b/sd/source/ui/animations/CustomAnimationList.hxx
@@ -40,7 +40,7 @@ class ICustomAnimationListController
public:
virtual void onSelect() = 0;
virtual void onDoubleClick() = 0;
- virtual void onContextMenu( sal_uInt16 nSelectedPopupEntry ) = 0;
+ virtual void onContextMenu(const OString &rIdent) = 0;
virtual ~ICustomAnimationListController() {}
};
@@ -96,6 +96,9 @@ public:
};
private:
+ std::unique_ptr<VclBuilder> mxBuilder;
+ VclPtr<PopupMenu> mxMenu;
+
bool mbIgnorePaint;
/** appends the given effect to the list*/
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index e446748f2b5c..86c77ac79387 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -878,33 +878,22 @@ void CustomAnimationPane::onDoubleClick()
showOptions();
}
-void CustomAnimationPane::onContextMenu( sal_uInt16 nSelectedPopupEntry )
+void CustomAnimationPane::onContextMenu(const OString &rIdent)
{
- switch( nSelectedPopupEntry )
- {
- case CM_WITH_CLICK:
+ if (rIdent == "onclick")
onChangeStart( EffectNodeType::ON_CLICK );
- break;
- case CM_WITH_PREVIOUS:
+ else if (rIdent == "withprev")
onChangeStart( EffectNodeType::WITH_PREVIOUS );
- break;
- case CM_AFTER_PREVIOUS:
+ else if (rIdent == "afterprev")
onChangeStart( EffectNodeType::AFTER_PREVIOUS );
- break;
- case CM_OPTIONS:
+ else if (rIdent == "options")
showOptions();
- break;
- case CM_DURATION:
+ else if (rIdent == "timing")
showOptions("timing");
- break;
- case CM_REMOVE:
+ else if (rIdent == "remove")
onRemove();
- break;
- case CM_CREATE:
- if( maViewSelection.hasValue() ) onAdd();
- break;
- }
-
+ else if (rIdent == "create" && maViewSelection.hasValue())
+ onAdd();
updateControls();
}
diff --git a/sd/source/ui/animations/CustomAnimationPane.hxx b/sd/source/ui/animations/CustomAnimationPane.hxx
index 97164dd8bd4e..12e2cd9f9a35 100644
--- a/sd/source/ui/animations/CustomAnimationPane.hxx
+++ b/sd/source/ui/animations/CustomAnimationPane.hxx
@@ -89,7 +89,7 @@ public:
// ICustomAnimationListController
virtual void onSelect() override;
virtual void onDoubleClick() override;
- virtual void onContextMenu( sal_uInt16 nSelectedPopupEntry ) override;
+ virtual void onContextMenu(const OString& rIdent) override;
// Window
virtual void DataChanged (const DataChangedEvent& rEvent) override;