1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef FORMS_SOLAR_CONTROL_NAVTOOLBAR_HXX 29*cdf0e10cSrcweir #define FORMS_SOLAR_CONTROL_NAVTOOLBAR_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <vcl/toolbox.hxx> 32*cdf0e10cSrcweir #include <vcl/field.hxx> 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir //......................................................................... 37*cdf0e10cSrcweir namespace frm 38*cdf0e10cSrcweir { 39*cdf0e10cSrcweir //......................................................................... 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir class IFeatureDispatcher; 42*cdf0e10cSrcweir class ICommandImageProvider; 43*cdf0e10cSrcweir class ICommandDescriptionProvider; 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir class ImplNavToolBar; 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir //===================================================================== 48*cdf0e10cSrcweir //= NavigationToolBar 49*cdf0e10cSrcweir //===================================================================== 50*cdf0e10cSrcweir class NavigationToolBar : public Window 51*cdf0e10cSrcweir { 52*cdf0e10cSrcweir public: 53*cdf0e10cSrcweir enum ImageSize 54*cdf0e10cSrcweir { 55*cdf0e10cSrcweir eSmall, 56*cdf0e10cSrcweir eLarge 57*cdf0e10cSrcweir }; 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir enum FunctionGroup 60*cdf0e10cSrcweir { 61*cdf0e10cSrcweir ePosition, 62*cdf0e10cSrcweir eNavigation, 63*cdf0e10cSrcweir eRecordActions, 64*cdf0e10cSrcweir eFilterSort 65*cdf0e10cSrcweir }; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir private: 68*cdf0e10cSrcweir const IFeatureDispatcher* m_pDispatcher; 69*cdf0e10cSrcweir const ::boost::shared_ptr< const ICommandImageProvider > 70*cdf0e10cSrcweir m_pImageProvider; 71*cdf0e10cSrcweir const ::boost::shared_ptr< const ICommandDescriptionProvider > 72*cdf0e10cSrcweir m_pDescriptionProvider; 73*cdf0e10cSrcweir ImageSize m_eImageSize; 74*cdf0e10cSrcweir ImplNavToolBar* m_pToolbar; 75*cdf0e10cSrcweir ::std::vector< Window* > m_aChildWins; 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir public: 78*cdf0e10cSrcweir NavigationToolBar( 79*cdf0e10cSrcweir Window* _pParent, 80*cdf0e10cSrcweir WinBits _nStyle, 81*cdf0e10cSrcweir const ::boost::shared_ptr< const ICommandImageProvider >& _pImageProvider, 82*cdf0e10cSrcweir const ::boost::shared_ptr< const ICommandDescriptionProvider >& _pDescriptionProvider 83*cdf0e10cSrcweir ); 84*cdf0e10cSrcweir ~NavigationToolBar( ); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir /** sets the dispatcher which is to be used for the features 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir If the dispatcher is the same as the one which is currently set, 89*cdf0e10cSrcweir then the states of the features are updated 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir @param _pDispatcher 92*cdf0e10cSrcweir the new (or old) dispatcher. The caller is reponsible for 93*cdf0e10cSrcweir ensuring the life time of the object does exceed the life time 94*cdf0e10cSrcweir of the tool bar instance. 95*cdf0e10cSrcweir */ 96*cdf0e10cSrcweir void setDispatcher( const IFeatureDispatcher* _pDispatcher ); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir /// enables or disables a given feature 99*cdf0e10cSrcweir void enableFeature( sal_Int16 _nFeatureId, bool _bEnabled ); 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir /// checks or unchecks a given feature 102*cdf0e10cSrcweir void checkFeature( sal_Int16 _nFeatureId, bool _bEnabled ); 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir /// sets the text of a given feature 105*cdf0e10cSrcweir void setFeatureText( sal_Int16 _nFeatureId, const ::rtl::OUString& _rText ); 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir /** retrieves the current image size 108*cdf0e10cSrcweir */ 109*cdf0e10cSrcweir inline ImageSize GetImageSize( ) const { return m_eImageSize; } 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir /** sets the size of the images 112*cdf0e10cSrcweir */ 113*cdf0e10cSrcweir void SetImageSize( ImageSize _eSize ); 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir /** shows or hides a function group 116*cdf0e10cSrcweir */ 117*cdf0e10cSrcweir void ShowFunctionGroup( FunctionGroup _eGroup, bool _bShow ); 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir /** determines whether or not a given function group is currently visible 120*cdf0e10cSrcweir */ 121*cdf0e10cSrcweir bool IsFunctionGroupVisible( FunctionGroup _eGroup ); 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir // Window "overridables" (hiding the respective Window methods) 124*cdf0e10cSrcweir void SetControlBackground(); 125*cdf0e10cSrcweir void SetControlBackground( const Color& rColor ); 126*cdf0e10cSrcweir void SetTextLineColor( ); 127*cdf0e10cSrcweir void SetTextLineColor( const Color& rColor ); 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir protected: 130*cdf0e10cSrcweir // Window overridables 131*cdf0e10cSrcweir virtual void Resize(); 132*cdf0e10cSrcweir virtual void StateChanged( StateChangedType nType ); 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir /// ctor implementation 135*cdf0e10cSrcweir void implInit( ); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir /// impl version of SetImageSize 138*cdf0e10cSrcweir void implSetImageSize( ImageSize _eSize ); 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir /// updates the images of our items 141*cdf0e10cSrcweir void implUpdateImages(); 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir /// enables or disables an item, plus possible dependent items 144*cdf0e10cSrcweir void implEnableItem( sal_uInt16 _nItemId, bool _bEnabled ); 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir /** update the states of all features, using the callback 147*cdf0e10cSrcweir */ 148*cdf0e10cSrcweir void updateFeatureStates( ); 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir // iterating through item windows 151*cdf0e10cSrcweir typedef void (NavigationToolBar::*ItemWindowHandler) (sal_uInt16, Window*, const void*) const; 152*cdf0e10cSrcweir void forEachItemWindow( ItemWindowHandler _handler, const void* _pParam ); 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir void setItemBackground( sal_uInt16 /* _nItemId */, Window* _pItemWindow, const void* _pColor ) const; 155*cdf0e10cSrcweir void setTextLineColor( sal_uInt16 /* _nItemId */, Window* _pItemWindow, const void* _pColor ) const; 156*cdf0e10cSrcweir #if 0 157*cdf0e10cSrcweir void setItemWindowZoom( sal_uInt16 /* _nItemId */, Window* _pItemWindow, const void* /* _pParam */ ) const; 158*cdf0e10cSrcweir #endif 159*cdf0e10cSrcweir void setItemControlFont( sal_uInt16 /* _nItemId */, Window* _pItemWindow, const void* /* _pParam */ ) const; 160*cdf0e10cSrcweir void setItemControlForeground( sal_uInt16 /* _nItemId */, Window* _pItemWindow, const void* /* _pParam */ ) const; 161*cdf0e10cSrcweir void adjustItemWindowWidth( sal_uInt16 _nItemId, Window* _pItemWindow, const void* /* _pParam */ ) const; 162*cdf0e10cSrcweir void enableItemRTL( sal_uInt16 /*_nItemId*/, Window* _pItemWindow, const void* _pIsRTLEnabled ) const; 163*cdf0e10cSrcweir }; 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir //===================================================================== 166*cdf0e10cSrcweir //= RecordPositionInput 167*cdf0e10cSrcweir //===================================================================== 168*cdf0e10cSrcweir class RecordPositionInput : public NumericField 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir private: 171*cdf0e10cSrcweir const IFeatureDispatcher* m_pDispatcher; 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir public: 174*cdf0e10cSrcweir RecordPositionInput( Window* _pParent ); 175*cdf0e10cSrcweir ~RecordPositionInput(); 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir /** sets the dispatcher which is to be used for the features 178*cdf0e10cSrcweir */ 179*cdf0e10cSrcweir void setDispatcher( const IFeatureDispatcher* _pDispatcher ); 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir protected: 182*cdf0e10cSrcweir // Window overridables 183*cdf0e10cSrcweir virtual void LoseFocus(); 184*cdf0e10cSrcweir virtual void KeyInput( const KeyEvent& rKeyEvent ); 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir private: 187*cdf0e10cSrcweir void FirePosition( sal_Bool _bForce ); 188*cdf0e10cSrcweir }; 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir //......................................................................... 191*cdf0e10cSrcweir } // namespace frm 192*cdf0e10cSrcweir //......................................................................... 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir #endif // FORMS_SOLAR_CONTROL_NAVTOOLBAR_HXX 195