diff options
author | Juergen Funk <juergen.funk_ml@cib.de> | 2014-10-22 15:52:04 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <s.mehrbrodt@gmail.com> | 2014-10-27 17:23:56 +0000 |
commit | 4aa2791ea6ee72d429cb8ddcaffd0a9fe647e3db (patch) | |
tree | cf6dfb3d0c80f7628e0938827354d55a3d8db2c1 /sw | |
parent | 564fe4e36a9fdf313dc1abb86f6c24f61e03f31e (diff) |
fdo#84408 Toolbar: Insert Field dropdown doesn't contain icons
Change-Id: I3c8db72a84f2a68f1f68a0be1b21e2454707d84a
Reviewed-on: https://gerrit.libreoffice.org/12068
Reviewed-by: Samuel Mehrbrodt <s.mehrbrodt@gmail.com>
Tested-by: Samuel Mehrbrodt <s.mehrbrodt@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/inc/workctrl.hxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/ribbar/workctrl.cxx | 92 |
2 files changed, 21 insertions, 75 deletions
diff --git a/sw/source/uibase/inc/workctrl.hxx b/sw/source/uibase/inc/workctrl.hxx index 5a56dd459d48..567a0d08c703 100644 --- a/sw/source/uibase/inc/workctrl.hxx +++ b/sw/source/uibase/inc/workctrl.hxx @@ -96,10 +96,6 @@ public: class SwTbxFieldCtrl : public SfxToolBoxControl { - PopupMenu* pPopup; - SwView* pView; - - void DelPopup(); public: SFX_DECL_TOOLBOX_CONTROL(); diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index 698455412662..ef1e5b7fceeb 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -25,6 +25,8 @@ #include <sfx2/dispatch.hxx> #include <sfx2/bindings.hxx> #include <sfx2/imagemgr.hxx> +#include <sfx2/mnumgr.hxx> +#include <sfx2/msgpool.hxx> #include <swmodule.hxx> #include <view.hxx> #include <initui.hxx> @@ -47,6 +49,8 @@ #include <vcl/svapp.hxx> + + // Size check #define NAVI_ENTRIES 20 #if NAVI_ENTRIES != NID_COUNT @@ -282,57 +286,48 @@ SwTbxFieldCtrl::SwTbxFieldCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) : - SfxToolBoxControl( nSlotId, nId, rTbx ), - pPopup(0), - pView(0) + SfxToolBoxControl( nSlotId, nId, rTbx ) { rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWNONLY | rTbx.GetItemBits( nId ) ); } SwTbxFieldCtrl::~SwTbxFieldCtrl() { - DelPopup(); } SfxPopupWindow* SwTbxFieldCtrl::CreatePopupWindow() { - pView = ::GetActiveView(); + SwView* pView = ::GetActiveView(); if(pView && !pView->GetDocShell()->IsReadOnly() && !pView->GetWrtShell().HasReadonlySel() ) { - ToolBox& rBox = GetToolBox(); + PopupMenu* pPopup = new PopupMenu(SW_RES(RID_INSERT_FIELD_CTRL)); - Rectangle aItemRect( rBox.GetItemRect( GetId() ) ); - Point aPt(rBox.OutputToScreenPixel(aItemRect.TopLeft())); - aPt.X() += aItemRect.GetWidth()/2; - aPt.Y() += aItemRect.GetHeight()/2; - if(pView) + if (::GetHtmlMode(pView->GetDocShell()) & HTMLMODE_ON) { - Link aLnk = LINK(this, SwTbxFieldCtrl, PopupHdl); + pPopup->RemoveItem(pPopup->GetItemPos(FN_INSERT_FLD_PGCOUNT)); + pPopup->RemoveItem(pPopup->GetItemPos(FN_INSERT_FLD_TOPIC)); + } - pPopup = new PopupMenu(SW_RES(RID_INSERT_FIELD_CTRL)); - pPopup->SetSelectHdl(aLnk); + ToolBox* pToolBox = &GetToolBox(); + sal_uInt16 nId = GetId(); + SfxDispatcher *rDispat = pView->GetViewFrame()->GetDispatcher(); + + // set the icons in the Popup-Menu, delete the pPopup + SfxPopupMenuManager aPop( pPopup, rDispat->GetFrame()->GetBindings() ); - if (::GetHtmlMode(pView->GetDocShell()) & HTMLMODE_ON) - { - pPopup->RemoveItem(pPopup->GetItemPos(FN_INSERT_FLD_PGCOUNT)); - pPopup->RemoveItem(pPopup->GetItemPos(FN_INSERT_FLD_TOPIC)); - } - } - ToolBox* pToolBox = &GetToolBox(); - sal_uInt16 nId = GetId(); pToolBox->SetItemDown( nId, true ); pPopup->Execute( pToolBox, pToolBox->GetItemRect( nId ), - (pToolBox->GetAlign() == WINDOWALIGN_TOP || pToolBox->GetAlign() == WINDOWALIGN_BOTTOM) ? - POPUPMENU_EXECUTE_DOWN : POPUPMENU_EXECUTE_RIGHT ); + (pToolBox->GetAlign() == WINDOWALIGN_TOP || pToolBox->GetAlign() == WINDOWALIGN_BOTTOM) ? + POPUPMENU_EXECUTE_DOWN : POPUPMENU_EXECUTE_RIGHT ); pToolBox->SetItemDown( nId, false ); } + GetToolBox().EndSelection(); - DelPopup(); - return 0; + return 0; } SfxPopupWindowType SwTbxFieldCtrl::GetPopupWindowType() const @@ -351,51 +346,6 @@ void SwTbxFieldCtrl::StateChanged( sal_uInt16, } } -IMPL_LINK(SwTbxFieldCtrl, PopupHdl, PopupMenu*, pMenu) -{ - sal_uInt16 nId = pMenu->GetCurItemId(); - - Sequence< PropertyValue > aArgs; - const char* pChar = 0; - switch(nId) - { - case FN_INSERT_FLD_DATE: - pChar = ".uno:InsertDateField"; - break; - case FN_INSERT_FLD_TIME: - pChar = ".uno:InsertTimeField"; - break; - case FN_INSERT_FLD_PGNUMBER: - pChar = ".uno:InsertPageNumberField"; - break; - case FN_INSERT_FLD_PGCOUNT: - pChar = ".uno:InsertPageCountField"; - break; - case FN_INSERT_FLD_TOPIC: - pChar = ".uno:InsertTopicField"; - break; - case FN_INSERT_FLD_TITLE: - pChar = ".uno:InsertTitleField"; - break; - case FN_INSERT_FLD_AUTHOR: - pChar = ".uno:InsertAuthorField"; - break; - default: - pChar = ".uno:InsertFieldCtrl"; - } - Dispatch( OUString::createFromAscii( pChar ),aArgs ); - - return 0; -} - -void SwTbxFieldCtrl::DelPopup() -{ - if(pPopup) - { - delete pPopup; - pPopup = 0; - } -} // Navigation-Popup // determine the order of the toolbox items |