LCOV - code coverage report
Current view: top level - framework/source/uielement - controlmenucontroller.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 144 0.0 %
Date: 2014-04-14 Functions: 0 19 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <sal/config.h>
      21             : 
      22             : #include <stdtypes.h>
      23             : 
      24             : #include <com/sun/star/beans/PropertyValue.hpp>
      25             : #include <com/sun/star/lang/XServiceInfo.hpp>
      26             : #include <com/sun/star/lang/XInitialization.hpp>
      27             : #include <com/sun/star/frame/XDispatch.hpp>
      28             : #include <com/sun/star/frame/XDispatchProvider.hpp>
      29             : #include <com/sun/star/frame/XStatusListener.hpp>
      30             : #include <com/sun/star/frame/XPopupMenuController.hpp>
      31             : 
      32             : #include <cppuhelper/supportsservice.hxx>
      33             : #include <vcl/menu.hxx>
      34             : #include <vcl/svapp.hxx>
      35             : #include <vcl/settings.hxx>
      36             : #include <vcl/i18nhelp.hxx>
      37             : #include <rtl/ref.hxx>
      38             : #include <rtl/ustrbuf.hxx>
      39             : #include <svl/solar.hrc>
      40             : #include <tools/rcid.h>
      41             : #include <vcl/image.hxx>
      42             : #include <svtools/menuoptions.hxx>
      43             : #include <svtools/popupmenucontrollerbase.hxx>
      44             : #include <osl/mutex.hxx>
      45             : 
      46             : // Copied from svx
      47             : // Function-Id's
      48             : #define RID_FMSHELL_CONVERSIONMENU (RID_FORMS_START + 4)
      49             : #define RID_SVXIMGLIST_FMEXPL      (RID_FORMS_START + 0)
      50             : 
      51             : // Forms - Ids, used to address images from image list
      52             : #define SID_FMSLOTS_START                   (SID_SVX_START + 592)
      53             : #define SID_MORE_FMSLOTS_START              (SID_SVX_START + 702)
      54             : 
      55             : #define SID_FM_CONVERTTO_EDIT               (SID_MORE_FMSLOTS_START +  32)
      56             : #define SID_FM_CONVERTTO_BUTTON             (SID_MORE_FMSLOTS_START +  33)
      57             : #define SID_FM_CONVERTTO_FIXEDTEXT          (SID_MORE_FMSLOTS_START +  34)
      58             : #define SID_FM_CONVERTTO_LISTBOX            (SID_MORE_FMSLOTS_START +  35)
      59             : #define SID_FM_CONVERTTO_CHECKBOX           (SID_MORE_FMSLOTS_START +  36)
      60             : #define SID_FM_CONVERTTO_RADIOBUTTON        (SID_MORE_FMSLOTS_START +  37)
      61             : #define SID_FM_CONVERTTO_GROUPBOX           (SID_MORE_FMSLOTS_START +  38)
      62             : #define SID_FM_CONVERTTO_COMBOBOX           (SID_MORE_FMSLOTS_START +  39)
      63             : #define SID_FM_CONVERTTO_IMAGEBUTTON        (SID_MORE_FMSLOTS_START +  41)
      64             : #define SID_FM_CONVERTTO_FILECONTROL        (SID_MORE_FMSLOTS_START +  42)
      65             : #define SID_FM_CONVERTTO_DATE               (SID_MORE_FMSLOTS_START +  43)
      66             : #define SID_FM_CONVERTTO_TIME               (SID_MORE_FMSLOTS_START +  44)
      67             : #define SID_FM_CONVERTTO_NUMERIC            (SID_MORE_FMSLOTS_START +  45)
      68             : #define SID_FM_CONVERTTO_CURRENCY           (SID_MORE_FMSLOTS_START +  46)
      69             : #define SID_FM_CONVERTTO_PATTERN            (SID_MORE_FMSLOTS_START +  47)
      70             : #define SID_FM_CONVERTTO_IMAGECONTROL       (SID_MORE_FMSLOTS_START +  48)
      71             : #define SID_FM_CONVERTTO_FORMATTED          (SID_MORE_FMSLOTS_START +  49)
      72             : #define SID_FM_CONVERTTO_SCROLLBAR          (SID_MORE_FMSLOTS_START +  68)
      73             : #define SID_FM_CONVERTTO_SPINBUTTON         (SID_MORE_FMSLOTS_START +  69)
      74             : 
      75             : #define SID_FM_DATEFIELD                    (SID_MORE_FMSLOTS_START +   2)
      76             : #define SID_FM_TIMEFIELD                    (SID_MORE_FMSLOTS_START +   3)
      77             : #define SID_FM_NUMERICFIELD                 (SID_MORE_FMSLOTS_START +   4)
      78             : #define SID_FM_CURRENCYFIELD                (SID_MORE_FMSLOTS_START +   5)
      79             : #define SID_FM_PATTERNFIELD                 (SID_MORE_FMSLOTS_START +   6)
      80             : #define SID_FM_IMAGECONTROL                 (SID_MORE_FMSLOTS_START +   8)
      81             : #define SID_FM_FORMATTEDFIELD               (SID_MORE_FMSLOTS_START +  26)
      82             : #define SID_FM_SCROLLBAR                    (SID_MORE_FMSLOTS_START +  66)
      83             : #define SID_FM_SPINBUTTON                   (SID_MORE_FMSLOTS_START +  67)
      84             : #define SID_FM_PUSHBUTTON                   (SID_FMSLOTS_START + 2)
      85             : #define SID_FM_RADIOBUTTON                  (SID_FMSLOTS_START + 3)
      86             : #define SID_FM_CHECKBOX                     (SID_FMSLOTS_START + 4)
      87             : #define SID_FM_FIXEDTEXT                    (SID_FMSLOTS_START + 5)
      88             : #define SID_FM_GROUPBOX                     (SID_FMSLOTS_START + 6)
      89             : #define SID_FM_EDIT                         (SID_FMSLOTS_START + 7)
      90             : #define SID_FM_LISTBOX                      (SID_FMSLOTS_START + 8)
      91             : #define SID_FM_COMBOBOX                     (SID_FMSLOTS_START + 9)
      92             : #define SID_FM_IMAGEBUTTON                  (SID_FMSLOTS_START + 12)
      93             : #define SID_FM_FILECONTROL                  (SID_FMSLOTS_START + 13)
      94             : 
      95             : static const sal_Int16 nConvertSlots[] =
      96             : {
      97             :     SID_FM_CONVERTTO_EDIT,
      98             :     SID_FM_CONVERTTO_BUTTON,
      99             :     SID_FM_CONVERTTO_FIXEDTEXT,
     100             :     SID_FM_CONVERTTO_LISTBOX,
     101             :     SID_FM_CONVERTTO_CHECKBOX,
     102             :     SID_FM_CONVERTTO_RADIOBUTTON,
     103             :     SID_FM_CONVERTTO_GROUPBOX,
     104             :     SID_FM_CONVERTTO_COMBOBOX,
     105             : //  SID_FM_CONVERTTO_GRID,
     106             :     SID_FM_CONVERTTO_IMAGEBUTTON,
     107             :     SID_FM_CONVERTTO_FILECONTROL,
     108             :     SID_FM_CONVERTTO_DATE,
     109             :     SID_FM_CONVERTTO_TIME,
     110             :     SID_FM_CONVERTTO_NUMERIC,
     111             :     SID_FM_CONVERTTO_CURRENCY,
     112             :     SID_FM_CONVERTTO_PATTERN,
     113             :     SID_FM_CONVERTTO_IMAGECONTROL,
     114             :     SID_FM_CONVERTTO_FORMATTED,
     115             :     SID_FM_CONVERTTO_SCROLLBAR,
     116             :     SID_FM_CONVERTTO_SPINBUTTON
     117             : };
     118             : 
     119             : static const sal_Int16 nCreateSlots[] =
     120             : {
     121             :     SID_FM_EDIT,
     122             :     SID_FM_PUSHBUTTON,
     123             :     SID_FM_FIXEDTEXT,
     124             :     SID_FM_LISTBOX,
     125             :     SID_FM_CHECKBOX,
     126             :     SID_FM_RADIOBUTTON,
     127             :     SID_FM_GROUPBOX,
     128             :     SID_FM_COMBOBOX,
     129             : //  SID_FM_DBGRID,
     130             :     SID_FM_IMAGEBUTTON,
     131             :     SID_FM_FILECONTROL,
     132             :     SID_FM_DATEFIELD,
     133             :     SID_FM_TIMEFIELD,
     134             :     SID_FM_NUMERICFIELD,
     135             :     SID_FM_CURRENCYFIELD,
     136             :     SID_FM_PATTERNFIELD,
     137             :     SID_FM_IMAGECONTROL,
     138             :     SID_FM_FORMATTEDFIELD,
     139             :     SID_FM_SCROLLBAR,
     140             :     SID_FM_SPINBUTTON
     141             : };
     142             : 
     143             : static const char* aCommands[] =
     144             : {
     145             :     ".uno:ConvertToEdit",
     146             :     ".uno:ConvertToButton",
     147             :     ".uno:ConvertToFixed",
     148             :     ".uno:ConvertToList",
     149             :     ".uno:ConvertToCheckBox",
     150             :     ".uno:ConvertToRadio",
     151             :     ".uno:ConvertToGroup",
     152             :     ".uno:ConvertToCombo",
     153             : //    ".uno:ConvertToGrid",
     154             :     ".uno:ConvertToImageBtn",
     155             :     ".uno:ConvertToFileControl",
     156             :     ".uno:ConvertToDate",
     157             :     ".uno:ConvertToTime",
     158             :     ".uno:ConvertToNumeric",
     159             :     ".uno:ConvertToCurrency",
     160             :     ".uno:ConvertToPattern",
     161             :     ".uno:ConvertToImageControl",
     162             :     ".uno:ConvertToFormatted",
     163             :     ".uno:ConvertToScrollBar",
     164             :     ".uno:ConvertToSpinButton"
     165             : };
     166             : 
     167             : using namespace css;
     168             : using namespace com::sun::star::uno;
     169             : using namespace com::sun::star::lang;
     170             : using namespace com::sun::star::frame;
     171             : using namespace com::sun::star::beans;
     172             : 
     173             : namespace {
     174             : 
     175             : class ControlMenuController :  public svt::PopupMenuControllerBase
     176             : {
     177             :     using svt::PopupMenuControllerBase::disposing;
     178             : 
     179             : public:
     180             :     ControlMenuController( const uno::Reference< uno::XComponentContext >& xContext );
     181             :     virtual ~ControlMenuController();
     182             : 
     183             :     // XServiceInfo
     184           0 :     virtual OUString SAL_CALL getImplementationName()
     185             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     186             :     {
     187           0 :         return OUString("com.sun.star.comp.framework.ControlMenuController");
     188             :     }
     189             : 
     190           0 :     virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
     191             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     192             :     {
     193           0 :         return cppu::supportsService(this, ServiceName);
     194             :     }
     195             : 
     196           0 :     virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
     197             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     198             :     {
     199           0 :         css::uno::Sequence< OUString > aSeq(1);
     200           0 :         aSeq[0] = OUString("com.sun.star.frame.PopupMenuController");
     201           0 :         return aSeq;
     202             :     }
     203             : 
     204             :     // XPopupMenuController
     205             :     virtual void SAL_CALL updatePopupMenu() throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
     206             : 
     207             :     // XInitialization
     208             :     virtual void SAL_CALL initialize( const uno::Sequence< uno::Any >& aArguments ) throw (uno::Exception, uno::RuntimeException, std::exception) SAL_OVERRIDE;
     209             : 
     210             :     // XStatusListener
     211             :     virtual void SAL_CALL statusChanged( const frame::FeatureStateEvent& Event ) throw ( uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     212             : 
     213             :     // XMenuListener
     214             :     virtual void SAL_CALL itemActivated( const awt::MenuEvent& rEvent ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE;
     215             : 
     216             :     // XEventListener
     217             :     virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw ( uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     218             : 
     219             : private:
     220             :     virtual void impl_setPopupMenu() SAL_OVERRIDE;
     221             :     virtual void impl_select(const uno::Reference< frame::XDispatch >& _xDispatch,const util::URL& aURL) SAL_OVERRIDE;
     222             : 
     223           0 :     class UrlToDispatchMap : public ::boost::unordered_map< OUString,
     224             :                                                      uno::Reference< frame::XDispatch >,
     225             :                                                      OUStringHash,
     226             :                                                      ::std::equal_to< OUString > >
     227             :     {
     228             :         public:
     229           0 :             inline void free()
     230             :             {
     231           0 :                 UrlToDispatchMap().swap( *this );
     232           0 :             }
     233             :     };
     234             : 
     235             :     void updateImagesPopupMenu( PopupMenu* pPopupMenu );
     236             :     void fillPopupMenu( uno::Reference< awt::XPopupMenu >& rPopupMenu );
     237             : 
     238             :     bool            m_bShowMenuImages : 1;
     239             :     PopupMenu*          m_pResPopupMenu;
     240             :     UrlToDispatchMap    m_aURLToDispatchMap;
     241             : };
     242             : 
     243           0 : ControlMenuController::ControlMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ) :
     244             :     svt::PopupMenuControllerBase( xContext ),
     245           0 :     m_pResPopupMenu( 0 )
     246             : {
     247           0 :     const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
     248           0 :     m_bShowMenuImages   = rSettings.GetUseImagesInMenus();
     249             : 
     250           0 : }
     251             : 
     252           0 : ControlMenuController::~ControlMenuController()
     253             : {
     254           0 : }
     255             : 
     256             : // private function
     257           0 : void ControlMenuController::updateImagesPopupMenu( PopupMenu* pPopupMenu )
     258             : {
     259           0 :     ResMgr* pResMgr = ResMgr::CreateResMgr("svx", Application::GetSettings().GetUILanguageTag());
     260           0 :     ResId aResId( RID_SVXIMGLIST_FMEXPL, *pResMgr );
     261           0 :     aResId.SetRT( RSC_IMAGELIST );
     262             : 
     263           0 :     if ( pResMgr->IsAvailable( aResId ))
     264             :     {
     265           0 :         ImageList aImageList( aResId );
     266           0 :         for ( sal_uInt32 i=0; i < sizeof(nConvertSlots)/sizeof(nConvertSlots[0]); ++i )
     267             :         {
     268             :             // das entsprechende Image dran
     269           0 :             if ( m_bShowMenuImages )
     270           0 :                 pPopupMenu->SetItemImage( nConvertSlots[i], aImageList.GetImage(nCreateSlots[i]));
     271             :             else
     272           0 :                 pPopupMenu->SetItemImage( nConvertSlots[i], Image() );
     273           0 :         }
     274             :     }
     275             : 
     276           0 :     delete pResMgr;
     277           0 : }
     278             : 
     279             : // private function
     280           0 : void ControlMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopupMenu )
     281             : {
     282           0 :     VCLXPopupMenu*                                     pPopupMenu        = (VCLXPopupMenu *)VCLXMenu::GetImplementation( rPopupMenu );
     283           0 :     PopupMenu*                                         pVCLPopupMenu     = 0;
     284             : 
     285           0 :     SolarMutexGuard aSolarMutexGuard;
     286             : 
     287           0 :     resetPopupMenu( rPopupMenu );
     288           0 :     if ( pPopupMenu )
     289           0 :         pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu();
     290             : 
     291           0 :     if ( pVCLPopupMenu && m_pResPopupMenu )
     292           0 :         *pVCLPopupMenu = *m_pResPopupMenu;
     293           0 : }
     294             : 
     295             : // XEventListener
     296           0 : void SAL_CALL ControlMenuController::disposing( const EventObject& ) throw ( RuntimeException, std::exception )
     297             : {
     298           0 :     Reference< css::awt::XMenuListener > xHolder(( OWeakObject *)this, UNO_QUERY );
     299             : 
     300           0 :     osl::ResettableMutexGuard aLock( m_aMutex );
     301           0 :     m_xFrame.clear();
     302           0 :     m_xDispatch.clear();
     303             : 
     304           0 :     if ( m_xPopupMenu.is() )
     305           0 :         m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(( OWeakObject *)this, UNO_QUERY ));
     306           0 :     m_xPopupMenu.clear();
     307           0 :     delete m_pResPopupMenu;
     308           0 : }
     309             : 
     310             : // XStatusListener
     311           0 : void SAL_CALL ControlMenuController::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException, std::exception )
     312             : {
     313           0 :     osl::ResettableMutexGuard aLock( m_aMutex );
     314             : 
     315           0 :     sal_uInt16 nMenuId = 0;
     316           0 :     for (sal_uInt32 i=0; i < sizeof(aCommands) / sizeof (aCommands[0]); ++i)
     317             :     {
     318           0 :         if ( Event.FeatureURL.Complete.equalsAscii( aCommands[i] ))
     319             :         {
     320           0 :             nMenuId = nConvertSlots[i];
     321           0 :             break;
     322             :         }
     323             :     }
     324             : 
     325           0 :     if ( nMenuId )
     326             :     {
     327           0 :         VCLXPopupMenu*  pPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( m_xPopupMenu );
     328             : 
     329           0 :         SolarMutexGuard aSolarMutexGuard;
     330             : 
     331           0 :         PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu();
     332             : 
     333           0 :         if ( !Event.IsEnabled && pVCLPopupMenu->GetItemPos( nMenuId ) != MENU_ITEM_NOTFOUND )
     334           0 :             pVCLPopupMenu->RemoveItem( pVCLPopupMenu->GetItemPos( nMenuId ));
     335           0 :         else if ( Event.IsEnabled && pVCLPopupMenu->GetItemPos( nMenuId ) == MENU_ITEM_NOTFOUND )
     336             :         {
     337           0 :             sal_Int16 nSourcePos = m_pResPopupMenu->GetItemPos(nMenuId);
     338           0 :             sal_Int16 nPrevInSource = nSourcePos;
     339           0 :             sal_uInt16 nPrevInConversion = MENU_ITEM_NOTFOUND;
     340           0 :             while (nPrevInSource>0)
     341             :             {
     342           0 :                 sal_Int16 nPrevId = m_pResPopupMenu->GetItemId(--nPrevInSource);
     343             : 
     344             :                 // do we have the source's predecessor in our conversion menu, too ?
     345           0 :                 nPrevInConversion = pVCLPopupMenu->GetItemPos( nPrevId );
     346           0 :                 if ( nPrevInConversion != MENU_ITEM_NOTFOUND )
     347           0 :                     break;
     348             :             }
     349             : 
     350           0 :           if ( MENU_ITEM_NOTFOUND == nPrevInConversion )
     351             :                 // none of the items which precede the nSID-slot in the source menu are present in our conversion menu
     352           0 :                 nPrevInConversion = sal::static_int_cast< sal_uInt16 >(-1); // put the item at the first position
     353             : 
     354           0 :             pVCLPopupMenu->InsertItem( nMenuId, m_pResPopupMenu->GetItemText( nMenuId ), m_pResPopupMenu->GetItemBits( nMenuId ), OString(), ++nPrevInConversion );
     355           0 :             pVCLPopupMenu->SetItemImage( nMenuId, m_pResPopupMenu->GetItemImage( nMenuId ));
     356           0 :             pVCLPopupMenu->SetHelpId( nMenuId, m_pResPopupMenu->GetHelpId( nMenuId ));
     357           0 :         }
     358           0 :     }
     359           0 : }
     360             : 
     361             : // XMenuListener
     362           0 : void ControlMenuController::impl_select(const Reference< XDispatch >& /*_xDispatch*/,const ::com::sun::star::util::URL& aURL)
     363             : {
     364           0 :     UrlToDispatchMap::iterator pIter = m_aURLToDispatchMap.find( aURL.Complete );
     365           0 :     if ( pIter != m_aURLToDispatchMap.end() )
     366             :     {
     367           0 :         Sequence<PropertyValue>      aArgs;
     368           0 :         Reference< XDispatch > xDispatch = pIter->second;
     369           0 :         if ( xDispatch.is() )
     370           0 :             xDispatch->dispatch( aURL, aArgs );
     371             :     }
     372           0 : }
     373             : 
     374           0 : void SAL_CALL ControlMenuController::itemActivated( const css::awt::MenuEvent& ) throw (RuntimeException, std::exception)
     375             : {
     376           0 :     osl::ResettableMutexGuard aLock( m_aMutex );
     377             : 
     378           0 :     if ( m_xPopupMenu.is() )
     379             :     {
     380           0 :         SolarMutexGuard aSolarMutexGuard;
     381             : 
     382             :         // Check if some modes have changed so we have to update our menu images
     383           0 :         const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
     384           0 :         bool bShowMenuImages    = rSettings.GetUseImagesInMenus();
     385           0 :         bool bUpdateImages      = (bShowMenuImages != m_bShowMenuImages);
     386             : 
     387           0 :         if ( bUpdateImages )
     388             :         {
     389           0 :             m_bShowMenuImages   = bShowMenuImages;
     390             : 
     391           0 :             VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXPopupMenu::GetImplementation( m_xPopupMenu );
     392           0 :             if ( pPopupMenu )
     393             :             {
     394           0 :                 PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu();
     395           0 :                 if ( pVCLPopupMenu && bUpdateImages )
     396           0 :                     updateImagesPopupMenu( pVCLPopupMenu );
     397             :             }
     398           0 :         }
     399           0 :     }
     400           0 : }
     401             : 
     402             : // XPopupMenuController
     403           0 : void ControlMenuController::impl_setPopupMenu()
     404             : {
     405           0 :     if ( m_pResPopupMenu == 0 )
     406             :     {
     407           0 :         ResMgr* pResMgr = ResMgr::CreateResMgr("svx", Application::GetSettings().GetUILanguageTag());
     408           0 :         if ( pResMgr )
     409             :         {
     410           0 :             ResId aResId( RID_FMSHELL_CONVERSIONMENU, *pResMgr );
     411           0 :             aResId.SetRT( RSC_MENU );
     412           0 :             if ( pResMgr->IsAvailable( aResId ))
     413             :             {
     414           0 :                 m_pResPopupMenu = new PopupMenu( aResId );
     415           0 :                 updateImagesPopupMenu( m_pResPopupMenu );
     416             :             }
     417             : 
     418           0 :             delete pResMgr;
     419             :         }
     420             :     } // if ( m_pResPopupMenu == 0 )
     421           0 : }
     422             : 
     423           0 : void SAL_CALL ControlMenuController::updatePopupMenu() throw (::com::sun::star::uno::RuntimeException, std::exception)
     424             : {
     425           0 :     osl::ResettableMutexGuard aLock( m_aMutex );
     426             : 
     427           0 :     throwIfDisposed();
     428             : 
     429           0 :     if ( m_xFrame.is() && m_xPopupMenu.is() )
     430             :     {
     431           0 :         css::util::URL aTargetURL;
     432           0 :         Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
     433           0 :         fillPopupMenu( m_xPopupMenu );
     434           0 :         m_aURLToDispatchMap.free();
     435             : 
     436           0 :         for (sal_uInt32 i=0; i<sizeof(aCommands)/sizeof(aCommands[0]); ++i)
     437             :         {
     438           0 :             aTargetURL.Complete = OUString::createFromAscii( aCommands[i] );
     439           0 :             m_xURLTransformer->parseStrict( aTargetURL );
     440             : 
     441           0 :             Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 );
     442           0 :             if ( xDispatch.is() )
     443             :             {
     444           0 :                 xDispatch->addStatusListener( (static_cast< XStatusListener* >(this)), aTargetURL );
     445           0 :                 xDispatch->removeStatusListener( (static_cast< XStatusListener* >(this)), aTargetURL );
     446           0 :                 m_aURLToDispatchMap.insert( UrlToDispatchMap::value_type( aTargetURL.Complete, xDispatch ));
     447             :             }
     448           0 :         }
     449           0 :     }
     450           0 : }
     451             : 
     452             : // XInitialization
     453           0 : void SAL_CALL ControlMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException, std::exception )
     454             : {
     455           0 :     osl::ResettableMutexGuard aLock( m_aMutex );
     456           0 :     svt::PopupMenuControllerBase::initialize(aArguments);
     457           0 :     m_aBaseURL = OUString();
     458           0 : }
     459             : 
     460             : }
     461             : 
     462             : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
     463           0 : com_sun_star_comp_framework_ControlMenuController_get_implementation(
     464             :     css::uno::XComponentContext *context,
     465             :     css::uno::Sequence<css::uno::Any> const &)
     466             : {
     467           0 :     return cppu::acquire(new ControlMenuController(context));
     468             : }
     469             : 
     470             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10