Use COMReference to handle COM pointers in CreateShortcut
[LibreOffice.git] / cui / source / inc / swpossizetabpage.hxx
blob782d892a65a43f312dd39660837131347c99080a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #pragma once
21 #include <sfx2/tabdlg.hxx>
22 #include <svx/swframeexample.hxx>
23 #include <vcl/weld.hxx>
24 #include <svx/dlgutil.hxx>
26 // SvxSwPosSizeTabPage - position and size page for Writer drawing objects
27 struct FrmMap;
28 class SdrView;
29 struct SvxSwFrameValidation;
30 enum class SvxAnchorIds;
32 class SvxSwPosSizeTabPage : public SfxTabPage
34 Link<SvxSwFrameValidation&,void> m_aValidateLink;
36 ::tools::Rectangle m_aRect; //size of all selected objects
37 ::tools::Rectangle m_aWorkArea;
38 Point m_aAnchorPos;
40 FrmMap const * m_pVMap;
41 FrmMap const * m_pHMap;
42 const SdrView* m_pSdrView;
44 // initial values
45 short m_nOldH;
46 short m_nOldHRel;
47 short m_nOldV;
48 short m_nOldVRel;
50 double m_fWidthHeightRatio; //width-to-height ratio to support the KeepRatio button
51 bool m_bHtmlMode;
52 bool m_bIsVerticalFrame;
53 bool m_bPositioningDisabled;
54 bool m_bIsMultiSelection;
55 bool m_bIsInRightToLeft;
56 bool m_bDoNotMirrorRtlDrawObjs = false;
57 TriState m_nProtectSizeState;
59 SwFrameExample m_aExampleWN;
60 SvxRatioConnector m_aRatioTop;
61 SvxRatioConnector m_aRatioBottom;
63 std::unique_ptr<weld::MetricSpinButton> m_xWidthMF;
64 std::unique_ptr<weld::MetricSpinButton> m_xHeightMF;
65 std::unique_ptr<weld::CheckButton> m_xKeepRatioCB;
66 std::unique_ptr<weld::Image> m_xCbxScaleImg;
67 std::unique_ptr<weld::CustomWeld> m_xImgRatioTop;
68 std::unique_ptr<weld::CustomWeld> m_xImgRatioBottom;
69 std::unique_ptr<weld::RadioButton> m_xToPageRB;
70 std::unique_ptr<weld::RadioButton> m_xToParaRB;
71 std::unique_ptr<weld::RadioButton> m_xToCharRB;
72 std::unique_ptr<weld::RadioButton> m_xAsCharRB;
73 std::unique_ptr<weld::RadioButton> m_xToFrameRB;
74 std::unique_ptr<weld::CheckButton> m_xPositionCB;
75 std::unique_ptr<weld::CheckButton> m_xSizeCB;
76 std::unique_ptr<weld::Widget> m_xPosFrame;
77 std::unique_ptr<weld::Label> m_xHoriFT;
78 std::unique_ptr<weld::ComboBox> m_xHoriLB;
79 std::unique_ptr<weld::Label> m_xHoriByFT;
80 std::unique_ptr<weld::MetricSpinButton> m_xHoriByMF;
81 std::unique_ptr<weld::Label> m_xHoriToFT;
82 std::unique_ptr<weld::ComboBox> m_xHoriToLB;
83 std::unique_ptr<weld::CheckButton> m_xHoriMirrorCB;
84 std::unique_ptr<weld::Label> m_xVertFT;
85 std::unique_ptr<weld::ComboBox> m_xVertLB;
86 std::unique_ptr<weld::Label> m_xVertByFT;
87 std::unique_ptr<weld::MetricSpinButton> m_xVertByMF;
88 std::unique_ptr<weld::Label> m_xVertToFT;
89 std::unique_ptr<weld::ComboBox> m_xVertToLB;
90 std::unique_ptr<weld::CheckButton> m_xFollowCB;
91 std::unique_ptr<weld::CustomWeld> m_xExampleWN;
93 DECL_LINK(RangeModifyHdl, weld::Widget&, void);
94 DECL_LINK(RangeModifyClickHdl, weld::Toggleable&, void);
95 DECL_LINK(AnchorTypeHdl, weld::Toggleable&, void);
96 DECL_LINK(PosHdl, weld::ComboBox&, void);
97 DECL_LINK(RelHdl, weld::ComboBox&, void);
98 DECL_LINK(MirrorHdl, weld::Toggleable&, void);
99 DECL_LINK(ModifyHdl, weld::MetricSpinButton&, void);
100 DECL_LINK(ProtectHdl, weld::Toggleable&, void);
101 DECL_LINK(RatioHdl_Impl, weld::Toggleable&, void);
103 void InitPos(RndStdIds nAnchorType, sal_uInt16 nH, sal_uInt16 nHRel,
104 sal_uInt16 nV, sal_uInt16 nVRel,
105 tools::Long nX, tools::Long nY);
106 static sal_uInt16 GetMapPos(FrmMap const *pMap, const weld::ComboBox& rAlignLB);
107 static short GetAlignment(FrmMap const *pMap, sal_uInt16 nMapPos, const weld::ComboBox& rRelationLB);
108 static short GetRelation(const weld::ComboBox& rRelationLB);
109 RndStdIds GetAnchorType(bool* pbHasChanged = nullptr);
110 void FillRelLB(FrmMap const *pMap, sal_uInt16 nLBSelPos, sal_uInt16 nAlign, sal_uInt16 nRel, weld::ComboBox& rLB, weld::Label& rFT);
111 sal_uInt16 FillPosLB(FrmMap const *pMap, sal_uInt16 nAlign, const sal_uInt16 _nRel, weld::ComboBox& rLB);
113 void UpdateExample();
115 void setOptimalFrmWidth();
116 void setOptimalRelWidth();
118 public:
119 SvxSwPosSizeTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
120 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
121 virtual ~SvxSwPosSizeTabPage() override;
123 static const WhichRangesContainer & GetRanges();
125 virtual bool FillItemSet( SfxItemSet* ) override;
126 virtual void Reset( const SfxItemSet * ) override;
128 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
130 void EnableAnchorTypes(SvxAnchorIds nAnchorEnable);
132 void SetValidateFramePosLink( const Link<SvxSwFrameValidation&,void>& rLink )
133 {m_aValidateLink = rLink;}
135 void SetView( const SdrView* pSdrView );
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */