1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
26 #include <com/sun/star/uno/Reference.h>
27 #include <com/sun/star/frame/XFrame.hpp>
28 #include <com/sun/star/awt/XPopupMenu.hpp>
29 #include <com/sun/star/awt/XWindow.hpp>
30 #include <com/sun/star/awt/XWindowPeer.hpp>
31 #include <com/sun/star/util/URL.hpp>
32 #include <com/sun/star/util/URLTransformer.hpp>
33 #include <com/sun/star/util/XURLTransformer.hpp>
34 #include <com/sun/star/frame/XController.hpp>
35 #include <com/sun/star/lang/XUnoTunnel.hpp>
36 #include <com/sun/star/document/MacroExecMode.hpp>
37 #include <com/sun/star/document/UpdateDocMode.hpp>
38 #include <com/sun/star/frame/Desktop.hpp>
39 #include <com/sun/star/frame/XComponentLoader.hpp>
40 #include <com/sun/star/beans/PropertyValue.hpp>
41 #include <com/sun/star/beans/XPropertySet.hpp>
42 #include <com/sun/star/frame/XLayoutManager.hpp>
43 #include <com/sun/star/frame/XPopupMenuController.hpp>
44 #include <com/sun/star/frame/status/ItemStatus.hpp>
45 #include <com/sun/star/frame/status/ItemState.hpp>
46 #include <com/sun/star/ui/XUIElementFactory.hpp>
47 #include <com/sun/star/frame/XModuleManager.hpp>
48 #include <com/sun/star/container/XNameAccess.hpp>
49 #include <com/sun/star/ui/XUIFunctionListener.hpp>
50 #include <com/sun/star/ui/theUIElementFactoryManager.hpp>
51 #include <com/sun/star/frame/status/Visibility.hpp>
52 #include <svl/eitem.hxx>
53 #include <svl/stritem.hxx>
54 #include <svl/intitem.hxx>
55 #include <svl/imageitm.hxx>
56 #include <svl/visitem.hxx>
57 #include <svl/urlbmk.hxx>
58 #include <vcl/toolbox.hxx>
59 #include <unotools/moduleoptions.hxx>
61 #include <svtools/imagemgr.hxx>
62 #include <comphelper/processfactory.hxx>
63 #include <framework/addonmenu.hxx>
64 #include <framework/addonsoptions.hxx>
65 #include <framework/menuconfiguration.hxx>
66 #include <framework/sfxhelperfunctions.hxx>
67 #include <vcl/taskpanelist.hxx>
68 #include <toolkit/helper/vclunohelper.hxx>
69 #include <svtools/menuoptions.hxx>
70 #include <svtools/miscopt.hxx>
72 #include <sfx2/tbxctrl.hxx>
73 #include <sfx2/mnumgr.hxx>
74 #include <sfx2/dispatch.hxx>
75 #include <sfx2/msg.hxx>
76 #include <sfx2/msgpool.hxx>
77 #include "statcach.hxx"
78 #include <sfx2/viewfrm.hxx>
79 #include "sfxtypes.hxx"
80 #include <sfx2/genlink.hxx>
81 #include <sfx2/sfxresid.hxx>
82 #include <sfx2/sfx.hrc>
83 #include <sfx2/module.hxx>
84 #include <sfx2/docfile.hxx>
85 #include <sfx2/docfac.hxx>
86 #include <sfx2/frmhtmlw.hxx>
87 #include <sfx2/app.hxx>
88 #include <sfx2/unoctitm.hxx>
90 #include "workwin.hxx"
91 #include <sfx2/imgmgr.hxx>
92 #include "virtmenu.hxx"
93 #include <sfx2/imagemgr.hxx>
94 #include <ctrlfactoryimpl.hxx>
96 using namespace ::com::sun::star
;
97 using namespace ::com::sun::star::beans
;
98 using namespace ::com::sun::star::frame
;
99 using namespace ::com::sun::star::frame::status
;
100 using namespace ::com::sun::star::lang
;
101 using namespace ::com::sun::star::uno
;
102 using namespace ::com::sun::star::util
;
103 using namespace ::com::sun::star::container
;
104 using namespace ::com::sun::star::ui
;
108 SFX_IMPL_TOOLBOX_CONTROL_ARG(SfxToolBoxControl
, SfxStringItem
, true);
109 SFX_IMPL_TOOLBOX_CONTROL(SfxRecentFilesToolBoxControl
, SfxStringItem
);
111 static vcl::Window
* GetTopMostParentSystemWindow( vcl::Window
* pWindow
)
113 OSL_ASSERT( pWindow
);
116 // ->manually search topmost system window
117 // required because their might be another system window between this and the top window
118 pWindow
= pWindow
->GetParent();
119 SystemWindow
* pTopMostSysWin
= NULL
;
122 if ( pWindow
->IsSystemWindow() )
123 pTopMostSysWin
= static_cast<SystemWindow
*>(pWindow
);
124 pWindow
= pWindow
->GetParent();
126 pWindow
= pTopMostSysWin
;
127 OSL_ASSERT( pWindow
);
134 svt::ToolboxController
* SAL_CALL
SfxToolBoxControllerFactory( const Reference
< XFrame
>& rFrame
, ToolBox
* pToolbox
, unsigned short nID
, const OUString
& aCommandURL
)
136 SolarMutexGuard aGuard
;
139 aTargetURL
.Complete
= aCommandURL
;
140 Reference
< XURLTransformer
> xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
141 xTrans
->parseStrict( aTargetURL
);
142 if ( !aTargetURL
.Arguments
.isEmpty() )
145 SfxObjectShell
* pObjShell
= NULL
;
146 Reference
< XController
> xController
;
147 Reference
< XModel
> xModel
;
150 xController
= rFrame
->getController();
151 if ( xController
.is() )
152 xModel
= xController
->getModel();
157 // Get tunnel from model to retrieve the SfxObjectShell pointer from it
158 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XUnoTunnel
> xObj( xModel
, UNO_QUERY
);
161 ::com::sun::star::uno::Sequence
< sal_Int8
> aSeq
= SvGlobalName( SFX_GLOBAL_CLASSID
).GetByteSequence();
162 sal_Int64 nHandle
= xObj
->getSomething( aSeq
);
164 pObjShell
= reinterpret_cast< SfxObjectShell
* >( sal::static_int_cast
< sal_IntPtr
>( nHandle
));
168 SfxModule
* pModule
= pObjShell
? pObjShell
->GetModule() : NULL
;
169 SfxSlotPool
* pSlotPool
= 0;
172 pSlotPool
= pModule
->GetSlotPool();
174 pSlotPool
= &(SfxSlotPool::GetSlotPool( NULL
));
176 const SfxSlot
* pSlot
= pSlotPool
->GetUnoSlot( aTargetURL
.Path
);
179 sal_uInt16 nSlotId
= pSlot
->GetSlotId();
181 return SfxToolBoxControl::CreateControl( nSlotId
, nID
, pToolbox
, pModule
);
187 struct SfxToolBoxControl_Impl
189 VclPtr
<ToolBox
> pBox
;
191 SfxTbxCtrlFactory
* pFact
;
194 VclPtr
<SfxPopupWindow
> mpFloatingWindow
;
195 VclPtr
<SfxPopupWindow
> mpPopupWindow
;
196 Reference
< XUIElement
> mxUIElement
;
198 DECL_LINK( WindowEventListener
, VclSimpleEvent
* );
201 IMPL_LINK( SfxToolBoxControl_Impl
, WindowEventListener
, VclSimpleEvent
*, pEvent
)
204 pEvent
->ISA( VclWindowEvent
) &&
205 (( pEvent
->GetId() == VCLEVENT_WINDOW_MOVE
) ||
206 ( pEvent
->GetId() == VCLEVENT_WINDOW_ACTIVATE
)))
208 vcl::Window
* pWindow( static_cast<VclWindowEvent
*>(pEvent
)->GetWindow() );
209 if (( pWindow
== mpFloatingWindow
) &&
210 ( mpPopupWindow
!= nullptr ))
212 mpPopupWindow
.disposeAndClear();
221 SfxToolBoxControl::SfxToolBoxControl(
225 bool bShowStringItems
)
227 pImpl
= new SfxToolBoxControl_Impl
;
230 pImpl
->bShowString
= bShowStringItems
;
233 pImpl
->nSlotId
= nSlotID
;
234 pImpl
->mpFloatingWindow
= 0;
235 pImpl
->mpPopupWindow
= 0;
240 SfxToolBoxControl::~SfxToolBoxControl()
242 if ( pImpl
->mxUIElement
.is() )
244 Reference
< XComponent
> xComponent( pImpl
->mxUIElement
, UNO_QUERY
);
245 xComponent
->dispose();
247 pImpl
->mxUIElement
= 0;
253 ToolBox
& SfxToolBoxControl::GetToolBox() const
257 unsigned short SfxToolBoxControl::GetId() const
259 return pImpl
->nTbxId
;
261 unsigned short SfxToolBoxControl::GetSlotId() const
263 return pImpl
->nSlotId
;
268 void SAL_CALL
SfxToolBoxControl::dispose() throw (::com::sun::star::uno::RuntimeException
, std::exception
)
273 svt::ToolboxController::dispose();
275 // Remove and destroy our item window at our toolbox
276 SolarMutexGuard aGuard
;
277 VclPtr
< vcl::Window
> pWindow
= pImpl
->pBox
->GetItemWindow( pImpl
->nTbxId
);
278 pImpl
->pBox
->SetItemWindow( pImpl
->nTbxId
, 0 );
279 pWindow
.disposeAndClear();
281 // Dispose an open sub toolbar. It's possible that we have an open
282 // sub toolbar while we get disposed. Therefore we have to dispose
283 // it now! Not doing so would result in a crash. The sub toolbar
284 // gets destroyed asynchronously and would access a non-existing
286 if ( pImpl
->mxUIElement
.is() )
288 Reference
< XComponent
> xComponent( pImpl
->mxUIElement
, UNO_QUERY
);
289 xComponent
->dispose();
291 pImpl
->mxUIElement
= 0;
293 // Delete my popup windows
294 pImpl
->mpFloatingWindow
.disposeAndClear();
295 pImpl
->mpPopupWindow
.disposeAndClear();
299 void SfxToolBoxControl::RegisterToolBoxControl( SfxModule
* pMod
, SfxTbxCtrlFactory
* pFact
)
301 SfxGetpApp()->RegisterToolBoxControl_Impl( pMod
, pFact
);
304 SfxToolBoxControl
* SfxToolBoxControl::CreateControl( sal_uInt16 nSlotId
, sal_uInt16 nTbxId
, ToolBox
*pBox
, SfxModule
* pMod
)
306 SolarMutexGuard aGuard
;
308 SfxApplication
*pApp
= SfxGetpApp();
310 SfxSlotPool
*pSlotPool
;
312 pSlotPool
= pMod
->GetSlotPool();
314 pSlotPool
= &SfxSlotPool::GetSlotPool();
315 TypeId aSlotType
= pSlotPool
->GetSlotType( nSlotId
);
318 SfxToolBoxControl
*pCtrl
;
321 SfxTbxCtrlFactArr_Impl
*pFactories
= pMod
->GetTbxCtrlFactories_Impl();
324 SfxTbxCtrlFactArr_Impl
&rFactories
= *pFactories
;
326 const sal_uInt16 nCount
= rFactories
.size();
328 // search for a factory with the given slot id
329 for( nFactory
= 0; nFactory
< nCount
; ++nFactory
)
330 if( (rFactories
[nFactory
].nTypeId
== aSlotType
) && (rFactories
[nFactory
].nSlotId
== nSlotId
) )
333 if( nFactory
== nCount
)
335 // if no factory exists for the given slot id, see if we
336 // have a generic factory with the correct slot type and slot id == 0
337 for ( nFactory
= 0; nFactory
< nCount
; ++nFactory
)
338 if( (rFactories
[nFactory
].nTypeId
== aSlotType
) && (rFactories
[nFactory
].nSlotId
== 0) )
342 if( nFactory
< nCount
)
344 pCtrl
= rFactories
[nFactory
].pCtor( nSlotId
, nTbxId
, *pBox
);
345 pCtrl
->pImpl
->pFact
= &rFactories
[nFactory
];
351 SfxTbxCtrlFactArr_Impl
&rFactories
= pApp
->GetTbxCtrlFactories_Impl();
353 const sal_uInt16 nCount
= rFactories
.size();
355 for( nFactory
= 0; nFactory
< nCount
; ++nFactory
)
356 if( (rFactories
[nFactory
].nTypeId
== aSlotType
) && (rFactories
[nFactory
].nSlotId
== nSlotId
) )
359 if( nFactory
== nCount
)
361 // if no factory exists for the given slot id, see if we
362 // have a generic factory with the correct slot type and slot id == 0
363 for( nFactory
= 0; nFactory
< nCount
; ++nFactory
)
364 if( (rFactories
[nFactory
].nTypeId
== aSlotType
) && (rFactories
[nFactory
].nSlotId
== 0) )
368 if( nFactory
< nCount
)
370 pCtrl
= rFactories
[nFactory
].pCtor( nSlotId
, nTbxId
, *pBox
);
371 pCtrl
->pImpl
->pFact
= &rFactories
[nFactory
];
379 SfxItemState
SfxToolBoxControl::GetItemState(
380 const SfxPoolItem
* pState
)
383 Static method for determining the status of the SfxPoolItem-pointer,
384 used in the method <SfxControllerItem::StateChanged(const SfxPoolItem*)>.
388 SfxItemState SfxItemState::UNKNOWN
389 Enabled, however no further status information is available.
390 Typical for <Slot>s, which are temporarily disabled a
391 anyway but other than that do not change their appearance.
393 SfxItemState::DISABLED
394 Disabled, no further status information is available.
395 All other displayed values should be reset to the default
398 SfxItemState::DONTCARE
399 Enabled but there were only ambiguous values available
400 (i.e. none that could be queried).
402 SfxItemState::DEFAULT
403 Enabled and with available values which can be queried
404 through'pState'. The type is thus by the Slot clearly
405 defined in the entire Program.
410 ? SfxItemState::DISABLED
411 : IsInvalidItem(pState
)
412 ? SfxItemState::DONTCARE
413 : pState
->ISA(SfxVoidItem
) && !pState
->Which()
414 ? SfxItemState::UNKNOWN
415 : SfxItemState::DEFAULT
;
418 void SfxToolBoxControl::Dispatch(
419 const Reference
< XDispatchProvider
>& rProvider
,
420 const OUString
& rCommand
,
421 Sequence
< ::PropertyValue
>& aArgs
)
423 if ( rProvider
.is() )
425 ::com::sun::star::util::URL aTargetURL
;
426 aTargetURL
.Complete
= rCommand
;
427 Reference
< XURLTransformer
> xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) );
428 xTrans
->parseStrict( aTargetURL
);
430 Reference
< XDispatch
> xDispatch
= rProvider
->queryDispatch( aTargetURL
, OUString(), 0 );
431 if ( xDispatch
.is() )
432 xDispatch
->dispatch( aTargetURL
, aArgs
);
436 void SfxToolBoxControl::Dispatch( const OUString
& aCommand
, ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& aArgs
)
438 Reference
< XController
> xController
;
440 SolarMutexGuard aGuard
;
441 if ( getFrameInterface().is() )
442 xController
= getFrameInterface()->getController();
444 Reference
< XDispatchProvider
> xProvider( xController
, UNO_QUERY
);
445 if ( xProvider
.is() )
447 ::com::sun::star::util::URL aTargetURL
;
448 aTargetURL
.Complete
= aCommand
;
449 getURLTransformer()->parseStrict( aTargetURL
);
451 Reference
< XDispatch
> xDispatch
= xProvider
->queryDispatch( aTargetURL
, OUString(), 0 );
452 if ( xDispatch
.is() )
453 xDispatch
->dispatch( aTargetURL
, aArgs
);
457 void SAL_CALL
SfxToolBoxControl::disposing( const ::com::sun::star::lang::EventObject
& aEvent
)
458 throw( ::com::sun::star::uno::RuntimeException
, std::exception
)
460 svt::ToolboxController::disposing( aEvent
);
464 void SAL_CALL
SfxToolBoxControl::statusChanged( const FeatureStateEvent
& rEvent
)
465 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
)
467 SfxViewFrame
* pViewFrame
= NULL
;
468 Reference
< XController
> xController
;
470 SolarMutexGuard aGuard
;
471 if ( getFrameInterface().is() )
472 xController
= getFrameInterface()->getController();
474 Reference
< XDispatchProvider
> xProvider( xController
, UNO_QUERY
);
475 if ( xProvider
.is() )
477 Reference
< XDispatch
> xDisp
= xProvider
->queryDispatch( rEvent
.FeatureURL
, OUString(), 0 );
480 Reference
< XUnoTunnel
> xTunnel( xDisp
, UNO_QUERY
);
481 SfxOfficeDispatch
* pDisp
= NULL
;
484 sal_Int64 nImplementation
= xTunnel
->getSomething(SfxOfficeDispatch::impl_getStaticIdentifier());
485 pDisp
= reinterpret_cast< SfxOfficeDispatch
* >( sal::static_int_cast
< sal_IntPtr
>( nImplementation
));
489 pViewFrame
= pDisp
->GetDispatcher_Impl()->GetFrame();
493 sal_uInt16 nSlotId
= 0;
494 SfxSlotPool
& rPool
= SfxSlotPool::GetSlotPool( pViewFrame
);
495 const SfxSlot
* pSlot
= rPool
.GetUnoSlot( rEvent
.FeatureURL
.Path
);
497 nSlotId
= pSlot
->GetSlotId();
498 else if ( m_aCommandURL
== rEvent
.FeatureURL
.Path
)
499 nSlotId
= GetSlotId();
503 if ( rEvent
.Requery
)
504 svt::ToolboxController::statusChanged( rEvent
);
507 SfxItemState eState
= SfxItemState::DISABLED
;
508 SfxPoolItem
* pItem
= NULL
;
509 if ( rEvent
.IsEnabled
)
511 eState
= SfxItemState::DEFAULT
;
512 ::com::sun::star::uno::Type pType
= rEvent
.State
.getValueType();
514 if ( pType
== cppu::UnoType
<void>::get() )
516 pItem
= new SfxVoidItem( nSlotId
);
517 eState
= SfxItemState::UNKNOWN
;
519 else if ( pType
== cppu::UnoType
<bool>::get() )
522 rEvent
.State
>>= bTemp
;
523 pItem
= new SfxBoolItem( nSlotId
, bTemp
);
525 else if ( pType
== ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get())
527 sal_uInt16 nTemp
= 0;
528 rEvent
.State
>>= nTemp
;
529 pItem
= new SfxUInt16Item( nSlotId
, nTemp
);
531 else if ( pType
== cppu::UnoType
<sal_uInt32
>::get() )
533 sal_uInt32 nTemp
= 0;
534 rEvent
.State
>>= nTemp
;
535 pItem
= new SfxUInt32Item( nSlotId
, nTemp
);
537 else if ( pType
== cppu::UnoType
<OUString
>::get() )
540 rEvent
.State
>>= sTemp
;
541 pItem
= new SfxStringItem( nSlotId
, sTemp
);
543 else if ( pType
== cppu::UnoType
< ::com::sun::star::frame::status::ItemStatus
>::get() )
545 ItemStatus aItemStatus
;
546 rEvent
.State
>>= aItemStatus
;
547 SfxItemState tmpState
= (SfxItemState
) aItemStatus
.State
;
548 // make sure no-one tries to send us a combination of states
549 if (tmpState
!= SfxItemState::UNKNOWN
&& tmpState
!= SfxItemState::DISABLED
&&
550 tmpState
!= SfxItemState::READONLY
&& tmpState
!= SfxItemState::DONTCARE
&&
551 tmpState
!= SfxItemState::DEFAULT
&& tmpState
!= SfxItemState::SET
)
552 throw ::com::sun::star::uno::RuntimeException("unknown status");
554 pItem
= new SfxVoidItem( nSlotId
);
556 else if ( pType
== cppu::UnoType
< ::com::sun::star::frame::status::Visibility
>::get() )
558 Visibility aVisibilityStatus
;
559 rEvent
.State
>>= aVisibilityStatus
;
560 pItem
= new SfxVisibilityItem( nSlotId
, aVisibilityStatus
.bVisible
);
565 pItem
= pSlot
->GetType()->CreateItem();
568 pItem
->SetWhich( nSlotId
);
569 pItem
->PutValue( rEvent
.State
);
572 pItem
= new SfxVoidItem( nSlotId
);
576 StateChanged( nSlotId
, eState
, pItem
);
582 // XSubToolbarController
583 sal_Bool SAL_CALL
SfxToolBoxControl::opensSubToolbar() throw (::com::sun::star::uno::RuntimeException
, std::exception
)
588 OUString SAL_CALL
SfxToolBoxControl::getSubToolbarName() throw (::com::sun::star::uno::RuntimeException
, std::exception
)
593 void SAL_CALL
SfxToolBoxControl::functionSelected( const OUString
& /*aCommand*/ ) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
595 // must be implemented by sub-class
598 void SAL_CALL
SfxToolBoxControl::updateImage() throw (::com::sun::star::uno::RuntimeException
, std::exception
)
600 // must be implemented by sub-class
603 // XToolbarController
604 void SAL_CALL
SfxToolBoxControl::execute( sal_Int16 KeyModifier
) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
606 SolarMutexGuard aGuard
;
607 Select( (sal_uInt16
)KeyModifier
);
610 void SAL_CALL
SfxToolBoxControl::click() throw (::com::sun::star::uno::RuntimeException
, std::exception
)
612 SolarMutexGuard aGuard
;
616 void SAL_CALL
SfxToolBoxControl::doubleClick() throw (::com::sun::star::uno::RuntimeException
, std::exception
)
618 SolarMutexGuard aGuard
;
622 Reference
< ::com::sun::star::awt::XWindow
> SAL_CALL
SfxToolBoxControl::createPopupWindow() throw (::com::sun::star::uno::RuntimeException
, std::exception
)
624 SolarMutexGuard aGuard
;
625 VclPtr
<vcl::Window
> pWindow
= CreatePopupWindow();
627 return VCLUnoHelper::GetInterface( pWindow
);
629 return Reference
< ::com::sun::star::awt::XWindow
>();
632 Reference
< ::com::sun::star::awt::XWindow
> SAL_CALL
SfxToolBoxControl::createItemWindow( const Reference
< ::com::sun::star::awt::XWindow
>& rParent
) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
634 SolarMutexGuard aGuard
;
635 return VCLUnoHelper::GetInterface( CreateItemWindow( VCLUnoHelper::GetWindow( rParent
)));
638 // XDockableWindowListener
639 void SAL_CALL
SfxToolBoxControl::startDocking( const ::com::sun::star::awt::DockingEvent
& )
640 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
643 ::com::sun::star::awt::DockingData SAL_CALL
SfxToolBoxControl::docking( const ::com::sun::star::awt::DockingEvent
& )
644 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
646 return ::com::sun::star::awt::DockingData();
649 void SAL_CALL
SfxToolBoxControl::endDocking( const ::com::sun::star::awt::EndDockingEvent
& )
650 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
654 sal_Bool SAL_CALL
SfxToolBoxControl::prepareToggleFloatingMode( const ::com::sun::star::lang::EventObject
& )
655 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
660 void SAL_CALL
SfxToolBoxControl::toggleFloatingMode( const ::com::sun::star::lang::EventObject
& )
661 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
665 void SAL_CALL
SfxToolBoxControl::closed( const ::com::sun::star::lang::EventObject
& )
666 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
670 void SAL_CALL
SfxToolBoxControl::endPopupMode( const ::com::sun::star::awt::EndPopupModeEvent
& aEvent
)
671 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
673 SolarMutexGuard aGuard
;
675 OUString aSubToolBarResName
;
676 if ( pImpl
->mxUIElement
.is() )
678 Reference
< XPropertySet
> xPropSet( pImpl
->mxUIElement
, UNO_QUERY
);
683 xPropSet
->getPropertyValue("ResourceURL") >>= aSubToolBarResName
;
685 catch ( com::sun::star::beans::UnknownPropertyException
& )
688 catch ( com::sun::star::lang::WrappedTargetException
& )
693 Reference
< XComponent
> xComponent( pImpl
->mxUIElement
, UNO_QUERY
);
694 xComponent
->dispose();
696 pImpl
->mxUIElement
= 0;
698 // if the toolbar was teared-off recreate it and place it at the given position
699 if( aEvent
.bTearoff
)
701 Reference
< XUIElement
> xUIElement
;
702 Reference
< XLayoutManager
> xLayoutManager
= getLayoutManager();
704 if ( !xLayoutManager
.is() )
707 xLayoutManager
->createElement( aSubToolBarResName
);
708 xUIElement
= xLayoutManager
->getElement( aSubToolBarResName
);
709 if ( xUIElement
.is() )
711 Reference
< ::com::sun::star::awt::XWindow
> xParent
= getFrameInterface()->getContainerWindow();
713 Reference
< ::com::sun::star::awt::XWindow
> xSubToolBar( xUIElement
->getRealInterface(), UNO_QUERY
);
714 Reference
< ::com::sun::star::beans::XPropertySet
> xProp( xUIElement
, UNO_QUERY
);
715 if ( xSubToolBar
.is() && xProp
.is() )
717 OUString
aPersistentString( "Persistent" );
720 vcl::Window
* pTbxWindow
= VCLUnoHelper::GetWindow( xSubToolBar
);
721 if ( pTbxWindow
&& pTbxWindow
->GetType() == WINDOW_TOOLBOX
)
724 a
= xProp
->getPropertyValue( aPersistentString
);
725 xProp
->setPropertyValue( aPersistentString
, makeAny( sal_False
));
727 xLayoutManager
->hideElement( aSubToolBarResName
);
728 xLayoutManager
->floatWindow( aSubToolBarResName
);
730 xLayoutManager
->setElementPos( aSubToolBarResName
, aEvent
.FloatingPosition
);
731 xLayoutManager
->showElement( aSubToolBarResName
);
733 xProp
->setPropertyValue("Persistent", a
);
736 catch ( ::com::sun::star::uno::RuntimeException
& )
740 catch ( ::com::sun::star::uno::Exception
& )
748 ::Size
SfxToolBoxControl::getPersistentFloatingSize( const Reference
< XFrame
>& /*xFrame*/, const OUString
& /*rSubToolBarResName*/ )
754 bool SfxToolBoxControl::hasBigImages() const
756 return (GetToolBox().GetToolboxButtonSize() == TOOLBOX_BUTTONSIZE_LARGE
);
759 void SfxToolBoxControl::createAndPositionSubToolBar( const OUString
& rSubToolBarResName
)
761 SolarMutexGuard aGuard
;
765 static WeakReference
< XUIElementFactoryManager
> xWeakUIElementFactory
;
767 sal_uInt16 nItemId
= pImpl
->pBox
->GetDownItemId();
772 // create element with factory
773 Reference
< XFrame
> xFrame
= getFrameInterface();
774 Reference
< XUIElement
> xUIElement
;
775 Reference
< XUIElementFactoryManager
> xUIElementFactory
;
777 xUIElementFactory
= xWeakUIElementFactory
;
778 if ( !xUIElementFactory
.is() )
780 xUIElementFactory
= theUIElementFactoryManager::get( m_xContext
);
781 xWeakUIElementFactory
= xUIElementFactory
;
784 Sequence
< PropertyValue
> aPropSeq( 3 );
785 aPropSeq
[0].Name
= "Frame";
786 aPropSeq
[0].Value
<<= xFrame
;
787 aPropSeq
[1].Name
= "Persistent";
788 aPropSeq
[1].Value
<<= sal_False
;
789 aPropSeq
[2].Name
= "PopupMode";
790 aPropSeq
[2].Value
<<= sal_True
;
794 xUIElement
= xUIElementFactory
->createUIElement( rSubToolBarResName
, aPropSeq
);
796 catch ( ::com::sun::star::container::NoSuchElementException
& )
799 catch ( IllegalArgumentException
& )
803 if ( xUIElement
.is() )
805 Reference
< ::com::sun::star::awt::XWindow
> xParent
= getFrameInterface()->getContainerWindow();
807 Reference
< ::com::sun::star::awt::XWindow
> xSubToolBar( xUIElement
->getRealInterface(), UNO_QUERY
);
808 if ( xSubToolBar
.is() )
810 Reference
< ::com::sun::star::awt::XDockableWindow
> xDockWindow( xSubToolBar
, UNO_QUERY
);
811 xDockWindow
->addDockableWindowListener( Reference
< ::com::sun::star::awt::XDockableWindowListener
>(
812 static_cast< OWeakObject
* >( this ), UNO_QUERY
));
813 xDockWindow
->enableDocking( sal_True
);
815 // keep refererence to UIElement to avoid its destruction
816 if ( pImpl
->mxUIElement
.is() )
818 Reference
< XComponent
> xComponent( pImpl
->mxUIElement
, UNO_QUERY
);
819 xComponent
->dispose();
821 pImpl
->mxUIElement
= xUIElement
;
823 vcl::Window
* pTbxWindow
= VCLUnoHelper::GetWindow( xSubToolBar
);
824 ToolBox
* pToolBar( 0 );
825 if ( pTbxWindow
&& pTbxWindow
->GetType() == WINDOW_TOOLBOX
)
826 pToolBar
= static_cast<ToolBox
*>(pTbxWindow
);
830 vcl::Window
* pParentTbxWindow( pImpl
->pBox
);
831 pToolBar
->SetParent( pParentTbxWindow
);
832 ::Size aSize
= getPersistentFloatingSize( xFrame
, rSubToolBarResName
);
833 if ( aSize
.Width() == 0 || aSize
.Height() == 0 )
835 // calc and set size for popup mode
836 aSize
= pToolBar
->CalcPopupWindowSizePixel();
838 pToolBar
->SetSizePixel( aSize
);
840 // open subtoolbox in popup mode
841 vcl::Window::GetDockingManager()->StartPopupMode( pImpl
->pBox
, pToolBar
);
850 void SfxToolBoxControl::SetPopupWindow( SfxPopupWindow
* pWindow
)
852 pImpl
->mpPopupWindow
= pWindow
;
853 pImpl
->mpPopupWindow
->SetPopupModeEndHdl( LINK( this, SfxToolBoxControl
, PopupModeEndHdl
));
854 pImpl
->mpPopupWindow
->SetDeleteLink_Impl( LINK( this, SfxToolBoxControl
, ClosePopupWindow
));
859 IMPL_LINK_NOARG(SfxToolBoxControl
, PopupModeEndHdl
)
861 if ( pImpl
->mpPopupWindow
->IsVisible() )
863 // Replace floating window with popup window and destroy
864 // floating window instance.
865 pImpl
->mpFloatingWindow
.disposeAndClear();
866 pImpl
->mpFloatingWindow
= pImpl
->mpPopupWindow
;
867 pImpl
->mpPopupWindow
.clear();
868 // We also need to know when the user tries to use the
870 pImpl
->mpFloatingWindow
->AddEventListener( LINK( pImpl
, SfxToolBoxControl_Impl
, WindowEventListener
));
874 // Popup window has been closed by the user. No replacement, instance
875 // will destroy itself.
876 pImpl
->mpPopupWindow
.clear();
883 IMPL_LINK( SfxToolBoxControl
, ClosePopupWindow
, SfxPopupWindow
*, pWindow
)
885 if ( pWindow
== pImpl
->mpFloatingWindow
)
886 pImpl
->mpFloatingWindow
= 0;
888 pImpl
->mpPopupWindow
= 0;
895 void SfxToolBoxControl::StateChanged
899 const SfxPoolItem
* pState
902 DBG_ASSERT( pImpl
->pBox
!= nullptr, "setting state to dangling ToolBox" );
904 if ( GetId() >= SID_OBJECTMENU0
&& GetId() <= SID_OBJECTMENU_LAST
)
907 // enabled/disabled-Flag correcting the lump sum
908 pImpl
->pBox
->EnableItem( GetId(), eState
!= SfxItemState::DISABLED
);
910 ToolBoxItemBits nItemBits
= pImpl
->pBox
->GetItemBits( GetId() );
911 nItemBits
&= ~ToolBoxItemBits::CHECKABLE
;
912 ::TriState eTri
= TRISTATE_FALSE
;
915 case SfxItemState::DEFAULT
:
918 if ( pState
->ISA(SfxBoolItem
) )
920 // BoolItem for checking
921 if ( static_cast<const SfxBoolItem
*>(pState
)->GetValue() )
922 eTri
= TRISTATE_TRUE
;
923 nItemBits
|= ToolBoxItemBits::CHECKABLE
;
925 else if ( pState
->ISA(SfxEnumItemInterface
) &&
926 static_cast<const SfxEnumItemInterface
*>(pState
)->HasBoolValue())
928 // EnumItem is handled as Bool
929 if ( static_cast<const SfxEnumItemInterface
*>(pState
)->GetBoolValue() )
930 eTri
= TRISTATE_TRUE
;
931 nItemBits
|= ToolBoxItemBits::CHECKABLE
;
933 else if ( pImpl
->bShowString
&& pState
->ISA(SfxStringItem
) )
934 pImpl
->pBox
->SetItemText(nId
, static_cast<const SfxStringItem
*>(pState
)->GetValue() );
938 case SfxItemState::DONTCARE
:
940 eTri
= TRISTATE_INDET
;
941 nItemBits
|= ToolBoxItemBits::CHECKABLE
;
945 default: break; // do nothing
948 pImpl
->pBox
->SetItemState( GetId(), eTri
);
949 pImpl
->pBox
->SetItemBits( GetId(), nItemBits
);
954 void SfxToolBoxControl::Select( sal_uInt16 nSelectModifier
)
956 svt::ToolboxController::execute( nSelectModifier
);
961 void SfxToolBoxControl::DoubleClick()
967 void SfxToolBoxControl::Click()
973 SfxPopupWindowType
SfxToolBoxControl::GetPopupWindowType() const
975 return SfxPopupWindowType::NONE
;
980 VclPtr
<SfxPopupWindow
> SfxToolBoxControl::CreatePopupWindow()
985 VclPtr
<vcl::Window
> SfxToolBoxControl::CreateItemWindow( vcl::Window
* )
987 return VclPtr
<vcl::Window
>();
990 SfxFrameStatusListener::SfxFrameStatusListener(
991 const Reference
< XComponentContext
>& rxContext
,
992 const Reference
< XFrame
>& xFrame
,
993 SfxStatusListenerInterface
* pCallee
) :
994 svt::FrameStatusListener( rxContext
, xFrame
),
1001 SfxFrameStatusListener::~SfxFrameStatusListener()
1008 void SAL_CALL
SfxFrameStatusListener::statusChanged( const ::com::sun::star::frame::FeatureStateEvent
& rEvent
)
1009 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
)
1011 SfxViewFrame
* pViewFrame
= NULL
;
1012 Reference
< XController
> xController
;
1014 SolarMutexGuard aGuard
;
1015 if ( m_xFrame
.is() )
1016 xController
= m_xFrame
->getController();
1018 Reference
< XDispatchProvider
> xProvider( xController
, UNO_QUERY
);
1019 if ( xProvider
.is() )
1021 Reference
< XDispatch
> xDisp
= xProvider
->queryDispatch( rEvent
.FeatureURL
, OUString(), 0 );
1024 Reference
< XUnoTunnel
> xTunnel( xDisp
, UNO_QUERY
);
1025 SfxOfficeDispatch
* pDisp
= NULL
;
1028 sal_Int64 nImplementation
= xTunnel
->getSomething(SfxOfficeDispatch::impl_getStaticIdentifier());
1029 pDisp
= reinterpret_cast< SfxOfficeDispatch
* >( sal::static_int_cast
< sal_IntPtr
>( nImplementation
));
1033 pViewFrame
= pDisp
->GetDispatcher_Impl()->GetFrame();
1037 sal_uInt16 nSlotId
= 0;
1038 SfxSlotPool
& rPool
= SfxSlotPool::GetSlotPool( pViewFrame
);
1039 const SfxSlot
* pSlot
= rPool
.GetUnoSlot( rEvent
.FeatureURL
.Path
);
1041 nSlotId
= pSlot
->GetSlotId();
1045 if ( rEvent
.Requery
)
1047 // requery for the notified state
1048 addStatusListener( rEvent
.FeatureURL
.Complete
);
1052 SfxItemState eState
= SfxItemState::DISABLED
;
1053 SfxPoolItem
* pItem
= NULL
;
1054 if ( rEvent
.IsEnabled
)
1056 eState
= SfxItemState::DEFAULT
;
1057 ::com::sun::star::uno::Type pType
= rEvent
.State
.getValueType();
1059 if ( pType
== cppu::UnoType
<void>::get() )
1061 pItem
= new SfxVoidItem( nSlotId
);
1062 eState
= SfxItemState::UNKNOWN
;
1064 else if ( pType
== cppu::UnoType
<bool>::get() )
1067 rEvent
.State
>>= bTemp
;
1068 pItem
= new SfxBoolItem( nSlotId
, bTemp
);
1070 else if ( pType
== ::cppu::UnoType
< ::cppu::UnoUnsignedShortType
>::get())
1072 sal_uInt16 nTemp
= 0;
1073 rEvent
.State
>>= nTemp
;
1074 pItem
= new SfxUInt16Item( nSlotId
, nTemp
);
1076 else if ( pType
== cppu::UnoType
<sal_uInt32
>::get() )
1078 sal_uInt32 nTemp
= 0;
1079 rEvent
.State
>>= nTemp
;
1080 pItem
= new SfxUInt32Item( nSlotId
, nTemp
);
1082 else if ( pType
== cppu::UnoType
<OUString
>::get() )
1085 rEvent
.State
>>= sTemp
;
1086 pItem
= new SfxStringItem( nSlotId
, sTemp
);
1088 else if ( pType
== cppu::UnoType
< ::com::sun::star::frame::status::ItemStatus
>::get() )
1090 ItemStatus aItemStatus
;
1091 rEvent
.State
>>= aItemStatus
;
1092 SfxItemState tmpState
= (SfxItemState
) aItemStatus
.State
;
1093 // make sure no-one tries to send us a combination of states
1094 if (tmpState
!= SfxItemState::UNKNOWN
&& tmpState
!= SfxItemState::DISABLED
&&
1095 tmpState
!= SfxItemState::READONLY
&& tmpState
!= SfxItemState::DONTCARE
&&
1096 tmpState
!= SfxItemState::DEFAULT
&& tmpState
!= SfxItemState::SET
)
1097 throw ::com::sun::star::uno::RuntimeException("unknown status");
1099 pItem
= new SfxVoidItem( nSlotId
);
1101 else if ( pType
== cppu::UnoType
< ::com::sun::star::frame::status::Visibility
>::get() )
1103 Visibility aVisibilityStatus
;
1104 rEvent
.State
>>= aVisibilityStatus
;
1105 pItem
= new SfxVisibilityItem( nSlotId
, aVisibilityStatus
.bVisible
);
1110 pItem
= pSlot
->GetType()->CreateItem();
1113 pItem
->SetWhich( nSlotId
);
1114 pItem
->PutValue( rEvent
.State
);
1117 pItem
= new SfxVoidItem( nSlotId
);
1122 m_pCallee
->StateChanged( nSlotId
, eState
, pItem
);
1128 SfxPopupWindow::SfxPopupWindow(
1130 const Reference
< XFrame
>& rFrame
,
1132 FloatingWindow( SfxGetpApp()->GetTopWindow(), nBits
)
1133 , m_bFloating( false )
1134 , m_bCascading( false )
1136 , m_xFrame( rFrame
)
1137 , m_pStatusListener( 0 )
1139 vcl::Window
* pWindow
= GetTopMostParentSystemWindow( this );
1141 static_cast<SystemWindow
*>(pWindow
)->GetTaskPaneList()->AddWindow( this );
1144 SfxPopupWindow::SfxPopupWindow(sal_uInt16 nId
, const OString
& rID
, const OUString
& rUIXMLDescription
,
1145 const css::uno::Reference
<css::frame::XFrame
> &rFrame
)
1146 : FloatingWindow(SfxGetpApp()->GetTopWindow(), rID
, rUIXMLDescription
, rFrame
)
1147 , m_bFloating( false )
1148 , m_bCascading( false )
1150 , m_xFrame( rFrame
)
1151 , m_pStatusListener( 0 )
1153 vcl::Window
* pWindow
= GetTopMostParentSystemWindow( this );
1155 static_cast<SystemWindow
*>(pWindow
)->GetTaskPaneList()->AddWindow( this );
1158 SfxPopupWindow::SfxPopupWindow(
1160 const Reference
< XFrame
>& rFrame
,
1161 vcl::Window
* pParentWindow
,
1163 FloatingWindow( pParentWindow
, nBits
)
1164 , m_bFloating( false )
1165 , m_bCascading( false )
1167 , m_xFrame( rFrame
)
1168 , m_pStatusListener( 0 )
1170 vcl::Window
* pWindow
= GetTopMostParentSystemWindow( this );
1172 static_cast<SystemWindow
*>(pWindow
)->GetTaskPaneList()->AddWindow( this );
1175 SfxPopupWindow::SfxPopupWindow(
1177 vcl::Window
* pParentWindow
,
1178 const OString
& rID
, const OUString
& rUIXMLDescription
,
1179 const Reference
< XFrame
>& rFrame
) :
1180 FloatingWindow( pParentWindow
, rID
, rUIXMLDescription
, rFrame
)
1181 , m_bFloating( false )
1182 , m_bCascading( false )
1184 , m_xFrame( rFrame
)
1185 , m_pStatusListener( 0 )
1187 vcl::Window
* pWindow
= GetTopMostParentSystemWindow( this );
1189 static_cast<SystemWindow
*>(pWindow
)->GetTaskPaneList()->AddWindow( this );
1192 SfxPopupWindow::~SfxPopupWindow()
1197 void SfxPopupWindow::dispose()
1199 if ( m_xStatusListener
.is() )
1201 m_xStatusListener
->dispose();
1202 m_xStatusListener
.clear();
1205 vcl::Window
* pWindow
= GetTopMostParentSystemWindow( this );
1207 static_cast<SystemWindow
*>(pWindow
)->GetTaskPaneList()->RemoveWindow( this );
1208 FloatingWindow::dispose();
1213 SfxFrameStatusListener
* SfxPopupWindow::GetOrCreateStatusListener()
1215 if ( !m_xStatusListener
.is() )
1217 m_pStatusListener
= new SfxFrameStatusListener(
1218 ::comphelper::getProcessComponentContext(),
1221 m_xStatusListener
= Reference
< XComponent
>( static_cast< cppu::OWeakObject
* >(
1222 m_pStatusListener
), UNO_QUERY
);
1225 return m_pStatusListener
;
1230 void SfxPopupWindow::BindListener()
1232 GetOrCreateStatusListener();
1233 if ( m_xStatusListener
.is() )
1234 m_pStatusListener
->bindListener();
1239 void SfxPopupWindow::UnbindListener()
1241 GetOrCreateStatusListener();
1242 if ( m_xStatusListener
.is() )
1243 m_pStatusListener
->unbindListener();
1248 void SfxPopupWindow::AddStatusListener( const OUString
& rCommandURL
)
1250 GetOrCreateStatusListener();
1251 if ( m_xStatusListener
.is() )
1252 m_pStatusListener
->addStatusListener( rCommandURL
);
1257 bool SfxPopupWindow::Close()
1259 m_bFloating
= false;
1260 FloatingWindow::Close();
1268 void SfxPopupWindow::PopupModeEnd()
1270 //! to allow PopupModeEndHdl to be called
1271 FloatingWindow::PopupModeEnd();
1276 DeleteFloatingWindow();
1285 void SfxPopupWindow::DeleteFloatingWindow()
1296 void SfxPopupWindow::MouseMove( const ::MouseEvent
& rMEvt
)
1298 if ( !m_bCascading
)
1299 FloatingWindow::MouseMove( rMEvt
);
1302 // Forward MouseMove-Event to Children
1303 ::Point aPos
= rMEvt
.GetPosPixel();
1304 ::Point aScrPos
= OutputToScreenPixel( aPos
);
1306 vcl::Window
* pWindow
= GetChild( i
);
1309 ::MouseEvent
aMEvt( pWindow
->ScreenToOutputPixel( aScrPos
),
1310 rMEvt
.GetClicks(), rMEvt
.GetMode(),
1311 rMEvt
.GetButtons(), rMEvt
.GetModifier() );
1312 pWindow
->MouseMove( rMEvt
);
1315 pWindow
= GetChild( i
);
1322 void SfxPopupWindow::StartCascading()
1324 m_bCascading
= true;
1329 VclPtr
<SfxPopupWindow
> SfxPopupWindow::Clone() const
1333 This method must be overridden to show this Popup also in the
1334 Presentation-mode. It is called when a Show() would be meaningless
1335 since the parent is no presentation window.
1336 When create a new window the bew Top-Window will be used automatically,
1337 so that the Parent becomes the presentation window and that the new
1338 Popup therefore becomes visible.
1347 void SfxPopupWindow::StateChanged(
1348 sal_uInt16
/*nSID*/,
1349 SfxItemState eState
,
1350 const SfxPoolItem
* /*pState*/ )
1353 See also <SfxControllerItem::StateChanged()>. In addition the Popup
1354 will become hidden when eState==SfxItemState::DISABLED and in all other
1355 cases it will be shown again if it is floating. In general this requires
1356 to call the Base class.
1358 Due to the parent the presentation mode is handled in a special way.
1362 if ( SfxItemState::DISABLED
== eState
)
1366 else if ( m_bFloating
)
1368 Show( true, SHOW_NOFOCUSCHANGE
| SHOW_NOACTIVATE
);
1374 void SfxPopupWindow::Delete()
1376 if ( m_aDeleteLink
.IsSet() )
1377 m_aDeleteLink
.Call( this );
1383 SfxRecentFilesToolBoxControl::SfxRecentFilesToolBoxControl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rBox
)
1384 : SfxToolBoxControl( nSlotId
, nId
, rBox
)
1386 rBox
.SetItemBits( nId
, rBox
.GetItemBits( nId
) | ToolBoxItemBits::DROPDOWN
);
1389 SfxRecentFilesToolBoxControl::~SfxRecentFilesToolBoxControl()
1393 VclPtr
<SfxPopupWindow
> SfxRecentFilesToolBoxControl::CreatePopupWindow()
1395 ToolBox
& rBox
= GetToolBox();
1396 sal_uInt16 nItemId
= GetId();
1397 ::Rectangle
aRect( rBox
.GetItemRect( nItemId
) );
1399 Sequence
< Any
> aArgs( 2 );
1400 PropertyValue aPropValue
;
1402 aPropValue
.Name
= "CommandURL";
1403 aPropValue
.Value
<<= OUString( ".uno:RecentFileList" );
1404 aArgs
[0] <<= aPropValue
;
1406 aPropValue
.Name
= "Frame";
1407 aPropValue
.Value
<<= m_xFrame
;
1408 aArgs
[1] <<= aPropValue
;
1410 uno::Reference
< frame::XPopupMenuController
> xPopupController( m_xContext
->getServiceManager()->createInstanceWithArgumentsAndContext(
1411 "com.sun.star.comp.framework.RecentFilesMenuController", aArgs
, m_xContext
), UNO_QUERY
);
1413 uno::Reference
< awt::XPopupMenu
> xPopupMenu( m_xContext
->getServiceManager()->createInstanceWithContext(
1414 "com.sun.star.awt.PopupMenu", m_xContext
), uno::UNO_QUERY
);
1416 if ( xPopupController
.is() && xPopupMenu
.is() )
1418 xPopupController
->setPopupMenu( xPopupMenu
);
1420 rBox
.SetItemDown( nItemId
, true );
1421 Reference
< awt::XWindowPeer
> xPeer( getParent(), uno::UNO_QUERY
);
1424 xPopupMenu
->execute( xPeer
, VCLUnoHelper::ConvertToAWTRect( aRect
), 0 );
1426 rBox
.SetItemDown( nItemId
, false );
1432 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */