diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2009-11-05 16:31:23 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2009-11-05 16:31:23 +0100 |
commit | 595e1c2ebb346b3f7c69837fcf73d943bcade582 (patch) | |
tree | 9fdbcd8f279314a9519ff43c62f4be911fd18ddb /forms | |
parent | a7b054e6309a841df1c67696258af8ad19cebdea (diff) |
#i68332# use css.form.runtime.FormFeature, instead of SFX slot IDs (where possible so far)
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/component/Button.cxx | 14 | ||||
-rw-r--r-- | forms/source/component/Button.hxx | 10 | ||||
-rw-r--r-- | forms/source/helper/formnavigation.cxx | 162 | ||||
-rw-r--r-- | forms/source/inc/featuredispatcher.hxx | 12 | ||||
-rw-r--r-- | forms/source/inc/formnavigation.hxx | 24 | ||||
-rw-r--r-- | forms/source/solar/component/navbarcontrol.cxx | 52 | ||||
-rw-r--r-- | forms/source/solar/component/navbarcontrol.hxx | 6 | ||||
-rw-r--r-- | forms/source/solar/control/navtoolbar.cxx | 197 | ||||
-rw-r--r-- | forms/source/solar/inc/navtoolbar.hxx | 6 |
9 files changed, 259 insertions, 224 deletions
diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx index 8907dcd82712..575f842da4d0 100644 --- a/forms/source/component/Button.cxx +++ b/forms/source/component/Button.cxx @@ -509,7 +509,7 @@ IMPL_LINK( OButtonControl, OnClick, void*, EMPTYARG ) void OButtonControl::actionPerformed_Impl( sal_Bool _bNotifyListener, const ::com::sun::star::awt::MouseEvent& _rEvt ) { { - sal_Int32 nFeatureId = -1; + sal_Int16 nFeatureId = -1; { ::osl::MutexGuard aGuard( m_aMutex ); nFeatureId = m_nTargetUrlFeatureId; @@ -636,7 +636,7 @@ sal_Bool SAL_CALL OButtonControl::setModel( const Reference< XControlModel >& _r //------------------------------------------------------------------------------ void OButtonControl::modelFeatureUrlPotentiallyChanged( ) { - sal_Int32 nOldUrlFeatureId = m_nTargetUrlFeatureId; + sal_Int16 nOldUrlFeatureId = m_nTargetUrlFeatureId; // doe we have another TargetURL now? If so, we need to update our dispatches m_nTargetUrlFeatureId = getModelUrlFeatureId( ); @@ -675,9 +675,9 @@ namespace } //------------------------------------------------------------------------------ -sal_Int32 OButtonControl::getModelUrlFeatureId( ) const +sal_Int16 OButtonControl::getModelUrlFeatureId( ) const { - sal_Int32 nFeatureId = -1; + sal_Int16 nFeatureId = -1; // some URL related properties of the model ::rtl::OUString sUrl; @@ -717,14 +717,14 @@ void SAL_CALL OButtonControl::setDesignMode( sal_Bool _bOn ) throw( RuntimeExcep } //------------------------------------------------------------------------------ -void OButtonControl::getSupportedFeatures( ::std::vector< sal_Int32 >& /* [out] */ _rFeatureIds ) +void OButtonControl::getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds ) { if ( -1 != m_nTargetUrlFeatureId ) _rFeatureIds.push_back( m_nTargetUrlFeatureId ); } //------------------------------------------------------------------ -void OButtonControl::featureStateChanged( sal_Int32 _nFeatureId, sal_Bool _bEnabled ) +void OButtonControl::featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled ) { if ( _nFeatureId == m_nTargetUrlFeatureId ) { @@ -754,7 +754,7 @@ void OButtonControl::allFeatureStatesChanged( ) } //------------------------------------------------------------------ -bool OButtonControl::isEnabled( sal_Int32 _nFeatureId ) const +bool OButtonControl::isEnabled( sal_Int16 _nFeatureId ) const { if ( const_cast< OButtonControl* >( this )->isDesignMode() ) // TODO: the model property? diff --git a/forms/source/component/Button.hxx b/forms/source/component/Button.hxx index 5bbb7f387f85..3ca5154a9279 100644 --- a/forms/source/component/Button.hxx +++ b/forms/source/component/Button.hxx @@ -131,7 +131,7 @@ class OButtonControl :public OButtonControl_BASE { private: sal_uInt32 m_nClickEvent; - sal_Int32 m_nTargetUrlFeatureId; + sal_Int16 m_nTargetUrlFeatureId; /// caches the value of the "Enabled" property of our model sal_Bool m_bEnabledByPropertyValue; @@ -176,10 +176,10 @@ public: protected: // OFormNavigationHelper overriables - virtual void getSupportedFeatures( ::std::vector< sal_Int32 >& /* [out] */ _rFeatureIds ); - virtual void featureStateChanged( sal_Int32 _nFeatureId, sal_Bool _bEnabled ); + virtual void getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds ); + virtual void featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled ); virtual void allFeatureStatesChanged( ); - virtual bool isEnabled( sal_Int32 _nFeatureId ) const; + virtual bool isEnabled( sal_Int16 _nFeatureId ) const; // XDispatchProviderInterception disambiguaiton virtual void SAL_CALL registerDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException); @@ -198,7 +198,7 @@ private: /** retrieves the feature id (see OFormNavigationHelper) of the TargetURL of the model. */ - sal_Int32 getModelUrlFeatureId( ) const; + sal_Int16 getModelUrlFeatureId( ) const; /** starts or stops listening for changes in model properties we're interested in */ diff --git a/forms/source/helper/formnavigation.cxx b/forms/source/helper/formnavigation.cxx index 895b48a563f8..8f3d14df4657 100644 --- a/forms/source/helper/formnavigation.cxx +++ b/forms/source/helper/formnavigation.cxx @@ -33,12 +33,13 @@ #include "formnavigation.hxx" #include "urltransformer.hxx" #include "controlfeatureinterception.hxx" -#include <tools/debug.hxx> -#ifndef _SVX_SVXIDS_HRC -#include <svx/svxids.hrc> -#endif #include "frm_strings.hxx" +#include <com/sun/star/form/runtime/FormFeature.hpp> + +#include <tools/debug.hxx> + + //......................................................................... namespace frm { @@ -49,6 +50,7 @@ namespace frm using namespace ::com::sun::star::lang; using namespace ::com::sun::star::util; using namespace ::com::sun::star::frame; + namespace FormFeature = ::com::sun::star::form::runtime::FormFeature; //================================================================== //= OFormNavigationHelper @@ -83,7 +85,7 @@ namespace frm } //------------------------------------------------------------------ - void OFormNavigationHelper::featureStateChanged( sal_Int32 /*_nFeatureId*/, sal_Bool /*_bEnabled*/ ) + void OFormNavigationHelper::featureStateChanged( sal_Int16 /*_nFeatureId*/, sal_Bool /*_bEnabled*/ ) { // not interested in } @@ -270,12 +272,12 @@ namespace frm if ( m_aSupportedFeatures.empty() ) { // ask the derivee which feature ids it wants us to support - ::std::vector< sal_Int32 > aFeatureIds; + ::std::vector< sal_Int16 > aFeatureIds; getSupportedFeatures( aFeatureIds ); OFormNavigationMapper aUrlMapper( m_xORB ); - for ( ::std::vector< sal_Int32 >::const_iterator aLoop = aFeatureIds.begin(); + for ( ::std::vector< sal_Int16 >::const_iterator aLoop = aFeatureIds.begin(); aLoop != aFeatureIds.end(); ++aLoop ) @@ -300,7 +302,7 @@ namespace frm } //------------------------------------------------------------------ - void OFormNavigationHelper::dispatchWithArgument( sal_Int32 _nFeatureId, const sal_Char* _pParamAsciiName, + void OFormNavigationHelper::dispatchWithArgument( sal_Int16 _nFeatureId, const sal_Char* _pParamAsciiName, const Any& _rParamValue ) const { FeatureMap::const_iterator aInfo = m_aSupportedFeatures.find( _nFeatureId ); @@ -318,7 +320,7 @@ namespace frm } //------------------------------------------------------------------ - void OFormNavigationHelper::dispatch( sal_Int32 _nFeatureId ) const + void OFormNavigationHelper::dispatch( sal_Int16 _nFeatureId ) const { FeatureMap::const_iterator aInfo = m_aSupportedFeatures.find( _nFeatureId ); if ( m_aSupportedFeatures.end() != aInfo ) @@ -332,7 +334,7 @@ namespace frm } //------------------------------------------------------------------ - bool OFormNavigationHelper::isEnabled( sal_Int32 _nFeatureId ) const + bool OFormNavigationHelper::isEnabled( sal_Int16 _nFeatureId ) const { FeatureMap::const_iterator aInfo = m_aSupportedFeatures.find( _nFeatureId ); if ( m_aSupportedFeatures.end() != aInfo ) @@ -342,7 +344,7 @@ namespace frm } //------------------------------------------------------------------ - bool OFormNavigationHelper::getBooleanState( sal_Int32 _nFeatureId ) const + bool OFormNavigationHelper::getBooleanState( sal_Int16 _nFeatureId ) const { sal_Bool bState = sal_False; @@ -354,7 +356,7 @@ namespace frm } //------------------------------------------------------------------ - ::rtl::OUString OFormNavigationHelper::getStringState( sal_Int32 _nFeatureId ) const + ::rtl::OUString OFormNavigationHelper::getStringState( sal_Int16 _nFeatureId ) const { ::rtl::OUString sState; @@ -366,7 +368,7 @@ namespace frm } //------------------------------------------------------------------ - sal_Int32 OFormNavigationHelper::getIntegerState( sal_Int32 _nFeatureId ) const + sal_Int32 OFormNavigationHelper::getIntegerState( sal_Int16 _nFeatureId ) const { sal_Int32 nState = 0; @@ -382,7 +384,7 @@ namespace frm { disconnectDispatchers( ); // no supported features anymore: - FeatureMap aEmpty; + FeatureMap aEmpty; m_aSupportedFeatures.swap( aEmpty ); } @@ -401,7 +403,7 @@ namespace frm } //------------------------------------------------------------------ - bool OFormNavigationMapper::getFeatureURL( sal_Int32 _nFeatureId, URL& /* [out] */ _rURL ) + bool OFormNavigationMapper::getFeatureURL( sal_Int16 _nFeatureId, URL& /* [out] */ _rURL ) { // get the ascii version of the URL const char* pAsciiURL = getFeatureURLAscii( _nFeatureId ); @@ -412,84 +414,72 @@ namespace frm } //------------------------------------------------------------------ - const char* OFormNavigationMapper::getFeatureURLAscii( sal_Int32 _nFeatureId ) + namespace { - const char* pAsciiURL = NULL; - - switch ( _nFeatureId ) + struct FeatureURL { - case SID_FM_RECORD_ABSOLUTE : pAsciiURL = URL_FORM_POSITION; break; - case SID_FM_RECORD_TOTAL : pAsciiURL = URL_FORM_RECORDCOUNT; break; - case SID_FM_RECORD_FIRST : pAsciiURL = URL_RECORD_FIRST; break; - case SID_FM_RECORD_PREV : pAsciiURL = URL_RECORD_PREV; break; - case SID_FM_RECORD_NEXT : pAsciiURL = URL_RECORD_NEXT; break; - case SID_FM_RECORD_LAST : pAsciiURL = URL_RECORD_LAST; break; - case SID_FM_RECORD_SAVE : pAsciiURL = URL_RECORD_SAVE; break; - case SID_FM_RECORD_UNDO : pAsciiURL = URL_RECORD_UNDO; break; - case SID_FM_RECORD_NEW : pAsciiURL = URL_RECORD_NEW; break; - case SID_FM_RECORD_DELETE : pAsciiURL = URL_RECORD_DELETE; break; - case SID_FM_REFRESH : pAsciiURL = URL_FORM_REFRESH; break; - case SID_FM_REFRESH_FORM_CONTROL: pAsciiURL = URL_FORM_REFRESH_CURRENT_CONTROL; break; - - case SID_FM_SORTUP : pAsciiURL = URL_FORM_SORT_UP; break; - case SID_FM_SORTDOWN : pAsciiURL = URL_FORM_SORT_DOWN; break; - case SID_FM_ORDERCRIT : pAsciiURL = URL_FORM_SORT; break; - case SID_FM_AUTOFILTER : pAsciiURL = URL_FORM_AUTO_FILTER; break; - case SID_FM_FILTERCRIT : pAsciiURL = URL_FORM_FILTER; break; - case SID_FM_FORM_FILTERED : pAsciiURL = URL_FORM_APPLY_FILTER; break; - case SID_FM_REMOVE_FILTER_SORT : pAsciiURL = URL_FORM_REMOVE_FILTER; break; + const sal_Int16 nFormFeature; + const sal_Char* pAsciiURL; + + FeatureURL( const sal_Int16 _nFormFeature, const sal_Char* _pAsciiURL ) + :nFormFeature( _nFormFeature ) + ,pAsciiURL( _pAsciiURL ) + { + } }; - return pAsciiURL; + const FeatureURL* lcl_getFeatureTable() + { + static const FeatureURL s_aFeatureURLs[] = + { + FeatureURL( FormFeature::MoveAbsolute, URL_FORM_POSITION ), + FeatureURL( FormFeature::TotalRecords, URL_FORM_RECORDCOUNT ), + FeatureURL( FormFeature::MoveToFirst, URL_RECORD_FIRST ), + FeatureURL( FormFeature::MoveToPrevious, URL_RECORD_PREV ), + FeatureURL( FormFeature::MoveToNext, URL_RECORD_NEXT ), + FeatureURL( FormFeature::MoveToLast, URL_RECORD_LAST ), + FeatureURL( FormFeature::SaveRecordChanges, URL_RECORD_SAVE ), + FeatureURL( FormFeature::UndoRecordChanges, URL_RECORD_UNDO ), + FeatureURL( FormFeature::MoveToInsertRow, URL_RECORD_NEW ), + FeatureURL( FormFeature::DeleteRecord, URL_RECORD_DELETE ), + FeatureURL( FormFeature::ReloadForm, URL_FORM_REFRESH ), + FeatureURL( FormFeature::RefreshCurrentControl, URL_FORM_REFRESH_CURRENT_CONTROL ), + FeatureURL( FormFeature::SortAscending, URL_FORM_SORT_UP ), + FeatureURL( FormFeature::SortDescending, URL_FORM_SORT_DOWN ), + FeatureURL( FormFeature::InteractiveSort, URL_FORM_SORT ), + FeatureURL( FormFeature::AutoFilter, URL_FORM_AUTO_FILTER ), + FeatureURL( FormFeature::InteractiveFilter, URL_FORM_FILTER ), + FeatureURL( FormFeature::ToggleApplyFilter, URL_FORM_APPLY_FILTER ), + FeatureURL( FormFeature::RemoveFilterAndSort, URL_FORM_REMOVE_FILTER ), + FeatureURL( 0, NULL ) + }; + return s_aFeatureURLs; + } + } + + //------------------------------------------------------------------ + const char* OFormNavigationMapper::getFeatureURLAscii( sal_Int16 _nFeatureId ) + { + const FeatureURL* pFeatures = lcl_getFeatureTable(); + while ( pFeatures->pAsciiURL ) + { + if ( pFeatures->nFormFeature == _nFeatureId ) + return pFeatures->pAsciiURL; + ++pFeatures; + } + return NULL; } //------------------------------------------------------------------ - sal_Int32 OFormNavigationMapper::getFeatureId( const ::rtl::OUString& _rCompleteURL ) + sal_Int16 OFormNavigationMapper::getFeatureId( const ::rtl::OUString& _rCompleteURL ) { - sal_Int32 nFeatureId = -1; - - if ( _rCompleteURL == URL_FORM_POSITION ) - nFeatureId = SID_FM_RECORD_ABSOLUTE; - else if ( _rCompleteURL == URL_FORM_RECORDCOUNT ) - nFeatureId = SID_FM_RECORD_TOTAL; - else if ( _rCompleteURL == URL_RECORD_FIRST ) - nFeatureId = SID_FM_RECORD_FIRST; - else if ( _rCompleteURL == URL_RECORD_PREV ) - nFeatureId = SID_FM_RECORD_PREV; - else if ( _rCompleteURL == URL_RECORD_NEXT ) - nFeatureId = SID_FM_RECORD_NEXT; - else if ( _rCompleteURL == URL_RECORD_LAST ) - nFeatureId = SID_FM_RECORD_LAST; - else if ( _rCompleteURL == URL_RECORD_SAVE ) - nFeatureId = SID_FM_RECORD_SAVE; - else if ( _rCompleteURL == URL_RECORD_UNDO ) - nFeatureId = SID_FM_RECORD_UNDO; - else if ( _rCompleteURL == URL_RECORD_NEW ) - nFeatureId = SID_FM_RECORD_NEW; - else if ( _rCompleteURL == URL_RECORD_DELETE ) - nFeatureId = SID_FM_RECORD_DELETE; - else if ( _rCompleteURL == URL_FORM_REFRESH ) - nFeatureId = SID_FM_REFRESH; - else if ( _rCompleteURL == URL_FORM_REFRESH_CURRENT_CONTROL ) - nFeatureId = SID_FM_REFRESH_FORM_CONTROL; - else if ( _rCompleteURL == URL_FORM_SORT_UP ) - nFeatureId = SID_FM_SORTUP; - else if ( _rCompleteURL == URL_FORM_SORT_DOWN ) - nFeatureId = SID_FM_SORTDOWN; - else if ( _rCompleteURL == URL_FORM_SORT ) - nFeatureId = SID_FM_ORDERCRIT; - else if ( _rCompleteURL == URL_FORM_AUTO_FILTER ) - nFeatureId = SID_FM_AUTOFILTER; - else if ( _rCompleteURL == URL_FORM_FILTER ) - nFeatureId = SID_FM_FILTERCRIT; - else if ( _rCompleteURL == URL_FORM_APPLY_FILTER ) - nFeatureId = SID_FM_FORM_FILTERED; - else if ( _rCompleteURL == URL_FORM_REMOVE_FILTER ) - nFeatureId = SID_FM_REMOVE_FILTER_SORT; - - DBG_ASSERT( ( -1 == nFeatureId ) || _rCompleteURL.equalsAscii( getFeatureURLAscii( nFeatureId ) ), - "OFormNavigationMapper::getFeatureId: inconsistent maps!" ); - - return nFeatureId; + const FeatureURL* pFeatures = lcl_getFeatureTable(); + while ( pFeatures->pAsciiURL ) + { + if ( _rCompleteURL.compareToAscii( pFeatures->pAsciiURL ) == 0 ) + return pFeatures->nFormFeature; + ++pFeatures; + } + return -1; } //......................................................................... diff --git a/forms/source/inc/featuredispatcher.hxx b/forms/source/inc/featuredispatcher.hxx index 27fe022cd0b7..daf6a33eb5ba 100644 --- a/forms/source/inc/featuredispatcher.hxx +++ b/forms/source/inc/featuredispatcher.hxx @@ -49,7 +49,7 @@ namespace frm @param _nFeatureId the id of the feature to dispatch */ - virtual void dispatch( sal_Int32 _nFeatureId ) const = 0; + virtual void dispatch( sal_Int16 _nFeatureId ) const = 0; /** dispatches a feature, with an additional named parameter @@ -63,14 +63,14 @@ namespace frm the value of the parameter of the dispatch call */ virtual void dispatchWithArgument( - sal_Int32 _nFeatureId, + sal_Int16 _nFeatureId, const sal_Char* _pParamName, const ::com::sun::star::uno::Any& _rParamValue ) const = 0; /** checks whether a given feature is enabled */ - virtual bool isEnabled( sal_Int32 _nFeatureId ) const = 0; + virtual bool isEnabled( sal_Int16 _nFeatureId ) const = 0; /** returns the boolean state of a feature @@ -81,7 +81,7 @@ namespace frm This method allows retrieving status information about features which have an additional boolean information associated with it. */ - virtual bool getBooleanState( sal_Int32 _nFeatureId ) const = 0; + virtual bool getBooleanState( sal_Int16 _nFeatureId ) const = 0; /** returns the string state of a feature @@ -92,7 +92,7 @@ namespace frm This method allows retrieving status information about features which have an additional string information associated with it. */ - virtual ::rtl::OUString getStringState( sal_Int32 _nFeatureId ) const = 0; + virtual ::rtl::OUString getStringState( sal_Int16 _nFeatureId ) const = 0; /** returns the integer state of a feature @@ -103,7 +103,7 @@ namespace frm This method allows retrieving status information about features which have an additional integer information associated with it. */ - virtual sal_Int32 getIntegerState( sal_Int32 _nFeatureId ) const = 0; + virtual sal_Int32 getIntegerState( sal_Int16 _nFeatureId ) const = 0; }; //......................................................................... diff --git a/forms/source/inc/formnavigation.hxx b/forms/source/inc/formnavigation.hxx index be0512eb0583..05c976dac11a 100644 --- a/forms/source/inc/formnavigation.hxx +++ b/forms/source/inc/formnavigation.hxx @@ -71,7 +71,7 @@ namespace frm FeatureInfo() : bCachedState( sal_False ) { } }; - typedef ::std::map< sal_Int32, FeatureInfo > FeatureMap; + typedef ::std::map< sal_Int16, FeatureInfo > FeatureMap; private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > @@ -106,12 +106,12 @@ namespace frm virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); // IFeatureDispatcher - virtual void dispatch( sal_Int32 _nFeatureId ) const; - virtual void dispatchWithArgument( sal_Int32 _nFeatureId, const sal_Char* _pParamName, const ::com::sun::star::uno::Any& _rParamValue ) const; - virtual bool isEnabled( sal_Int32 _nFeatureId ) const; - virtual bool getBooleanState( sal_Int32 _nFeatureId ) const; - virtual ::rtl::OUString getStringState( sal_Int32 _nFeatureId ) const; - virtual sal_Int32 getIntegerState( sal_Int32 _nFeatureId ) const; + virtual void dispatch( sal_Int16 _nFeatureId ) const; + virtual void dispatchWithArgument( sal_Int16 _nFeatureId, const sal_Char* _pParamName, const ::com::sun::star::uno::Any& _rParamValue ) const; + virtual bool isEnabled( sal_Int16 _nFeatureId ) const; + virtual bool getBooleanState( sal_Int16 _nFeatureId ) const; + virtual ::rtl::OUString getStringState( sal_Int16 _nFeatureId ) const; + virtual sal_Int32 getIntegerState( sal_Int16 _nFeatureId ) const; // own overridables /** is called when the interceptors have. @@ -134,7 +134,7 @@ namespace frm determines if the features is enabled or disabled @see getBooleanState */ - virtual void featureStateChanged( sal_Int32 _nFeatureId, sal_Bool _bEnabled ); + virtual void featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled ); /** notification for (potential) changes in the state of all features <p>The base class implementation does nothing. Derived classes could force @@ -149,7 +149,7 @@ namespace frm the array of features to support. Out parameter to fill by the derivee's implementation @pure */ - virtual void getSupportedFeatures( ::std::vector< sal_Int32 >& /* [out] */ _rFeatureIds ) = 0; + virtual void getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds ) = 0; protected: /** update all our dispatches which are controlled by our dispatch interceptors @@ -205,7 +205,7 @@ namespace frm @complexity O(log n) @return NULL if the given id is not a known feature id (which is a valid usage) */ - const char* getFeatureURLAscii( sal_Int32 _nFeatureId ); + const char* getFeatureURLAscii( sal_Int16 _nFeatureId ); /** retrieves the feature URL belonging to an feature id @@ -214,7 +214,7 @@ namespace frm <TRUE/> if and only if the given id is a known feature id (which is a valid usage) */ - bool getFeatureURL( sal_Int32 _nFeatureId, ::com::sun::star::util::URL& /* [out] */ _rURL ); + bool getFeatureURL( sal_Int16 _nFeatureId, ::com::sun::star::util::URL& /* [out] */ _rURL ); /** retrieves the feature id belonging to an feature URL @@ -223,7 +223,7 @@ namespace frm the id of the feature URL, or -1 if the URl is not known (which is a valid usage) */ - sal_Int32 getFeatureId( const ::rtl::OUString& _rCompleteURL ); + sal_Int16 getFeatureId( const ::rtl::OUString& _rCompleteURL ); private: OFormNavigationMapper( ); // never implemented diff --git a/forms/source/solar/component/navbarcontrol.cxx b/forms/source/solar/component/navbarcontrol.cxx index 88995b49f4a8..ecc1771fe955 100644 --- a/forms/source/solar/component/navbarcontrol.cxx +++ b/forms/source/solar/component/navbarcontrol.cxx @@ -40,6 +40,7 @@ /** === begin UNO includes === **/ #include <com/sun/star/awt/XView.hpp> #include <com/sun/star/awt/PosSize.hpp> +#include <com/sun/star/form/runtime/FormFeature.hpp> /** === end UNO includes === **/ #include <tools/debug.hxx> @@ -62,6 +63,7 @@ namespace frm using namespace ::com::sun::star::awt; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::frame; + namespace FormFeature = ::com::sun::star::form::runtime::FormFeature; #define FORWARD_TO_PEER_1( unoInterface, method, param1 ) \ Reference< unoInterface > xTypedPeer( getPeer(), UNO_QUERY ); \ @@ -456,7 +458,7 @@ namespace frm } //------------------------------------------------------------------ - void ONavigationBarPeer::featureStateChanged( sal_Int32 _nFeatureId, sal_Bool _bEnabled ) + void ONavigationBarPeer::featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled ) { // enable this button on the toolbox NavigationToolBar* pNavBar = static_cast< NavigationToolBar* >( GetWindow() ); @@ -465,15 +467,15 @@ namespace frm pNavBar->enableFeature( _nFeatureId, _bEnabled ); // is it a feature with additional state information? - if ( _nFeatureId == SID_FM_FORM_FILTERED ) + if ( _nFeatureId == FormFeature::ToggleApplyFilter ) { // additional boolean state pNavBar->checkFeature( _nFeatureId, getBooleanState( _nFeatureId ) ); } - else if ( _nFeatureId == SID_FM_RECORD_TOTAL ) + else if ( _nFeatureId == FormFeature::TotalRecords ) { pNavBar->setFeatureText( _nFeatureId, getStringState( _nFeatureId ) ); } - else if ( _nFeatureId == SID_FM_RECORD_ABSOLUTE ) + else if ( _nFeatureId == FormFeature::MoveAbsolute ) { pNavBar->setFeatureText( _nFeatureId, String::CreateFromInt32( getIntegerState( _nFeatureId ) ) ); } @@ -496,7 +498,7 @@ namespace frm } //------------------------------------------------------------------ - bool ONavigationBarPeer::isEnabled( sal_Int32 _nFeatureId ) const + bool ONavigationBarPeer::isEnabled( sal_Int16 _nFeatureId ) const { if ( const_cast< ONavigationBarPeer* >( this )->isDesignMode() ) return false; @@ -524,27 +526,27 @@ namespace frm } //------------------------------------------------------------------ - void ONavigationBarPeer::getSupportedFeatures( ::std::vector< sal_Int32 >& _rFeatureIds ) + void ONavigationBarPeer::getSupportedFeatures( ::std::vector< sal_Int16 >& _rFeatureIds ) { - _rFeatureIds.push_back( SID_FM_RECORD_ABSOLUTE ); - _rFeatureIds.push_back( SID_FM_RECORD_TOTAL ); - _rFeatureIds.push_back( SID_FM_RECORD_FIRST ); - _rFeatureIds.push_back( SID_FM_RECORD_PREV ); - _rFeatureIds.push_back( SID_FM_RECORD_NEXT ); - _rFeatureIds.push_back( SID_FM_RECORD_LAST ); - _rFeatureIds.push_back( SID_FM_RECORD_SAVE ); - _rFeatureIds.push_back( SID_FM_RECORD_UNDO ); - _rFeatureIds.push_back( SID_FM_RECORD_NEW ); - _rFeatureIds.push_back( SID_FM_RECORD_DELETE ); - _rFeatureIds.push_back( SID_FM_REFRESH ); - _rFeatureIds.push_back( SID_FM_REFRESH_FORM_CONTROL ); - _rFeatureIds.push_back( SID_FM_SORTUP ); - _rFeatureIds.push_back( SID_FM_SORTDOWN ); - _rFeatureIds.push_back( SID_FM_ORDERCRIT ); - _rFeatureIds.push_back( SID_FM_AUTOFILTER ); - _rFeatureIds.push_back( SID_FM_FILTERCRIT ); - _rFeatureIds.push_back( SID_FM_FORM_FILTERED ); - _rFeatureIds.push_back( SID_FM_REMOVE_FILTER_SORT ); + _rFeatureIds.push_back( FormFeature::MoveAbsolute ); + _rFeatureIds.push_back( FormFeature::TotalRecords ); + _rFeatureIds.push_back( FormFeature::MoveToFirst ); + _rFeatureIds.push_back( FormFeature::MoveToPrevious ); + _rFeatureIds.push_back( FormFeature::MoveToNext ); + _rFeatureIds.push_back( FormFeature::MoveToLast ); + _rFeatureIds.push_back( FormFeature::SaveRecordChanges ); + _rFeatureIds.push_back( FormFeature::UndoRecordChanges ); + _rFeatureIds.push_back( FormFeature::MoveToInsertRow ); + _rFeatureIds.push_back( FormFeature::DeleteRecord ); + _rFeatureIds.push_back( FormFeature::ReloadForm ); + _rFeatureIds.push_back( FormFeature::RefreshCurrentControl ); + _rFeatureIds.push_back( FormFeature::SortAscending ); + _rFeatureIds.push_back( FormFeature::SortDescending ); + _rFeatureIds.push_back( FormFeature::InteractiveSort ); + _rFeatureIds.push_back( FormFeature::AutoFilter ); + _rFeatureIds.push_back( FormFeature::InteractiveFilter ); + _rFeatureIds.push_back( FormFeature::ToggleApplyFilter ); + _rFeatureIds.push_back( FormFeature::RemoveFilterAndSort ); } //......................................................................... diff --git a/forms/source/solar/component/navbarcontrol.hxx b/forms/source/solar/component/navbarcontrol.hxx index 0c3f76f315ed..37b62fa2668b 100644 --- a/forms/source/solar/component/navbarcontrol.hxx +++ b/forms/source/solar/component/navbarcontrol.hxx @@ -144,12 +144,12 @@ namespace frm // OFormNavigationHelper overriables virtual void interceptorsChanged( ); - virtual void featureStateChanged( sal_Int32 _nFeatureId, sal_Bool _bEnabled ); + virtual void featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled ); virtual void allFeatureStatesChanged( ); - virtual void getSupportedFeatures( ::std::vector< sal_Int32 >& /* [out] */ _rFeatureIds ); + virtual void getSupportedFeatures( ::std::vector< sal_Int16 >& /* [out] */ _rFeatureIds ); // IFeatureDispatcher overriables - virtual bool isEnabled( sal_Int32 _nFeatureId ) const; + virtual bool isEnabled( sal_Int16 _nFeatureId ) const; }; //......................................................................... diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx index 37b9faf8a5f4..c5d52261d8a8 100644 --- a/forms/source/solar/control/navtoolbar.cxx +++ b/forms/source/solar/control/navtoolbar.cxx @@ -30,39 +30,40 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_forms.hxx" + #include "navtoolbar.hxx" #include "frm_resource.hxx" -#ifndef _FRM_RESOURCE_HRC_ -#include "frm_resource.hrc" -#endif -#include <vcl/fixed.hxx> -#ifndef _SVX_SVXIDS_HRC -#include <svx/svxids.hrc> -#endif -#include <sfx2/msgpool.hxx> -#include <sfx2/imgmgr.hxx> #include "featuredispatcher.hxx" +#include "frm_resource.hrc" + #include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/form/runtime/FormFeature.hpp> + +#include <sfx2/imgmgr.hxx> +#include <svx/svxids.hrc> +#include <vcl/fixed.hxx> #include <memory> -#define LID_RECORD_LABEL 1 -#define LID_RECORD_FILLER 2 +#define LID_RECORD_LABEL 1000 +#define LID_RECORD_FILLER 1001 //......................................................................... namespace frm { //......................................................................... + using ::com::sun::star::uno::makeAny; + namespace FormFeature = ::com::sun::star::form::runtime::FormFeature; + //===================================================================== //..................................................................... namespace { - static bool isSfxSlot( sal_Int32 _nFeatureId ) + static bool isArtificialItem( sal_Int16 _nFeatureId ) { - // everything we use in this class is an SFX-slot - except the LID_* ids - return ( _nFeatureId != LID_RECORD_LABEL ) - && ( _nFeatureId != LID_RECORD_FILLER ); + return ( _nFeatureId == LID_RECORD_LABEL ) + || ( _nFeatureId == LID_RECORD_FILLER ); } static String getLabelString( USHORT _nResId ) @@ -72,10 +73,39 @@ namespace frm sLabel += String::CreateFromAscii( " " ); return sLabel; } + static bool lcl_isHighContrast( const Color& _rColor ) { return _rColor.IsDark(); } + + sal_Int32 lcl_getSlotId( const sal_Int16 _nFormFeature ) + { + switch ( _nFormFeature ) + { + case FormFeature::MoveAbsolute : return SID_FM_RECORD_ABSOLUTE; + case FormFeature::TotalRecords : return SID_FM_RECORD_TOTAL; + case FormFeature::MoveToFirst : return SID_FM_RECORD_FIRST; + case FormFeature::MoveToPrevious : return SID_FM_RECORD_PREV; + case FormFeature::MoveToNext : return SID_FM_RECORD_NEXT; + case FormFeature::MoveToLast : return SID_FM_RECORD_LAST; + case FormFeature::SaveRecordChanges : return SID_FM_RECORD_SAVE; + case FormFeature::UndoRecordChanges : return SID_FM_RECORD_UNDO; + case FormFeature::MoveToInsertRow : return SID_FM_RECORD_NEW; + case FormFeature::DeleteRecord : return SID_FM_RECORD_DELETE; + case FormFeature::ReloadForm : return SID_FM_REFRESH; + case FormFeature::RefreshCurrentControl : return SID_FM_REFRESH_FORM_CONTROL; + case FormFeature::SortAscending : return SID_FM_SORTUP; + case FormFeature::SortDescending : return SID_FM_SORTDOWN; + case FormFeature::InteractiveSort : return SID_FM_ORDERCRIT; + case FormFeature::AutoFilter : return SID_FM_AUTOFILTER; + case FormFeature::InteractiveFilter : return SID_FM_FILTERCRIT; + case FormFeature::ToggleApplyFilter : return SID_FM_FORM_FILTERED; + case FormFeature::RemoveFilterAndSort : return SID_FM_REMOVE_FILTER_SORT; + } + OSL_ENSURE( isArtificialItem( _nFormFeature ), "lcl_getSlotId: unknown FormFeature!" ); + return 0; + } } //===================================================================== @@ -154,7 +184,7 @@ namespace frm m_pToolbar->setDispatcher( _pDispatcher ); - RecordPositionInput* pPositionWindow = static_cast< RecordPositionInput* >( m_pToolbar->GetItemWindow( SID_FM_RECORD_ABSOLUTE ) ); + RecordPositionInput* pPositionWindow = static_cast< RecordPositionInput* >( m_pToolbar->GetItemWindow( FormFeature::MoveAbsolute ) ); OSL_ENSURE( pPositionWindow, "NavigationToolBar::setDispatcher: can't forward the dispatcher to the position window!" ); if ( pPositionWindow ) pPositionWindow->setDispatcher( _pDispatcher ); @@ -183,15 +213,15 @@ namespace frm { m_pToolbar->EnableItem( _nItemId, _bEnabled ); - if ( _nItemId == SID_FM_RECORD_ABSOLUTE ) + if ( _nItemId == FormFeature::MoveAbsolute ) m_pToolbar->EnableItem( LID_RECORD_LABEL, _bEnabled ); - if ( _nItemId == SID_FM_RECORD_TOTAL ) + if ( _nItemId == FormFeature::TotalRecords ) m_pToolbar->EnableItem( LID_RECORD_FILLER, _bEnabled ); } //--------------------------------------------------------------------- - void NavigationToolBar::enableFeature( sal_Int32 _nFeatureId, bool _bEnabled ) + void NavigationToolBar::enableFeature( sal_Int16 _nFeatureId, bool _bEnabled ) { DBG_ASSERT( m_pToolbar->GetItemPos( (USHORT)_nFeatureId ) != TOOLBOX_ITEM_NOTFOUND, "NavigationToolBar::enableFeature: invalid id!" ); @@ -200,7 +230,7 @@ namespace frm } //--------------------------------------------------------------------- - void NavigationToolBar::checkFeature( sal_Int32 _nFeatureId, bool _bEnabled ) + void NavigationToolBar::checkFeature( sal_Int16 _nFeatureId, bool _bEnabled ) { DBG_ASSERT( m_pToolbar->GetItemPos( (USHORT)_nFeatureId ) != TOOLBOX_ITEM_NOTFOUND, "NavigationToolBar::checkFeature: invalid id!" ); @@ -209,7 +239,7 @@ namespace frm } //--------------------------------------------------------------------- - void NavigationToolBar::setFeatureText( sal_Int32 _nFeatureId, const ::rtl::OUString& _rText ) + void NavigationToolBar::setFeatureText( sal_Int16 _nFeatureId, const ::rtl::OUString& _rText ) { DBG_ASSERT( m_pToolbar->GetItemPos( (USHORT)_nFeatureId ) != TOOLBOX_ITEM_NOTFOUND, "NavigationToolBar::checkFeature: invalid id!" ); @@ -232,45 +262,44 @@ namespace frm // items. We could duplicate all the information here in our lib // (such as the item text and the image), but why should we? - struct SlotDescription + struct FeatureDescription { USHORT nId; bool bRepeat; bool bItemWindow; - } aSupportedSlots[] = + } aSupportedFeatures[] = { - { LID_RECORD_LABEL, false, true }, - { SID_FM_RECORD_ABSOLUTE, false, true }, - { LID_RECORD_FILLER, false, true }, - { SID_FM_RECORD_TOTAL, false, true }, - - { SID_FM_RECORD_FIRST, true, false }, - { SID_FM_RECORD_PREV, true, false }, - { SID_FM_RECORD_NEXT, true, false }, - { SID_FM_RECORD_LAST, true, false }, + { LID_RECORD_LABEL, false, true }, + { FormFeature::MoveAbsolute, false, true }, + { LID_RECORD_FILLER, false, true }, + { FormFeature::TotalRecords, false, true }, + { FormFeature::MoveToFirst, true, false }, + { FormFeature::MoveToPrevious, true, false }, + { FormFeature::MoveToNext, true, false }, + { FormFeature::MoveToLast, true, false }, + { FormFeature::MoveToInsertRow, false, false }, { 0, false, false }, - { SID_FM_RECORD_SAVE, false, false }, - { SID_FM_RECORD_UNDO, false, false }, - { SID_FM_RECORD_NEW, false, false }, - { SID_FM_RECORD_DELETE, false, false }, - { SID_FM_REFRESH, false, false }, - { SID_FM_REFRESH_FORM_CONTROL, false, false }, + { FormFeature::SaveRecordChanges, false, false }, + { FormFeature::UndoRecordChanges, false, false }, + { FormFeature::DeleteRecord, false, false }, + { FormFeature::ReloadForm, false, false }, + { FormFeature::RefreshCurrentControl, false, false }, { 0, false, false }, - { SID_FM_SORTUP, false, false }, - { SID_FM_SORTDOWN, false, false }, - { SID_FM_ORDERCRIT, false, false }, - { SID_FM_AUTOFILTER, false, false }, - { SID_FM_FILTERCRIT, false, false }, - { SID_FM_FORM_FILTERED, false, false }, - { SID_FM_REMOVE_FILTER_SORT, false, false }, + { FormFeature::SortAscending, false, false }, + { FormFeature::SortDescending, false, false }, + { FormFeature::InteractiveSort, false, false }, + { FormFeature::AutoFilter, false, false }, + { FormFeature::InteractiveFilter, false, false }, + { FormFeature::ToggleApplyFilter, false, false }, + { FormFeature::RemoveFilterAndSort, false, false }, }; - size_t nSupportedSlots = sizeof( aSupportedSlots ) / sizeof( aSupportedSlots[0] ); - SlotDescription* pSupportedSlots = aSupportedSlots; - SlotDescription* pSupportedSlotsEnd = aSupportedSlots + nSupportedSlots; - for ( ; pSupportedSlots < pSupportedSlotsEnd; ++pSupportedSlots ) + size_t nSupportedFeatures = sizeof( aSupportedFeatures ) / sizeof( aSupportedFeatures[0] ); + FeatureDescription* pSupportedFeatures = aSupportedFeatures; + FeatureDescription* pSupportedFeaturesEnd = aSupportedFeatures + nSupportedFeatures; + for ( ; pSupportedFeatures < pSupportedFeaturesEnd; ++pSupportedFeatures ) { - if ( pSupportedSlots->nId ) + if ( pSupportedFeatures->nId ) { // it's _not_ a separator // the text(s) of the item @@ -279,24 +308,24 @@ namespace frm // TODO/CLEANUP: this code does nothing(!) nowadays //SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( NULL ); - //sItemText = rSlotPool.GetSlotName( pSupportedSlots->nId, &sItemHelpText ); + //sItemText = rSlotPool.GetSlotName( pSupportedFeatures->nId, &sItemHelpText ); // insert the entry - m_pToolbar->InsertItem( pSupportedSlots->nId, sItemText, pSupportedSlots->bRepeat ? TIB_REPEAT : 0 ); - m_pToolbar->SetQuickHelpText( pSupportedSlots->nId, sItemHelpText ); - if ( isSfxSlot( pSupportedSlots->nId ) ) - m_pToolbar->SetHelpId( pSupportedSlots->nId, pSupportedSlots->nId ); + m_pToolbar->InsertItem( pSupportedFeatures->nId, sItemText, pSupportedFeatures->bRepeat ? TIB_REPEAT : 0 ); + m_pToolbar->SetQuickHelpText( pSupportedFeatures->nId, sItemHelpText ); + if ( !isArtificialItem( pSupportedFeatures->nId ) ) + m_pToolbar->SetHelpId( pSupportedFeatures->nId, lcl_getSlotId( pSupportedFeatures->nId ) ); - if ( pSupportedSlots->bItemWindow ) + if ( pSupportedFeatures->bItemWindow ) { Window* pItemWindow = NULL; - if ( SID_FM_RECORD_ABSOLUTE == pSupportedSlots->nId ) + if ( FormFeature::MoveAbsolute == pSupportedFeatures->nId ) { pItemWindow = new RecordPositionInput( m_pToolbar ); static_cast< RecordPositionInput* >( pItemWindow )->setDispatcher( m_pDispatcher ); } - else if ( LID_RECORD_FILLER == pSupportedSlots->nId ) + else if ( LID_RECORD_FILLER == pSupportedFeatures->nId ) { pItemWindow = new FixedText( m_pToolbar, WB_CENTER | WB_VCENTER ); pItemWindow->SetBackground(Wallpaper(Color(COL_TRANSPARENT))); @@ -309,7 +338,7 @@ namespace frm } m_aChildWins.push_back( pItemWindow ); - switch ( pSupportedSlots->nId ) + switch ( pSupportedFeatures->nId ) { case LID_RECORD_LABEL: pItemWindow->SetText( getLabelString( RID_STR_LABEL_RECORD ) ); @@ -320,7 +349,7 @@ namespace frm break; } - m_pToolbar->SetItemWindow( pSupportedSlots->nId, pItemWindow ); + m_pToolbar->SetItemWindow( pSupportedFeatures->nId, pItemWindow ); } } else @@ -331,12 +360,7 @@ namespace frm forEachItemWindow( &NavigationToolBar::adjustItemWindowWidth, NULL ); - // the image of the item - ::std::auto_ptr< SfxImageManager > pImageManager( new SfxImageManager( NULL ) ); - pImageManager->SetImagesForceSize( *m_pToolbar, FALSE, m_eImageSize == eLarge ); - - // parts of our layout is dependent on the size of our icons - Resize(); + implSetImageSize( m_eImageSize, true ); } //--------------------------------------------------------------------- @@ -345,8 +369,27 @@ namespace frm if ( ( _eSize != m_eImageSize ) || _bForce ) { m_eImageSize = _eSize; + ::std::auto_ptr< SfxImageManager > pImageManager( new SfxImageManager( NULL ) ); - pImageManager->SetImagesForceSize( *m_pToolbar, lcl_isHighContrast( GetBackground().GetColor() ), m_eImageSize == eLarge ); + const bool bIsHighContrast = lcl_isHighContrast( GetBackground().GetColor() ); + + const USHORT nCount = m_pToolbar->GetItemCount(); + for ( USHORT i=0; i<nCount; ++i ) + { + USHORT nId = m_pToolbar->GetItemId( i ); + if ( TOOLBOXITEM_BUTTON == m_pToolbar->GetItemType( i ) ) + { + Image aItemImage; + if ( !isArtificialItem( nId ) ) + aItemImage = pImageManager->GetImage( lcl_getSlotId( nId ), m_eImageSize == eLarge, bIsHighContrast ); + m_pToolbar->SetItemImage( nId, aItemImage ); + } + } + + // TODO: using the "official" command URLs belonging to a FormFeature, it should be possible to obtain + // the images from some global UNO service, instead of using the SfxImageManager, and SFX slot IDs. + // Also, those URLs allow (/me thinks) to obtain the command texts, which we could set at the toolbox, + // so they would appear as tooltip. // parts of our layout is dependent on the size of our icons Resize(); @@ -369,7 +412,7 @@ namespace frm case ePosition: { static const USHORT aPositionIds[] = { - LID_RECORD_LABEL, SID_FM_RECORD_ABSOLUTE, LID_RECORD_FILLER, SID_FM_RECORD_TOTAL, 0 + LID_RECORD_LABEL, FormFeature::MoveAbsolute, LID_RECORD_FILLER, FormFeature::TotalRecords, 0 }; pGroupIds = aPositionIds; } @@ -377,7 +420,7 @@ namespace frm case eNavigation: { static const USHORT aNavigationIds[] = { - SID_FM_RECORD_FIRST, SID_FM_RECORD_PREV, SID_FM_RECORD_NEXT, SID_FM_RECORD_LAST, 0 + FormFeature::MoveToFirst, FormFeature::MoveToPrevious, FormFeature::MoveToNext, FormFeature::MoveToLast, FormFeature::MoveToInsertRow, 0 }; pGroupIds = aNavigationIds; } @@ -385,7 +428,7 @@ namespace frm case eRecordActions: { static const USHORT aActionIds[] = { - SID_FM_RECORD_SAVE, SID_FM_RECORD_UNDO, SID_FM_RECORD_NEW, SID_FM_RECORD_DELETE, SID_FM_REFRESH, SID_FM_REFRESH_FORM_CONTROL, 0 + FormFeature::SaveRecordChanges, FormFeature::UndoRecordChanges, FormFeature::DeleteRecord, FormFeature::ReloadForm, FormFeature::RefreshCurrentControl, 0 }; pGroupIds = aActionIds; } @@ -393,7 +436,7 @@ namespace frm case eFilterSort: { static const USHORT aFilterSortIds[] = { - SID_FM_SORTUP, SID_FM_SORTDOWN, SID_FM_ORDERCRIT, SID_FM_AUTOFILTER, SID_FM_FILTERCRIT, SID_FM_FORM_FILTERED, SID_FM_REMOVE_FILTER_SORT, 0 + FormFeature::SortAscending, FormFeature::SortDescending, FormFeature::InteractiveSort, FormFeature::AutoFilter, FormFeature::InteractiveFilter, FormFeature::ToggleApplyFilter, FormFeature::RemoveFilterAndSort, 0 }; pGroupIds = aFilterSortIds; } @@ -414,9 +457,9 @@ namespace frm switch ( _eGroup ) { case ePosition : nIndicatorItem = LID_RECORD_LABEL; break; - case eNavigation : nIndicatorItem = SID_FM_RECORD_FIRST; break; - case eRecordActions : nIndicatorItem = SID_FM_RECORD_SAVE; break; - case eFilterSort : nIndicatorItem = SID_FM_SORTUP; break; + case eNavigation : nIndicatorItem = FormFeature::MoveToFirst; break; + case eRecordActions : nIndicatorItem = FormFeature::SaveRecordChanges; break; + case eFilterSort : nIndicatorItem = FormFeature::SortAscending; break; default: OSL_ENSURE( sal_False, "NavigationToolBar::IsFunctionGroupVisible: invalid group id!" ); } @@ -583,11 +626,11 @@ namespace frm sItemText = getLabelString( RID_STR_LABEL_OF ); break; - case SID_FM_RECORD_ABSOLUTE: + case FormFeature::MoveAbsolute: sItemText = String::CreateFromAscii( "12345678" ); break; - case SID_FM_RECORD_TOTAL: + case FormFeature::TotalRecords: sItemText = String::CreateFromAscii( "123456" ); break; } @@ -642,7 +685,7 @@ namespace frm return; if ( m_pDispatcher ) - m_pDispatcher->dispatchWithArgument( SID_FM_RECORD_ABSOLUTE, "Position", ::com::sun::star::uno::makeAny( (sal_Int32)nRecord ) ); + m_pDispatcher->dispatchWithArgument( FormFeature::MoveAbsolute, "Position", makeAny( (sal_Int32)nRecord ) ); SaveValue(); } diff --git a/forms/source/solar/inc/navtoolbar.hxx b/forms/source/solar/inc/navtoolbar.hxx index b19c57431706..107a9cc2615b 100644 --- a/forms/source/solar/inc/navtoolbar.hxx +++ b/forms/source/solar/inc/navtoolbar.hxx @@ -86,15 +86,15 @@ namespace frm /** enables or disables a given feature */ - void enableFeature( sal_Int32 _nFeatureId, bool _bEnabled ); + void enableFeature( sal_Int16 _nFeatureId, bool _bEnabled ); /** checks or unchecks a given feature */ - void checkFeature( sal_Int32 _nFeatureId, bool _bEnabled ); + void checkFeature( sal_Int16 _nFeatureId, bool _bEnabled ); /** sets the text of a given feature */ - void setFeatureText( sal_Int32 _nFeatureId, const ::rtl::OUString& _rText ); + void setFeatureText( sal_Int16 _nFeatureId, const ::rtl::OUString& _rText ); /** retrieves the current image size */ |