2010-10-27 12:33:13 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-14 17:39:53 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2013-10-23 19:18:54 +02:00
|
|
|
#ifndef INCLUDED_DBACCESS_GENERICCONTROLLER_HXX
|
|
|
|
#define INCLUDED_DBACCESS_GENERICCONTROLLER_HXX
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2013-12-05 23:42:23 +01:00
|
|
|
#include <sal/config.h>
|
|
|
|
|
2013-12-06 10:17:37 +01:00
|
|
|
#include <deque>
|
2016-06-15 21:00:59 -07:00
|
|
|
#include <exception>
|
2013-12-06 10:17:37 +01:00
|
|
|
#include <map>
|
2016-06-15 21:00:59 -07:00
|
|
|
#include <memory>
|
2013-12-05 23:42:23 +01:00
|
|
|
#include <vector>
|
|
|
|
|
2016-06-15 21:00:59 -07:00
|
|
|
#include <boost/optional.hpp>
|
2008-03-06 16:55:59 +00:00
|
|
|
|
2016-06-15 21:00:59 -07:00
|
|
|
#include <com/sun/star/awt/XUserInputInterception.hpp>
|
2008-03-06 16:55:59 +00:00
|
|
|
#include <com/sun/star/frame/CommandGroup.hpp>
|
2016-06-15 21:00:59 -07:00
|
|
|
#include <com/sun/star/frame/DispatchInformation.hpp>
|
2008-06-06 12:54:25 +00:00
|
|
|
#include <com/sun/star/frame/XController2.hpp>
|
2007-07-06 06:50:17 +00:00
|
|
|
#include <com/sun/star/frame/XDispatch.hpp>
|
2008-03-06 16:55:59 +00:00
|
|
|
#include <com/sun/star/frame/XDispatchInformationProvider.hpp>
|
2007-07-06 06:50:17 +00:00
|
|
|
#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
|
2016-06-15 21:00:59 -07:00
|
|
|
#include <com/sun/star/frame/XLayoutManager.hpp>
|
2008-04-04 13:29:58 +00:00
|
|
|
#include <com/sun/star/frame/XTitle.hpp>
|
|
|
|
#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
|
2016-06-15 21:00:59 -07:00
|
|
|
#include <com/sun/star/lang/EventObject.hpp>
|
2007-07-06 06:50:17 +00:00
|
|
|
#include <com/sun/star/lang/XInitialization.hpp>
|
|
|
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
2016-06-15 21:00:59 -07:00
|
|
|
#include <com/sun/star/uno/Any.hxx>
|
|
|
|
#include <com/sun/star/uno/Exception.hpp>
|
|
|
|
#include <com/sun/star/uno/Reference.hxx>
|
|
|
|
#include <com/sun/star/uno/RuntimeException.hpp>
|
|
|
|
#include <com/sun/star/uno/Sequence.hxx>
|
|
|
|
#include <com/sun/star/util/URL.hpp>
|
2008-03-06 16:55:59 +00:00
|
|
|
#include <com/sun/star/util/XModifyListener.hpp>
|
2008-12-01 12:31:27 +00:00
|
|
|
#include <comphelper/sharedmutex.hxx>
|
2007-07-06 06:50:17 +00:00
|
|
|
#include <comphelper/namedvaluecollection.hxx>
|
2008-03-06 16:55:59 +00:00
|
|
|
#include <connectivity/dbexception.hxx>
|
2015-07-17 11:59:26 +09:00
|
|
|
#include <cppuhelper/compbase.hxx>
|
2008-03-06 16:55:59 +00:00
|
|
|
#include <cppuhelper/interfacecontainer.h>
|
2016-06-15 21:00:59 -07:00
|
|
|
#include <dbaccess/AsynchronousLink.hxx>
|
|
|
|
#include <dbaccess/controllerframe.hxx>
|
|
|
|
#include <dbaccess/dbaccessdllapi.h>
|
|
|
|
#include <dbaccess/IController.hxx>
|
|
|
|
#include <osl/mutex.hxx>
|
|
|
|
#include <rtl/string.hxx>
|
|
|
|
#include <rtl/ustring.hxx>
|
|
|
|
#include <sal/types.h>
|
|
|
|
#include <tools/link.hxx>
|
2015-03-09 14:29:30 +02:00
|
|
|
#include <vcl/vclptr.hxx>
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2016-06-15 21:00:59 -07:00
|
|
|
namespace com { namespace sun { namespace star {
|
|
|
|
namespace awt { class XKeyHandler; }
|
|
|
|
namespace awt { class XMouseClickHandler; }
|
|
|
|
namespace awt { class XWindow; }
|
|
|
|
namespace beans { struct PropertyValue; }
|
|
|
|
namespace frame { class XController; }
|
|
|
|
namespace frame { class XDispatchProvider; }
|
|
|
|
namespace frame { class XFrame; }
|
|
|
|
namespace frame { class XFrameActionListener; }
|
|
|
|
namespace frame { class XModel; }
|
|
|
|
namespace frame { class XStatusListener; }
|
|
|
|
namespace frame { class XTitleChangeListener; }
|
|
|
|
namespace frame { struct DispatchDescriptor; }
|
|
|
|
namespace frame { struct FrameActionEvent; }
|
|
|
|
namespace lang { class XEventListener; }
|
|
|
|
namespace sdb { class XDatabaseContext; }
|
|
|
|
namespace sdbc { class XConnection; }
|
|
|
|
namespace sdbc { class XDataSource; }
|
|
|
|
namespace ui { class XSidebarProvider; }
|
|
|
|
namespace uno { class XComponentContext; }
|
|
|
|
namespace util { class XURLTransformer; }
|
|
|
|
} } }
|
2008-12-01 12:31:27 +00:00
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
namespace vcl { class Window; }
|
2018-02-19 16:33:35 +00:00
|
|
|
namespace weld { class Window; }
|
2016-06-15 21:00:59 -07:00
|
|
|
class NotifyEvent;
|
|
|
|
|
2007-07-06 06:50:17 +00:00
|
|
|
namespace dbaui
|
|
|
|
{
|
|
|
|
class ODataView;
|
|
|
|
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2007-07-06 06:50:17 +00:00
|
|
|
// = optional
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2008-10-01 12:28:29 +00:00
|
|
|
/** convenience wrapper around boost::optional, allowing typed assignments
|
2007-07-06 06:50:17 +00:00
|
|
|
*/
|
|
|
|
template < typename T >
|
|
|
|
class optional : public ::boost::optional< T >
|
|
|
|
{
|
|
|
|
typedef ::boost::optional< T > base_type;
|
|
|
|
|
|
|
|
public:
|
|
|
|
optional ( ) : base_type( ) { }
|
|
|
|
explicit optional ( T const& val ) : base_type( val ) { }
|
2015-03-29 15:13:23 +02:00
|
|
|
optional ( optional const& rhs ) : base_type( static_cast<base_type const&>(rhs) ) { }
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
optional& operator= ( T const& rhs )
|
|
|
|
{
|
|
|
|
base_type::reset( rhs );
|
|
|
|
return *this;
|
|
|
|
}
|
CWS-TOOLING: integrate CWS boost134
2009-09-09 10:30:24 +0200 fs r275970 : #i100127# provided by rene: check whether system-boost's function.hpp compiles without exception support
2009-09-04 21:58:00 +0200 fs r275832 : indention
2009-09-04 21:57:10 +0200 fs r275831 : #i10000# type in boost/spirit check. Thanks to thb
2009-09-04 10:58:54 +0200 fs r275787 : #i100127# provided by tono@openoffice.org: mingw needs using directives for std::min/max
2009-09-04 10:31:54 +0200 fs r275782 : #i100127# (approved by hjs) on Solaris, set GNUTAR to /usr/sfw/bin/gtar, this is available on baseline machines (Solaris 10.x), but not necessarily available in LD_LIBRARY_PATH
2009-08-19 21:47:55 +0200 rene r275161 : #i10000# check for the header actually used now
2009-08-17 21:55:31 +0200 fs r275073 : CWS-TOOLING: rebase CWS boost134 to trunk@275001 (milestone: DEV300:m55)
2009-07-16 09:39:25 +0200 fs r274031 : #i100127# extract download/% with GNUTAR instead of TAR
2009-07-14 09:18:15 +0200 fs r273960 : CWS-TOOLING: rebase CWS boost134 to trunk@273858 (milestone: DEV300:m52)
2009-07-13 09:55:14 +0200 fs r273919 : #i100127# use boost 1.39, not 1.34
2009-07-13 09:45:57 +0200 fs r273918 : use GNUTAR when extracting download/%.tar.gz, not TAR (necessary with boost 1.39 tarball)
2009-07-10 21:10:52 +0200 fs r273905 : #i100127# spirit now part of boost
2009-07-06 12:12:13 +0200 fs r273732 : #i10000# lngconvex, used in src/wizards, is built in shell => added missing module dependency
2009-07-02 15:34:51 +0200 fs r273660 : #i100127#
2009-07-02 13:35:24 +0200 fs r273645 : #i100127# MSVC needs some hinting when using boost::bind on (some) member functions
2009-07-02 10:33:59 +0200 fs r273625 : removed unused include (lead to an internal compiler error with MSVC and boost 1.34+)
2009-07-02 09:44:35 +0200 fs r273619 : change some include orders, prevents 'internal compiler errors' with MSVC
2009-07-01 09:19:25 +0200 fs r273547 : #i100127# who the heck is defining max as something unusable?
2009-07-01 09:17:28 +0200 fs r273546 : #i100127# defining min/max is causing trouble now
2009-07-01 09:15:40 +0200 fs r273545 : #i100127# reverted previous patch, and properly fixed the problem by defining BOOST_MEM_FN_ENABLE_CDECL, and disabling warning 4180
2009-07-01 09:14:23 +0200 fs r273544 : #i100127# re-disable warning 4180, still needed for some files
2009-07-01 09:07:33 +0200 fs r273543 : #i100127# reverted previous patch, and properly fixed the problem by defining BOOST_MEM_FN_ENABLE_CDECL
2009-06-24 11:00:32 +0200 fs r273319 : oops, re-introduced some inc locations
2009-06-23 22:10:02 +0200 fs r273304 : #i100127# disable warning C4180
2009-06-23 22:08:36 +0200 fs r273303 : #i100127# disable warning C4180
2009-06-16 12:26:49 +0200 fs r273015 : #i10000# (provided by mst@openoffice.org)
2009-06-15 09:10:27 +0200 fs r272962 : #i10000# use -r instead of -a when copying the include files, this prevents the spurious 'failed to preserve ownership' errors
2009-06-11 23:55:06 +0200 fs r272902 : #i100127#
2009-06-11 23:54:47 +0200 fs r272901 : #i100127#
2009-06-11 23:54:05 +0200 fs r272900 : make compile on unxsol[i|s]4
2009-06-10 10:12:22 +0200 fs r272798 : #i100127# don't deliver from within unxlngi6/misc/build/boost, but from a 'normalized' location unxlngi6/inc
2009-06-10 09:48:00 +0200 fs r272795 : #i100127# use 1.34.1 unconditionally on all platforms
2009-09-17 10:11:42 +00:00
|
|
|
optional& operator= ( optional< T > const& rhs )
|
|
|
|
{
|
|
|
|
if ( rhs.is_initialized() )
|
|
|
|
base_type::reset( rhs.get() );
|
|
|
|
else
|
|
|
|
base_type::reset();
|
|
|
|
return *this;
|
|
|
|
}
|
2007-07-06 06:50:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template< typename T >
|
2015-10-20 11:11:25 +02:00
|
|
|
inline bool SAL_CALL operator >>= ( const css::uno::Any & _any, optional< T >& _value )
|
2007-07-06 06:50:17 +00:00
|
|
|
{
|
|
|
|
_value.reset(); // de-init the optional value
|
|
|
|
|
2007-07-09 07:44:32 +00:00
|
|
|
T directValue = T();
|
2007-07-06 06:50:17 +00:00
|
|
|
if ( _any >>= directValue )
|
|
|
|
_value.reset( directValue );
|
|
|
|
|
|
|
|
return !!_value;
|
|
|
|
}
|
|
|
|
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2007-07-06 06:50:17 +00:00
|
|
|
// = FeatureState
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2007-07-06 06:50:17 +00:00
|
|
|
/** describes the state of a feature
|
|
|
|
|
|
|
|
In opposite to the FeatureStateEvent in css.frame, this one allows for multiple states to be specified at once.
|
|
|
|
With this, you can for instance specify that a toolbox item is checked, and has a certain title, at the same
|
|
|
|
time.
|
|
|
|
*/
|
|
|
|
struct FeatureState
|
|
|
|
{
|
2014-04-01 09:53:24 +02:00
|
|
|
bool bEnabled;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
optional< bool > bChecked;
|
2008-03-05 16:04:19 +00:00
|
|
|
optional< bool > bInvisible;
|
2015-10-20 11:11:25 +02:00
|
|
|
css::uno::Any aValue;
|
|
|
|
optional< OUString > sTitle;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2014-04-01 09:53:24 +02:00
|
|
|
FeatureState() : bEnabled(false) { }
|
2007-07-06 06:50:17 +00:00
|
|
|
};
|
|
|
|
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2007-07-06 06:50:17 +00:00
|
|
|
// = helper
|
|
|
|
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
struct ControllerFeature : public css::frame::DispatchInformation
|
2007-07-06 06:50:17 +00:00
|
|
|
{
|
|
|
|
sal_uInt16 nFeatureId;
|
|
|
|
};
|
|
|
|
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
typedef ::std::map < OUString
|
2007-07-06 06:50:17 +00:00
|
|
|
, ControllerFeature
|
2013-04-07 12:06:47 +02:00
|
|
|
, ::std::less< OUString >
|
2007-07-06 06:50:17 +00:00
|
|
|
> SupportedFeatures;
|
|
|
|
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2017-07-04 12:23:19 +02:00
|
|
|
class CompareFeatureById
|
2007-07-06 06:50:17 +00:00
|
|
|
{
|
2017-07-04 12:23:19 +02:00
|
|
|
const sal_Int32 m_nId;
|
|
|
|
public:
|
|
|
|
CompareFeatureById(sal_Int32 _nId) : m_nId(_nId)
|
|
|
|
{}
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2017-07-04 12:23:19 +02:00
|
|
|
bool operator()( const SupportedFeatures::value_type& _aType ) const
|
2007-07-06 06:50:17 +00:00
|
|
|
{
|
2017-07-04 12:23:19 +02:00
|
|
|
return m_nId == _aType.second.nFeatureId;
|
2007-07-06 06:50:17 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2008-10-01 12:28:29 +00:00
|
|
|
struct FeatureListener
|
2007-07-06 06:50:17 +00:00
|
|
|
{
|
2015-10-20 11:11:25 +02:00
|
|
|
css::uno::Reference< css::frame::XStatusListener >
|
2007-07-06 06:50:17 +00:00
|
|
|
xListener;
|
|
|
|
sal_Int32 nId;
|
2014-04-01 09:53:24 +02:00
|
|
|
bool bForceBroadcast;
|
2008-10-01 12:28:29 +00:00
|
|
|
};
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2017-07-04 12:23:19 +02:00
|
|
|
class FindFeatureListener
|
2007-07-06 06:50:17 +00:00
|
|
|
{
|
2017-07-04 12:23:19 +02:00
|
|
|
const css::uno::Reference< css::frame::XStatusListener >& m_xListener;
|
|
|
|
public:
|
|
|
|
FindFeatureListener(const css::uno::Reference< css::frame::XStatusListener >& _xListener)
|
|
|
|
: m_xListener(_xListener)
|
|
|
|
{}
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2017-07-04 12:23:19 +02:00
|
|
|
bool operator()( const FeatureListener& lhs ) const
|
2007-07-06 06:50:17 +00:00
|
|
|
{
|
2017-07-04 12:23:19 +02:00
|
|
|
return lhs.xListener == m_xListener;
|
2007-07-06 06:50:17 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
typedef ::comphelper::SharedMutexBase OGenericUnoController_MBASE;
|
2008-03-06 16:55:59 +00:00
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
typedef ::cppu::WeakComponentImplHelper< css::frame::XDispatch
|
|
|
|
, css::frame::XDispatchProviderInterceptor
|
|
|
|
, css::util::XModifyListener
|
|
|
|
, css::frame::XFrameActionListener
|
|
|
|
, css::lang::XInitialization
|
|
|
|
, css::lang::XServiceInfo
|
|
|
|
, css::frame::XDispatchInformationProvider
|
|
|
|
, css::frame::XController2
|
|
|
|
, css::frame::XTitle
|
|
|
|
, css::frame::XTitleChangeBroadcaster
|
|
|
|
, css::awt::XUserInputInterception
|
2015-07-17 11:59:26 +09:00
|
|
|
> OGenericUnoController_Base;
|
2008-03-06 16:55:59 +00:00
|
|
|
|
2008-06-25 11:28:36 +00:00
|
|
|
struct OGenericUnoController_Data;
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2008-03-06 16:55:59 +00:00
|
|
|
class DBACCESS_DLLPUBLIC OGenericUnoController
|
|
|
|
:public OGenericUnoController_MBASE
|
|
|
|
,public OGenericUnoController_Base
|
2007-07-06 06:50:17 +00:00
|
|
|
,public IController
|
|
|
|
{
|
|
|
|
private:
|
2008-06-25 11:28:36 +00:00
|
|
|
SupportedFeatures m_aSupportedFeatures;
|
2007-07-06 06:50:17 +00:00
|
|
|
::comphelper::NamedValueCollection
|
2008-06-25 11:28:36 +00:00
|
|
|
m_aInitParameters;
|
|
|
|
|
2014-09-24 18:50:37 +02:00
|
|
|
::std::unique_ptr< OGenericUnoController_Data >
|
2008-06-25 11:28:36 +00:00
|
|
|
m_pData;
|
2015-03-09 14:29:30 +02:00
|
|
|
VclPtr<ODataView> m_pView; // our (VCL) "main window"
|
2008-06-25 11:28:36 +00:00
|
|
|
|
2007-07-06 06:50:17 +00:00
|
|
|
#ifdef DBG_UTIL
|
2010-02-09 17:26:40 +01:00
|
|
|
bool m_bDescribingSupportedFeatures;
|
2007-07-06 06:50:17 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2007-07-06 06:50:17 +00:00
|
|
|
// attributes
|
|
|
|
struct DispatchTarget
|
|
|
|
{
|
2015-10-20 11:11:25 +02:00
|
|
|
css::util::URL aURL;
|
|
|
|
css::uno::Reference< css::frame::XStatusListener > xListener;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
DispatchTarget(const css::util::URL& rURL, const css::uno::Reference< css::frame::XStatusListener >& rRef) : aURL(rURL), xListener(rRef) { }
|
2007-07-06 06:50:17 +00:00
|
|
|
};
|
|
|
|
|
2013-12-06 10:17:37 +01:00
|
|
|
typedef std::map<sal_uInt16, FeatureState> StateCache;
|
2013-12-05 23:42:23 +01:00
|
|
|
typedef std::vector<DispatchTarget> Dispatch;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2017-12-18 14:24:50 +02:00
|
|
|
::std::deque< FeatureListener >
|
|
|
|
m_aFeaturesToInvalidate;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
::osl::Mutex m_aFeatureMutex; // locked when features are append to or remove from deque
|
|
|
|
StateCache m_aStateCache; // save the current status of feature state
|
|
|
|
Dispatch m_arrStatusListener; // all our listeners where we dispatch status changes
|
2015-10-20 11:11:25 +02:00
|
|
|
OAsynchronousLink m_aAsyncInvalidateAll;
|
|
|
|
OAsynchronousLink m_aAsyncCloseTask; // called when a task should be closed
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
css::uno::Reference< css::util::XURLTransformer > m_xUrlTransformer; // needed sometimes
|
|
|
|
css::uno::Reference< css::uno::XComponentContext > m_xContext;
|
2008-03-06 16:55:59 +00:00
|
|
|
ControllerFrame m_aCurrentFrame;
|
2015-10-20 11:11:25 +02:00
|
|
|
css::uno::Reference< css::frame::XDispatchProvider > m_xSlaveDispatcher; // for intercepting dispatches
|
|
|
|
css::uno::Reference< css::frame::XDispatchProvider > m_xMasterDispatcher; // dito
|
|
|
|
css::uno::Reference< css::sdb::XDatabaseContext > m_xDatabaseContext;
|
|
|
|
css::uno::Reference< css::frame::XTitle > m_xTitleHelper;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2014-04-01 09:53:24 +02:00
|
|
|
bool m_bPreview;
|
|
|
|
bool m_bReadOnly;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2014-04-01 09:53:24 +02:00
|
|
|
bool m_bCurrentlyModified : 1;
|
|
|
|
bool m_bExternalTitle : 1;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
// attribute access
|
2016-10-22 10:04:52 +02:00
|
|
|
using OGenericUnoController_MBASE::getMutex;
|
2008-12-01 12:31:27 +00:00
|
|
|
::cppu::OBroadcastHelper& getBroadcastHelper() { return OGenericUnoController_Base::rBHelper; }
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2014-02-25 19:06:16 +01:00
|
|
|
|
2007-07-06 06:50:17 +00:00
|
|
|
// methods
|
2015-10-20 11:11:25 +02:00
|
|
|
OGenericUnoController( const css::uno::Reference< css::uno::XComponentContext >& _rM );
|
2018-01-31 12:34:32 +03:00
|
|
|
OGenericUnoController() = delete;
|
2007-07-06 06:50:17 +00:00
|
|
|
const ::comphelper::NamedValueCollection&
|
|
|
|
getInitParams() const { return m_aInitParameters; }
|
|
|
|
|
|
|
|
// closes the task when possible
|
|
|
|
void closeTask();
|
|
|
|
|
|
|
|
// if getMenu returns a non empty string than this will be dispatched at the frame
|
2015-10-20 11:11:25 +02:00
|
|
|
virtual void loadMenu(const css::uno::Reference< css::frame::XFrame >& _xFrame);
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
/** called when our menu has been loaded into our frame, can be used to load sub toolbars
|
|
|
|
|
|
|
|
@param _xLayoutManager
|
|
|
|
The layout manager.
|
|
|
|
*/
|
2015-10-20 11:11:25 +02:00
|
|
|
virtual void onLoadedMenu(const css::uno::Reference< css::frame::XLayoutManager >& _xLayoutManager);
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
// all the features which should be handled by this class
|
|
|
|
virtual void describeSupportedFeatures();
|
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
// state of a feature. 'feature' may be the handle of a css::util::URL somebody requested a dispatch interface for OR a toolbar slot.
|
2007-07-06 06:50:17 +00:00
|
|
|
virtual FeatureState GetState(sal_uInt16 nId) const;
|
|
|
|
// execute a feature
|
2015-10-20 11:11:25 +02:00
|
|
|
virtual void Execute(sal_uInt16 nId , const css::uno::Sequence< css::beans::PropertyValue>& aArgs);
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
/** describes a feature supported by the controller
|
|
|
|
|
|
|
|
Must not be called outside <member>describeSupportedFeatures</member>.
|
|
|
|
|
|
|
|
@param _pAsciiCommandURL
|
|
|
|
the URL of the feature command
|
|
|
|
@param _nFeatureId
|
|
|
|
the id of the feature. Later references to this feature usually happen by id, not by
|
|
|
|
URL
|
|
|
|
@param _nCommandGroup
|
|
|
|
the command group of the feature. This is important for configuring the controller UI
|
2015-10-20 11:11:25 +02:00
|
|
|
by the user, see also <type scope="css::frame">CommandGroup</type>.
|
2007-07-06 06:50:17 +00:00
|
|
|
*/
|
|
|
|
void implDescribeSupportedFeature(
|
|
|
|
const sal_Char* _pAsciiCommandURL,
|
|
|
|
sal_uInt16 _nFeatureId,
|
2015-10-20 11:11:25 +02:00
|
|
|
sal_Int16 _nCommandGroup = css::frame::CommandGroup::INTERNAL
|
2007-07-06 06:50:17 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
/** returns <TRUE/> if the feature is supported, otherwise <FALSE/>
|
|
|
|
@param _nId
|
|
|
|
The ID of the feature.
|
|
|
|
*/
|
2014-04-01 09:53:24 +02:00
|
|
|
bool isFeatureSupported( sal_Int32 _nId );
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
// gets the URL which the given id is assigned to
|
2015-10-20 11:11:25 +02:00
|
|
|
css::util::URL getURLForId(sal_Int32 _nId) const;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2008-06-25 11:28:36 +00:00
|
|
|
/** determines whether the given feature ID denotes a user-defined feature
|
|
|
|
|
|
|
|
@see IController::registerCommandURL
|
|
|
|
*/
|
2015-04-24 15:29:31 +02:00
|
|
|
static bool isUserDefinedFeature( const sal_uInt16 nFeatureId );
|
2008-10-01 12:28:29 +00:00
|
|
|
|
|
|
|
/** determines whether the given feature URL denotes a user-defined feature
|
|
|
|
|
|
|
|
@see IController::registerCommandURL
|
|
|
|
*/
|
2013-04-07 12:06:47 +02:00
|
|
|
bool isUserDefinedFeature( const OUString& _rFeatureURL ) const;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
// connect to a datasource
|
2015-10-20 11:11:25 +02:00
|
|
|
css::uno::Reference< css::sdbc::XConnection > connect(
|
2016-09-12 12:56:25 +02:00
|
|
|
const css::uno::Reference< css::sdbc::XDataSource>& _xDataSource
|
2007-07-06 06:50:17 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
// connect to a datasource
|
2015-10-20 11:11:25 +02:00
|
|
|
css::uno::Reference< css::sdbc::XConnection > connect(
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& _rsDataSourceName,
|
|
|
|
const OUString& _rContextInformation,
|
2008-12-01 12:31:27 +00:00
|
|
|
::dbtools::SQLExceptionInfo* _pErrorInfo
|
2007-07-06 06:50:17 +00:00
|
|
|
);
|
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
void startConnectionListening(const css::uno::Reference< css::sdbc::XConnection >& _rxConnection);
|
|
|
|
void stopConnectionListening(const css::uno::Reference< css::sdbc::XConnection >& _rxConnection);
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
/** return the container window of the top most frame
|
|
|
|
@return
|
|
|
|
The top most container window, nmay be <NULL/>.
|
|
|
|
*/
|
2015-10-20 11:11:25 +02:00
|
|
|
css::uno::Reference< css::awt::XWindow> getTopMostContainerWindow() const;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
// XInitialize will be called inside initialize
|
|
|
|
virtual void impl_initialize();
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
virtual OUString getPrivateTitle() const { return OUString(); }
|
2008-04-04 13:29:58 +00:00
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
css::uno::Reference< css::frame::XTitle > impl_getTitleHelper_throw();
|
|
|
|
virtual css::uno::Reference< css::frame::XModel > getPrivateModel() const
|
2008-04-04 13:29:58 +00:00
|
|
|
{
|
2015-10-20 11:11:25 +02:00
|
|
|
return css::uno::Reference< css::frame::XModel >();
|
2008-04-04 13:29:58 +00:00
|
|
|
}
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
virtual void startFrameListening( const css::uno::Reference< css::frame::XFrame >& _rxFrame );
|
|
|
|
virtual void stopFrameListening( const css::uno::Reference< css::frame::XFrame >& _rxFrame );
|
2008-03-06 16:55:59 +00:00
|
|
|
|
2008-10-01 12:28:29 +00:00
|
|
|
void releaseNumberForComponent();
|
|
|
|
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~OGenericUnoController() override;
|
2008-06-25 11:28:36 +00:00
|
|
|
|
2007-07-06 06:50:17 +00:00
|
|
|
private:
|
2008-06-25 11:28:36 +00:00
|
|
|
void fillSupportedFeatures();
|
|
|
|
|
2007-07-06 06:50:17 +00:00
|
|
|
void InvalidateAll_Impl();
|
|
|
|
void InvalidateFeature_Impl();
|
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
void ImplInvalidateFeature( sal_Int32 _nId, const css::uno::Reference< css::frame::XStatusListener >& _xListener, bool _bForceBroadcast );
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
void ImplBroadcastFeatureState(const OUString& _rFeature, const css::uno::Reference< css::frame::XStatusListener > & xListener, bool _bIgnoreCache);
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
// link methods
|
2016-10-05 07:56:12 +02:00
|
|
|
DECL_LINK(OnAsyncInvalidateAll, void*, void);
|
|
|
|
DECL_LINK(OnAsyncCloseTask, void*, void);
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
public:
|
2016-04-13 10:44:57 +02:00
|
|
|
const css::uno::Reference< css::uno::XComponentContext >& getORB() const { return m_xContext; }
|
2010-02-09 17:26:40 +01:00
|
|
|
ODataView* getView() const { return m_pView; }
|
2018-02-19 16:33:35 +00:00
|
|
|
weld::Window* getFrameWeld() const;
|
2015-04-20 14:00:04 +01:00
|
|
|
void setView( const VclPtr<ODataView>& i_rView );
|
2015-03-09 14:29:30 +02:00
|
|
|
void clearView();
|
2007-07-06 06:50:17 +00:00
|
|
|
// shows a error box if the SQLExceptionInfo is valid
|
|
|
|
void showError(const ::dbtools::SQLExceptionInfo& _rInfo);
|
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
// if there is an css::util::URL translation for the id
|
2016-04-26 09:56:47 +02:00
|
|
|
// ('handle') then if xListener is NULL the change will be forwarded
|
2015-10-20 11:11:25 +02:00
|
|
|
// to all listeners to the given css::util::URL
|
2007-07-06 06:50:17 +00:00
|
|
|
// if there is a toolbar slot with the given id it is updated (the new state is determined via GetState)
|
|
|
|
// if _bForceBroadcast is sal_True, the current feature state is broadcasted no matter if it is the same as the cached state
|
2015-11-10 10:13:39 +01:00
|
|
|
void InvalidateFeature(sal_uInt16 nId, const css::uno::Reference< css::frame::XStatusListener > & xListener = nullptr, bool _bForceBroadcast = false);
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
/** InvalidateAll invalidates all features currently known
|
|
|
|
*/
|
2015-01-20 12:38:10 +02:00
|
|
|
void InvalidateAll();
|
2007-07-06 06:50:17 +00:00
|
|
|
// late construction
|
2014-09-23 11:20:40 +02:00
|
|
|
virtual bool Construct(vcl::Window* pParent);
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
/** get the layout manager
|
|
|
|
@param _xFrame
|
|
|
|
The frame to ask for the layout manager.
|
|
|
|
@return
|
|
|
|
The layout manager of the frame, can be <NULL/> if the frame isn't initialized.
|
|
|
|
*/
|
2015-10-20 11:11:25 +02:00
|
|
|
static css::uno::Reference< css::frame::XLayoutManager > getLayoutManager(const css::uno::Reference< css::frame::XFrame >& _xFrame);
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
// IController
|
2015-10-20 11:11:25 +02:00
|
|
|
virtual void executeUnChecked(const css::util::URL& _rCommand, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
|
|
|
|
virtual void executeChecked(const css::util::URL& _rCommand, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
|
|
|
|
virtual void executeUnChecked(sal_uInt16 _nCommandId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
|
|
|
|
virtual void executeChecked(sal_uInt16 _nCommandId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual bool isCommandEnabled(sal_uInt16 _nCommandId) const override;
|
|
|
|
virtual bool isCommandEnabled(const OUString& _rCompleteCommandURL) const override;
|
|
|
|
virtual void notifyHiContrastChanged() override;
|
|
|
|
virtual bool isDataSourceReadOnly() const override;
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual css::uno::Reference< css::frame::XController > getXController() override;
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual bool interceptUserInput( const NotifyEvent& _rEvent ) override;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
// misc
|
2015-01-20 12:38:10 +02:00
|
|
|
bool isCommandChecked(sal_uInt16 _nCommandId) const;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
// css::lang::XEventListener
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
// css::util::XModifyListener
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL modified(const css::lang::EventObject& aEvent) override;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
// XInterface
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void SAL_CALL acquire( ) throw () override;
|
|
|
|
virtual void SAL_CALL release( ) throw () override;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
// css::frame::XController2
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow() override;
|
|
|
|
virtual OUString SAL_CALL getViewControllerName() override;
|
|
|
|
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCreationArguments() override;
|
2008-06-06 12:54:25 +00:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual css::uno::Reference< css::ui::XSidebarProvider > SAL_CALL getSidebar() override;
|
2015-04-30 16:56:14 +02:00
|
|
|
|
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
// css::frame::XController
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL attachFrame(const css::uno::Reference< css::frame::XFrame > & xFrame) override;
|
|
|
|
virtual sal_Bool SAL_CALL attachModel(const css::uno::Reference< css::frame::XModel > & xModel) override;
|
|
|
|
virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) override = 0;
|
|
|
|
virtual css::uno::Any SAL_CALL getViewData() override;
|
|
|
|
virtual void SAL_CALL restoreViewData(const css::uno::Any& Data) override;
|
|
|
|
virtual css::uno::Reference< css::frame::XModel > SAL_CALL getModel() override;
|
|
|
|
virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame() override;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
// css::frame::XDispatch
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL dispatch(const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
|
|
|
|
virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > & aListener, const css::util::URL& aURL) override;
|
|
|
|
virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener > & aListener, const css::util::URL& aURL) override;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
// css::frame::XDispatchProviderInterceptor
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider() override;
|
|
|
|
virtual void SAL_CALL setSlaveDispatchProvider(const css::uno::Reference< css::frame::XDispatchProvider > & _xNewProvider) override;
|
|
|
|
virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider() override;
|
|
|
|
virtual void SAL_CALL setMasterDispatchProvider(const css::uno::Reference< css::frame::XDispatchProvider > & _xNewProvider) override;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
// css::frame::XDispatchProvider
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags) override;
|
|
|
|
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches(const css::uno::Sequence< css::frame::DispatchDescriptor >& aDescripts) override;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
// css::lang::XComponent
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL dispose() override; //LLA: need solar mutex {OGenericUnoController_COMPBASE::dispose(); }
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void SAL_CALL disposing() override;
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override;
|
|
|
|
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2015-10-20 11:11:25 +02:00
|
|
|
// css::frame::XFrameActionListener
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) override;
|
2007-07-06 06:50:17 +00:00
|
|
|
// lang::XInitialization
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
// XServiceInfo
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual OUString SAL_CALL getImplementationName() override = 0;
|
|
|
|
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
|
|
|
|
virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override = 0;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
// XDispatchInformationProvider
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual css::uno::Sequence< ::sal_Int16 > SAL_CALL getSupportedCommandGroups() override;
|
|
|
|
virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( ::sal_Int16 ) override;
|
2007-07-06 06:50:17 +00:00
|
|
|
|
2008-04-04 13:29:58 +00:00
|
|
|
// XTitle
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual OUString SAL_CALL getTitle( ) override;
|
|
|
|
virtual void SAL_CALL setTitle( const OUString& sTitle ) override;
|
2008-04-04 13:29:58 +00:00
|
|
|
|
|
|
|
// XTitleChangeBroadcaster
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL addTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) override;
|
|
|
|
virtual void SAL_CALL removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) override;
|
2008-04-08 11:46:07 +00:00
|
|
|
|
2008-06-25 11:28:36 +00:00
|
|
|
// XUserInputInterception
|
2017-01-26 12:28:58 +01:00
|
|
|
virtual void SAL_CALL addKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler ) override;
|
|
|
|
virtual void SAL_CALL removeKeyHandler( const css::uno::Reference< css::awt::XKeyHandler >& xHandler ) override;
|
|
|
|
virtual void SAL_CALL addMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler ) override;
|
|
|
|
virtual void SAL_CALL removeMouseClickHandler( const css::uno::Reference< css::awt::XMouseClickHandler >& xHandler ) override;
|
2007-07-06 06:50:17 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2013-10-23 19:18:54 +02:00
|
|
|
#endif // INCLUDED_DBACCESS_GENERICCONTROLLER_HXX
|
2007-07-06 06:50:17 +00:00
|
|
|
|
|
|
|
|
2010-10-27 12:33:13 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|