User: obo Date: 2006/07/10 08:32:54 Modified: dba/dbaccess/source/ui/inc/genericcontroller.hxx
Log: INTEGRATION: CWS qiq (1.36.18); FILE MERGED 2006/06/27 12:41:02 fs 1.36.18.4: RESYNC: (1.36-1.37); FILE MERGED 2006/06/19 09:27:51 fs 1.36.18.3: during #i51143#: A FeatureState can now transport more than one state. In particular, it has typed bChecked and sTitle members, instead of the previous unchecked aState 2006/05/24 06:49:25 fs 1.36.18.2: some refactoring of compose/quoteTableName and friends, in preparation of #i51143# 2006/05/12 13:47:01 fs 1.36.18.1: #i51143# refactoring of controller initialization, which allows accessing the load arguments even during Construct (and not only in the - later - impl_initialize) File Changes: Directory: /dba/dbaccess/source/ui/inc/ ======================================= File [changed]: genericcontroller.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/inc/genericcontroller.hxx?r1=1.37&r2=1.38 Delta lines: +59 -7 -------------------- --- genericcontroller.hxx 20 Jun 2006 03:17:14 -0000 1.37 +++ genericcontroller.hxx 10 Jul 2006 15:32:52 -0000 1.38 @@ -104,6 +104,11 @@ #ifndef DBAUI_ICONTROLLER_HXX #include "IController.hxx" #endif +#ifndef COMPHELPER_NAMEDVALUECOLLECTION_HXX +#include <comphelper/namedvaluecollection.hxx> +#endif + +#include <boost/optional.hpp> class Window; class VCLXWindow; @@ -125,21 +130,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( 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 ...) // -------------------------------------------------------------------- // .................................................................... @@ -197,6 +244,8 @@ { private: SupportedFeatures m_aSupportedFeatures; // look at the name + ::comphelper::NamedValueCollection + m_aInitParameters; #ifdef DBG_UTIL bool m_bDescribingSupportedFeatures; @@ -247,6 +296,9 @@ ::osl::Mutex& getMutex( ) { return OGenericUnoController_MBASE::m_aMutex; } ::cppu::OBroadcastHelper& getBroadcastHelper() { return OGenericUnoController_COMPBASE::rBHelper; } + const ::comphelper::NamedValueCollection& + getInitParams() const { return m_aInitParameters; } + // ---------------------------------------------------------------- // methods OGenericUnoController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM); @@ -342,7 +394,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 */ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
