LibreOffice Module framework (master) 1
dispatchprovider.hxx
Go to the documentation of this file.
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#pragma once
21
23
24#include <com/sun/star/frame/XDispatchProvider.hpp>
25#include <com/sun/star/util/URL.hpp>
26#include <com/sun/star/frame/DispatchDescriptor.hpp>
27#include <com/sun/star/frame/XFrame.hpp>
28#include <com/sun/star/uno/XComponentContext.hpp>
29
32
33namespace framework{
34
41{
48};
49
67class DispatchProvider final : public ::cppu::WeakImplHelper< css::frame::XDispatchProvider >
68{
69 /* member */
70 private:
72 css::uno::Reference< css::uno::XComponentContext > m_xContext;
74 css::uno::WeakReference< css::frame::XFrame > m_xFrame;
77 std::unordered_map<OUString, css::uno::Reference<css::frame::XDispatchProvider>>
79
80 /* interface */
81 public:
82
83 DispatchProvider( css::uno::Reference< css::uno::XComponentContext > xContext ,
84 const css::uno::Reference< css::frame::XFrame >& xFrame );
85
86 virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL ,
87 const OUString& sTargetFrameName ,
88 sal_Int32 nSearchFlags ) override;
89 virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptions ) override;
90
92
93 /* helper */
94 private:
95 // Let him protected! So nobody can use us as base ...
96 virtual ~DispatchProvider() override;
97
98 css::uno::Reference< css::frame::XDispatch > implts_getOrCreateDispatchHelper ( EDispatchHelper eHelper ,
99 const css::uno::Reference< css::frame::XFrame >& xOwner ,
100 const OUString& sTarget = OUString() ,
101 sal_Int32 nSearchFlags = 0 );
102 bool implts_isLoadableContent ( const css::util::URL& aURL );
103 css::uno::Reference< css::frame::XDispatch > implts_queryDesktopDispatch ( const css::uno::Reference< css::frame::XFrame >& xDesktop ,
104 const css::util::URL& aURL ,
105 const OUString& sTargetFrameName ,
106 sal_Int32 nSearchFlags );
107 css::uno::Reference< css::frame::XDispatch > implts_queryFrameDispatch ( const css::uno::Reference< css::frame::XFrame >& xFrame ,
108 const css::util::URL& aURL ,
109 const OUString& sTargetFrameName ,
110 sal_Int32 nSearchFlags );
111 css::uno::Reference< css::frame::XDispatch > implts_searchProtocolHandler ( const css::util::URL& aURL );
112
113}; // class DispatchProvider
114
115} // namespace framework
116
117/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
implement a helper for XDispatchProvider interface @descr The result of a queryDispatch() call depend...
css::uno::Reference< css::frame::XDispatch > implts_queryDesktopDispatch(const css::uno::Reference< css::frame::XFrame > &xDesktop, const css::util::URL &aURL, const OUString &sTargetFrameName, sal_Int32 nSearchFlags)
helper for queryDispatch() @descr Every member of the frame tree (frame, desktop) must handle such re...
css::uno::Reference< css::frame::XDispatch > implts_getOrCreateDispatchHelper(EDispatchHelper eHelper, const css::uno::Reference< css::frame::XFrame > &xOwner, const OUString &sTarget=OUString(), sal_Int32 nSearchFlags=0)
get or create new dispatch helper @descr Sometimes we need some helper implementations to support dis...
css::uno::Reference< css::frame::XDispatch > implts_searchProtocolHandler(const css::util::URL &aURL)
search for a registered protocol handler and ask him for a dispatch object @descr We search a suitabl...
css::uno::Reference< css::frame::XDispatch > implts_queryFrameDispatch(const css::uno::Reference< css::frame::XFrame > &xFrame, const css::util::URL &aURL, const OUString &sTargetFrameName, sal_Int32 nSearchFlags)
css::uno::WeakReference< css::frame::XFrame > m_xFrame
weakreference to owner frame (Don't use a hard reference. Owner can't delete us then!...
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches(const css::uno::Sequence< css::frame::DispatchDescriptor > &lDescriptions) override
std::unordered_map< OUString, css::uno::Reference< css::frame::XDispatchProvider > > m_aProtocolHandlers
DispatchProvider(css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::frame::XFrame > &xFrame)
standard ctor/dtor @descr These initialize a new instance of this class with needed information for w...
HandlerCache m_aProtocolHandlerCache
cache of some other dispatch provider which are registered inside configuration to handle special URL...
bool implts_isLoadableContent(const css::util::URL &aURL)
check URL for support by our used loader or handler @descr If we must return our own dispatch helper ...
virtual ~DispatchProvider() override
protected(!) dtor for deinitializing @descr We made it protected to prevent using of us as base class...
css::uno::Reference< css::uno::XComponentContext > m_xContext
reference to global service manager to create new services
virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL &aURL, const OUString &sTargetFrameName, sal_Int32 nSearchFlags) override
EDispatchHelper
@descr We know some special dispatch objects with different functionality.