LibreOffice Module cui (master)  1
swpossizetabpage.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 #ifndef INCLUDED_CUI_SOURCE_INC_SWPOSSIZETABPAGE_HXX
20 #define INCLUDED_CUI_SOURCE_INC_SWPOSSIZETABPAGE_HXX
21 
22 #include <sfx2/tabdlg.hxx>
23 #include <svx/swframeexample.hxx>
24 #include <vcl/weld.hxx>
25 
26 // SvxSwPosSizeTabPage - position and size page for Writer drawing objects
27 struct FrmMap;
28 class SdrView;
30 enum class SvxAnchorIds;
31 
33 {
35 
37 
38  ::tools::Rectangle m_aRect; //size of all selected objects
41 
42  FrmMap const * m_pVMap;
43  FrmMap const * m_pHMap;
45 
46  // initial values
47  short m_nOldH;
48  short m_nOldHRel;
49  short m_nOldV;
50  short m_nOldVRel;
51 
52  double m_fWidthHeightRatio; //width-to-height ratio to support the KeepRatio button
59 
61 
62  std::unique_ptr<weld::MetricSpinButton> m_xWidthMF;
63  std::unique_ptr<weld::MetricSpinButton> m_xHeightMF;
64  std::unique_ptr<weld::CheckButton> m_xKeepRatioCB;
65  std::unique_ptr<weld::RadioButton> m_xToPageRB;
66  std::unique_ptr<weld::RadioButton> m_xToParaRB;
67  std::unique_ptr<weld::RadioButton> m_xToCharRB;
68  std::unique_ptr<weld::RadioButton> m_xAsCharRB;
69  std::unique_ptr<weld::RadioButton> m_xToFrameRB;
70  std::unique_ptr<weld::CheckButton> m_xPositionCB;
71  std::unique_ptr<weld::CheckButton> m_xSizeCB;
72  std::unique_ptr<weld::Widget> m_xPosFrame;
73  std::unique_ptr<weld::Label> m_xHoriFT;
74  std::unique_ptr<weld::ComboBox> m_xHoriLB;
75  std::unique_ptr<weld::Label> m_xHoriByFT;
76  std::unique_ptr<weld::MetricSpinButton> m_xHoriByMF;
77  std::unique_ptr<weld::Label> m_xHoriToFT;
78  std::unique_ptr<weld::ComboBox> m_xHoriToLB;
79  std::unique_ptr<weld::CheckButton> m_xHoriMirrorCB;
80  std::unique_ptr<weld::Label> m_xVertFT;
81  std::unique_ptr<weld::ComboBox> m_xVertLB;
82  std::unique_ptr<weld::Label> m_xVertByFT;
83  std::unique_ptr<weld::MetricSpinButton> m_xVertByMF;
84  std::unique_ptr<weld::Label> m_xVertToFT;
85  std::unique_ptr<weld::ComboBox> m_xVertToLB;
86  std::unique_ptr<weld::CheckButton> m_xFollowCB;
87  std::unique_ptr<weld::CustomWeld> m_xExampleWN;
88 
89  DECL_LINK(RangeModifyHdl, weld::Widget&, void);
90  DECL_LINK(RangeModifyClickHdl, weld::ToggleButton&, void);
91  DECL_LINK(AnchorTypeHdl, weld::ToggleButton&, void);
92  DECL_LINK(PosHdl, weld::ComboBox&, void);
93  DECL_LINK(RelHdl, weld::ComboBox&, void);
94  DECL_LINK(MirrorHdl, weld::ToggleButton&, void);
95  DECL_LINK(ModifyHdl, weld::MetricSpinButton&, void);
96  DECL_LINK(ProtectHdl, weld::ToggleButton&, void);
97 
98  void InitPos(RndStdIds nAnchorType, sal_uInt16 nH, sal_uInt16 nHRel,
99  sal_uInt16 nV, sal_uInt16 nVRel,
100  long nX, long nY);
101  static sal_uInt16 GetMapPos(FrmMap const *pMap, const weld::ComboBox& rAlignLB);
102  static short GetAlignment(FrmMap const *pMap, sal_uInt16 nMapPos, const weld::ComboBox& rRelationLB);
103  static short GetRelation(const weld::ComboBox& rRelationLB);
104  RndStdIds GetAnchorType(bool* pbHasChanged = nullptr);
105  void FillRelLB(FrmMap const *pMap, sal_uInt16 nLBSelPos, sal_uInt16 nAlign, sal_uInt16 nRel, weld::ComboBox& rLB, weld::Label& rFT);
106  sal_uInt16 FillPosLB(FrmMap const *pMap, sal_uInt16 nAlign, const sal_uInt16 _nRel, weld::ComboBox& rLB);
107 
108  void UpdateExample();
109 
110  void setOptimalFrmWidth();
111  void setOptimalRelWidth();
112 
113 public:
114  SvxSwPosSizeTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
115  virtual void dispose() override;
116  virtual ~SvxSwPosSizeTabPage() override;
117 
119  static const sal_uInt16* GetRanges();
120 
121  virtual bool FillItemSet( SfxItemSet* ) override;
122  virtual void Reset( const SfxItemSet * ) override;
123 
124  virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
125 
126  void EnableAnchorTypes(SvxAnchorIds nAnchorEnable);
127 
129  {m_aValidateLink = rLink;}
130 
131  void SetView( const SdrView* pSdrView );
132 };
133 
134 #endif
135 
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual bool FillItemSet(SfxItemSet *) override
std::unique_ptr< weld::Label > m_xVertByFT
::tools::Rectangle m_aWorkArea
DECL_LINK(RangeModifyHdl, weld::Widget &, void)
static sal_uInt16 GetMapPos(FrmMap const *pMap, const weld::ComboBox &rAlignLB)
const SfxItemSet * pSet
void InitPos(RndStdIds nAnchorType, sal_uInt16 nH, sal_uInt16 nHRel, sal_uInt16 nV, sal_uInt16 nVRel, long nX, long nY)
void SetValidateFramePosLink(const Link< SvxSwFrameValidation &, void > &rLink)
std::unique_ptr< weld::CheckButton > m_xPositionCB
static VclPtr< SfxTabPage > Create(TabPageParent, const SfxItemSet *)
std::unique_ptr< weld::RadioButton > m_xToFrameRB
virtual void dispose() override
sal_uInt16 FillPosLB(FrmMap const *pMap, sal_uInt16 nAlign, const sal_uInt16 _nRel, weld::ComboBox &rLB)
std::unique_ptr< weld::CheckButton > m_xKeepRatioCB
std::unique_ptr< weld::Widget > m_xPosFrame
std::unique_ptr< weld::Label > m_xVertFT
static const sal_uInt16 * GetRanges()
std::unique_ptr< weld::Label > m_xHoriByFT
std::unique_ptr< weld::MetricSpinButton > m_xVertByMF
Link< SvxSwFrameValidation &, void > m_aValidateLink
std::unique_ptr< weld::CheckButton > m_xHoriMirrorCB
std::unique_ptr< weld::RadioButton > m_xToPageRB
std::unique_ptr< weld::ComboBox > m_xHoriToLB
std::unique_ptr< weld::ComboBox > m_xVertToLB
SwFrameExample m_aExampleWN
FrmMap const * m_pVMap
std::unique_ptr< weld::CheckButton > m_xSizeCB
std::unique_ptr< weld::CheckButton > m_xFollowCB
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
virtual void Reset(const SfxItemSet *) override
std::unique_ptr< weld::Label > m_xHoriToFT
std::unique_ptr< weld::ComboBox > m_xVertLB
std::unique_ptr< weld::RadioButton > m_xAsCharRB
std::unique_ptr< weld::MetricSpinButton > m_xWidthMF
std::unique_ptr< weld::MetricSpinButton > m_xHoriByMF
std::unique_ptr< weld::Label > m_xVertToFT
::tools::Rectangle m_aRect
std::unique_ptr< weld::ComboBox > m_xHoriLB
static short GetAlignment(FrmMap const *pMap, sal_uInt16 nMapPos, const weld::ComboBox &rRelationLB)
SvxSwPosSizeTabPage(TabPageParent pParent, const SfxItemSet &rInAttrs)
RndStdIds GetAnchorType(bool *pbHasChanged=nullptr)
const SdrView * m_pSdrView
SvxAnchorIds
static short GetRelation(const weld::ComboBox &rRelationLB)
std::unique_ptr< weld::MetricSpinButton > m_xHeightMF
DeactivateRC
std::unique_ptr< weld::RadioButton > m_xToCharRB
FrmMap const * m_pHMap
RndStdIds
virtual void DeactivatePage()
std::unique_ptr< weld::RadioButton > m_xToParaRB
void EnableAnchorTypes(SvxAnchorIds nAnchorEnable)
TriState
void FillRelLB(FrmMap const *pMap, sal_uInt16 nLBSelPos, sal_uInt16 nAlign, sal_uInt16 nRel, weld::ComboBox &rLB, weld::Label &rFT)
std::unique_ptr< weld::CustomWeld > m_xExampleWN
virtual ~SvxSwPosSizeTabPage() override
std::unique_ptr< weld::Label > m_xHoriFT
void SetView(const SdrView *pSdrView)