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#pragma once
20
21#include <vcl/customweld.hxx>
22#include <vcl/image.hxx>
23#include <vcl/window.hxx>
24#include <svl/poolitem.hxx>
26#include <sfx2/tbxctrl.hxx>
27
29
31
33{
34public:
36 ScZoomSliderControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
37 virtual ~ScZoomSliderControl() override;
38
39 virtual void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override;
40 virtual VclPtr<InterimItemWindow> CreateItemWindow( vcl::Window *pParent ) override;
41};
42
44{
45private:
46 sal_uInt16 mnCurrentZoom;
47 sal_uInt16 mnMinZoom;
48 sal_uInt16 mnMaxZoom;
49 std::vector< tools::Long > maSnappingPointOffsets;
50 std::vector< sal_uInt16 > maSnappingPointZooms;
55 css::uno::Reference<css::frame::XDispatchProvider> m_xDispatchProvider;
56
57 sal_uInt16 Offset2Zoom(tools::Long nOffset) const;
58 tools::Long Zoom2Offset(sal_uInt16 nZoom) const;
59
60 void DoPaint(vcl::RenderContext& rRenderContext);
61public:
62 ScZoomSlider(css::uno::Reference<css::frame::XDispatchProvider> xDispatchProvider,
63 sal_uInt16 nCurrentZoom);
64
65 void UpdateFromItem(const SvxZoomSliderItem* pZoomSliderItem);
66
67 virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
68 virtual bool MouseMove( const MouseEvent& rMEvt ) override;
69 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
70};
71
73{
74private:
75 std::unique_ptr<ScZoomSlider> mxWidget;
76 std::unique_ptr<weld::CustomWeld> mxWeld;
77
78public:
79 ScZoomSliderWnd(vcl::Window* pParent, const css::uno::Reference<css::frame::XDispatchProvider>& rDispatchProvider,
80 sal_uInt16 nCurrentZoom);
81 virtual ~ScZoomSliderWnd() override;
82 virtual void dispose() override;
83 void UpdateFromItem( const SvxZoomSliderItem* pZoomSliderItem );
84};
85
86/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
virtual ~ScZoomSliderControl() override
ScZoomSliderControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx)
virtual VclPtr< InterimItemWindow > CreateItemWindow(vcl::Window *pParent) override
void UpdateFromItem(const SvxZoomSliderItem *pZoomSliderItem)
std::unique_ptr< weld::CustomWeld > mxWeld
virtual void dispose() override
std::unique_ptr< ScZoomSlider > mxWidget
ScZoomSliderWnd(vcl::Window *pParent, const css::uno::Reference< css::frame::XDispatchProvider > &rDispatchProvider, sal_uInt16 nCurrentZoom)
virtual ~ScZoomSliderWnd() override
void DoPaint(vcl::RenderContext &rRenderContext)
std::vector< sal_uInt16 > maSnappingPointZooms
virtual bool MouseMove(const MouseEvent &rMEvt) override
sal_uInt16 Offset2Zoom(tools::Long nOffset) const
ScZoomSlider(css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider, sal_uInt16 nCurrentZoom)
css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchProvider
std::vector< tools::Long > maSnappingPointOffsets
void UpdateFromItem(const SvxZoomSliderItem *pZoomSliderItem)
sal_uInt16 mnMinZoom
tools::Long Zoom2Offset(sal_uInt16 nZoom) const
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
sal_uInt16 mnMaxZoom
sal_uInt16 mnCurrentZoom
long Long
SfxItemState