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 #ifndef INCLUDED_CUI_SOURCE_INC_GRFPAGE_HXX
21 #define INCLUDED_CUI_SOURCE_INC_GRFPAGE_HXX
22 
23 #include <vcl/customweld.hxx>
24 #include <vcl/graph.hxx>
25 #include <sfx2/tabdlg.hxx>
26 
28 {
33 
34 public:
36 
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;
40 
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; }
47 };
48 
49 class SvxGrfCropPage : public SfxTabPage
50 {
51  friend class VclPtr<SvxGrfCropPage>;
52 
53  OUString aGraphicName;
57  long nOldWidth;
58  long nOldHeight;
60 
62 
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;
70 
71  std::unique_ptr<weld::Widget> m_xScaleFrame;
72  std::unique_ptr<weld::MetricSpinButton> m_xWidthZoomMF;
73  std::unique_ptr<weld::MetricSpinButton> m_xHeightZoomMF;
74 
75  std::unique_ptr<weld::Widget> m_xSizeFrame;
76  std::unique_ptr<weld::MetricSpinButton> m_xWidthMF;
77  std::unique_ptr<weld::MetricSpinButton> m_xHeightMF;
78 
79  std::unique_ptr<weld::Widget> m_xOrigSizeGrid;
80  std::unique_ptr<weld::Label> m_xOrigSizeFT;
81  std::unique_ptr<weld::Button> m_xOrigSizePB;
82 
83  // Example
84  std::unique_ptr<weld::CustomWeld> m_xExampleWN;
85 
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);
90 
91  void CalcZoom();
92  void CalcMinMaxBorder();
93  void GraphicHasChanged(bool bFound);
94  virtual void ActivatePage(const SfxItemSet& rSet) override;
95 
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;
101 
102  virtual bool FillItemSet( SfxItemSet *rSet ) override;
103  virtual void Reset( const SfxItemSet *rSet ) override;
104  virtual DeactivateRC DeactivatePage( SfxItemSet *pSet ) override;
105 };
106 
107 #endif
108 
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Point m_aTopLeft
Definition: grfpage.hxx:31
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: grfpage.cxx:341
DECL_LINK(ZoomHdl, weld::MetricSpinButton &, void)
Graphic m_aGrf
Definition: grfpage.hxx:32
MapMode m_aMapMode
Definition: grfpage.hxx:29
const SfxItemSet * pSet
Size aOrigPixelSize
Definition: grfpage.hxx:55
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: grfpage.cxx:280
void SetTop(long nVal)
Definition: grfpage.hxx:41
std::unique_ptr< weld::MetricSpinButton > m_xLeftMF
Definition: grfpage.hxx:66
virtual void Paint(vcl::RenderContext &rRenderContext, const ::tools::Rectangle &rRect) override
Definition: grfpage.cxx:695
void SetLeft(long nVal)
Definition: grfpage.hxx:43
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: grfpage.cxx:682
std::unique_ptr< weld::MetricSpinButton > m_xTopMF
Definition: grfpage.hxx:68
std::unique_ptr< weld::Widget > m_xScaleFrame
Definition: grfpage.hxx:71
bool bSetOrigSize
Definition: grfpage.hxx:59
SvxGrfCropPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: grfpage.cxx:52
std::unique_ptr< weld::Widget > m_xCropFrame
Definition: grfpage.hxx:63
void setX(long nX)
long nOldWidth
Definition: grfpage.hxx:57
static Size GetGrfOrigSize(const Graphic &)
Definition: grfpage.cxx:662
std::unique_ptr< weld::MetricSpinButton > m_xBottomMF
Definition: grfpage.hxx:69
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: grfpage.cxx:216
Size aPageSize
Definition: grfpage.hxx:56
Size m_aFrameSize
Definition: grfpage.hxx:30
std::unique_ptr< weld::MetricSpinButton > m_xRightMF
Definition: grfpage.hxx:67
void CalcZoom()
Definition: grfpage.cxx:525
virtual ~SvxGrfCropPage() override
Definition: grfpage.cxx:104
void setY(long nY)
std::unique_ptr< weld::MetricSpinButton > m_xHeightZoomMF
Definition: grfpage.hxx:73
std::unique_ptr< weld::CustomWeld > m_xExampleWN
Definition: grfpage.hxx:84
Size aOrigSize
Definition: grfpage.hxx:54
void CalcMinMaxBorder()
Definition: grfpage.cxx:554
std::unique_ptr< weld::Button > m_xOrigSizePB
Definition: grfpage.hxx:81
void SetFrameSize(const Size &rSz)
Definition: grfpage.cxx:727
std::unique_ptr< weld::MetricSpinButton > m_xHeightMF
Definition: grfpage.hxx:77
std::unique_ptr< weld::Widget > m_xSizeFrame
Definition: grfpage.hxx:75
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: grfpage.cxx:109
std::unique_ptr< weld::MetricSpinButton > m_xWidthZoomMF
Definition: grfpage.hxx:72
std::unique_ptr< weld::RadioButton > m_xSizeConstRB
Definition: grfpage.hxx:65
long nOldHeight
Definition: grfpage.hxx:58
SvxCropExample m_aExampleWN
Definition: grfpage.hxx:61
virtual void Resize() override
Definition: grfpage.cxx:722
OUString aGraphicName
Definition: grfpage.hxx:53
std::unique_ptr< weld::RadioButton > m_xZoomConstRB
Definition: grfpage.hxx:64
void SetRight(long nVal)
Definition: grfpage.hxx:44
DeactivateRC
virtual void Reset(const SfxItemSet *rSet) override
Definition: grfpage.cxx:114
std::unique_ptr< weld::MetricSpinButton > m_xWidthMF
Definition: grfpage.hxx:76
std::unique_ptr< weld::Label > m_xOrigSizeFT
Definition: grfpage.hxx:80
Point m_aBottomRight
Definition: grfpage.hxx:31
void GraphicHasChanged(bool bFound)
Definition: grfpage.cxx:583
void SetGraphic(const Graphic &rGrf)
Definition: grfpage.hxx:46
std::unique_ptr< weld::Widget > m_xOrigSizeGrid
Definition: grfpage.hxx:79
void SetBottom(long nVal)
Definition: grfpage.hxx:42