Bump version to 6.4.7.2.M8
[LibreOffice.git] / cui / source / inc / grfpage.hxx
blobafdc7cb6ba6f22bcad2bbe2774e1293a58d780ec
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 #ifndef INCLUDED_CUI_SOURCE_INC_GRFPAGE_HXX
21 #define INCLUDED_CUI_SOURCE_INC_GRFPAGE_HXX
23 #include <vcl/customweld.hxx>
24 #include <vcl/graph.hxx>
25 #include <sfx2/tabdlg.hxx>
27 class SvxCropExample : public weld::CustomWidgetController
29 MapMode m_aMapMode;
30 Size m_aFrameSize;
31 Point m_aTopLeft, m_aBottomRight;
32 Graphic m_aGrf;
34 public:
35 SvxCropExample();
37 virtual void Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect) override;
38 virtual void Resize() override;
39 virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
41 void SetTop( long nVal ) { m_aTopLeft.setX(nVal); }
42 void SetBottom( long nVal ) { m_aBottomRight.setX(nVal); }
43 void SetLeft( long nVal ) { m_aTopLeft.setY(nVal); }
44 void SetRight( long nVal) { m_aBottomRight.setY(nVal); }
45 void SetFrameSize( const Size& rSz );
46 void SetGraphic( const Graphic& rGrf ) { m_aGrf = rGrf; }
49 class SvxGrfCropPage : public SfxTabPage
51 friend class VclPtr<SvxGrfCropPage>;
53 OUString aGraphicName;
54 Size aOrigSize;
55 Size aOrigPixelSize;
56 Size aPageSize;
57 long nOldWidth;
58 long nOldHeight;
59 bool bSetOrigSize;
61 SvxCropExample m_aExampleWN;
63 std::unique_ptr<weld::Widget> m_xCropFrame;
64 std::unique_ptr<weld::RadioButton> m_xZoomConstRB;
65 std::unique_ptr<weld::RadioButton> m_xSizeConstRB;
66 std::unique_ptr<weld::MetricSpinButton> m_xLeftMF;
67 std::unique_ptr<weld::MetricSpinButton> m_xRightMF;
68 std::unique_ptr<weld::MetricSpinButton> m_xTopMF;
69 std::unique_ptr<weld::MetricSpinButton> m_xBottomMF;
71 std::unique_ptr<weld::Widget> m_xScaleFrame;
72 std::unique_ptr<weld::MetricSpinButton> m_xWidthZoomMF;
73 std::unique_ptr<weld::MetricSpinButton> m_xHeightZoomMF;
75 std::unique_ptr<weld::Widget> m_xSizeFrame;
76 std::unique_ptr<weld::MetricSpinButton> m_xWidthMF;
77 std::unique_ptr<weld::MetricSpinButton> m_xHeightMF;
79 std::unique_ptr<weld::Widget> m_xOrigSizeGrid;
80 std::unique_ptr<weld::Label> m_xOrigSizeFT;
81 std::unique_ptr<weld::Button> m_xOrigSizePB;
83 // Example
84 std::unique_ptr<weld::CustomWeld> m_xExampleWN;
86 DECL_LINK(ZoomHdl, weld::MetricSpinButton&, void);
87 DECL_LINK(SizeHdl, weld::MetricSpinButton&, void);
88 DECL_LINK(CropModifyHdl, weld::MetricSpinButton&, void);
89 DECL_LINK(OrigSizeHdl, weld::Button&, void);
91 void CalcZoom();
92 void CalcMinMaxBorder();
93 void GraphicHasChanged(bool bFound);
94 virtual void ActivatePage(const SfxItemSet& rSet) override;
96 static Size GetGrfOrigSize(const Graphic&);
97 public:
98 SvxGrfCropPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet);
99 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet );
100 virtual ~SvxGrfCropPage() override;
102 virtual bool FillItemSet( SfxItemSet *rSet ) override;
103 virtual void Reset( const SfxItemSet *rSet ) override;
104 virtual DeactivateRC DeactivatePage( SfxItemSet *pSet ) override;
107 #endif
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */