LibreOffice Module forms (master) 1
formnavigation.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
22#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
23#include <com/sun/star/frame/XStatusListener.hpp>
24#include <com/sun/star/uno/XComponentContext.hpp>
26#include "featuredispatcher.hxx"
28#include <vector>
29#include <map>
30#include <memory>
31
32
33namespace frm
34{
35
36
37 class UrlTransformer;
38
39
40 //= OFormNavigationHelper
41
42 typedef ::cppu::ImplHelper2 < css::frame::XDispatchProviderInterception
43 , css::frame::XStatusListener
45
48 ,public IFeatureDispatcher
49 {
50 private:
52 {
53 css::util::URL aURL;
54 css::uno::Reference< css::frame::XDispatch > xDispatcher;
57
58 FeatureInfo() : bCachedState( false ) { }
59 };
60 typedef ::std::map< sal_Int16, FeatureInfo > FeatureMap;
61
62 private:
63 css::uno::Reference< css::uno::XComponentContext >
67
68 // all supported features
70 // all features which we have an external dispatcher for
72
73 protected:
74 OFormNavigationHelper( const css::uno::Reference< css::uno::XComponentContext >& _rxORB );
75 virtual ~OFormNavigationHelper();
76
77 // XComponent
79 void dispose( );
80
81 // XDispatchProviderInterception
82 virtual void SAL_CALL registerDispatchProviderInterceptor( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& Interceptor ) override;
83 virtual void SAL_CALL releaseDispatchProviderInterceptor( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& Interceptor ) override;
84
85 // XStatusListener
86 virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& State ) override;
87
88 // XEventListener
89 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
90
91 // IFeatureDispatcher
92 virtual void dispatch( sal_Int16 _nFeatureId ) const override;
93 virtual void dispatchWithArgument( sal_Int16 _nFeatureId, const char* _pParamName, const css::uno::Any& _rParamValue ) const override;
94 virtual bool isEnabled( sal_Int16 _nFeatureId ) const override;
95 virtual bool getBooleanState( sal_Int16 _nFeatureId ) const override;
96 virtual OUString getStringState( sal_Int16 _nFeatureId ) const override;
97 virtual sal_Int32 getIntegerState( sal_Int16 _nFeatureId ) const override;
98
99 // own overridables
104 virtual void interceptorsChanged( );
105
120 virtual void featureStateChanged( sal_Int16 _nFeatureId, bool _bEnabled );
121
127 virtual void allFeatureStatesChanged( );
128
135 virtual void getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds ) = 0;
136
137 protected:
140 void updateDispatches();
141
144 void connectDispatchers();
145
149
152 css::uno::Reference< css::frame::XDispatch >
153 queryDispatch( const css::util::URL& _rURL );
154
163
164 private:
168 };
169
173 {
174 private:
175 ::std::unique_ptr< UrlTransformer > m_pUrlTransformer;
176
177 public:
179 const css::uno::Reference< css::uno::XComponentContext >& _rxORB
180 );
182
188 static const char* getFeatureURLAscii( sal_Int16 _nFeatureId );
189
197 bool getFeatureURL( sal_Int16 _nFeatureId, css::util::URL& /* [out] */ _rURL );
198
206 static sal_Int16 getFeatureId( std::u16string_view _rCompleteURL );
207
208 private:
211 };
212
213
214} // namespace frm
215
216
217/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
helper class for controls which allow some of their features to be intercepted by external instances
virtual void interceptorsChanged()
is called when the interceptors have.
virtual void dispatchWithArgument(sal_Int16 _nFeatureId, const char *_pParamName, const css::uno::Any &_rParamValue) const override
dispatches a feature, with an additional named parameter
void disconnectDispatchers()
disconnect from the dispatch interceptors
void updateDispatches()
update all our dispatches which are controlled by our dispatch interceptors
virtual OUString getStringState(sal_Int16 _nFeatureId) const override
returns the string state of a feature
virtual bool getBooleanState(sal_Int16 _nFeatureId) const override
returns the boolean state of a feature
OFormNavigationHelper(const css::uno::Reference< css::uno::XComponentContext > &_rxORB)
virtual void allFeatureStatesChanged()
notification for (potential) changes in the state of all features
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &State) override
virtual void SAL_CALL registerDispatchProviderInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterceptor > &Interceptor) override
virtual sal_Int32 getIntegerState(sal_Int16 _nFeatureId) const override
returns the integer state of a feature
void initializeSupportedFeatures()
initialize m_aSupportedFeatures, if necessary
virtual void SAL_CALL releaseDispatchProviderInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterceptor > &Interceptor) override
ControlFeatureInterception m_aFeatureInterception
css::uno::Reference< css::uno::XComponentContext > m_xORB
::std::map< sal_Int16, FeatureInfo > FeatureMap
css::uno::Reference< css::frame::XDispatch > queryDispatch(const css::util::URL &_rURL)
queries the interceptor chain for a dispatcher for the given URL
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
virtual bool isEnabled(sal_Int16 _nFeatureId) const override
checks whether a given feature is enabled
void connectDispatchers()
connect to the dispatch interceptors
virtual void getSupportedFeatures(::std::vector< sal_Int16 > &_rFeatureIds)=0
retrieves the list of supported features
virtual void featureStateChanged(sal_Int16 _nFeatureId, bool _bEnabled)
called when the status of a feature changed
virtual void dispatch(sal_Int16 _nFeatureId) const override
dispatches a feature
void invalidateSupportedFeaturesSet()
invalidates the set of supported features
helper class mapping between feature ids and feature URLs
bool getFeatureURL(sal_Int16 _nFeatureId, css::util::URL &_rURL)
retrieves the feature URL belonging to a feature id
OFormNavigationMapper & operator=(const OFormNavigationMapper &)=delete
OFormNavigationMapper(const OFormNavigationMapper &)=delete
::std::unique_ptr< UrlTransformer > m_pUrlTransformer
static const char * getFeatureURLAscii(sal_Int16 _nFeatureId)
retrieves the ASCII representation of a feature URL belonging to an id
static sal_Int16 getFeatureId(std::u16string_view _rCompleteURL)
retrieves the feature id belonging to a feature URL
OFormNavigationMapper(const css::uno::Reference< css::uno::XComponentContext > &_rxORB)
ListBox is a bit confusing / different from other form components, so here are a few notes:
Definition: BaseListBox.hxx:25
::cppu::ImplHelper2< css::frame::XDispatchProviderInterception, css::frame::XStatusListener > OFormNavigationHelper_Base
State
css::uno::Reference< css::frame::XDispatch > xDispatcher