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_TRANSFRM_HXX 20 #define INCLUDED_CUI_SOURCE_INC_TRANSFRM_HXX 21 22 #include <svx/dlgctrl.hxx> 23 #include <svx/dialcontrol.hxx> 24 #include <svx/anchorid.hxx> 25 #include <basegfx/range/b2drange.hxx> 26 27 // predefines 28 class SdrView; 29 30 /************************************************************************* 31 |* 32 |* Transform-Tab-Dialog 33 |* 34 \************************************************************************/ 35 36 struct SvxSwFrameValidation; 37 class SvxTransformTabDialog : public SfxTabDialogController 38 { 39 private: 40 const SdrView* pView; 41 42 SvxAnchorIds nAnchorCtrls; 43 Link<SvxSwFrameValidation&,void> aValidateLink; 44 45 virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override; 46 47 public: 48 SvxTransformTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, 49 const SdrView* pView, 50 SvxAnchorIds nAnchorTypes); 51 52 //link for the Writer to validate positions 53 void SetValidateFramePosLink( const Link<SvxSwFrameValidation&,void>& rLink ); 54 }; 55 56 /************************************************************************* 57 |* 58 |* position and size tab page 59 |* 60 \************************************************************************/ 61 62 class SvxPositionSizeTabPage : public SvxTabPage 63 { 64 static const sal_uInt16 pPosSizeRanges[]; 65 66 private: 67 const SfxItemSet& mrOutAttrs; 68 69 const SdrView* mpView; 70 71 // #i75273# 72 basegfx::B2DRange maRange; 73 basegfx::B2DRange maWorkRange; 74 basegfx::B2DPoint maAnchor; 75 76 MapUnit mePoolUnit; 77 FieldUnit meDlgUnit; 78 TriState mnProtectSizeState; 79 bool mbPageDisabled; 80 bool mbProtectDisabled; 81 bool mbSizeDisabled; 82 bool mbAdjustDisabled; 83 bool mbIgnoreAutoGrowWidth; 84 bool mbIgnoreAutoGrowHeight; 85 86 // from size 87 // #i75273# 88 double mfOldWidth; 89 double mfOldHeight; 90 RectPoint meRP; 91 92 SvxRectCtl m_aCtlPos; 93 SvxRectCtl m_aCtlSize; 94 95 // position 96 std::unique_ptr<weld::Widget> m_xFlPosition; 97 std::unique_ptr<weld::MetricSpinButton> m_xMtrPosX; 98 std::unique_ptr<weld::MetricSpinButton> m_xMtrPosY; 99 std::unique_ptr<weld::CustomWeld> m_xCtlPos; 100 101 // size 102 std::unique_ptr<weld::Widget> m_xFlSize; 103 std::unique_ptr<weld::Label> m_xFtWidth; 104 std::unique_ptr<weld::MetricSpinButton> m_xMtrWidth; 105 std::unique_ptr<weld::Label> m_xFtHeight; 106 std::unique_ptr<weld::MetricSpinButton> m_xMtrHeight; 107 std::unique_ptr<weld::CheckButton> m_xCbxScale; 108 std::unique_ptr<weld::CustomWeld> m_xCtlSize; 109 110 // protect 111 std::unique_ptr<weld::Widget> m_xFlProtect; 112 std::unique_ptr<weld::CheckButton> m_xTsbPosProtect; 113 std::unique_ptr<weld::CheckButton> m_xTsbSizeProtect; 114 115 // adjust 116 std::unique_ptr<weld::Widget> m_xFlAdjust; 117 std::unique_ptr<weld::CheckButton> m_xTsbAutoGrowWidth; 118 std::unique_ptr<weld::CheckButton> m_xTsbAutoGrowHeight; 119 120 DECL_LINK(ChangePosProtectHdl, weld::ToggleButton&, void); 121 DECL_LINK(ChangeSizeProtectHdl, weld::ToggleButton&, void); 122 123 void SetMinMaxPosition(); 124 void GetTopLeftPosition(double& rfX, double& rfY, const basegfx::B2DRange& rRange); 125 126 DECL_LINK( ChangeWidthHdl, weld::MetricSpinButton&, void ); 127 DECL_LINK( ChangeHeightHdl, weld::MetricSpinButton&, void ); 128 DECL_LINK( ClickSizeProtectHdl, weld::ToggleButton&, void ); 129 DECL_LINK( ClickAutoHdl, weld::ToggleButton&, void ); 130 131 public: 132 SvxPositionSizeTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs); 133 virtual ~SvxPositionSizeTabPage() override; 134 135 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* ); GetRanges()136 static const sal_uInt16* GetRanges() { return pPosSizeRanges; } 137 138 virtual bool FillItemSet( SfxItemSet* ) override; 139 virtual void Reset( const SfxItemSet * ) override; 140 141 virtual void ActivatePage( const SfxItemSet& rSet ) override; 142 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; 143 144 virtual void PointChanged(weld::DrawingArea* pWindow, RectPoint eRP) override; 145 146 void Construct(); SetView(const SdrView * pSdrView)147 void SetView( const SdrView* pSdrView ) { mpView = pSdrView; } 148 149 virtual void FillUserData() override; 150 151 void DisableResize(); 152 void DisableProtect(); 153 154 void UpdateControlStates(); 155 }; 156 157 /************************************************************************* 158 |* 159 |* rotation angle tab page 160 |* 161 \************************************************************************/ 162 class SvxAngleTabPage : public SvxTabPage 163 { 164 static const sal_uInt16 pAngleRanges[]; 165 166 private: 167 const SfxItemSet& rOutAttrs; 168 const SdrView* pView; 169 170 // #i75273# 171 basegfx::B2DRange maRange; 172 basegfx::B2DPoint maAnchor; 173 174 MapUnit ePoolUnit; 175 FieldUnit eDlgUnit; 176 177 svx::SvxDialControl m_aCtlAngle; 178 SvxRectCtl m_aCtlRect; 179 180 std::unique_ptr<weld::Widget> m_xFlPosition; 181 std::unique_ptr<weld::MetricSpinButton> m_xMtrPosX; 182 std::unique_ptr<weld::MetricSpinButton> m_xMtrPosY; 183 std::unique_ptr<weld::CustomWeld> m_xCtlRect; 184 std::unique_ptr<weld::Widget> m_xFlAngle; 185 std::unique_ptr<weld::SpinButton> m_xNfAngle; 186 std::unique_ptr<weld::CustomWeld> m_xCtlAngle; 187 188 public: 189 SvxAngleTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs); 190 virtual ~SvxAngleTabPage() override; 191 192 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* ); GetRanges()193 static const sal_uInt16* GetRanges() { return pAngleRanges; } 194 195 virtual bool FillItemSet( SfxItemSet* ) override; 196 virtual void Reset( const SfxItemSet * ) override; 197 198 virtual void ActivatePage( const SfxItemSet& rSet ) override; 199 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; 200 201 virtual void PointChanged(weld::DrawingArea* pWindow, RectPoint eRP) override; 202 203 void Construct(); SetView(const SdrView * pSdrView)204 void SetView( const SdrView* pSdrView ) { pView = pSdrView; } 205 }; 206 207 /************************************************************************* 208 |* 209 |* slant/corner radius tab page 210 |* 211 \************************************************************************/ 212 class SvxSlantTabPage : public SfxTabPage 213 { 214 static const sal_uInt16 pSlantRanges[]; 215 216 private: 217 const SfxItemSet& rOutAttrs; 218 219 const SdrView* pView; 220 221 MapUnit ePoolUnit; 222 FieldUnit eDlgUnit; 223 224 std::unique_ptr<weld::Widget> m_xFlRadius; 225 std::unique_ptr<weld::MetricSpinButton> m_xMtrRadius; 226 std::unique_ptr<weld::Widget> m_xFlAngle; 227 std::unique_ptr<weld::MetricSpinButton> m_xMtrAngle; 228 std::unique_ptr<weld::Widget> m_aControlGroups[2]; 229 std::unique_ptr<weld::Widget> m_aControlGroupX[2]; 230 std::unique_ptr<weld::MetricSpinButton> m_aControlX[2]; 231 std::unique_ptr<weld::Widget> m_aControlGroupY[2]; 232 std::unique_ptr<weld::MetricSpinButton> m_aControlY[2]; 233 234 public: 235 SvxSlantTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs); 236 virtual ~SvxSlantTabPage() override; 237 238 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* ); GetRanges()239 static const sal_uInt16* GetRanges() { return pSlantRanges; } 240 241 virtual bool FillItemSet( SfxItemSet* ) override; 242 virtual void Reset( const SfxItemSet * ) override; 243 244 virtual void ActivatePage( const SfxItemSet& rSet ) override; 245 virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; 246 247 void Construct(); SetView(const SdrView * pSdrView)248 void SetView( const SdrView* pSdrView ) { pView = pSdrView; } 249 }; 250 251 252 #endif // INCLUDED_CUI_SOURCE_INC_TRANSFRM_HXX 253 254 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 255