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