Tag: cws_src680_oj14 User: oj Date: 2006/11/07 00:25:30 Modified: dba/dbaccess/inc/genericcontroller.hxx
Log: merge changes File Changes: Directory: /dba/dbaccess/inc/ ============================= File [changed]: genericcontroller.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/inc/genericcontroller.hxx?r1=1.1.2.4&r2=1.1.2.5 Delta lines: +62 -10 --------------------- --- genericcontroller.hxx 11 Jul 2006 10:57:54 -0000 1.1.2.4 +++ genericcontroller.hxx 7 Nov 2006 08:25:27 -0000 1.1.2.5 @@ -4,9 +4,9 @@ * * $RCSfile: genericcontroller.hxx,v $ * - * $Revision: 1.1.2.4 $ + * $Revision: 1.1.2.5 $ * - * last change: $Author: oj $ $Date: 2006/07/11 10:57:54 $ + * last change: $Author: oj $ $Date: 2006/11/07 08:25:27 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -104,6 +104,11 @@ #endif #ifndef INCLUDED_DBACCESSDLLAPI_H #include "dbaccessdllapi.h" +#ifndef COMPHELPER_NAMEDVALUECOLLECTION_HXX +#include <comphelper/namedvaluecollection.hxx> +#endif + +#include <boost/optional.hpp> #endif #ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_ #include <com/sun/star/uno/XComponentContext.hpp> @@ -129,21 +134,63 @@ typedef ::cppu::ImplHelper1 < ::com::sun::star::frame::XController > OGenericUnoController_CTRBASE; - // a smaller version of the FeatureEvent to be broadcasted by an ::com::sun::star::frame::XController - // ------------------------------------------------------------------------- + // ==================================================================== + // = optional + // ==================================================================== + /** convenience wrapper around boost::optional, allowing type assignments + */ + 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 ) { } + optional ( optional const& rhs ) : base_type( (base_type const&)rhs ) { } + + public: + optional& operator= ( T const& rhs ) + { + base_type::reset( rhs ); + return *this; + } + }; + + template< typename T > + inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & _any, optional< T >& _value ) + { + _value.reset(); // de-init the optional value + + T directValue; + if ( _any >>= directValue ) + _value.reset( directValue ); + + return !!_value; + } + + // ==================================================================== + // = FeatureState + // ==================================================================== + /** 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 { - ::com::sun::star::uno::Any aState; sal_Bool bEnabled; - sal_Bool bRequery; - FeatureState() : bEnabled(sal_False), bRequery(sal_False) { } + optional< bool > bChecked; + optional< ::rtl::OUString > sTitle; + + FeatureState() : bEnabled(sal_False) { } }; // ==================================================================== // = helper // ==================================================================== - // (would like to have them local to OGenericUnoController, but SunPro5 complains then ...) // -------------------------------------------------------------------- // .................................................................... @@ -201,6 +248,8 @@ private: SupportedFeatures m_aSupportedFeatures; // look at the name + ::comphelper::NamedValueCollection + m_aInitParameters; #ifdef DBG_UTIL bool m_bDescribingSupportedFeatures; #endif @@ -253,6 +302,9 @@ // ---------------------------------------------------------------- // methods OGenericUnoController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM); + const ::comphelper::NamedValueCollection& + getInitParams() const { return m_aInitParameters; } + /** open the help agent for the given help id. @param _nHelpId @@ -347,7 +399,7 @@ virtual void setTitle(const ::rtl::OUString& _sName); // XInitialize will be called inside initialize - virtual void impl_initialize(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments); + virtual void impl_initialize(); /** updateTitle will be called when a new frame is attached */ @@ -425,7 +477,7 @@ // XTypeProvider virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException) = 0; + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException); // ::com::sun::star::frame::XController virtual void SAL_CALL attachFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & xFrame) throw( ::com::sun::star::uno::RuntimeException ); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
