Add missing copy&paste of SfxAppToolBoxControl_Impl::Select
(cherry picked from commit 47204c74d9e52f54f6983af19b66af2a96b42e61) Conflicts: framework/inc/uielement/popuptoolbarcontroller.hxx svtools/inc/svtools/toolboxcontroller.hxx Change-Id: I304d17c662450f29eeffb17f576b418986f3fb0a
This commit is contained in:
parent
a1748501d8
commit
57207cab00
4 changed files with 66 additions and 20 deletions
|
@ -78,7 +78,10 @@ namespace framework
|
|||
private:
|
||||
void functionExecuted( const OUString &rCommand );
|
||||
void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& rEvent ) throw ( ::com::sun::star::uno::RuntimeException );
|
||||
void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException);
|
||||
void setItemImage( const OUString &rCommand );
|
||||
|
||||
OUString m_aLastURL;
|
||||
};
|
||||
|
||||
class WizardsToolbarController : public PopupMenuToolbarController
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
*/
|
||||
|
||||
#include <uielement/popuptoolbarcontroller.hxx>
|
||||
#include <framework/menuconfiguration.hxx>
|
||||
#include <toolkit/awt/vclxmenu.hxx>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <svtools/imagemgr.hxx>
|
||||
#include <svtools/miscopt.hxx>
|
||||
|
@ -28,9 +30,10 @@
|
|||
|
||||
#include <com/sun/star/awt/PopupMenuDirection.hpp>
|
||||
#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
|
||||
|
||||
#include <com/sun/star/frame/XDispatchProvider.hpp>
|
||||
|
||||
#define UNO_COMMAND_RECENT_FILE_LIST ".uno:RecentFileList"
|
||||
#define SFX_REFERER_USER "private:user"
|
||||
|
||||
namespace css = ::com::sun::star;
|
||||
|
||||
|
@ -270,6 +273,39 @@ NewToolbarController::statusChanged(
|
|||
enable( rEvent.IsEnabled );
|
||||
}
|
||||
|
||||
void SAL_CALL
|
||||
NewToolbarController::execute( sal_Int16 /*KeyModifier*/ )
|
||||
throw ( css::uno::RuntimeException )
|
||||
{
|
||||
osl::MutexGuard aGuard( m_aMutex );
|
||||
if ( !m_aLastURL.getLength() )
|
||||
return;
|
||||
|
||||
OUString aTarget( RTL_CONSTASCII_USTRINGPARAM( "_default" ) );
|
||||
if ( m_xPopupMenu.is() )
|
||||
{
|
||||
// TODO investigate how to wrap Get/SetUserValue in css::awt::XMenu
|
||||
MenuConfiguration::Attributes* pMenuAttributes( 0 );
|
||||
VCLXPopupMenu* pTkPopupMenu = dynamic_cast< VCLXPopupMenu * >(
|
||||
VCLXMenu::GetImplementation( m_xPopupMenu ) );
|
||||
|
||||
SolarMutexGuard aSolarMutexGuard;
|
||||
PopupMenu* pVCLPopupMenu = dynamic_cast< PopupMenu * >( pTkPopupMenu->GetMenu() );
|
||||
if ( pVCLPopupMenu )
|
||||
pMenuAttributes = reinterpret_cast< MenuConfiguration::Attributes* >(
|
||||
pVCLPopupMenu->GetUserValue( pVCLPopupMenu->GetCurItemId() ) );
|
||||
|
||||
if ( pMenuAttributes )
|
||||
aTarget = pMenuAttributes->aTargetFrame;
|
||||
}
|
||||
|
||||
css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 );
|
||||
aArgs[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Referer" ));
|
||||
aArgs[0].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( SFX_REFERER_USER ) );
|
||||
|
||||
dispatchCommand( m_aLastURL, aArgs, aTarget );
|
||||
}
|
||||
|
||||
void NewToolbarController::functionExecuted( const OUString &rCommand )
|
||||
{
|
||||
setItemImage( rCommand );
|
||||
|
@ -400,6 +436,8 @@ void NewToolbarController::setItemImage( const OUString &rCommand )
|
|||
}
|
||||
else
|
||||
pToolBox->SetItemImage( m_nToolBoxId, aImage );
|
||||
|
||||
m_aLastURL = aURL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,8 +46,6 @@ class ToolBox;
|
|||
namespace svt
|
||||
{
|
||||
|
||||
struct DispatchInfo;
|
||||
|
||||
class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusListener,
|
||||
public ::com::sun::star::frame::XToolbarController,
|
||||
public ::com::sun::star::lang::XInitialization,
|
||||
|
@ -116,13 +114,10 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL
|
|||
const OUString& getCommandURL() const { return m_aCommandURL; }
|
||||
const OUString& getModuleName() const { return m_sModuleName; }
|
||||
|
||||
|
||||
void dispatchCommand( const OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs );
|
||||
void dispatchCommand( const OUString& sCommandURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs, const OUString &rTarget = OUString() );
|
||||
|
||||
void enable( bool bEnable );
|
||||
|
||||
DECL_STATIC_LINK( ToolboxController, ExecuteHdl_Impl, DispatchInfo* );
|
||||
|
||||
protected:
|
||||
bool getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox );
|
||||
void setSupportVisibleProperty(sal_Bool bValue); //shizhoubo
|
||||
|
@ -135,6 +130,23 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL
|
|||
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch;
|
||||
};
|
||||
|
||||
struct DispatchInfo
|
||||
{
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > mxDispatch;
|
||||
const ::com::sun::star::util::URL maURL;
|
||||
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > maArgs;
|
||||
|
||||
DispatchInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >& xDispatch,
|
||||
const ::com::sun::star::util::URL& rURL,
|
||||
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs )
|
||||
: mxDispatch( xDispatch )
|
||||
, maURL( rURL )
|
||||
, maArgs( rArgs )
|
||||
{}
|
||||
};
|
||||
|
||||
DECL_STATIC_LINK( ToolboxController, ExecuteHdl_Impl, DispatchInfo* );
|
||||
|
||||
typedef ::boost::unordered_map< OUString,
|
||||
com::sun::star::uno::Reference< com::sun::star::frame::XDispatch >,
|
||||
OUStringHash,
|
||||
|
|
|
@ -49,16 +49,6 @@ using namespace ::com::sun::star::frame;
|
|||
namespace svt
|
||||
{
|
||||
|
||||
struct DispatchInfo
|
||||
{
|
||||
Reference< XDispatch > mxDispatch;
|
||||
const URL maURL;
|
||||
const Sequence< PropertyValue > maArgs;
|
||||
|
||||
DispatchInfo( const Reference< XDispatch >& xDispatch, const URL& rURL, const Sequence< PropertyValue >& rArgs )
|
||||
: mxDispatch( xDispatch ), maURL( rURL ), maArgs( rArgs ) {}
|
||||
};
|
||||
|
||||
ToolboxController::ToolboxController(
|
||||
const Reference< XComponentContext >& rxContext,
|
||||
const Reference< XFrame >& xFrame,
|
||||
|
@ -705,7 +695,7 @@ Reference< ::com::sun::star::awt::XWindow > ToolboxController::getParent() const
|
|||
return m_xParentWindow;
|
||||
}
|
||||
|
||||
void ToolboxController::dispatchCommand( const OUString& sCommandURL, const Sequence< PropertyValue >& rArgs )
|
||||
void ToolboxController::dispatchCommand( const OUString& sCommandURL, const Sequence< PropertyValue >& rArgs, const OUString &sTarget )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -714,9 +704,12 @@ void ToolboxController::dispatchCommand( const OUString& sCommandURL, const Sequ
|
|||
aURL.Complete = sCommandURL;
|
||||
getURLTransformer()->parseStrict( aURL );
|
||||
|
||||
Reference< XDispatch > xDispatch( xDispatchProvider->queryDispatch( aURL, OUString(), 0 ), UNO_QUERY_THROW );
|
||||
Reference< XDispatch > xDispatch( xDispatchProvider->queryDispatch( aURL, sTarget, 0 ), UNO_QUERY_THROW );
|
||||
|
||||
Application::PostUserEvent( STATIC_LINK(0, ToolboxController, ExecuteHdl_Impl), new DispatchInfo( xDispatch, aURL, rArgs ) );
|
||||
DispatchInfo *pDispatchInfo = new DispatchInfo( xDispatch, aURL, rArgs );
|
||||
if ( !Application::PostUserEvent( STATIC_LINK(0, ToolboxController, ExecuteHdl_Impl),
|
||||
pDispatchInfo ) )
|
||||
delete pDispatchInfo;
|
||||
|
||||
}
|
||||
catch( Exception& )
|
||||
|
|
Loading…
Reference in a new issue