1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _SC_ZOOMSLIDERTBCONTRL_HXX 28 #define _SC_ZOOMSLIDERTBCONTRL_HXX 29 30 #ifndef _WINDOW_HXX //autogen 31 #include <vcl/window.hxx> 32 #endif 33 #ifndef _SFXPOOLITEM_HXX //autogen 34 #include <svl/poolitem.hxx> 35 #endif 36 #ifndef _SFXTBXCTRL_HXX //autogen 37 #include <sfx2/tbxctrl.hxx> 38 #endif 39 #ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_ 40 #include <com/sun/star/frame/XDispatchProvider.hpp> 41 #endif 42 #ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_ 43 #include <com/sun/star/frame/XFrame.hpp> 44 #endif 45 #include <svx/zoomslideritem.hxx> 46 47 48 //class ScZoomSliderControl define 49 class ScZoomSliderControl: public SfxToolBoxControl 50 { 51 public: 52 SFX_DECL_TOOLBOX_CONTROL(); 53 ScZoomSliderControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ); 54 ~ScZoomSliderControl(); 55 56 virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ); 57 virtual Window* CreateItemWindow( Window *pParent ); 58 }; 59 60 //======================================================================== 61 // class ScZoomSliderWnd define--------------------------------------- 62 //======================================================================== 63 class ScZoomSliderWnd: public Window 64 { 65 private: 66 struct ScZoomSliderWnd_Impl; 67 ScZoomSliderWnd_Impl* mpImpl; 68 Size aLogicalSize; 69 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider; 70 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; 71 72 sal_uInt16 Offset2Zoom( long nOffset ) const; 73 long Zoom2Offset( sal_uInt16 nZoom ) const; 74 void DoPaint( const Rectangle& rRect ); 75 76 public: 77 ScZoomSliderWnd( Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider, 78 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame , sal_uInt16 nCurrentZoom ); 79 ~ScZoomSliderWnd(); 80 void UpdateFromItem( const SvxZoomSliderItem* pZoomSliderItem ); 81 82 protected: 83 virtual void MouseButtonDown( const MouseEvent& rMEvt ); 84 virtual void MouseMove( const MouseEvent& rMEvt ); 85 virtual void Paint( const Rectangle& rRect ); 86 }; 87 #endif 88