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  using Window::CalcZoom;
55 
56  OUString aGraphicName;
60  long nOldWidth;
61  long nOldHeight;
63 
65 
66  std::unique_ptr<weld::Widget> m_xCropFrame;
67  std::unique_ptr<weld::RadioButton> m_xZoomConstRB;
68  std::unique_ptr<weld::RadioButton> m_xSizeConstRB;
69  std::unique_ptr<weld::MetricSpinButton> m_xLeftMF;
70  std::unique_ptr<weld::MetricSpinButton> m_xRightMF;
71  std::unique_ptr<weld::MetricSpinButton> m_xTopMF;
72  std::unique_ptr<weld::MetricSpinButton> m_xBottomMF;
73 
74  std::unique_ptr<weld::Widget> m_xScaleFrame;
75  std::unique_ptr<weld::MetricSpinButton> m_xWidthZoomMF;
76  std::unique_ptr<weld::MetricSpinButton> m_xHeightZoomMF;
77 
78  std::unique_ptr<weld::Widget> m_xSizeFrame;
79  std::unique_ptr<weld::MetricSpinButton> m_xWidthMF;
80  std::unique_ptr<weld::MetricSpinButton> m_xHeightMF;
81 
82  std::unique_ptr<weld::Widget> m_xOrigSizeGrid;
83  std::unique_ptr<weld::Label> m_xOrigSizeFT;
84  std::unique_ptr<weld::Button> m_xOrigSizePB;
85 
86  // Example
87  std::unique_ptr<weld::CustomWeld> m_xExampleWN;
88 
89  SvxGrfCropPage(TabPageParent pParent, const SfxItemSet &rSet);
90  virtual ~SvxGrfCropPage() override;
91  virtual void dispose() override;
92 
93  DECL_LINK(ZoomHdl, weld::MetricSpinButton&, void);
94  DECL_LINK(SizeHdl, weld::MetricSpinButton&, void);
95  DECL_LINK(CropModifyHdl, weld::MetricSpinButton&, void);
96  DECL_LINK(OrigSizeHdl, weld::Button&, void);
97 
98  void CalcZoom();
99  void CalcMinMaxBorder();
100  void GraphicHasChanged(bool bFound);
101  virtual void ActivatePage(const SfxItemSet& rSet) override;
102 
103  Size GetGrfOrigSize( const Graphic& ) const;
104 public:
105  static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet *rSet );
106 
107  virtual bool FillItemSet( SfxItemSet *rSet ) override;
108  virtual void Reset( const SfxItemSet *rSet ) override;
109  virtual DeactivateRC DeactivatePage( SfxItemSet *pSet ) override;
110 };
111 
112 #endif
113 
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Point m_aTopLeft
Definition: grfpage.hxx:31
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: grfpage.cxx:350
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:58
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: grfpage.cxx:289
void SetTop(long nVal)
Definition: grfpage.hxx:41
static VclPtr< SfxTabPage > Create(TabPageParent pParent, const SfxItemSet *rSet)
Definition: grfpage.cxx:118
std::unique_ptr< weld::MetricSpinButton > m_xLeftMF
Definition: grfpage.hxx:69
virtual void Paint(vcl::RenderContext &rRenderContext, const ::tools::Rectangle &rRect) override
Definition: grfpage.cxx:705
void SetLeft(long nVal)
Definition: grfpage.hxx:43
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: grfpage.cxx:692
std::unique_ptr< weld::MetricSpinButton > m_xTopMF
Definition: grfpage.hxx:71
std::unique_ptr< weld::Widget > m_xScaleFrame
Definition: grfpage.hxx:74
bool bSetOrigSize
Definition: grfpage.hxx:62
std::unique_ptr< weld::Widget > m_xCropFrame
Definition: grfpage.hxx:66
void setX(long nX)
long nOldWidth
Definition: grfpage.hxx:60
std::unique_ptr< weld::MetricSpinButton > m_xBottomMF
Definition: grfpage.hxx:72
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: grfpage.cxx:225
Size aPageSize
Definition: grfpage.hxx:59
Size m_aFrameSize
Definition: grfpage.hxx:30
std::unique_ptr< weld::MetricSpinButton > m_xRightMF
Definition: grfpage.hxx:70
void CalcZoom()
Definition: grfpage.cxx:534
virtual ~SvxGrfCropPage() override
Definition: grfpage.cxx:107
void setY(long nY)
virtual void ActivatePage()
std::unique_ptr< weld::MetricSpinButton > m_xHeightZoomMF
Definition: grfpage.hxx:76
std::unique_ptr< weld::CustomWeld > m_xExampleWN
Definition: grfpage.hxx:87
Size GetGrfOrigSize(const Graphic &) const
Definition: grfpage.cxx:672
Size aOrigSize
Definition: grfpage.hxx:57
void CalcMinMaxBorder()
Definition: grfpage.cxx:563
std::unique_ptr< weld::Button > m_xOrigSizePB
Definition: grfpage.hxx:84
SvxGrfCropPage(TabPageParent pParent, const SfxItemSet &rSet)
Definition: grfpage.cxx:55
void SetFrameSize(const Size &rSz)
Definition: grfpage.cxx:737
std::unique_ptr< weld::MetricSpinButton > m_xHeightMF
Definition: grfpage.hxx:80
std::unique_ptr< weld::Widget > m_xSizeFrame
Definition: grfpage.hxx:78
virtual void dispose() override
Definition: grfpage.cxx:112
std::unique_ptr< weld::MetricSpinButton > m_xWidthZoomMF
Definition: grfpage.hxx:75
std::unique_ptr< weld::RadioButton > m_xSizeConstRB
Definition: grfpage.hxx:68
long nOldHeight
Definition: grfpage.hxx:61
SvxCropExample m_aExampleWN
Definition: grfpage.hxx:64
virtual void Resize() override
Definition: grfpage.cxx:732
OUString aGraphicName
Definition: grfpage.hxx:56
std::unique_ptr< weld::RadioButton > m_xZoomConstRB
Definition: grfpage.hxx:67
void SetRight(long nVal)
Definition: grfpage.hxx:44
DeactivateRC
virtual void Reset(const SfxItemSet *rSet) override
Definition: grfpage.cxx:123
std::unique_ptr< weld::MetricSpinButton > m_xWidthMF
Definition: grfpage.hxx:79
std::unique_ptr< weld::Label > m_xOrigSizeFT
Definition: grfpage.hxx:83
virtual void DeactivatePage()
Point m_aBottomRight
Definition: grfpage.hxx:31
void GraphicHasChanged(bool bFound)
Definition: grfpage.cxx:592
void SetGraphic(const Graphic &rGrf)
Definition: grfpage.hxx:46
std::unique_ptr< weld::Widget > m_xOrigSizeGrid
Definition: grfpage.hxx:82
void SetBottom(long nVal)
Definition: grfpage.hxx:42