tdf#147611: fix indices
[LibreOffice.git] / cui / source / inc / grfpage.hxx
blob35653eaf6ade652c0a69de3ed40dcbedde8ba2c9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #pragma once
22 #include <vcl/customweld.hxx>
23 #include <vcl/graph.hxx>
24 #include <sfx2/tabdlg.hxx>
26 class SvxCropExample : public weld::CustomWidgetController
28 MapMode m_aMapMode;
29 Size m_aFrameSize;
30 Point m_aTopLeft, m_aBottomRight;
31 Graphic m_aGrf;
33 public:
34 SvxCropExample();
36 virtual void Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect) override;
37 virtual void Resize() override;
38 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
40 void SetTop( tools::Long nVal ) { m_aTopLeft.setX(nVal); }
41 void SetBottom( tools::Long nVal ) { m_aBottomRight.setX(nVal); }
42 void SetLeft( tools::Long nVal ) { m_aTopLeft.setY(nVal); }
43 void SetRight( tools::Long nVal) { m_aBottomRight.setY(nVal); }
44 void SetFrameSize( const Size& rSz );
45 void SetGraphic( const Graphic& rGrf ) { m_aGrf = rGrf; }
48 class SvxGrfCropPage : public SfxTabPage
50 friend class VclPtr<SvxGrfCropPage>;
52 OUString aGraphicName;
53 Size aOrigSize;
54 Size aOrigPixelSize;
55 Size aPageSize;
56 tools::Long nOldWidth;
57 tools::Long nOldHeight;
58 bool bSetOrigSize;
60 SvxCropExample m_aExampleWN;
62 std::unique_ptr<weld::Widget> m_xCropFrame;
63 std::unique_ptr<weld::RadioButton> m_xZoomConstRB;
64 std::unique_ptr<weld::RadioButton> m_xSizeConstRB;
65 std::unique_ptr<weld::MetricSpinButton> m_xLeftMF;
66 std::unique_ptr<weld::MetricSpinButton> m_xRightMF;
67 std::unique_ptr<weld::MetricSpinButton> m_xTopMF;
68 std::unique_ptr<weld::MetricSpinButton> m_xBottomMF;
70 std::unique_ptr<weld::Widget> m_xScaleFrame;
71 std::unique_ptr<weld::MetricSpinButton> m_xWidthZoomMF;
72 std::unique_ptr<weld::MetricSpinButton> m_xHeightZoomMF;
74 std::unique_ptr<weld::Widget> m_xSizeFrame;
75 std::unique_ptr<weld::MetricSpinButton> m_xWidthMF;
76 std::unique_ptr<weld::MetricSpinButton> m_xHeightMF;
78 std::unique_ptr<weld::Widget> m_xOrigSizeGrid;
79 std::unique_ptr<weld::Label> m_xOrigSizeFT;
80 std::unique_ptr<weld::Button> m_xOrigSizePB;
82 // Example
83 std::unique_ptr<weld::CustomWeld> m_xExampleWN;
85 DECL_LINK(ZoomHdl, weld::MetricSpinButton&, void);
86 DECL_LINK(SizeHdl, weld::MetricSpinButton&, void);
87 DECL_LINK(CropModifyHdl, weld::MetricSpinButton&, void);
88 DECL_LINK(OrigSizeHdl, weld::Button&, void);
90 void CalcZoom();
91 void CalcMinMaxBorder();
92 void GraphicHasChanged(bool bFound);
93 virtual void ActivatePage(const SfxItemSet& rSet) override;
95 static Size GetGrfOrigSize(const Graphic&);
96 public:
97 SvxGrfCropPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet);
98 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet );
99 virtual ~SvxGrfCropPage() override;
101 virtual bool FillItemSet( SfxItemSet *rSet ) override;
102 virtual void Reset( const SfxItemSet *rSet ) override;
103 virtual DeactivateRC DeactivatePage( SfxItemSet *pSet ) override;
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */