LibreOffice Module sc (master)  1
tbzoomsliderctrl.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 #ifndef INCLUDED_SC_SOURCE_UI_INC_TBZOOMSLIDERCTRL_HXX
20 #define INCLUDED_SC_SOURCE_UI_INC_TBZOOMSLIDERCTRL_HXX
21 
22 #include <vcl/customweld.hxx>
23 #include <vcl/window.hxx>
24 #include <svl/poolitem.hxx>
26 #include <sfx2/tbxctrl.hxx>
27 
28 namespace com::sun::star::frame { class XDispatchProvider; }
29 
30 class SvxZoomSliderItem;
31 
33 {
34 public:
36  ScZoomSliderControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
37  virtual ~ScZoomSliderControl() override;
38 
39  virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override;
40  virtual VclPtr<InterimItemWindow> CreateItemWindow( vcl::Window *pParent ) override;
41 };
42 
44 {
45 private:
47  std::unique_ptr<ScZoomSliderWnd_Impl> mpImpl;
48  css::uno::Reference<css::frame::XDispatchProvider> m_xDispatchProvider;
49 
50  sal_uInt16 Offset2Zoom(long nOffset) const;
51  long Zoom2Offset(sal_uInt16 nZoom) const;
52 
53  void DoPaint(vcl::RenderContext& rRenderContext);
54 public:
55  ScZoomSlider(const css::uno::Reference<css::frame::XDispatchProvider>& rDispatchProvider,
56  sal_uInt16 nCurrentZoom, vcl::Window*);
57 
58  void UpdateFromItem(const SvxZoomSliderItem* pZoomSliderItem);
59 
60  virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
61  virtual bool MouseMove( const MouseEvent& rMEvt ) override;
62  virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
63 };
64 
65 class ScZoomSliderWnd final : public InterimItemWindow
66 {
67 private:
68  std::unique_ptr<ScZoomSlider> mxWidget;
69  std::unique_ptr<weld::CustomWeld> mxWeld;
70 
71 public:
72  ScZoomSliderWnd(vcl::Window* pParent, const css::uno::Reference<css::frame::XDispatchProvider>& rDispatchProvider,
73  sal_uInt16 nCurrentZoom);
74  virtual ~ScZoomSliderWnd() override;
75  virtual void dispose() override;
76  void UpdateFromItem( const SvxZoomSliderItem* pZoomSliderItem );
77 };
78 
79 #endif
80 
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::CustomWeld > mxWeld
void DoPaint(vcl::RenderContext &rRenderContext)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
virtual ~ScZoomSliderWnd() override
sal_Int16 nId
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchProvider
sal_uInt16 Offset2Zoom(long nOffset) const
virtual VclPtr< InterimItemWindow > CreateItemWindow(vcl::Window *pParent) override
virtual bool MouseMove(const MouseEvent &rMEvt) override
virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
ScZoomSliderWnd(vcl::Window *pParent, const css::uno::Reference< css::frame::XDispatchProvider > &rDispatchProvider, sal_uInt16 nCurrentZoom)
std::unique_ptr< ScZoomSlider > mxWidget
std::unique_ptr< ScZoomSliderWnd_Impl > mpImpl
virtual void dispose() override
ScZoomSlider(const css::uno::Reference< css::frame::XDispatchProvider > &rDispatchProvider, sal_uInt16 nCurrentZoom, vcl::Window *)
ScZoomSliderControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx)
virtual ~ScZoomSliderControl() override
SfxItemState
void UpdateFromItem(const SvxZoomSliderItem *pZoomSliderItem)
void UpdateFromItem(const SvxZoomSliderItem *pZoomSliderItem)
long Zoom2Offset(sal_uInt16 nZoom) const