1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SC_SOURCE_UI_INC_TBZOOMSLIDERCTRL_HXX
20 #define INCLUDED_SC_SOURCE_UI_INC_TBZOOMSLIDERCTRL_HXX
22 #include <vcl/window.hxx>
23 #include <svl/poolitem.hxx>
24 #include <sfx2/tbxctrl.hxx>
25 #include <com/sun/star/frame/XDispatchProvider.hpp>
26 #include <com/sun/star/frame/XFrame.hpp>
27 #include <svx/zoomslideritem.hxx>
29 class ScZoomSliderControl
: public SfxToolBoxControl
32 SFX_DECL_TOOLBOX_CONTROL();
33 ScZoomSliderControl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
);
34 virtual ~ScZoomSliderControl();
36 virtual void StateChanged( sal_uInt16 nSID
, SfxItemState eState
, const SfxPoolItem
* pState
) SAL_OVERRIDE
;
37 virtual VclPtr
<vcl::Window
> CreateItemWindow( vcl::Window
*pParent
) SAL_OVERRIDE
;
40 class ScZoomSliderWnd
: public vcl::Window
43 struct ScZoomSliderWnd_Impl
;
44 ScZoomSliderWnd_Impl
* mpImpl
;
46 css::uno::Reference
<css::frame::XDispatchProvider
> m_xDispatchProvider
;
47 css::uno::Reference
<css::frame::XFrame
> m_xFrame
;
49 sal_uInt16
Offset2Zoom(long nOffset
) const;
50 long Zoom2Offset(sal_uInt16 nZoom
) const;
51 void DoPaint(vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
);
54 ScZoomSliderWnd(vcl::Window
* pParent
, const css::uno::Reference
<css::frame::XDispatchProvider
>& rDispatchProvider
,
55 const css::uno::Reference
<css::frame::XFrame
>& _xFrame
, sal_uInt16 nCurrentZoom
);
56 virtual ~ScZoomSliderWnd();
57 virtual void dispose() SAL_OVERRIDE
;
58 void UpdateFromItem( const SvxZoomSliderItem
* pZoomSliderItem
);
61 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
62 virtual void MouseMove( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
63 virtual void Paint(vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
) SAL_OVERRIDE
;
67 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */