24#include <com/sun/star/frame/XLayoutManager2.hpp>
25#include <com/sun/star/beans/XPropertySet.hpp>
26#include <com/sun/star/uri/UriReferenceFactory.hpp>
27#include <com/sun/star/ui/XUIElement.hpp>
44using namespace ::
cppu;
48 uno::Reference< XComponentContext > xContext )
50 , m_bAlreadyDisposed ( false )
51 , m_bActivateListener ( false )
64 return "com.sun.star.comp.framework.PopupMenuControllerDispatcher";
79 css::uno::Reference< css::frame::XFrame >
xFrame;
82 for (
int a=0;
a<lArguments.getLength(); ++
a)
90 uno::Reference< css::frame::XFrameActionListener > xFrameActionListener(
this);
91 xFrame->addFrameActionListener( xFrameActionListener );
96css::uno::Reference< css::frame::XDispatch >
98 const css::util::URL& rURL ,
99 const OUString& sTarget ,
102 if ( !rURL.Complete.startsWith(
"vnd.sun.star.popup:" ) )
111 css::uno::Reference< css::container::XNameAccess > xPopupCtrlQuery(
m_xPopupCtrlQuery );
115 if ( !xPopupCtrlQuery.is() )
118 css::uno::Reference< css::frame::XDispatch >
xDispatch;
123 sal_Int32 nSchemePart( 0 );
124 OUString aBaseURL(
"vnd.sun.star.popup:" );
125 OUString
aURL( rURL.Complete );
127 nSchemePart =
aURL.indexOf(
':' );
128 if (( nSchemePart > 0 ) &&
129 (
aURL.getLength() > ( nSchemePart+1 )))
131 sal_Int32 nQueryPart =
aURL.indexOf(
'?', nSchemePart );
132 if ( nQueryPart > 0 )
133 aBaseURL +=
aURL.subView( nSchemePart+1, nQueryPart-(nSchemePart+1) );
134 else if ( nQueryPart == -1 )
135 aBaseURL +=
aURL.subView( nSchemePart+1 );
138 css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider;
141 xPopupCtrlQuery->getByName( aBaseURL ) >>= xDispatchProvider;
144 if ( xDispatchProvider.is() )
145 xDispatch = xDispatchProvider->queryDispatch( rURL, sTarget, nFlags );
157css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL
159 const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor )
161 sal_Int32
nCount = lDescriptor.getLength();
162 css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > lDispatcher(
nCount );
163 auto lDispatcherRange = asNonConstRange(lDispatcher);
167 lDescriptor[
i].FeatureURL,
168 lDescriptor[
i].FrameName,
169 lDescriptor[
i].SearchFlags);
191 if ((
aEvent.Action == css::frame::FrameAction_COMPONENT_DETACHING ) ||
192 (
aEvent.Action == css::frame::FrameAction_COMPONENT_ATTACHED ))
215 xFrame->removeFrameActionListener( uno::Reference< XFrameActionListener >(
this) );
229 css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager;
235 css::uno::Reference< css::beans::XPropertySet > xPropSet(
xFrame, css::uno::UNO_QUERY );
236 if ( !xPropSet.is() )
243 if ( xLayoutManager.is() )
245 css::uno::Reference< css::ui::XUIElement > xMenuBar = xLayoutManager->getElement(
"private:resource/menubar/menubar" );
250 catch (
const css::uno::RuntimeException& )
254 catch (
const css::uno::Exception& )
262extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
264 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const& )
constexpr OUStringLiteral sServiceName
Reference< XDispatch > xDispatch
css::uno::Reference< css::uno::XComponentContext > m_xContext
#define SAL_WARN_IF(condition, area, stream)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr OUStringLiteral SERVICENAME_PROTOCOLHANDLER
constexpr OUStringLiteral FRAME_PROPNAME_ASCII_LAYOUTMANAGER
Reference< XFrame > xFrame