diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-04-14 14:38:35 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-04-14 14:38:43 +0100 |
commit | c4462e7858297a81da24a4362621b0142c2cc7ed (patch) | |
tree | 2cc9d0f2c6992108ecf87170d17a5c80d6c0b50d | |
parent | c908096d9e0ffd9c869bb6431f15b5ac15280b35 (diff) |
GalleryBrowser2::Dispatch is always used with just MN_ADD
Change-Id: I295738e3114fe033df50dcd6787f56d846fe5ce4
-rw-r--r-- | svx/inc/galbrws2.hxx | 5 | ||||
-rw-r--r-- | svx/inc/gallery.hrc | 1 | ||||
-rw-r--r-- | svx/inc/helpid.hrc | 1 | ||||
-rw-r--r-- | svx/source/gallery2/galbrws2.cxx | 153 |
4 files changed, 73 insertions, 87 deletions
diff --git a/svx/inc/galbrws2.hxx b/svx/inc/galbrws2.hxx index a68e1d329cdf..ab92f8adafc1 100644 --- a/svx/inc/galbrws2.hxx +++ b/svx/inc/galbrws2.hxx @@ -163,9 +163,8 @@ public: const css::uno::Reference< css::util::XURLTransformer >& GetURLTransformer() const { return m_xTransformer; } void Execute(const OString &rIdent); - void Dispatch( sal_uInt16 nId, - const css::uno::Reference< css::frame::XDispatch > &rxDispatch, - const css::util::URL &rURL ); + void DispatchAdd(const css::uno::Reference<css::frame::XDispatch> &rxDispatch, + const css::util::URL &rURL); DECL_STATIC_LINK( GalleryBrowser2, AsyncDispatch_Impl, void*, void ); }; diff --git a/svx/inc/gallery.hrc b/svx/inc/gallery.hrc index 1c1f0fd3b1a8..742e81391b24 100644 --- a/svx/inc/gallery.hrc +++ b/svx/inc/gallery.hrc @@ -52,7 +52,6 @@ #define RID_SVXBMP_GALLERY_MEDIA (RID_SVX_GALLERY_START + 71) // local Defines -#define MN_ADD 6 #define MN_PREVIEW 10 #define MN_DELETE 12 diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc index 3ba81a7a2706..75e7079434ea 100644 --- a/svx/inc/helpid.hrc +++ b/svx/inc/helpid.hrc @@ -34,7 +34,6 @@ #define HID_EDITENG_SPELLER_WORDLANGUAGE "SVX_HID_EDITENG_SPELLER_WORDLANGUAGE" #define HID_GALLERY_ICONVIEW "SVX_HID_GALLERY_ICONVIEW" #define HID_GALLERY_LISTVIEW "SVX_HID_GALLERY_LISTVIEW" -#define HID_GALLERY_MN_ADD "SVX_HID_GALLERY_MN_ADD" #define HID_GALLERY_MN_DELETE "SVX_HID_GALLERY_MN_DELETE" #define HID_GALLERY_MN_PREVIEW "SVX_HID_GALLERY_MN_PREVIEW" #define HID_GALLERY_NEWTHEME "SVX_HID_GALLERY_NEWTHEME" diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index 1701ffcf0dd6..2cce206440f8 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -311,7 +311,7 @@ IMPL_LINK( GalleryThemePopup, MenuSelectHdl, Menu*, pMenu, bool ) { const CommandInfoMap::const_iterator it = m_aCommandInfo.find( SID_GALLERY_FORMATS ); if (it != m_aCommandInfo.end()) - mpBrowser->Dispatch(MN_ADD, it->second.Dispatch, it->second.URL); + mpBrowser->DispatchAdd(it->second.Dispatch, it->second.URL); } else mpBrowser->Execute(sIdent); @@ -655,7 +655,7 @@ bool GalleryBrowser2::KeyInput( const KeyEvent& rKEvt, vcl::Window* pWindow ) // Inserting a gallery item in the document must be dispatched if( bValidURL ) { - Dispatch( MN_ADD, css::uno::Reference<css::frame::XDispatch>(), css::util::URL() ); + DispatchAdd(css::uno::Reference<css::frame::XDispatch>(), css::util::URL()); return true; } } @@ -989,10 +989,9 @@ GalleryBrowser2::GetFrame() return xFrame; } -void GalleryBrowser2::Dispatch( - sal_uInt16 nId, +void GalleryBrowser2::DispatchAdd( const css::uno::Reference< css::frame::XDispatch > &rxDispatch, - const css::util::URL &rURL ) + const css::util::URL &rURL) { Point aSelPos; const sal_uIntPtr nItemId = ImplGetSelectedItemId( nullptr, aSelPos ); @@ -1002,94 +1001,84 @@ void GalleryBrowser2::Dispatch( mnCurActionPos = nItemId - 1; - switch( nId ) - { - case MN_ADD: - { - css::uno::Reference< css::frame::XDispatch > xDispatch( rxDispatch ); - css::util::URL aURL = rURL; + css::uno::Reference< css::frame::XDispatch > xDispatch( rxDispatch ); + css::util::URL aURL = rURL; - if ( !xDispatch.is() ) - { - css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( - GetFrame(), css::uno::UNO_QUERY ); - if ( !xDispatchProvider.is() || !m_xTransformer.is() ) - return; - - aURL.Complete = CMD_SID_GALLERY_FORMATS; - m_xTransformer->parseStrict( aURL ); - xDispatch = xDispatchProvider->queryDispatch( - aURL, - "_self", - css::frame::FrameSearchFlag::SELF ); - } + if ( !xDispatch.is() ) + { + css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( + GetFrame(), css::uno::UNO_QUERY ); + if ( !xDispatchProvider.is() || !m_xTransformer.is() ) + return; + + aURL.Complete = CMD_SID_GALLERY_FORMATS; + m_xTransformer->parseStrict( aURL ); + xDispatch = xDispatchProvider->queryDispatch( + aURL, + "_self", + css::frame::FrameSearchFlag::SELF ); + } - if ( !xDispatch.is() ) - return; + if ( !xDispatch.is() ) + return; - sal_Int8 nType = 0; - OUString aFileURL, aFilterName; - css::uno::Reference< css::lang::XComponent > xDrawing; - css::uno::Reference< css::graphic::XGraphic > xGraphic; + sal_Int8 nType = 0; + OUString aFileURL, aFilterName; + css::uno::Reference< css::lang::XComponent > xDrawing; + css::uno::Reference< css::graphic::XGraphic > xGraphic; - aFilterName = GetFilterName(); + aFilterName = GetFilterName(); - switch( mpCurTheme->GetObjectKind( mnCurActionPos ) ) - { - case SgaObjKind::Bitmap: - case SgaObjKind::Animation: - case SgaObjKind::Inet: - // TODO drawing objects are inserted as drawings only via drag&drop - case SgaObjKind::SvDraw: - nType = css::gallery::GalleryItemType::GRAPHIC; - break; - - case SgaObjKind::Sound : - nType = css::gallery::GalleryItemType::MEDIA; - break; - - default: - nType = css::gallery::GalleryItemType::EMPTY; - break; - } + switch( mpCurTheme->GetObjectKind( mnCurActionPos ) ) + { + case SgaObjKind::Bitmap: + case SgaObjKind::Animation: + case SgaObjKind::Inet: + // TODO drawing objects are inserted as drawings only via drag&drop + case SgaObjKind::SvDraw: + nType = css::gallery::GalleryItemType::GRAPHIC; + break; - Graphic aGraphic; - bool bGraphic = mpCurTheme->GetGraphic( mnCurActionPos, aGraphic ); - if ( bGraphic && !!aGraphic ) - xGraphic.set( aGraphic.GetXGraphic() ); - OSL_ENSURE( xGraphic.is(), "gallery item is graphic, but the reference is invalid!" ); - - css::uno::Sequence< css::beans::PropertyValue > aSeq( SVXGALLERYITEM_PARAMS ); - - aSeq[0].Name = SVXGALLERYITEM_TYPE; - aSeq[0].Value <<= nType; - aSeq[1].Name = SVXGALLERYITEM_URL; - aSeq[1].Value <<= aFileURL; - aSeq[2].Name = SVXGALLERYITEM_FILTER; - aSeq[2].Value <<= aFilterName; - aSeq[3].Name = SVXGALLERYITEM_DRAWING; - aSeq[3].Value <<= xDrawing; - aSeq[4].Name = SVXGALLERYITEM_GRAPHIC; - aSeq[4].Value <<= xGraphic; - - css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 ); - aArgs[0].Name = SVXGALLERYITEM_ARGNAME; - aArgs[0].Value <<= aSeq; - - DispatchInfo *pInfo = new DispatchInfo; - pInfo->TargetURL = aURL; - pInfo->Arguments = aArgs; - pInfo->Dispatch = xDispatch; - - if ( !Application::PostUserEvent( - LINK( nullptr, GalleryBrowser2, AsyncDispatch_Impl), pInfo ) ) - delete pInfo; - } + case SgaObjKind::Sound : + nType = css::gallery::GalleryItemType::MEDIA; break; default: + nType = css::gallery::GalleryItemType::EMPTY; break; } + + Graphic aGraphic; + bool bGraphic = mpCurTheme->GetGraphic( mnCurActionPos, aGraphic ); + if ( bGraphic && !!aGraphic ) + xGraphic.set( aGraphic.GetXGraphic() ); + OSL_ENSURE( xGraphic.is(), "gallery item is graphic, but the reference is invalid!" ); + + css::uno::Sequence< css::beans::PropertyValue > aSeq( SVXGALLERYITEM_PARAMS ); + + aSeq[0].Name = SVXGALLERYITEM_TYPE; + aSeq[0].Value <<= nType; + aSeq[1].Name = SVXGALLERYITEM_URL; + aSeq[1].Value <<= aFileURL; + aSeq[2].Name = SVXGALLERYITEM_FILTER; + aSeq[2].Value <<= aFilterName; + aSeq[3].Name = SVXGALLERYITEM_DRAWING; + aSeq[3].Value <<= xDrawing; + aSeq[4].Name = SVXGALLERYITEM_GRAPHIC; + aSeq[4].Value <<= xGraphic; + + css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 ); + aArgs[0].Name = SVXGALLERYITEM_ARGNAME; + aArgs[0].Value <<= aSeq; + + DispatchInfo *pInfo = new DispatchInfo; + pInfo->TargetURL = aURL; + pInfo->Arguments = aArgs; + pInfo->Dispatch = xDispatch; + + if ( !Application::PostUserEvent( + LINK( nullptr, GalleryBrowser2, AsyncDispatch_Impl), pInfo ) ) + delete pInfo; } void GalleryBrowser2::Execute(const OString &rIdent) |