popuptoolbarcontroller.cxx (dc055bd2) popuptoolbarcontroller.cxx (7ca83afa)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 9 unchanged lines hidden (view full) ---

18 * under the License.
19 *
20 *************************************************************/
21
22// MARKER(update_precomp.py): autogen include statement, do not remove
23#include "precompiled_framework.hxx"
24
25#include <uielement/popuptoolbarcontroller.hxx>
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 9 unchanged lines hidden (view full) ---

18 * under the License.
19 *
20 *************************************************************/
21
22// MARKER(update_precomp.py): autogen include statement, do not remove
23#include "precompiled_framework.hxx"
24
25#include <uielement/popuptoolbarcontroller.hxx>
26#include <framework/menuconfiguration.hxx>
27#include <toolkit/awt/vclxmenu.hxx>
26#include <comphelper/processfactory.hxx>
27#include <svtools/imagemgr.hxx>
28#include <svtools/miscopt.hxx>
29#include <toolkit/helper/vclunohelper.hxx>
30#include <tools/urlobj.hxx>
31#include <unotools/moduleoptions.hxx>
32#include <vcl/svapp.hxx>
33#include <vcl/toolbox.hxx>
34#include <vos/mutex.hxx>
35
36#include <com/sun/star/awt/PopupMenuDirection.hpp>
37#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
28#include <comphelper/processfactory.hxx>
29#include <svtools/imagemgr.hxx>
30#include <svtools/miscopt.hxx>
31#include <toolkit/helper/vclunohelper.hxx>
32#include <tools/urlobj.hxx>
33#include <unotools/moduleoptions.hxx>
34#include <vcl/svapp.hxx>
35#include <vcl/toolbox.hxx>
36#include <vos/mutex.hxx>
37
38#include <com/sun/star/awt/PopupMenuDirection.hpp>
39#include <com/sun/star/frame/PopupMenuControllerFactory.hpp>
40#include <com/sun/star/frame/XDispatchProvider.hpp>
38
41
39
40#define UNO_COMMAND_RECENT_FILE_LIST ".uno:RecentFileList"
42#define UNO_COMMAND_RECENT_FILE_LIST ".uno:RecentFileList"
43#define SFX_REFERER_USER "private:user"
41
42using rtl::OUString;
43namespace css = ::com::sun::star;
44
45namespace framework
46{
47
48PopupMenuToolbarController::PopupMenuToolbarController(

--- 224 unchanged lines hidden (view full) ---

273 // set the image even if the state is not a string
274 // this will set the image of the default module
275 setItemImage( aState );
276 }
277
278 enable( rEvent.IsEnabled );
279}
280
44
45using rtl::OUString;
46namespace css = ::com::sun::star;
47
48namespace framework
49{
50
51PopupMenuToolbarController::PopupMenuToolbarController(

--- 224 unchanged lines hidden (view full) ---

276 // set the image even if the state is not a string
277 // this will set the image of the default module
278 setItemImage( aState );
279 }
280
281 enable( rEvent.IsEnabled );
282}
283
284void SAL_CALL
285NewToolbarController::execute( sal_Int16 /*KeyModifier*/ )
286 throw ( css::uno::RuntimeException )
287{
288 osl::MutexGuard aGuard( m_aMutex );
289 if ( !m_aLastURL.getLength() )
290 return;
291
292 OUString aTarget( RTL_CONSTASCII_USTRINGPARAM( "_default" ) );
293 if ( m_xPopupMenu.is() )
294 {
295 // TODO investigate how to wrap Get/SetUserValue in css::awt::XMenu
296 MenuConfiguration::Attributes* pMenuAttributes( 0 );
297 VCLXPopupMenu* pTkPopupMenu = dynamic_cast< VCLXPopupMenu * >(
298 VCLXMenu::GetImplementation( m_xPopupMenu ) );
299
300 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
301 PopupMenu* pVCLPopupMenu = dynamic_cast< PopupMenu * >( pTkPopupMenu->GetMenu() );
302 if ( pVCLPopupMenu )
303 pMenuAttributes = reinterpret_cast< MenuConfiguration::Attributes* >(
304 pVCLPopupMenu->GetUserValue( pVCLPopupMenu->GetCurItemId() ) );
305
306 if ( pMenuAttributes )
307 aTarget = pMenuAttributes->aTargetFrame;
308 }
309
310 css::uno::Sequence< css::beans::PropertyValue > aArgs( 1 );
311 aArgs[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Referer" ));
312 aArgs[0].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( SFX_REFERER_USER ) );
313
314 dispatchCommand( m_aLastURL, aArgs, aTarget );
315}
316
281void NewToolbarController::functionExecuted( const OUString &rCommand )
282{
283 setItemImage( rCommand );
284}
285
286/**
287 it return the existing state of the given URL in the popupmenu of this toolbox control.
288

--- 115 unchanged lines hidden (view full) ---

404 if ( bBig && aImage.GetSizePixel() != aBigSize )
405 {
406 BitmapEx aScaleBmpEx( aImage.GetBitmapEx() );
407 aScaleBmpEx.Scale( aBigSize, BMP_SCALE_INTERPOLATE );
408 pToolBox->SetItemImage( m_nToolBoxId, Image( aScaleBmpEx ) );
409 }
410 else
411 pToolBox->SetItemImage( m_nToolBoxId, aImage );
317void NewToolbarController::functionExecuted( const OUString &rCommand )
318{
319 setItemImage( rCommand );
320}
321
322/**
323 it return the existing state of the given URL in the popupmenu of this toolbox control.
324

--- 115 unchanged lines hidden (view full) ---

440 if ( bBig && aImage.GetSizePixel() != aBigSize )
441 {
442 BitmapEx aScaleBmpEx( aImage.GetBitmapEx() );
443 aScaleBmpEx.Scale( aBigSize, BMP_SCALE_INTERPOLATE );
444 pToolBox->SetItemImage( m_nToolBoxId, Image( aScaleBmpEx ) );
445 }
446 else
447 pToolBox->SetItemImage( m_nToolBoxId, aImage );
448
449 m_aLastURL = aURL;
412}
413
414
415}
450}
451
452
453}