xref: /trunk/main/sc/source/ui/inc/tbzoomsliderctrl.hxx (revision 38d50f7b)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SC_ZOOMSLIDERTBCONTRL_HXX
24 #define _SC_ZOOMSLIDERTBCONTRL_HXX
25 
26 #ifndef _WINDOW_HXX        //autogen
27 #include <vcl/window.hxx>
28 #endif
29 #ifndef _SFXPOOLITEM_HXX   //autogen
30 #include <svl/poolitem.hxx>
31 #endif
32 #ifndef _SFXTBXCTRL_HXX    //autogen
33 #include <sfx2/tbxctrl.hxx>
34 #endif
35 #ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_
36 #include <com/sun/star/frame/XDispatchProvider.hpp>
37 #endif
38 #ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
39 #include <com/sun/star/frame/XFrame.hpp>
40 #endif
41 #include <svx/zoomslideritem.hxx>
42 
43 
44 //class ScZoomSliderControl define
45 class ScZoomSliderControl: public SfxToolBoxControl
46 {
47 public:
48     SFX_DECL_TOOLBOX_CONTROL();
49     ScZoomSliderControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
50     ~ScZoomSliderControl();
51 
52     virtual void    StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
53     virtual Window* CreateItemWindow( Window *pParent );
54 };
55 
56 //========================================================================
57 // class ScZoomSliderWnd define---------------------------------------
58 //========================================================================
59 class ScZoomSliderWnd: public Window
60 {
61 private:
62     struct                  ScZoomSliderWnd_Impl;
63     ScZoomSliderWnd_Impl*   mpImpl;
64     Size                    aLogicalSize;
65     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider;
66     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >            m_xFrame;
67 
68     sal_uInt16          Offset2Zoom( long nOffset ) const;
69     long            Zoom2Offset( sal_uInt16 nZoom ) const;
70     void            DoPaint( const Rectangle& rRect );
71 
72 public:
73     ScZoomSliderWnd( Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider,
74                     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame , sal_uInt16 nCurrentZoom );
75     ~ScZoomSliderWnd();
76     void            UpdateFromItem( const SvxZoomSliderItem* pZoomSliderItem );
77 
78 protected:
79     virtual void    MouseButtonDown( const MouseEvent& rMEvt );
80     virtual void    MouseMove( const MouseEvent& rMEvt );
81     virtual void    Paint( const Rectangle& rRect );
82 };
83 #endif
84