LibreOffice Module cui (master)  1
grfpage.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 
20 #pragma once
21 
22 #include <vcl/customweld.hxx>
23 #include <vcl/graph.hxx>
24 #include <sfx2/tabdlg.hxx>
25 
27 {
32 
33 public:
35 
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;
39 
40  void SetTop( long nVal ) { m_aTopLeft.setX(nVal); }
41  void SetBottom( long nVal ) { m_aBottomRight.setX(nVal); }
42  void SetLeft( long nVal ) { m_aTopLeft.setY(nVal); }
43  void SetRight( long nVal) { m_aBottomRight.setY(nVal); }
44  void SetFrameSize( const Size& rSz );
45  void SetGraphic( const Graphic& rGrf ) { m_aGrf = rGrf; }
46 };
47 
48 class SvxGrfCropPage : public SfxTabPage
49 {
50  friend class VclPtr<SvxGrfCropPage>;
51 
52  OUString aGraphicName;
56  long nOldWidth;
57  long nOldHeight;
59 
61 
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;
69 
70  std::unique_ptr<weld::Widget> m_xScaleFrame;
71  std::unique_ptr<weld::MetricSpinButton> m_xWidthZoomMF;
72  std::unique_ptr<weld::MetricSpinButton> m_xHeightZoomMF;
73 
74  std::unique_ptr<weld::Widget> m_xSizeFrame;
75  std::unique_ptr<weld::MetricSpinButton> m_xWidthMF;
76  std::unique_ptr<weld::MetricSpinButton> m_xHeightMF;
77 
78  std::unique_ptr<weld::Widget> m_xOrigSizeGrid;
79  std::unique_ptr<weld::Label> m_xOrigSizeFT;
80  std::unique_ptr<weld::Button> m_xOrigSizePB;
81 
82  // Example
83  std::unique_ptr<weld::CustomWeld> m_xExampleWN;
84 
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);
89 
90  void CalcZoom();
91  void CalcMinMaxBorder();
92  void GraphicHasChanged(bool bFound);
93  virtual void ActivatePage(const SfxItemSet& rSet) override;
94 
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;
100 
101  virtual bool FillItemSet( SfxItemSet *rSet ) override;
102  virtual void Reset( const SfxItemSet *rSet ) override;
103  virtual DeactivateRC DeactivatePage( SfxItemSet *pSet ) override;
104 };
105 
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Point m_aTopLeft
Definition: grfpage.hxx:30
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: grfpage.cxx:344
DECL_LINK(ZoomHdl, weld::MetricSpinButton &, void)
Graphic m_aGrf
Definition: grfpage.hxx:31
MapMode m_aMapMode
Definition: grfpage.hxx:28
const SfxItemSet * pSet
Size aOrigPixelSize
Definition: grfpage.hxx:54
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: grfpage.cxx:283
void SetTop(long nVal)
Definition: grfpage.hxx:40
std::unique_ptr< weld::MetricSpinButton > m_xLeftMF
Definition: grfpage.hxx:65
virtual void Paint(vcl::RenderContext &rRenderContext, const ::tools::Rectangle &rRect) override
Definition: grfpage.cxx:702
void SetLeft(long nVal)
Definition: grfpage.hxx:42
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: grfpage.cxx:689
std::unique_ptr< weld::MetricSpinButton > m_xTopMF
Definition: grfpage.hxx:67
std::unique_ptr< weld::Widget > m_xScaleFrame
Definition: grfpage.hxx:70
bool bSetOrigSize
Definition: grfpage.hxx:58
SvxGrfCropPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: grfpage.cxx:55
std::unique_ptr< weld::Widget > m_xCropFrame
Definition: grfpage.hxx:62
long nOldWidth
Definition: grfpage.hxx:56
static Size GetGrfOrigSize(const Graphic &)
Definition: grfpage.cxx:669
std::unique_ptr< weld::MetricSpinButton > m_xBottomMF
Definition: grfpage.hxx:68
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: grfpage.cxx:219
Size aPageSize
Definition: grfpage.hxx:55
Size m_aFrameSize
Definition: grfpage.hxx:29
std::unique_ptr< weld::MetricSpinButton > m_xRightMF
Definition: grfpage.hxx:66
void CalcZoom()
Definition: grfpage.cxx:528
virtual ~SvxGrfCropPage() override
Definition: grfpage.cxx:107
std::unique_ptr< weld::MetricSpinButton > m_xHeightZoomMF
Definition: grfpage.hxx:72
std::unique_ptr< weld::CustomWeld > m_xExampleWN
Definition: grfpage.hxx:83
Size aOrigSize
Definition: grfpage.hxx:53
void CalcMinMaxBorder()
Definition: grfpage.cxx:557
std::unique_ptr< weld::Button > m_xOrigSizePB
Definition: grfpage.hxx:80
void SetFrameSize(const Size &rSz)
Definition: grfpage.cxx:765
std::unique_ptr< weld::MetricSpinButton > m_xHeightMF
Definition: grfpage.hxx:76
std::unique_ptr< weld::Widget > m_xSizeFrame
Definition: grfpage.hxx:74
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: grfpage.cxx:112
std::unique_ptr< weld::MetricSpinButton > m_xWidthZoomMF
Definition: grfpage.hxx:71
std::unique_ptr< weld::RadioButton > m_xSizeConstRB
Definition: grfpage.hxx:64
long nOldHeight
Definition: grfpage.hxx:57
SvxCropExample m_aExampleWN
Definition: grfpage.hxx:60
virtual void Resize() override
Definition: grfpage.cxx:760
OUString aGraphicName
Definition: grfpage.hxx:52
std::unique_ptr< weld::RadioButton > m_xZoomConstRB
Definition: grfpage.hxx:63
void SetRight(long nVal)
Definition: grfpage.hxx:43
DeactivateRC
virtual void Reset(const SfxItemSet *rSet) override
Definition: grfpage.cxx:117
std::unique_ptr< weld::MetricSpinButton > m_xWidthMF
Definition: grfpage.hxx:75
std::unique_ptr< weld::Label > m_xOrigSizeFT
Definition: grfpage.hxx:79
Point m_aBottomRight
Definition: grfpage.hxx:30
void GraphicHasChanged(bool bFound)
Definition: grfpage.cxx:586
void SetGraphic(const Graphic &rGrf)
Definition: grfpage.hxx:45
std::unique_ptr< weld::Widget > m_xOrigSizeGrid
Definition: grfpage.hxx:78
void SetBottom(long nVal)
Definition: grfpage.hxx:41