1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_cui.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir // include --------------------------------------------------------------- 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include <tools/shl.hxx> 34*cdf0e10cSrcweir #include <sfx2/app.hxx> 35*cdf0e10cSrcweir #include <svx/svdview.hxx> 36*cdf0e10cSrcweir #include <svx/svdobj.hxx> 37*cdf0e10cSrcweir #include <svx/svdpagv.hxx> 38*cdf0e10cSrcweir #include <svx/svdotext.hxx> 39*cdf0e10cSrcweir #include <svx/sderitm.hxx> 40*cdf0e10cSrcweir #include <svx/dialogs.hrc> 41*cdf0e10cSrcweir #include <cuires.hrc> 42*cdf0e10cSrcweir #include "transfrm.hrc" 43*cdf0e10cSrcweir #include <editeng/sizeitem.hxx> 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir #include "transfrm.hxx" 46*cdf0e10cSrcweir #include <dialmgr.hxx> 47*cdf0e10cSrcweir #include "svx/dlgutil.hxx" 48*cdf0e10cSrcweir #include <editeng/svxenum.hxx> 49*cdf0e10cSrcweir #include "svx/anchorid.hxx" 50*cdf0e10cSrcweir #include <sfx2/module.hxx> 51*cdf0e10cSrcweir #include <svl/rectitem.hxx> 52*cdf0e10cSrcweir #include <svl/aeitem.hxx> 53*cdf0e10cSrcweir #include <swpossizetabpage.hxx> 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir // Toleranz fuer WorkingArea 56*cdf0e10cSrcweir #define DIFF 1000 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir // static ---------------------------------------------------------------- 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir static sal_uInt16 pPosSizeRanges[] = 61*cdf0e10cSrcweir { 62*cdf0e10cSrcweir SID_ATTR_TRANSFORM_POS_X, 63*cdf0e10cSrcweir SID_ATTR_TRANSFORM_POS_Y, 64*cdf0e10cSrcweir SID_ATTR_TRANSFORM_PROTECT_POS, 65*cdf0e10cSrcweir SID_ATTR_TRANSFORM_PROTECT_POS, 66*cdf0e10cSrcweir SID_ATTR_TRANSFORM_INTERN, 67*cdf0e10cSrcweir SID_ATTR_TRANSFORM_INTERN, 68*cdf0e10cSrcweir SID_ATTR_TRANSFORM_ANCHOR, 69*cdf0e10cSrcweir SID_ATTR_TRANSFORM_VERT_ORIENT, 70*cdf0e10cSrcweir SID_ATTR_TRANSFORM_WIDTH, 71*cdf0e10cSrcweir SID_ATTR_TRANSFORM_SIZE_POINT, 72*cdf0e10cSrcweir SID_ATTR_TRANSFORM_PROTECT_POS, 73*cdf0e10cSrcweir SID_ATTR_TRANSFORM_INTERN, 74*cdf0e10cSrcweir SID_ATTR_TRANSFORM_AUTOWIDTH, 75*cdf0e10cSrcweir SID_ATTR_TRANSFORM_AUTOHEIGHT, 76*cdf0e10cSrcweir 0 77*cdf0e10cSrcweir }; 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir static sal_uInt16 pAngleRanges[] = 80*cdf0e10cSrcweir { 81*cdf0e10cSrcweir SID_ATTR_TRANSFORM_ROT_X, 82*cdf0e10cSrcweir SID_ATTR_TRANSFORM_ANGLE, 83*cdf0e10cSrcweir SID_ATTR_TRANSFORM_INTERN, 84*cdf0e10cSrcweir SID_ATTR_TRANSFORM_INTERN, 85*cdf0e10cSrcweir 0 86*cdf0e10cSrcweir }; 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir static sal_uInt16 pSlantRanges[] = 89*cdf0e10cSrcweir { 90*cdf0e10cSrcweir SDRATTR_ECKENRADIUS, 91*cdf0e10cSrcweir SDRATTR_ECKENRADIUS, 92*cdf0e10cSrcweir SID_ATTR_TRANSFORM_SHEAR, 93*cdf0e10cSrcweir SID_ATTR_TRANSFORM_SHEAR_VERTICAL, 94*cdf0e10cSrcweir SID_ATTR_TRANSFORM_INTERN, 95*cdf0e10cSrcweir SID_ATTR_TRANSFORM_INTERN, 96*cdf0e10cSrcweir 0 97*cdf0e10cSrcweir }; 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir void lcl_ConvertRect(basegfx::B2DRange& rRange, const sal_uInt16 nDigits, const MapUnit ePoolUnit, const FieldUnit eDlgUnit) 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir const basegfx::B2DPoint aTopLeft( 102*cdf0e10cSrcweir (double)MetricField::ConvertValue(basegfx::fround(rRange.getMinX()), nDigits, ePoolUnit, eDlgUnit), 103*cdf0e10cSrcweir (double)MetricField::ConvertValue(basegfx::fround(rRange.getMinY()), nDigits, ePoolUnit, eDlgUnit)); 104*cdf0e10cSrcweir const basegfx::B2DPoint aBottomRight( 105*cdf0e10cSrcweir (double)MetricField::ConvertValue(basegfx::fround(rRange.getMaxX()), nDigits, ePoolUnit, eDlgUnit), 106*cdf0e10cSrcweir (double)MetricField::ConvertValue(basegfx::fround(rRange.getMaxY()), nDigits, ePoolUnit, eDlgUnit)); 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir rRange = basegfx::B2DRange(aTopLeft, aBottomRight); 109*cdf0e10cSrcweir } 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir void lcl_ScaleRect(basegfx::B2DRange& rRange, const Fraction aUIScale) 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir const double fFactor(1.0 / double(aUIScale)); 114*cdf0e10cSrcweir rRange = basegfx::B2DRange(rRange.getMinimum() * fFactor, rRange.getMaximum() * fFactor); 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir /************************************************************************* 118*cdf0e10cSrcweir |* 119*cdf0e10cSrcweir |* Konstruktor des Tab-Dialogs: Fuegt die Seiten zum Dialog hinzu 120*cdf0e10cSrcweir |* 121*cdf0e10cSrcweir \************************************************************************/ 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir SvxTransformTabDialog::SvxTransformTabDialog( Window* pParent, const SfxItemSet* pAttr, 124*cdf0e10cSrcweir const SdrView* pSdrView, sal_uInt16 nAnchorTypes ) : 125*cdf0e10cSrcweir SfxTabDialog( pParent, CUI_RES( RID_SVXDLG_TRANSFORM ), pAttr ), 126*cdf0e10cSrcweir pView ( pSdrView ), 127*cdf0e10cSrcweir nAnchorCtrls(nAnchorTypes) 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir DBG_ASSERT(pView, "no valid view (!)"); 130*cdf0e10cSrcweir FreeResource(); 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir //different positioning page in Writer 133*cdf0e10cSrcweir if(nAnchorCtrls & 0x00ff) 134*cdf0e10cSrcweir { 135*cdf0e10cSrcweir AddTabPage(RID_SVXPAGE_SWPOSSIZE, SvxSwPosSizeTabPage::Create, SvxSwPosSizeTabPage::GetRanges); 136*cdf0e10cSrcweir RemoveTabPage(RID_SVXPAGE_POSITION_SIZE); 137*cdf0e10cSrcweir } 138*cdf0e10cSrcweir else 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir AddTabPage(RID_SVXPAGE_POSITION_SIZE, SvxPositionSizeTabPage::Create, SvxPositionSizeTabPage::GetRanges); 141*cdf0e10cSrcweir RemoveTabPage(RID_SVXPAGE_SWPOSSIZE); 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir AddTabPage(RID_SVXPAGE_ANGLE, SvxAngleTabPage::Create, SvxAngleTabPage::GetRanges); 145*cdf0e10cSrcweir AddTabPage(RID_SVXPAGE_SLANT, SvxSlantTabPage::Create, SvxSlantTabPage::GetRanges); 146*cdf0e10cSrcweir } 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir // ----------------------------------------------------------------------- 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir SvxTransformTabDialog::~SvxTransformTabDialog() 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir // ----------------------------------------------------------------------- 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir void SvxTransformTabDialog::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) 157*cdf0e10cSrcweir { 158*cdf0e10cSrcweir switch(nId) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir case RID_SVXPAGE_POSITION_SIZE: 161*cdf0e10cSrcweir { 162*cdf0e10cSrcweir SvxPositionSizeTabPage& rSvxPos = static_cast<SvxPositionSizeTabPage&>(rPage); 163*cdf0e10cSrcweir rSvxPos.SetView(pView); 164*cdf0e10cSrcweir rSvxPos.Construct(); 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir if(nAnchorCtrls & SVX_OBJ_NORESIZE) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir rSvxPos.DisableResize(); 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir if(nAnchorCtrls & SVX_OBJ_NOPROTECT) 172*cdf0e10cSrcweir { 173*cdf0e10cSrcweir rSvxPos.DisableProtect(); 174*cdf0e10cSrcweir rSvxPos.UpdateControlStates(); 175*cdf0e10cSrcweir } 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir break; 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir case RID_SVXPAGE_SWPOSSIZE : 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir SvxSwPosSizeTabPage& rSwPos = static_cast<SvxSwPosSizeTabPage&>(rPage); 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir rSwPos.EnableAnchorTypes(nAnchorCtrls); 184*cdf0e10cSrcweir rSwPos.SetValidateFramePosLink(aValidateLink); 185*cdf0e10cSrcweir rSwPos.SetView(pView); 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir break; 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir case RID_SVXPAGE_ANGLE: 191*cdf0e10cSrcweir { 192*cdf0e10cSrcweir SvxAngleTabPage& rSvxAng = static_cast<SvxAngleTabPage&>(rPage); 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir rSvxAng.SetView( pView ); 195*cdf0e10cSrcweir rSvxAng.Construct(); 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir break; 198*cdf0e10cSrcweir } 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir case RID_SVXPAGE_SLANT: 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir SvxSlantTabPage& rSvxSlnt = static_cast<SvxSlantTabPage&>(rPage); 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir rSvxSlnt.SetView( pView ); 205*cdf0e10cSrcweir rSvxSlnt.Construct(); 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir break; 208*cdf0e10cSrcweir } 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir } 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir // ----------------------------------------------------------------------- 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir void SvxTransformTabDialog::SetValidateFramePosLink(const Link& rLink) 215*cdf0e10cSrcweir { 216*cdf0e10cSrcweir aValidateLink = rLink; 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir /************************************************************************* 220*cdf0e10cSrcweir |* 221*cdf0e10cSrcweir |* Dialog zum Aendern der Position des Drehwinkels und des Drehwinkels 222*cdf0e10cSrcweir |* der Grafikobjekte 223*cdf0e10cSrcweir |* 224*cdf0e10cSrcweir \************************************************************************/ 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir SvxAngleTabPage::SvxAngleTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : 227*cdf0e10cSrcweir SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_ANGLE ), rInAttrs ), 228*cdf0e10cSrcweir aFlPosition ( this, CUI_RES( FL_POSITION ) ), 229*cdf0e10cSrcweir aFtPosX ( this, CUI_RES( FT_POS_X ) ), 230*cdf0e10cSrcweir aMtrPosX ( this, CUI_RES( MTR_FLD_POS_X ) ), 231*cdf0e10cSrcweir aFtPosY ( this, CUI_RES( FT_POS_Y ) ), 232*cdf0e10cSrcweir aMtrPosY ( this, CUI_RES( MTR_FLD_POS_Y ) ), 233*cdf0e10cSrcweir aFtPosPresets ( this, CUI_RES(FT_POSPRESETS) ), 234*cdf0e10cSrcweir aCtlRect ( this, CUI_RES( CTL_RECT ) ), 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir aFlAngle ( this, CUI_RES( FL_ANGLE ) ), 237*cdf0e10cSrcweir aFtAngle ( this, CUI_RES( FT_ANGLE ) ), 238*cdf0e10cSrcweir aMtrAngle ( this, CUI_RES( MTR_FLD_ANGLE ) ), 239*cdf0e10cSrcweir aFtAnglePresets ( this, CUI_RES(FT_ANGLEPRESETS) ), 240*cdf0e10cSrcweir aCtlAngle ( this, CUI_RES( CTL_ANGLE ), 241*cdf0e10cSrcweir RP_RB, 200, 80, CS_ANGLE ), 242*cdf0e10cSrcweir rOutAttrs ( rInAttrs ) 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir FreeResource(); 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir // calculate PoolUnit 247*cdf0e10cSrcweir SfxItemPool* pPool = rOutAttrs.GetPool(); 248*cdf0e10cSrcweir DBG_ASSERT( pPool, "no pool (!)" ); 249*cdf0e10cSrcweir ePoolUnit = pPool->GetMetric(SID_ATTR_TRANSFORM_POS_X); 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir aMtrAngle.SetModifyHdl(LINK( this, SvxAngleTabPage, ModifiedHdl)); 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir aCtlRect.SetAccessibleRelationLabeledBy(&aFtPosPresets); 254*cdf0e10cSrcweir aCtlRect.SetAccessibleRelationMemberOf(&aFlPosition); 255*cdf0e10cSrcweir aCtlAngle.SetAccessibleRelationLabeledBy(&aFtAnglePresets); 256*cdf0e10cSrcweir aCtlAngle.SetAccessibleRelationMemberOf(&aFlAngle); 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir // ----------------------------------------------------------------------- 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir void SvxAngleTabPage::Construct() 262*cdf0e10cSrcweir { 263*cdf0e10cSrcweir DBG_ASSERT(pView, "No valid view (!)"); 264*cdf0e10cSrcweir eDlgUnit = GetModuleFieldUnit(GetItemSet()); 265*cdf0e10cSrcweir SetFieldUnit(aMtrPosX, eDlgUnit, sal_True); 266*cdf0e10cSrcweir SetFieldUnit(aMtrPosY, eDlgUnit, sal_True); 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir if(FUNIT_MILE == eDlgUnit || FUNIT_KM == eDlgUnit) 269*cdf0e10cSrcweir { 270*cdf0e10cSrcweir aMtrPosX.SetDecimalDigits( 3 ); 271*cdf0e10cSrcweir aMtrPosY.SetDecimalDigits( 3 ); 272*cdf0e10cSrcweir } 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir { // #i75273# 275*cdf0e10cSrcweir Rectangle aTempRect(pView->GetAllMarkedRect()); 276*cdf0e10cSrcweir pView->GetSdrPageView()->LogicToPagePos(aTempRect); 277*cdf0e10cSrcweir maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); 278*cdf0e10cSrcweir } 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir // Take anchor into account (Writer) 281*cdf0e10cSrcweir const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir if(rMarkList.GetMarkCount()) 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 286*cdf0e10cSrcweir maAnchor = basegfx::B2DPoint(pObj->GetAnchorPos().X(), pObj->GetAnchorPos().Y()); 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir if(!maAnchor.equalZero()) // -> Writer 289*cdf0e10cSrcweir { 290*cdf0e10cSrcweir maRange = basegfx::B2DRange(maRange.getMinimum() - maAnchor, maRange.getMaximum() - maAnchor); 291*cdf0e10cSrcweir } 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir // take scale into account 295*cdf0e10cSrcweir const Fraction aUIScale(pView->GetModel()->GetUIScale()); 296*cdf0e10cSrcweir lcl_ScaleRect(maRange, aUIScale); 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir // take UI units into account 299*cdf0e10cSrcweir sal_uInt16 nDigits(aMtrPosX.GetDecimalDigits()); 300*cdf0e10cSrcweir lcl_ConvertRect(maRange, nDigits, (MapUnit)ePoolUnit, eDlgUnit); 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir if(!pView->IsRotateAllowed()) 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir aFlPosition.Disable(); 305*cdf0e10cSrcweir aFtPosX.Disable(); 306*cdf0e10cSrcweir aMtrPosX.Disable(); 307*cdf0e10cSrcweir aFtPosY.Disable(); 308*cdf0e10cSrcweir aMtrPosY.Disable(); 309*cdf0e10cSrcweir aFtPosPresets.Disable(); 310*cdf0e10cSrcweir aCtlRect.Disable(); 311*cdf0e10cSrcweir aFlAngle.Disable(); 312*cdf0e10cSrcweir aFtAngle.Disable(); 313*cdf0e10cSrcweir aMtrAngle.Disable(); 314*cdf0e10cSrcweir aFtAnglePresets.Disable(); 315*cdf0e10cSrcweir aCtlAngle.Disable(); 316*cdf0e10cSrcweir } 317*cdf0e10cSrcweir } 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir // ----------------------------------------------------------------------- 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir sal_Bool SvxAngleTabPage::FillItemSet(SfxItemSet& rSet) 322*cdf0e10cSrcweir { 323*cdf0e10cSrcweir sal_Bool bModified = sal_False; 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir if(aMtrAngle.IsValueModified() || aMtrPosX.IsValueModified() || aMtrPosY.IsValueModified()) 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir const double fUIScale(double(pView->GetModel()->GetUIScale())); 328*cdf0e10cSrcweir const double fTmpX((GetCoreValue(aMtrPosX, ePoolUnit) + maAnchor.getX()) * fUIScale); 329*cdf0e10cSrcweir const double fTmpY((GetCoreValue(aMtrPosY, ePoolUnit) + maAnchor.getY()) * fUIScale); 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir rSet.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ANGLE), static_cast<sal_Int32>(aMtrAngle.GetValue()))); 332*cdf0e10cSrcweir rSet.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_X), basegfx::fround(fTmpX))); 333*cdf0e10cSrcweir rSet.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_Y), basegfx::fround(fTmpY))); 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir bModified |= sal_True; 336*cdf0e10cSrcweir } 337*cdf0e10cSrcweir 338*cdf0e10cSrcweir return bModified; 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir // ----------------------------------------------------------------------- 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir void SvxAngleTabPage::Reset(const SfxItemSet& rAttrs) 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir const double fUIScale(double(pView->GetModel()->GetUIScale())); 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir const SfxPoolItem* pItem = GetItem( rAttrs, SID_ATTR_TRANSFORM_ROT_X ); 348*cdf0e10cSrcweir if(pItem) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir const double fTmp(((double)((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getX()) / fUIScale); 351*cdf0e10cSrcweir SetMetricValue(aMtrPosX, basegfx::fround(fTmp), ePoolUnit); 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir else 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir aMtrPosX.SetText( String() ); 356*cdf0e10cSrcweir } 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir pItem = GetItem(rAttrs, SID_ATTR_TRANSFORM_ROT_Y); 359*cdf0e10cSrcweir if(pItem) 360*cdf0e10cSrcweir { 361*cdf0e10cSrcweir const double fTmp(((double)((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getY()) / fUIScale); 362*cdf0e10cSrcweir SetMetricValue(aMtrPosY, basegfx::fround(fTmp), ePoolUnit); 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir else 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir aMtrPosX.SetText( String() ); 367*cdf0e10cSrcweir } 368*cdf0e10cSrcweir 369*cdf0e10cSrcweir pItem = GetItem( rAttrs, SID_ATTR_TRANSFORM_ANGLE ); 370*cdf0e10cSrcweir if(pItem) 371*cdf0e10cSrcweir { 372*cdf0e10cSrcweir aMtrAngle.SetValue(((const SfxInt32Item*)pItem)->GetValue()); 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir else 375*cdf0e10cSrcweir { 376*cdf0e10cSrcweir aMtrAngle.SetText( String() ); 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir aMtrAngle.SaveValue(); 380*cdf0e10cSrcweir ModifiedHdl(this); 381*cdf0e10cSrcweir } 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir // ----------------------------------------------------------------------- 384*cdf0e10cSrcweir 385*cdf0e10cSrcweir SfxTabPage* SvxAngleTabPage::Create( Window* pWindow, const SfxItemSet& rSet) 386*cdf0e10cSrcweir { 387*cdf0e10cSrcweir return(new SvxAngleTabPage(pWindow, rSet)); 388*cdf0e10cSrcweir } 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir //------------------------------------------------------------------------ 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir sal_uInt16* SvxAngleTabPage::GetRanges() 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir return(pAngleRanges); 395*cdf0e10cSrcweir } 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir // ----------------------------------------------------------------------- 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir void SvxAngleTabPage::ActivatePage(const SfxItemSet& /*rSet*/) 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir } 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir // ----------------------------------------------------------------------- 404*cdf0e10cSrcweir 405*cdf0e10cSrcweir int SvxAngleTabPage::DeactivatePage( SfxItemSet* _pSet ) 406*cdf0e10cSrcweir { 407*cdf0e10cSrcweir if(_pSet) 408*cdf0e10cSrcweir { 409*cdf0e10cSrcweir FillItemSet(*_pSet); 410*cdf0e10cSrcweir } 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir return LEAVE_PAGE; 413*cdf0e10cSrcweir } 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir //------------------------------------------------------------------------ 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir void SvxAngleTabPage::PointChanged(Window* pWindow, RECT_POINT eRP) 418*cdf0e10cSrcweir { 419*cdf0e10cSrcweir if(pWindow == &aCtlRect) 420*cdf0e10cSrcweir { 421*cdf0e10cSrcweir switch(eRP) 422*cdf0e10cSrcweir { 423*cdf0e10cSrcweir case RP_LT: 424*cdf0e10cSrcweir { 425*cdf0e10cSrcweir aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMinX()), FUNIT_NONE ); 426*cdf0e10cSrcweir aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMinY()), FUNIT_NONE ); 427*cdf0e10cSrcweir break; 428*cdf0e10cSrcweir } 429*cdf0e10cSrcweir case RP_MT: 430*cdf0e10cSrcweir { 431*cdf0e10cSrcweir aMtrPosX.SetUserValue( basegfx::fround64(maRange.getCenter().getX()), FUNIT_NONE ); 432*cdf0e10cSrcweir aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMinY()), FUNIT_NONE ); 433*cdf0e10cSrcweir break; 434*cdf0e10cSrcweir } 435*cdf0e10cSrcweir case RP_RT: 436*cdf0e10cSrcweir { 437*cdf0e10cSrcweir aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMaxX()), FUNIT_NONE ); 438*cdf0e10cSrcweir aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMinY()), FUNIT_NONE ); 439*cdf0e10cSrcweir break; 440*cdf0e10cSrcweir } 441*cdf0e10cSrcweir case RP_LM: 442*cdf0e10cSrcweir { 443*cdf0e10cSrcweir aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMinX()), FUNIT_NONE ); 444*cdf0e10cSrcweir aMtrPosY.SetUserValue( basegfx::fround64(maRange.getCenter().getY()), FUNIT_NONE ); 445*cdf0e10cSrcweir break; 446*cdf0e10cSrcweir } 447*cdf0e10cSrcweir case RP_MM: 448*cdf0e10cSrcweir { 449*cdf0e10cSrcweir aMtrPosX.SetUserValue( basegfx::fround64(maRange.getCenter().getX()), FUNIT_NONE ); 450*cdf0e10cSrcweir aMtrPosY.SetUserValue( basegfx::fround64(maRange.getCenter().getY()), FUNIT_NONE ); 451*cdf0e10cSrcweir break; 452*cdf0e10cSrcweir } 453*cdf0e10cSrcweir case RP_RM: 454*cdf0e10cSrcweir { 455*cdf0e10cSrcweir aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMaxX()), FUNIT_NONE ); 456*cdf0e10cSrcweir aMtrPosY.SetUserValue( basegfx::fround64(maRange.getCenter().getY()), FUNIT_NONE ); 457*cdf0e10cSrcweir break; 458*cdf0e10cSrcweir } 459*cdf0e10cSrcweir case RP_LB: 460*cdf0e10cSrcweir { 461*cdf0e10cSrcweir aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMinX()), FUNIT_NONE ); 462*cdf0e10cSrcweir aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMaxY()), FUNIT_NONE ); 463*cdf0e10cSrcweir break; 464*cdf0e10cSrcweir } 465*cdf0e10cSrcweir case RP_MB: 466*cdf0e10cSrcweir { 467*cdf0e10cSrcweir aMtrPosX.SetUserValue( basegfx::fround64(maRange.getCenter().getX()), FUNIT_NONE ); 468*cdf0e10cSrcweir aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMaxY()), FUNIT_NONE ); 469*cdf0e10cSrcweir break; 470*cdf0e10cSrcweir } 471*cdf0e10cSrcweir case RP_RB: 472*cdf0e10cSrcweir { 473*cdf0e10cSrcweir aMtrPosX.SetUserValue( basegfx::fround64(maRange.getMaxX()), FUNIT_NONE ); 474*cdf0e10cSrcweir aMtrPosY.SetUserValue( basegfx::fround64(maRange.getMaxY()), FUNIT_NONE ); 475*cdf0e10cSrcweir break; 476*cdf0e10cSrcweir } 477*cdf0e10cSrcweir } 478*cdf0e10cSrcweir } 479*cdf0e10cSrcweir else if(pWindow == &aCtlAngle) 480*cdf0e10cSrcweir { 481*cdf0e10cSrcweir switch( eRP ) 482*cdf0e10cSrcweir { 483*cdf0e10cSrcweir case RP_LT: aMtrAngle.SetUserValue( 13500, FUNIT_NONE ); break; 484*cdf0e10cSrcweir case RP_MT: aMtrAngle.SetUserValue( 9000, FUNIT_NONE ); break; 485*cdf0e10cSrcweir case RP_RT: aMtrAngle.SetUserValue( 4500, FUNIT_NONE ); break; 486*cdf0e10cSrcweir case RP_LM: aMtrAngle.SetUserValue( 18000, FUNIT_NONE ); break; 487*cdf0e10cSrcweir case RP_RM: aMtrAngle.SetUserValue( 0, FUNIT_NONE ); break; 488*cdf0e10cSrcweir case RP_LB: aMtrAngle.SetUserValue( 22500, FUNIT_NONE ); break; 489*cdf0e10cSrcweir case RP_MB: aMtrAngle.SetUserValue( 27000, FUNIT_NONE ); break; 490*cdf0e10cSrcweir case RP_RB: aMtrAngle.SetUserValue( 31500, FUNIT_NONE ); break; 491*cdf0e10cSrcweir case RP_MM: break; 492*cdf0e10cSrcweir } 493*cdf0e10cSrcweir } 494*cdf0e10cSrcweir } 495*cdf0e10cSrcweir 496*cdf0e10cSrcweir //------------------------------------------------------------------------ 497*cdf0e10cSrcweir 498*cdf0e10cSrcweir IMPL_LINK( SvxAngleTabPage, ModifiedHdl, void *, EMPTYARG ) 499*cdf0e10cSrcweir { 500*cdf0e10cSrcweir switch(aMtrAngle.GetValue()) 501*cdf0e10cSrcweir { 502*cdf0e10cSrcweir case 13500: aCtlAngle.SetActualRP( RP_LT ); break; 503*cdf0e10cSrcweir case 9000: aCtlAngle.SetActualRP( RP_MT ); break; 504*cdf0e10cSrcweir case 4500: aCtlAngle.SetActualRP( RP_RT ); break; 505*cdf0e10cSrcweir case 18000: aCtlAngle.SetActualRP( RP_LM ); break; 506*cdf0e10cSrcweir case 0: aCtlAngle.SetActualRP( RP_RM ); break; 507*cdf0e10cSrcweir case 22500: aCtlAngle.SetActualRP( RP_LB ); break; 508*cdf0e10cSrcweir case 27000: aCtlAngle.SetActualRP( RP_MB ); break; 509*cdf0e10cSrcweir case 31500: aCtlAngle.SetActualRP( RP_RB ); break; 510*cdf0e10cSrcweir default: aCtlAngle.SetActualRP( RP_MM ); break; 511*cdf0e10cSrcweir } 512*cdf0e10cSrcweir 513*cdf0e10cSrcweir return( 0L ); 514*cdf0e10cSrcweir } 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir /************************************************************************* 517*cdf0e10cSrcweir |* 518*cdf0e10cSrcweir |* Dialog zum Aendern des Eckenradius und zum Schraegstellen 519*cdf0e10cSrcweir |* 520*cdf0e10cSrcweir \************************************************************************/ 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir SvxSlantTabPage::SvxSlantTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : 523*cdf0e10cSrcweir SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_SLANT ), rInAttrs ), 524*cdf0e10cSrcweir 525*cdf0e10cSrcweir aFlRadius ( this, CUI_RES( FL_RADIUS ) ), 526*cdf0e10cSrcweir aFtRadius ( this, CUI_RES( FT_RADIUS ) ), 527*cdf0e10cSrcweir aMtrRadius ( this, CUI_RES( MTR_FLD_RADIUS ) ), 528*cdf0e10cSrcweir aFlAngle ( this, CUI_RES( FL_SLANT ) ), 529*cdf0e10cSrcweir aFtAngle ( this, CUI_RES( FT_ANGLE ) ), 530*cdf0e10cSrcweir aMtrAngle ( this, CUI_RES( MTR_FLD_ANGLE ) ), 531*cdf0e10cSrcweir rOutAttrs ( rInAttrs ) 532*cdf0e10cSrcweir { 533*cdf0e10cSrcweir FreeResource(); 534*cdf0e10cSrcweir 535*cdf0e10cSrcweir // this page needs ExchangeSupport 536*cdf0e10cSrcweir SetExchangeSupport(); 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir // evaluate PoolUnit 539*cdf0e10cSrcweir SfxItemPool* pPool = rOutAttrs.GetPool(); 540*cdf0e10cSrcweir DBG_ASSERT( pPool, "no pool (!)" ); 541*cdf0e10cSrcweir ePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X ); 542*cdf0e10cSrcweir } 543*cdf0e10cSrcweir 544*cdf0e10cSrcweir // ----------------------------------------------------------------------- 545*cdf0e10cSrcweir 546*cdf0e10cSrcweir void SvxSlantTabPage::Construct() 547*cdf0e10cSrcweir { 548*cdf0e10cSrcweir // get the range 549*cdf0e10cSrcweir DBG_ASSERT(pView, "no valid view (!)"); 550*cdf0e10cSrcweir eDlgUnit = GetModuleFieldUnit(GetItemSet()); 551*cdf0e10cSrcweir SetFieldUnit(aMtrRadius, eDlgUnit, sal_True); 552*cdf0e10cSrcweir 553*cdf0e10cSrcweir { // #i75273# 554*cdf0e10cSrcweir Rectangle aTempRect(pView->GetAllMarkedRect()); 555*cdf0e10cSrcweir pView->GetSdrPageView()->LogicToPagePos(aTempRect); 556*cdf0e10cSrcweir maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); 557*cdf0e10cSrcweir } 558*cdf0e10cSrcweir } 559*cdf0e10cSrcweir 560*cdf0e10cSrcweir // ----------------------------------------------------------------------- 561*cdf0e10cSrcweir 562*cdf0e10cSrcweir sal_Bool SvxSlantTabPage::FillItemSet(SfxItemSet& rAttrs) 563*cdf0e10cSrcweir { 564*cdf0e10cSrcweir sal_Bool bModified = sal_False; 565*cdf0e10cSrcweir sal_Int32 nValue = 0L; 566*cdf0e10cSrcweir String aStr = aMtrRadius.GetText(); 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir if( aStr != aMtrRadius.GetSavedValue() ) 569*cdf0e10cSrcweir { 570*cdf0e10cSrcweir Fraction aUIScale = pView->GetModel()->GetUIScale(); 571*cdf0e10cSrcweir long nTmp = GetCoreValue( aMtrRadius, ePoolUnit ); 572*cdf0e10cSrcweir nTmp = Fraction( nTmp ) * aUIScale; 573*cdf0e10cSrcweir 574*cdf0e10cSrcweir rAttrs.Put( SdrEckenradiusItem( nTmp ) ); 575*cdf0e10cSrcweir bModified = sal_True; 576*cdf0e10cSrcweir } 577*cdf0e10cSrcweir 578*cdf0e10cSrcweir aStr = aMtrAngle.GetText(); 579*cdf0e10cSrcweir 580*cdf0e10cSrcweir if( aStr != aMtrAngle.GetSavedValue() ) 581*cdf0e10cSrcweir { 582*cdf0e10cSrcweir nValue = static_cast<sal_Int32>(aMtrAngle.GetValue()); 583*cdf0e10cSrcweir rAttrs.Put( SfxInt32Item( SID_ATTR_TRANSFORM_SHEAR, nValue ) ); 584*cdf0e10cSrcweir bModified = sal_True; 585*cdf0e10cSrcweir } 586*cdf0e10cSrcweir 587*cdf0e10cSrcweir if( bModified ) 588*cdf0e10cSrcweir { 589*cdf0e10cSrcweir // Referenzpunkt setzen 590*cdf0e10cSrcweir // #75897# 591*cdf0e10cSrcweir Rectangle aObjectRect(pView->GetAllMarkedRect()); 592*cdf0e10cSrcweir pView->GetSdrPageView()->LogicToPagePos(aObjectRect); 593*cdf0e10cSrcweir Point aPt = aObjectRect.Center(); 594*cdf0e10cSrcweir 595*cdf0e10cSrcweir rAttrs.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_X, aPt.X())); 596*cdf0e10cSrcweir rAttrs.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_Y, aPt.Y())); 597*cdf0e10cSrcweir rAttrs.Put( SfxBoolItem( SID_ATTR_TRANSFORM_SHEAR_VERTICAL, sal_False ) ); 598*cdf0e10cSrcweir } 599*cdf0e10cSrcweir 600*cdf0e10cSrcweir return( bModified ); 601*cdf0e10cSrcweir } 602*cdf0e10cSrcweir 603*cdf0e10cSrcweir // ----------------------------------------------------------------------- 604*cdf0e10cSrcweir 605*cdf0e10cSrcweir void SvxSlantTabPage::Reset(const SfxItemSet& rAttrs) 606*cdf0e10cSrcweir { 607*cdf0e10cSrcweir // if the view has selected objects, items with SFX_ITEM_DEFAULT need to be disabled 608*cdf0e10cSrcweir const SfxPoolItem* pItem; 609*cdf0e10cSrcweir 610*cdf0e10cSrcweir // Eckenradius 611*cdf0e10cSrcweir if(!pView->IsEdgeRadiusAllowed()) 612*cdf0e10cSrcweir { 613*cdf0e10cSrcweir aFlRadius.Disable(); 614*cdf0e10cSrcweir aFtRadius.Disable(); 615*cdf0e10cSrcweir aMtrRadius.Disable(); 616*cdf0e10cSrcweir aMtrRadius.SetText( String() ); 617*cdf0e10cSrcweir } 618*cdf0e10cSrcweir else 619*cdf0e10cSrcweir { 620*cdf0e10cSrcweir pItem = GetItem( rAttrs, SDRATTR_ECKENRADIUS ); 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir if( pItem ) 623*cdf0e10cSrcweir { 624*cdf0e10cSrcweir const double fUIScale(double(pView->GetModel()->GetUIScale())); 625*cdf0e10cSrcweir const double fTmp((double)((const SdrEckenradiusItem*)pItem)->GetValue() / fUIScale); 626*cdf0e10cSrcweir SetMetricValue(aMtrRadius, basegfx::fround(fTmp), ePoolUnit); 627*cdf0e10cSrcweir } 628*cdf0e10cSrcweir else 629*cdf0e10cSrcweir { 630*cdf0e10cSrcweir aMtrRadius.SetText( String() ); 631*cdf0e10cSrcweir } 632*cdf0e10cSrcweir } 633*cdf0e10cSrcweir 634*cdf0e10cSrcweir aMtrRadius.SaveValue(); 635*cdf0e10cSrcweir 636*cdf0e10cSrcweir // Schraegstellen: Winkel 637*cdf0e10cSrcweir if( !pView->IsShearAllowed() ) 638*cdf0e10cSrcweir { 639*cdf0e10cSrcweir aFlAngle.Disable(); 640*cdf0e10cSrcweir aFtAngle.Disable(); 641*cdf0e10cSrcweir aMtrAngle.Disable(); 642*cdf0e10cSrcweir aMtrAngle.SetText( String() ); 643*cdf0e10cSrcweir } 644*cdf0e10cSrcweir else 645*cdf0e10cSrcweir { 646*cdf0e10cSrcweir pItem = GetItem( rAttrs, SID_ATTR_TRANSFORM_SHEAR ); 647*cdf0e10cSrcweir 648*cdf0e10cSrcweir if( pItem ) 649*cdf0e10cSrcweir { 650*cdf0e10cSrcweir aMtrAngle.SetValue( ( (const SfxInt32Item*)pItem )->GetValue() ); 651*cdf0e10cSrcweir } 652*cdf0e10cSrcweir else 653*cdf0e10cSrcweir { 654*cdf0e10cSrcweir aMtrAngle.SetText( String() ); 655*cdf0e10cSrcweir } 656*cdf0e10cSrcweir } 657*cdf0e10cSrcweir 658*cdf0e10cSrcweir aMtrAngle.SaveValue(); 659*cdf0e10cSrcweir } 660*cdf0e10cSrcweir 661*cdf0e10cSrcweir // ----------------------------------------------------------------------- 662*cdf0e10cSrcweir 663*cdf0e10cSrcweir SfxTabPage* SvxSlantTabPage::Create( Window* pWindow, const SfxItemSet& rOutAttrs ) 664*cdf0e10cSrcweir { 665*cdf0e10cSrcweir return( new SvxSlantTabPage( pWindow, rOutAttrs ) ); 666*cdf0e10cSrcweir } 667*cdf0e10cSrcweir 668*cdf0e10cSrcweir //------------------------------------------------------------------------ 669*cdf0e10cSrcweir 670*cdf0e10cSrcweir sal_uInt16* SvxSlantTabPage::GetRanges() 671*cdf0e10cSrcweir { 672*cdf0e10cSrcweir return( pSlantRanges ); 673*cdf0e10cSrcweir } 674*cdf0e10cSrcweir 675*cdf0e10cSrcweir // ----------------------------------------------------------------------- 676*cdf0e10cSrcweir 677*cdf0e10cSrcweir void SvxSlantTabPage::ActivatePage( const SfxItemSet& rSet ) 678*cdf0e10cSrcweir { 679*cdf0e10cSrcweir SfxRectangleItem* pRectItem = NULL; 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_TRANSFORM_INTERN ) , sal_False, (const SfxPoolItem**) &pRectItem ) ) 682*cdf0e10cSrcweir { 683*cdf0e10cSrcweir const Rectangle aTempRect(pRectItem->GetValue()); 684*cdf0e10cSrcweir maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); 685*cdf0e10cSrcweir } 686*cdf0e10cSrcweir } 687*cdf0e10cSrcweir 688*cdf0e10cSrcweir // ----------------------------------------------------------------------- 689*cdf0e10cSrcweir 690*cdf0e10cSrcweir int SvxSlantTabPage::DeactivatePage( SfxItemSet* _pSet ) 691*cdf0e10cSrcweir { 692*cdf0e10cSrcweir if(_pSet) 693*cdf0e10cSrcweir { 694*cdf0e10cSrcweir FillItemSet(*_pSet); 695*cdf0e10cSrcweir } 696*cdf0e10cSrcweir 697*cdf0e10cSrcweir return LEAVE_PAGE; 698*cdf0e10cSrcweir } 699*cdf0e10cSrcweir 700*cdf0e10cSrcweir //------------------------------------------------------------------------ 701*cdf0e10cSrcweir 702*cdf0e10cSrcweir void SvxSlantTabPage::PointChanged( Window* , RECT_POINT ) 703*cdf0e10cSrcweir { 704*cdf0e10cSrcweir } 705*cdf0e10cSrcweir 706*cdf0e10cSrcweir /************************************************************************* 707*cdf0e10cSrcweir |* 708*cdf0e10cSrcweir |* Dialog for changing position and size of graphic objects 709*cdf0e10cSrcweir |* 710*cdf0e10cSrcweir \************************************************************************/ 711*cdf0e10cSrcweir 712*cdf0e10cSrcweir SvxPositionSizeTabPage::SvxPositionSizeTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : 713*cdf0e10cSrcweir SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_POSITION_SIZE ), rInAttrs ), 714*cdf0e10cSrcweir maFlPosition ( this, CUI_RES( FL_POSITION ) ), 715*cdf0e10cSrcweir maFtPosX ( this, CUI_RES( FT_POS_X ) ), 716*cdf0e10cSrcweir maMtrPosX ( this, CUI_RES( MTR_FLD_POS_X ) ), 717*cdf0e10cSrcweir maFtPosY ( this, CUI_RES( FT_POS_Y ) ), 718*cdf0e10cSrcweir maMtrPosY ( this, CUI_RES( MTR_FLD_POS_Y ) ), 719*cdf0e10cSrcweir maFtPosReference ( this, CUI_RES( FT_POSREFERENCE ) ), 720*cdf0e10cSrcweir maCtlPos ( this, CUI_RES( CTL_POSRECT ), RP_LT ), 721*cdf0e10cSrcweir 722*cdf0e10cSrcweir maFlSize ( this, CUI_RES( FL_SIZE ) ), 723*cdf0e10cSrcweir maFtWidth ( this, CUI_RES( FT_WIDTH ) ), 724*cdf0e10cSrcweir maMtrWidth ( this, CUI_RES( MTR_FLD_WIDTH ) ), 725*cdf0e10cSrcweir maFtHeight ( this, CUI_RES( FT_HEIGHT ) ), 726*cdf0e10cSrcweir maMtrHeight ( this, CUI_RES( MTR_FLD_HEIGHT ) ), 727*cdf0e10cSrcweir maCbxScale ( this, CUI_RES( CBX_SCALE ) ), 728*cdf0e10cSrcweir maFtSizeReference ( this, CUI_RES( FT_SIZEREFERENCE) ), 729*cdf0e10cSrcweir maCtlSize ( this, CUI_RES( CTL_SIZERECT ), RP_LT ), 730*cdf0e10cSrcweir 731*cdf0e10cSrcweir maFlProtect ( this, CUI_RES( FL_PROTECT) ), 732*cdf0e10cSrcweir maTsbPosProtect ( this, CUI_RES( TSB_POSPROTECT ) ), 733*cdf0e10cSrcweir maTsbSizeProtect ( this, CUI_RES( TSB_SIZEPROTECT ) ), 734*cdf0e10cSrcweir 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir maFlAdjust ( this, CUI_RES( FL_ADJUST ) ), 737*cdf0e10cSrcweir maTsbAutoGrowWidth ( this, CUI_RES( TSB_AUTOGROW_WIDTH ) ), 738*cdf0e10cSrcweir maTsbAutoGrowHeight ( this, CUI_RES( TSB_AUTOGROW_HEIGHT ) ), 739*cdf0e10cSrcweir 740*cdf0e10cSrcweir maFlDivider (this, CUI_RES( FL_DIVIDER ) ), 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir mrOutAttrs ( rInAttrs ), 743*cdf0e10cSrcweir mnProtectSizeState( STATE_NOCHECK ), 744*cdf0e10cSrcweir mbPageDisabled ( sal_False ), 745*cdf0e10cSrcweir mbProtectDisabled( false ), 746*cdf0e10cSrcweir mbSizeDisabled( false ), 747*cdf0e10cSrcweir mbAdjustDisabled( true ) 748*cdf0e10cSrcweir { 749*cdf0e10cSrcweir FreeResource(); 750*cdf0e10cSrcweir 751*cdf0e10cSrcweir // this pege needs ExchangeSupport 752*cdf0e10cSrcweir SetExchangeSupport(); 753*cdf0e10cSrcweir 754*cdf0e10cSrcweir // evaluate PoolUnit 755*cdf0e10cSrcweir SfxItemPool* pPool = mrOutAttrs.GetPool(); 756*cdf0e10cSrcweir DBG_ASSERT( pPool, "no pool (!)" ); 757*cdf0e10cSrcweir mePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X ); 758*cdf0e10cSrcweir 759*cdf0e10cSrcweir meRP = RP_LT; // s.o. 760*cdf0e10cSrcweir 761*cdf0e10cSrcweir maMtrWidth.SetModifyHdl( LINK( this, SvxPositionSizeTabPage, ChangeWidthHdl ) ); 762*cdf0e10cSrcweir maMtrHeight.SetModifyHdl( LINK( this, SvxPositionSizeTabPage, ChangeHeightHdl ) ); 763*cdf0e10cSrcweir maCbxScale.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ClickAutoHdl ) ); 764*cdf0e10cSrcweir 765*cdf0e10cSrcweir maTsbAutoGrowWidth.Disable(); 766*cdf0e10cSrcweir maTsbAutoGrowHeight.Disable(); 767*cdf0e10cSrcweir maFlAdjust.Disable(); 768*cdf0e10cSrcweir 769*cdf0e10cSrcweir // #i2379# disable controls when protected 770*cdf0e10cSrcweir maTsbPosProtect.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ChangePosProtectHdl ) ); 771*cdf0e10cSrcweir maTsbSizeProtect.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ChangeSizeProtectHdl ) ); 772*cdf0e10cSrcweir 773*cdf0e10cSrcweir maCtlPos.SetAccessibleRelationMemberOf( &maFlPosition ); 774*cdf0e10cSrcweir maCtlSize.SetAccessibleRelationMemberOf( &maFlSize ); 775*cdf0e10cSrcweir maCtlPos.SetAccessibleRelationLabeledBy( &maFtPosReference ); 776*cdf0e10cSrcweir maCtlSize.SetAccessibleRelationLabeledBy( &maFtSizeReference ); 777*cdf0e10cSrcweir } 778*cdf0e10cSrcweir 779*cdf0e10cSrcweir // ----------------------------------------------------------------------- 780*cdf0e10cSrcweir 781*cdf0e10cSrcweir void SvxPositionSizeTabPage::Construct() 782*cdf0e10cSrcweir { 783*cdf0e10cSrcweir // get range and work area 784*cdf0e10cSrcweir DBG_ASSERT( mpView, "no valid view (!)" ); 785*cdf0e10cSrcweir meDlgUnit = GetModuleFieldUnit( GetItemSet() ); 786*cdf0e10cSrcweir SetFieldUnit( maMtrPosX, meDlgUnit, sal_True ); 787*cdf0e10cSrcweir SetFieldUnit( maMtrPosY, meDlgUnit, sal_True ); 788*cdf0e10cSrcweir SetFieldUnit( maMtrWidth, meDlgUnit, sal_True ); 789*cdf0e10cSrcweir SetFieldUnit( maMtrHeight, meDlgUnit, sal_True ); 790*cdf0e10cSrcweir 791*cdf0e10cSrcweir if(FUNIT_MILE == meDlgUnit || FUNIT_KM == meDlgUnit) 792*cdf0e10cSrcweir { 793*cdf0e10cSrcweir maMtrPosX.SetDecimalDigits( 3 ); 794*cdf0e10cSrcweir maMtrPosY.SetDecimalDigits( 3 ); 795*cdf0e10cSrcweir maMtrWidth.SetDecimalDigits( 3 ); 796*cdf0e10cSrcweir maMtrHeight.SetDecimalDigits( 3 ); 797*cdf0e10cSrcweir } 798*cdf0e10cSrcweir 799*cdf0e10cSrcweir { // #i75273# 800*cdf0e10cSrcweir Rectangle aTempRect(mpView->GetAllMarkedRect()); 801*cdf0e10cSrcweir mpView->GetSdrPageView()->LogicToPagePos(aTempRect); 802*cdf0e10cSrcweir maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); 803*cdf0e10cSrcweir } 804*cdf0e10cSrcweir 805*cdf0e10cSrcweir { // #i75273# 806*cdf0e10cSrcweir Rectangle aTempRect(mpView->GetWorkArea()); 807*cdf0e10cSrcweir mpView->GetSdrPageView()->LogicToPagePos(aTempRect); 808*cdf0e10cSrcweir maWorkRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); 809*cdf0e10cSrcweir } 810*cdf0e10cSrcweir 811*cdf0e10cSrcweir // take anchor into account (Writer) 812*cdf0e10cSrcweir const SdrMarkList& rMarkList = mpView->GetMarkedObjectList(); 813*cdf0e10cSrcweir 814*cdf0e10cSrcweir if(rMarkList.GetMarkCount()) 815*cdf0e10cSrcweir { 816*cdf0e10cSrcweir const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 817*cdf0e10cSrcweir maAnchor = basegfx::B2DPoint(pObj->GetAnchorPos().X(), pObj->GetAnchorPos().Y()); 818*cdf0e10cSrcweir 819*cdf0e10cSrcweir if(!maAnchor.equalZero()) // -> Writer 820*cdf0e10cSrcweir { 821*cdf0e10cSrcweir for(sal_uInt16 i(1); i < rMarkList.GetMarkCount(); i++) 822*cdf0e10cSrcweir { 823*cdf0e10cSrcweir pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); 824*cdf0e10cSrcweir 825*cdf0e10cSrcweir if(maAnchor != basegfx::B2DPoint(pObj->GetAnchorPos().X(), pObj->GetAnchorPos().Y())) 826*cdf0e10cSrcweir { 827*cdf0e10cSrcweir // diferent anchor positions 828*cdf0e10cSrcweir maMtrPosX.SetText( String() ); 829*cdf0e10cSrcweir maMtrPosY.SetText( String() ); 830*cdf0e10cSrcweir mbPageDisabled = sal_True; 831*cdf0e10cSrcweir return; 832*cdf0e10cSrcweir } 833*cdf0e10cSrcweir } 834*cdf0e10cSrcweir 835*cdf0e10cSrcweir // translate ranges about anchor 836*cdf0e10cSrcweir maRange = basegfx::B2DRange(maRange.getMinimum() - maAnchor, maRange.getMaximum() - maAnchor); 837*cdf0e10cSrcweir maWorkRange = basegfx::B2DRange(maWorkRange.getMinimum() - maAnchor, maWorkRange.getMaximum() - maAnchor); 838*cdf0e10cSrcweir } 839*cdf0e10cSrcweir } 840*cdf0e10cSrcweir 841*cdf0e10cSrcweir // this should happen via SID_ATTR_TRANSFORM_AUTOSIZE 842*cdf0e10cSrcweir if(1 == rMarkList.GetMarkCount()) 843*cdf0e10cSrcweir { 844*cdf0e10cSrcweir const SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 845*cdf0e10cSrcweir const SdrObjKind eKind((SdrObjKind)pObj->GetObjIdentifier()); 846*cdf0e10cSrcweir 847*cdf0e10cSrcweir if((pObj->GetObjInventor() == SdrInventor) && (OBJ_TEXT == eKind || OBJ_TITLETEXT == eKind || OBJ_OUTLINETEXT == eKind) && ((SdrTextObj*)pObj)->HasText()) 848*cdf0e10cSrcweir { 849*cdf0e10cSrcweir mbAdjustDisabled = false; 850*cdf0e10cSrcweir maFlAdjust.Enable(); 851*cdf0e10cSrcweir maTsbAutoGrowWidth.Enable(); 852*cdf0e10cSrcweir maTsbAutoGrowHeight.Enable(); 853*cdf0e10cSrcweir maTsbAutoGrowWidth.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ClickSizeProtectHdl ) ); 854*cdf0e10cSrcweir maTsbAutoGrowHeight.SetClickHdl( LINK( this, SvxPositionSizeTabPage, ClickSizeProtectHdl ) ); 855*cdf0e10cSrcweir 856*cdf0e10cSrcweir // is used as flag to evaluate if its selectable 857*cdf0e10cSrcweir maTsbAutoGrowWidth.EnableTriState( sal_False ); 858*cdf0e10cSrcweir maTsbAutoGrowHeight.EnableTriState( sal_False ); 859*cdf0e10cSrcweir } 860*cdf0e10cSrcweir } 861*cdf0e10cSrcweir 862*cdf0e10cSrcweir // take scale into account 863*cdf0e10cSrcweir const Fraction aUIScale(mpView->GetModel()->GetUIScale()); 864*cdf0e10cSrcweir lcl_ScaleRect( maWorkRange, aUIScale ); 865*cdf0e10cSrcweir lcl_ScaleRect( maRange, aUIScale ); 866*cdf0e10cSrcweir 867*cdf0e10cSrcweir // take UI units into account 868*cdf0e10cSrcweir const sal_uInt16 nDigits(maMtrPosX.GetDecimalDigits()); 869*cdf0e10cSrcweir lcl_ConvertRect( maWorkRange, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); 870*cdf0e10cSrcweir lcl_ConvertRect( maRange, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); 871*cdf0e10cSrcweir 872*cdf0e10cSrcweir SetMinMaxPosition(); 873*cdf0e10cSrcweir } 874*cdf0e10cSrcweir 875*cdf0e10cSrcweir // ----------------------------------------------------------------------- 876*cdf0e10cSrcweir 877*cdf0e10cSrcweir sal_Bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet& rOutAttrs ) 878*cdf0e10cSrcweir { 879*cdf0e10cSrcweir sal_Bool bModified(sal_False); 880*cdf0e10cSrcweir 881*cdf0e10cSrcweir if ( maMtrWidth.HasFocus() ) 882*cdf0e10cSrcweir { 883*cdf0e10cSrcweir ChangeWidthHdl( this ); 884*cdf0e10cSrcweir } 885*cdf0e10cSrcweir 886*cdf0e10cSrcweir if ( maMtrHeight.HasFocus() ) 887*cdf0e10cSrcweir { 888*cdf0e10cSrcweir ChangeHeightHdl( this ); 889*cdf0e10cSrcweir } 890*cdf0e10cSrcweir 891*cdf0e10cSrcweir if( !mbPageDisabled ) 892*cdf0e10cSrcweir { 893*cdf0e10cSrcweir if ( maMtrPosX.IsValueModified() || maMtrPosY.IsValueModified() ) 894*cdf0e10cSrcweir { 895*cdf0e10cSrcweir const double fUIScale(double(mpView->GetModel()->GetUIScale())); 896*cdf0e10cSrcweir double fX((GetCoreValue( maMtrPosX, mePoolUnit ) + maAnchor.getX()) * fUIScale); 897*cdf0e10cSrcweir double fY((GetCoreValue( maMtrPosY, mePoolUnit ) + maAnchor.getY()) * fUIScale); 898*cdf0e10cSrcweir 899*cdf0e10cSrcweir { // #i75273# 900*cdf0e10cSrcweir Rectangle aTempRect(mpView->GetAllMarkedRect()); 901*cdf0e10cSrcweir mpView->GetSdrPageView()->LogicToPagePos(aTempRect); 902*cdf0e10cSrcweir maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); 903*cdf0e10cSrcweir } 904*cdf0e10cSrcweir 905*cdf0e10cSrcweir // #101581# GetTopLeftPosition(...) needs coordinates after UI scaling, in real PagePositions 906*cdf0e10cSrcweir GetTopLeftPosition(fX, fY, maRange); 907*cdf0e10cSrcweir 908*cdf0e10cSrcweir rOutAttrs.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_POS_X), basegfx::fround(fX))); 909*cdf0e10cSrcweir rOutAttrs.Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_POS_Y), basegfx::fround(fY))); 910*cdf0e10cSrcweir 911*cdf0e10cSrcweir bModified |= sal_True; 912*cdf0e10cSrcweir } 913*cdf0e10cSrcweir 914*cdf0e10cSrcweir if ( maTsbPosProtect.GetState() != maTsbPosProtect.GetSavedValue() ) 915*cdf0e10cSrcweir { 916*cdf0e10cSrcweir if( maTsbPosProtect.GetState() == STATE_DONTKNOW ) 917*cdf0e10cSrcweir { 918*cdf0e10cSrcweir rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_POS ); 919*cdf0e10cSrcweir } 920*cdf0e10cSrcweir else 921*cdf0e10cSrcweir { 922*cdf0e10cSrcweir rOutAttrs.Put( 923*cdf0e10cSrcweir SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_POS ), 924*cdf0e10cSrcweir maTsbPosProtect.GetState() == STATE_CHECK ? sal_True : sal_False ) ); 925*cdf0e10cSrcweir } 926*cdf0e10cSrcweir 927*cdf0e10cSrcweir bModified |= sal_True; 928*cdf0e10cSrcweir } 929*cdf0e10cSrcweir } 930*cdf0e10cSrcweir 931*cdf0e10cSrcweir if ( maMtrWidth.IsValueModified() || maMtrHeight.IsValueModified() ) 932*cdf0e10cSrcweir { 933*cdf0e10cSrcweir Fraction aUIScale = mpView->GetModel()->GetUIScale(); 934*cdf0e10cSrcweir 935*cdf0e10cSrcweir // get Width 936*cdf0e10cSrcweir double nWidth = static_cast<double>(maMtrWidth.GetValue( meDlgUnit )); 937*cdf0e10cSrcweir nWidth = MetricField::ConvertDoubleValue( nWidth, maMtrWidth.GetBaseValue(), maMtrWidth.GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); 938*cdf0e10cSrcweir long lWidth = long(nWidth * (double)aUIScale); 939*cdf0e10cSrcweir lWidth = OutputDevice::LogicToLogic( lWidth, MAP_100TH_MM, (MapUnit)mePoolUnit ); 940*cdf0e10cSrcweir lWidth = static_cast<long>(maMtrWidth.Denormalize( lWidth )); 941*cdf0e10cSrcweir 942*cdf0e10cSrcweir // get Height 943*cdf0e10cSrcweir double nHeight = static_cast<double>(maMtrHeight.GetValue( meDlgUnit )); 944*cdf0e10cSrcweir nHeight = MetricField::ConvertDoubleValue( nHeight, maMtrHeight.GetBaseValue(), maMtrHeight.GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); 945*cdf0e10cSrcweir long lHeight = long(nHeight * (double)aUIScale); 946*cdf0e10cSrcweir lHeight = OutputDevice::LogicToLogic( lHeight, MAP_100TH_MM, (MapUnit)mePoolUnit ); 947*cdf0e10cSrcweir lHeight = static_cast<long>(maMtrWidth.Denormalize( lHeight )); 948*cdf0e10cSrcweir 949*cdf0e10cSrcweir // put Width & Height to itemset 950*cdf0e10cSrcweir rOutAttrs.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_WIDTH ), 951*cdf0e10cSrcweir (sal_uInt32) lWidth ) ); 952*cdf0e10cSrcweir rOutAttrs.Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_HEIGHT ), 953*cdf0e10cSrcweir (sal_uInt32) lHeight ) ); 954*cdf0e10cSrcweir rOutAttrs.Put( SfxAllEnumItem( GetWhich( SID_ATTR_TRANSFORM_SIZE_POINT ), sal::static_int_cast< sal_uInt16 >( meRP ) ) ); 955*cdf0e10cSrcweir bModified |= sal_True; 956*cdf0e10cSrcweir } 957*cdf0e10cSrcweir 958*cdf0e10cSrcweir if ( maTsbSizeProtect.GetState() != maTsbSizeProtect.GetSavedValue() ) 959*cdf0e10cSrcweir { 960*cdf0e10cSrcweir if ( maTsbSizeProtect.GetState() == STATE_DONTKNOW ) 961*cdf0e10cSrcweir rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_PROTECT_SIZE ); 962*cdf0e10cSrcweir else 963*cdf0e10cSrcweir rOutAttrs.Put( 964*cdf0e10cSrcweir SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_SIZE ), 965*cdf0e10cSrcweir maTsbSizeProtect.GetState() == STATE_CHECK ? sal_True : sal_False ) ); 966*cdf0e10cSrcweir bModified |= sal_True; 967*cdf0e10cSrcweir } 968*cdf0e10cSrcweir 969*cdf0e10cSrcweir if ( maTsbAutoGrowWidth.GetState() != maTsbAutoGrowWidth.GetSavedValue() ) 970*cdf0e10cSrcweir { 971*cdf0e10cSrcweir if ( !maTsbAutoGrowWidth.IsTriStateEnabled() ) 972*cdf0e10cSrcweir { 973*cdf0e10cSrcweir if( maTsbAutoGrowWidth.GetState() == STATE_DONTKNOW ) 974*cdf0e10cSrcweir rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_AUTOWIDTH ); 975*cdf0e10cSrcweir else 976*cdf0e10cSrcweir rOutAttrs.Put( 977*cdf0e10cSrcweir SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_AUTOWIDTH ), 978*cdf0e10cSrcweir maTsbAutoGrowWidth.GetState() == STATE_CHECK ? sal_True : sal_False ) ); 979*cdf0e10cSrcweir } 980*cdf0e10cSrcweir bModified |= sal_True; 981*cdf0e10cSrcweir } 982*cdf0e10cSrcweir 983*cdf0e10cSrcweir if ( maTsbAutoGrowHeight.GetState() != maTsbAutoGrowHeight.GetSavedValue() ) 984*cdf0e10cSrcweir { 985*cdf0e10cSrcweir if ( !maTsbAutoGrowHeight.IsTriStateEnabled() ) 986*cdf0e10cSrcweir { 987*cdf0e10cSrcweir if( maTsbAutoGrowHeight.GetState() == STATE_DONTKNOW ) 988*cdf0e10cSrcweir rOutAttrs.InvalidateItem( SID_ATTR_TRANSFORM_AUTOHEIGHT ); 989*cdf0e10cSrcweir else 990*cdf0e10cSrcweir rOutAttrs.Put( 991*cdf0e10cSrcweir SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_AUTOHEIGHT ), 992*cdf0e10cSrcweir maTsbAutoGrowHeight.GetState() == STATE_CHECK ? sal_True : sal_False ) ); 993*cdf0e10cSrcweir } 994*cdf0e10cSrcweir bModified |= sal_True; 995*cdf0e10cSrcweir } 996*cdf0e10cSrcweir 997*cdf0e10cSrcweir 998*cdf0e10cSrcweir return bModified; 999*cdf0e10cSrcweir } 1000*cdf0e10cSrcweir 1001*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1002*cdf0e10cSrcweir 1003*cdf0e10cSrcweir void SvxPositionSizeTabPage::Reset( const SfxItemSet& ) 1004*cdf0e10cSrcweir { 1005*cdf0e10cSrcweir const SfxPoolItem* pItem; 1006*cdf0e10cSrcweir const double fUIScale(double(mpView->GetModel()->GetUIScale())); 1007*cdf0e10cSrcweir 1008*cdf0e10cSrcweir if ( !mbPageDisabled ) 1009*cdf0e10cSrcweir { 1010*cdf0e10cSrcweir pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_POS_X ); 1011*cdf0e10cSrcweir if ( pItem ) 1012*cdf0e10cSrcweir { 1013*cdf0e10cSrcweir const double fTmp((((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getX()) / fUIScale); 1014*cdf0e10cSrcweir SetMetricValue(maMtrPosX, basegfx::fround(fTmp), mePoolUnit); 1015*cdf0e10cSrcweir } 1016*cdf0e10cSrcweir 1017*cdf0e10cSrcweir pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_POS_Y ); 1018*cdf0e10cSrcweir if ( pItem ) 1019*cdf0e10cSrcweir { 1020*cdf0e10cSrcweir const double fTmp((((const SfxInt32Item*)pItem)->GetValue() - maAnchor.getY()) / fUIScale); 1021*cdf0e10cSrcweir SetMetricValue(maMtrPosY, basegfx::fround(fTmp), mePoolUnit); 1022*cdf0e10cSrcweir } 1023*cdf0e10cSrcweir 1024*cdf0e10cSrcweir pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_PROTECT_POS ); 1025*cdf0e10cSrcweir if ( pItem ) 1026*cdf0e10cSrcweir { 1027*cdf0e10cSrcweir sal_Bool bProtected = ( ( const SfxBoolItem* )pItem )->GetValue(); 1028*cdf0e10cSrcweir maTsbPosProtect.SetState( bProtected ? STATE_CHECK : STATE_NOCHECK ); 1029*cdf0e10cSrcweir maTsbPosProtect.EnableTriState( sal_False ); 1030*cdf0e10cSrcweir } 1031*cdf0e10cSrcweir else 1032*cdf0e10cSrcweir { 1033*cdf0e10cSrcweir maTsbPosProtect.SetState( STATE_DONTKNOW ); 1034*cdf0e10cSrcweir } 1035*cdf0e10cSrcweir 1036*cdf0e10cSrcweir maTsbPosProtect.SaveValue(); 1037*cdf0e10cSrcweir maCtlPos.Reset(); 1038*cdf0e10cSrcweir 1039*cdf0e10cSrcweir // #i2379# Disable controls for protected objects 1040*cdf0e10cSrcweir ChangePosProtectHdl( this ); 1041*cdf0e10cSrcweir } 1042*cdf0e10cSrcweir 1043*cdf0e10cSrcweir { // #i75273# set width 1044*cdf0e10cSrcweir pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_WIDTH ); 1045*cdf0e10cSrcweir mfOldWidth = std::max( pItem ? (double)((const SfxUInt32Item*)pItem)->GetValue() : 0.0, 1.0 ); 1046*cdf0e10cSrcweir double fTmpWidth((OutputDevice::LogicToLogic(static_cast<sal_Int32>(mfOldWidth), (MapUnit)mePoolUnit, MAP_100TH_MM)) / fUIScale); 1047*cdf0e10cSrcweir 1048*cdf0e10cSrcweir if(maMtrWidth.GetDecimalDigits()) 1049*cdf0e10cSrcweir fTmpWidth *= pow(10.0, maMtrWidth.GetDecimalDigits()); 1050*cdf0e10cSrcweir 1051*cdf0e10cSrcweir fTmpWidth = MetricField::ConvertDoubleValue(fTmpWidth, maMtrWidth.GetBaseValue(), maMtrWidth.GetDecimalDigits(), FUNIT_100TH_MM, meDlgUnit); 1052*cdf0e10cSrcweir maMtrWidth.SetValue(static_cast<sal_Int64>(fTmpWidth), meDlgUnit); 1053*cdf0e10cSrcweir } 1054*cdf0e10cSrcweir 1055*cdf0e10cSrcweir { // #i75273# set height 1056*cdf0e10cSrcweir pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_HEIGHT ); 1057*cdf0e10cSrcweir mfOldHeight = std::max( pItem ? (double)((const SfxUInt32Item*)pItem)->GetValue() : 0.0, 1.0 ); 1058*cdf0e10cSrcweir double fTmpHeight((OutputDevice::LogicToLogic(static_cast<sal_Int32>(mfOldHeight), (MapUnit)mePoolUnit, MAP_100TH_MM)) / fUIScale); 1059*cdf0e10cSrcweir 1060*cdf0e10cSrcweir if(maMtrHeight.GetDecimalDigits()) 1061*cdf0e10cSrcweir fTmpHeight *= pow(10.0, maMtrHeight.GetDecimalDigits()); 1062*cdf0e10cSrcweir 1063*cdf0e10cSrcweir fTmpHeight = MetricField::ConvertDoubleValue(fTmpHeight, maMtrHeight.GetBaseValue(), maMtrHeight.GetDecimalDigits(), FUNIT_100TH_MM, meDlgUnit); 1064*cdf0e10cSrcweir maMtrHeight.SetValue(static_cast<sal_Int64>(fTmpHeight), meDlgUnit); 1065*cdf0e10cSrcweir } 1066*cdf0e10cSrcweir 1067*cdf0e10cSrcweir pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_PROTECT_SIZE ); 1068*cdf0e10cSrcweir if ( pItem ) 1069*cdf0e10cSrcweir { 1070*cdf0e10cSrcweir maTsbSizeProtect.SetState( ( (const SfxBoolItem*)pItem )->GetValue() 1071*cdf0e10cSrcweir ? STATE_CHECK : STATE_NOCHECK ); 1072*cdf0e10cSrcweir maTsbSizeProtect.EnableTriState( sal_False ); 1073*cdf0e10cSrcweir } 1074*cdf0e10cSrcweir else 1075*cdf0e10cSrcweir maTsbSizeProtect.SetState( STATE_DONTKNOW ); 1076*cdf0e10cSrcweir 1077*cdf0e10cSrcweir pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_AUTOWIDTH ); 1078*cdf0e10cSrcweir if ( pItem ) 1079*cdf0e10cSrcweir { 1080*cdf0e10cSrcweir maTsbAutoGrowWidth.SetState( ( ( const SfxBoolItem* )pItem )->GetValue() 1081*cdf0e10cSrcweir ? STATE_CHECK : STATE_NOCHECK ); 1082*cdf0e10cSrcweir } 1083*cdf0e10cSrcweir else 1084*cdf0e10cSrcweir maTsbAutoGrowWidth.SetState( STATE_DONTKNOW ); 1085*cdf0e10cSrcweir 1086*cdf0e10cSrcweir pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_AUTOHEIGHT ); 1087*cdf0e10cSrcweir if ( pItem ) 1088*cdf0e10cSrcweir { 1089*cdf0e10cSrcweir maTsbAutoGrowHeight.SetState( ( ( const SfxBoolItem* )pItem )->GetValue() 1090*cdf0e10cSrcweir ? STATE_CHECK : STATE_NOCHECK ); 1091*cdf0e10cSrcweir } 1092*cdf0e10cSrcweir else 1093*cdf0e10cSrcweir maTsbAutoGrowHeight.SetState( STATE_DONTKNOW ); 1094*cdf0e10cSrcweir 1095*cdf0e10cSrcweir // Ist Abgleich gesetzt? 1096*cdf0e10cSrcweir String aStr = GetUserData(); 1097*cdf0e10cSrcweir maCbxScale.Check( (sal_Bool)aStr.ToInt32() ); 1098*cdf0e10cSrcweir 1099*cdf0e10cSrcweir maTsbSizeProtect.SaveValue(); 1100*cdf0e10cSrcweir maTsbAutoGrowWidth.SaveValue(); 1101*cdf0e10cSrcweir maTsbAutoGrowHeight.SaveValue(); 1102*cdf0e10cSrcweir ClickSizeProtectHdl( NULL ); 1103*cdf0e10cSrcweir 1104*cdf0e10cSrcweir // #i2379# Disable controls for protected objects 1105*cdf0e10cSrcweir ChangeSizeProtectHdl( this ); 1106*cdf0e10cSrcweir } 1107*cdf0e10cSrcweir 1108*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1109*cdf0e10cSrcweir 1110*cdf0e10cSrcweir SfxTabPage* SvxPositionSizeTabPage::Create( Window* pWindow, const SfxItemSet& rOutAttrs ) 1111*cdf0e10cSrcweir { 1112*cdf0e10cSrcweir return( new SvxPositionSizeTabPage( pWindow, rOutAttrs ) ); 1113*cdf0e10cSrcweir } 1114*cdf0e10cSrcweir 1115*cdf0e10cSrcweir //------------------------------------------------------------------------ 1116*cdf0e10cSrcweir 1117*cdf0e10cSrcweir sal_uInt16* SvxPositionSizeTabPage::GetRanges() 1118*cdf0e10cSrcweir { 1119*cdf0e10cSrcweir return( pPosSizeRanges ); 1120*cdf0e10cSrcweir } 1121*cdf0e10cSrcweir 1122*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1123*cdf0e10cSrcweir 1124*cdf0e10cSrcweir void SvxPositionSizeTabPage::ActivatePage( const SfxItemSet& rSet ) 1125*cdf0e10cSrcweir { 1126*cdf0e10cSrcweir SfxRectangleItem* pRectItem = NULL; 1127*cdf0e10cSrcweir 1128*cdf0e10cSrcweir if( SFX_ITEM_SET == rSet.GetItemState( GetWhich( SID_ATTR_TRANSFORM_INTERN ) , sal_False, (const SfxPoolItem**) &pRectItem ) ) 1129*cdf0e10cSrcweir { 1130*cdf0e10cSrcweir { // #i75273# 1131*cdf0e10cSrcweir const Rectangle aTempRect(pRectItem->GetValue()); 1132*cdf0e10cSrcweir maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); 1133*cdf0e10cSrcweir } 1134*cdf0e10cSrcweir 1135*cdf0e10cSrcweir SetMinMaxPosition(); 1136*cdf0e10cSrcweir } 1137*cdf0e10cSrcweir } 1138*cdf0e10cSrcweir 1139*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1140*cdf0e10cSrcweir 1141*cdf0e10cSrcweir int SvxPositionSizeTabPage::DeactivatePage( SfxItemSet* _pSet ) 1142*cdf0e10cSrcweir { 1143*cdf0e10cSrcweir if( _pSet ) 1144*cdf0e10cSrcweir { 1145*cdf0e10cSrcweir double fX((double)maMtrPosX.GetValue()); 1146*cdf0e10cSrcweir double fY((double)maMtrPosY.GetValue()); 1147*cdf0e10cSrcweir 1148*cdf0e10cSrcweir GetTopLeftPosition(fX, fY, maRange); 1149*cdf0e10cSrcweir const Rectangle aOutRectangle( 1150*cdf0e10cSrcweir basegfx::fround(fX), basegfx::fround(fY), 1151*cdf0e10cSrcweir basegfx::fround(fX + maRange.getWidth()), basegfx::fround(fY + maRange.getHeight())); 1152*cdf0e10cSrcweir _pSet->Put(SfxRectangleItem(SID_ATTR_TRANSFORM_INTERN, aOutRectangle)); 1153*cdf0e10cSrcweir 1154*cdf0e10cSrcweir FillItemSet(*_pSet); 1155*cdf0e10cSrcweir } 1156*cdf0e10cSrcweir 1157*cdf0e10cSrcweir return LEAVE_PAGE; 1158*cdf0e10cSrcweir } 1159*cdf0e10cSrcweir 1160*cdf0e10cSrcweir //------------------------------------------------------------------------ 1161*cdf0e10cSrcweir 1162*cdf0e10cSrcweir IMPL_LINK( SvxPositionSizeTabPage, ChangePosProtectHdl, void *, EMPTYARG ) 1163*cdf0e10cSrcweir { 1164*cdf0e10cSrcweir // #106572# Remember user's last choice 1165*cdf0e10cSrcweir maTsbSizeProtect.SetState( maTsbPosProtect.GetState() == STATE_CHECK ? STATE_CHECK : mnProtectSizeState ); 1166*cdf0e10cSrcweir UpdateControlStates(); 1167*cdf0e10cSrcweir return( 0L ); 1168*cdf0e10cSrcweir } 1169*cdf0e10cSrcweir 1170*cdf0e10cSrcweir //------------------------------------------------------------------------ 1171*cdf0e10cSrcweir 1172*cdf0e10cSrcweir void SvxPositionSizeTabPage::UpdateControlStates() 1173*cdf0e10cSrcweir { 1174*cdf0e10cSrcweir const bool bPosProtect = maTsbPosProtect.GetState() == STATE_CHECK; 1175*cdf0e10cSrcweir const bool bSizeProtect = maTsbSizeProtect.GetState() == STATE_CHECK; 1176*cdf0e10cSrcweir const bool bHeightChecked = !maTsbAutoGrowHeight.IsTriStateEnabled() && (maTsbAutoGrowHeight.GetState() == STATE_CHECK); 1177*cdf0e10cSrcweir const bool bWidthChecked = !maTsbAutoGrowWidth.IsTriStateEnabled() && (maTsbAutoGrowWidth.GetState() == STATE_CHECK); 1178*cdf0e10cSrcweir 1179*cdf0e10cSrcweir maFlPosition.Enable( !bPosProtect && !mbPageDisabled ); 1180*cdf0e10cSrcweir maFtPosX.Enable( !bPosProtect && !mbPageDisabled ); 1181*cdf0e10cSrcweir maMtrPosX.Enable( !bPosProtect && !mbPageDisabled ); 1182*cdf0e10cSrcweir maFtPosY.Enable( !bPosProtect && !mbPageDisabled ); 1183*cdf0e10cSrcweir maMtrPosY.Enable( !bPosProtect && !mbPageDisabled ); 1184*cdf0e10cSrcweir maFtPosReference.Enable( !bPosProtect && !mbPageDisabled ); 1185*cdf0e10cSrcweir maCtlPos.Enable( !bPosProtect ); 1186*cdf0e10cSrcweir maTsbPosProtect.Enable( !mbProtectDisabled && !mbPageDisabled ); 1187*cdf0e10cSrcweir 1188*cdf0e10cSrcweir maFlSize.Enable( !mbSizeDisabled && !bSizeProtect ); 1189*cdf0e10cSrcweir maCtlSize.Enable( !mbSizeDisabled && !bSizeProtect && (!bHeightChecked || !bWidthChecked) ); 1190*cdf0e10cSrcweir maFtWidth.Enable( !mbSizeDisabled && !bSizeProtect && !bWidthChecked ); 1191*cdf0e10cSrcweir maMtrWidth.Enable( !mbSizeDisabled && !bSizeProtect && !bWidthChecked ); 1192*cdf0e10cSrcweir maFtHeight.Enable( !mbSizeDisabled && !bSizeProtect && !bHeightChecked ); 1193*cdf0e10cSrcweir maMtrHeight.Enable( !mbSizeDisabled && !bSizeProtect && !bHeightChecked ); 1194*cdf0e10cSrcweir maCbxScale.Enable( !mbSizeDisabled && !bSizeProtect && !bHeightChecked && !bWidthChecked ); 1195*cdf0e10cSrcweir maFtSizeReference.Enable( !mbSizeDisabled && !bSizeProtect ); 1196*cdf0e10cSrcweir maFlProtect.Enable( !mbProtectDisabled ); 1197*cdf0e10cSrcweir maTsbSizeProtect.Enable( !mbProtectDisabled && !bPosProtect ); 1198*cdf0e10cSrcweir 1199*cdf0e10cSrcweir maFlAdjust.Enable( !mbSizeDisabled && !bSizeProtect && !mbAdjustDisabled ); 1200*cdf0e10cSrcweir maTsbAutoGrowWidth.Enable( !mbSizeDisabled && !bSizeProtect && !mbAdjustDisabled ); 1201*cdf0e10cSrcweir maTsbAutoGrowHeight.Enable( !mbSizeDisabled && !bSizeProtect && !mbAdjustDisabled ); 1202*cdf0e10cSrcweir 1203*cdf0e10cSrcweir maCtlSize.Invalidate(); 1204*cdf0e10cSrcweir maCtlPos.Invalidate(); 1205*cdf0e10cSrcweir 1206*cdf0e10cSrcweir } 1207*cdf0e10cSrcweir 1208*cdf0e10cSrcweir //------------------------------------------------------------------------ 1209*cdf0e10cSrcweir 1210*cdf0e10cSrcweir IMPL_LINK( SvxPositionSizeTabPage, ChangeSizeProtectHdl, void *, EMPTYARG ) 1211*cdf0e10cSrcweir { 1212*cdf0e10cSrcweir if( maTsbSizeProtect.IsEnabled() ) 1213*cdf0e10cSrcweir { 1214*cdf0e10cSrcweir // #106572# Remember user's last choice 1215*cdf0e10cSrcweir 1216*cdf0e10cSrcweir // Note: this works only as long as the dialog is open. When 1217*cdf0e10cSrcweir // the user closes the dialog, there is no way to remember 1218*cdf0e10cSrcweir // whether size was enabled or disabled befor pos protect was 1219*cdf0e10cSrcweir // clicked. Thus, if pos protect is selected, the dialog is 1220*cdf0e10cSrcweir // closed and reopened again, unchecking pos protect will 1221*cdf0e10cSrcweir // always uncheck size protect, too. That's life. 1222*cdf0e10cSrcweir mnProtectSizeState = maTsbSizeProtect.GetState(); 1223*cdf0e10cSrcweir } 1224*cdf0e10cSrcweir 1225*cdf0e10cSrcweir UpdateControlStates(); 1226*cdf0e10cSrcweir 1227*cdf0e10cSrcweir return( 0L ); 1228*cdf0e10cSrcweir } 1229*cdf0e10cSrcweir 1230*cdf0e10cSrcweir //------------------------------------------------------------------------ 1231*cdf0e10cSrcweir 1232*cdf0e10cSrcweir IMPL_LINK_INLINE_START( SvxPositionSizeTabPage, ChangePosXHdl, void *, EMPTYARG ) 1233*cdf0e10cSrcweir { 1234*cdf0e10cSrcweir return( 0L ); 1235*cdf0e10cSrcweir } 1236*cdf0e10cSrcweir IMPL_LINK_INLINE_END( SvxPositionSizeTabPage, ChangePosXHdl, void *, EMPTYARG ) 1237*cdf0e10cSrcweir 1238*cdf0e10cSrcweir //------------------------------------------------------------------------ 1239*cdf0e10cSrcweir 1240*cdf0e10cSrcweir IMPL_LINK_INLINE_START( SvxPositionSizeTabPage, ChangePosYHdl, void *, EMPTYARG ) 1241*cdf0e10cSrcweir { 1242*cdf0e10cSrcweir return( 0L ); 1243*cdf0e10cSrcweir } 1244*cdf0e10cSrcweir IMPL_LINK_INLINE_END( SvxPositionSizeTabPage, ChangePosYHdl, void *, EMPTYARG ) 1245*cdf0e10cSrcweir 1246*cdf0e10cSrcweir //------------------------------------------------------------------------ 1247*cdf0e10cSrcweir 1248*cdf0e10cSrcweir void SvxPositionSizeTabPage::SetMinMaxPosition() 1249*cdf0e10cSrcweir { 1250*cdf0e10cSrcweir // position 1251*cdf0e10cSrcweir double fLeft(maWorkRange.getMinX()); 1252*cdf0e10cSrcweir double fTop(maWorkRange.getMinY()); 1253*cdf0e10cSrcweir double fRight(maWorkRange.getMaxX()); 1254*cdf0e10cSrcweir double fBottom(maWorkRange.getMaxY()); 1255*cdf0e10cSrcweir 1256*cdf0e10cSrcweir switch ( maCtlPos.GetActualRP() ) 1257*cdf0e10cSrcweir { 1258*cdf0e10cSrcweir case RP_LT: 1259*cdf0e10cSrcweir { 1260*cdf0e10cSrcweir fRight -= maRange.getWidth(); 1261*cdf0e10cSrcweir fBottom -= maRange.getHeight(); 1262*cdf0e10cSrcweir break; 1263*cdf0e10cSrcweir } 1264*cdf0e10cSrcweir case RP_MT: 1265*cdf0e10cSrcweir { 1266*cdf0e10cSrcweir fLeft += maRange.getWidth() / 2.0; 1267*cdf0e10cSrcweir fRight -= maRange.getWidth() / 2.0; 1268*cdf0e10cSrcweir fBottom -= maRange.getHeight(); 1269*cdf0e10cSrcweir break; 1270*cdf0e10cSrcweir } 1271*cdf0e10cSrcweir case RP_RT: 1272*cdf0e10cSrcweir { 1273*cdf0e10cSrcweir fLeft += maRange.getWidth(); 1274*cdf0e10cSrcweir fBottom -= maRange.getHeight(); 1275*cdf0e10cSrcweir break; 1276*cdf0e10cSrcweir } 1277*cdf0e10cSrcweir case RP_LM: 1278*cdf0e10cSrcweir { 1279*cdf0e10cSrcweir fRight -= maRange.getWidth(); 1280*cdf0e10cSrcweir fTop += maRange.getHeight() / 2.0; 1281*cdf0e10cSrcweir fBottom -= maRange.getHeight() / 2.0; 1282*cdf0e10cSrcweir break; 1283*cdf0e10cSrcweir } 1284*cdf0e10cSrcweir case RP_MM: 1285*cdf0e10cSrcweir { 1286*cdf0e10cSrcweir fLeft += maRange.getWidth() / 2.0; 1287*cdf0e10cSrcweir fRight -= maRange.getWidth() / 2.0; 1288*cdf0e10cSrcweir fTop += maRange.getHeight() / 2.0; 1289*cdf0e10cSrcweir fBottom -= maRange.getHeight() / 2.0; 1290*cdf0e10cSrcweir break; 1291*cdf0e10cSrcweir } 1292*cdf0e10cSrcweir case RP_RM: 1293*cdf0e10cSrcweir { 1294*cdf0e10cSrcweir fLeft += maRange.getWidth(); 1295*cdf0e10cSrcweir fTop += maRange.getHeight() / 2.0; 1296*cdf0e10cSrcweir fBottom -= maRange.getHeight() / 2.0; 1297*cdf0e10cSrcweir break; 1298*cdf0e10cSrcweir } 1299*cdf0e10cSrcweir case RP_LB: 1300*cdf0e10cSrcweir { 1301*cdf0e10cSrcweir fRight -= maRange.getWidth(); 1302*cdf0e10cSrcweir fTop += maRange.getHeight(); 1303*cdf0e10cSrcweir break; 1304*cdf0e10cSrcweir } 1305*cdf0e10cSrcweir case RP_MB: 1306*cdf0e10cSrcweir { 1307*cdf0e10cSrcweir fLeft += maRange.getWidth() / 2.0; 1308*cdf0e10cSrcweir fRight -= maRange.getWidth() / 2.0; 1309*cdf0e10cSrcweir fTop += maRange.getHeight(); 1310*cdf0e10cSrcweir break; 1311*cdf0e10cSrcweir } 1312*cdf0e10cSrcweir case RP_RB: 1313*cdf0e10cSrcweir { 1314*cdf0e10cSrcweir fLeft += maRange.getWidth(); 1315*cdf0e10cSrcweir fTop += maRange.getHeight(); 1316*cdf0e10cSrcweir break; 1317*cdf0e10cSrcweir } 1318*cdf0e10cSrcweir } 1319*cdf0e10cSrcweir 1320*cdf0e10cSrcweir const double fMaxLong((double)(MetricField::ConvertValue( LONG_MAX, 0, MAP_100TH_MM, meDlgUnit ) - 1L)); 1321*cdf0e10cSrcweir fLeft = (fLeft > fMaxLong) ? fMaxLong : (fLeft < -fMaxLong) ? -fMaxLong : fLeft; 1322*cdf0e10cSrcweir fRight = (fRight > fMaxLong) ? fMaxLong : (fRight < -fMaxLong) ? -fMaxLong : fRight; 1323*cdf0e10cSrcweir fTop = (fTop > fMaxLong) ? fMaxLong : (fTop < -fMaxLong) ? -fMaxLong : fTop; 1324*cdf0e10cSrcweir fBottom = (fBottom > fMaxLong) ? fMaxLong : (fBottom < -fMaxLong) ? -fMaxLong : fBottom; 1325*cdf0e10cSrcweir 1326*cdf0e10cSrcweir // #i75273# normalizing when setting the min/max values was wrong, removed 1327*cdf0e10cSrcweir maMtrPosX.SetMin(basegfx::fround64(fLeft)); 1328*cdf0e10cSrcweir maMtrPosX.SetFirst(basegfx::fround64(fLeft)); 1329*cdf0e10cSrcweir maMtrPosX.SetMax(basegfx::fround64(fRight)); 1330*cdf0e10cSrcweir maMtrPosX.SetLast(basegfx::fround64(fRight)); 1331*cdf0e10cSrcweir maMtrPosY.SetMin(basegfx::fround64(fTop)); 1332*cdf0e10cSrcweir maMtrPosY.SetFirst(basegfx::fround64(fTop)); 1333*cdf0e10cSrcweir maMtrPosY.SetMax(basegfx::fround64(fBottom)); 1334*cdf0e10cSrcweir maMtrPosY.SetLast(basegfx::fround64(fBottom)); 1335*cdf0e10cSrcweir 1336*cdf0e10cSrcweir // size 1337*cdf0e10cSrcweir fLeft = maWorkRange.getMinX(); 1338*cdf0e10cSrcweir fTop = maWorkRange.getMinY(); 1339*cdf0e10cSrcweir fRight = maWorkRange.getMaxX(); 1340*cdf0e10cSrcweir fBottom = maWorkRange.getMaxY(); 1341*cdf0e10cSrcweir double fNewX(0); 1342*cdf0e10cSrcweir double fNewY(0); 1343*cdf0e10cSrcweir 1344*cdf0e10cSrcweir switch ( maCtlSize.GetActualRP() ) 1345*cdf0e10cSrcweir { 1346*cdf0e10cSrcweir case RP_LT: 1347*cdf0e10cSrcweir { 1348*cdf0e10cSrcweir fNewX = maWorkRange.getWidth() - ( maRange.getMinX() - fLeft ); 1349*cdf0e10cSrcweir fNewY = maWorkRange.getHeight() - ( maRange.getMinY() - fTop ); 1350*cdf0e10cSrcweir break; 1351*cdf0e10cSrcweir } 1352*cdf0e10cSrcweir case RP_MT: 1353*cdf0e10cSrcweir { 1354*cdf0e10cSrcweir fNewX = std::min( maRange.getCenter().getX() - fLeft, fRight - maRange.getCenter().getX() ) * 2.0; 1355*cdf0e10cSrcweir fNewY = maWorkRange.getHeight() - ( maRange.getMinY() - fTop ); 1356*cdf0e10cSrcweir break; 1357*cdf0e10cSrcweir } 1358*cdf0e10cSrcweir case RP_RT: 1359*cdf0e10cSrcweir { 1360*cdf0e10cSrcweir fNewX = maWorkRange.getWidth() - ( fRight - maRange.getMaxX() ); 1361*cdf0e10cSrcweir fNewY = maWorkRange.getHeight() - ( maRange.getMinY() - fTop ); 1362*cdf0e10cSrcweir break; 1363*cdf0e10cSrcweir } 1364*cdf0e10cSrcweir case RP_LM: 1365*cdf0e10cSrcweir { 1366*cdf0e10cSrcweir fNewX = maWorkRange.getWidth() - ( maRange.getMinX() - fLeft ); 1367*cdf0e10cSrcweir fNewY = std::min( maRange.getCenter().getY() - fTop, fBottom - maRange.getCenter().getY() ) * 2.0; 1368*cdf0e10cSrcweir break; 1369*cdf0e10cSrcweir } 1370*cdf0e10cSrcweir case RP_MM: 1371*cdf0e10cSrcweir { 1372*cdf0e10cSrcweir const double f1(maRange.getCenter().getX() - fLeft); 1373*cdf0e10cSrcweir const double f2(fRight - maRange.getCenter().getX()); 1374*cdf0e10cSrcweir const double f3(std::min(f1, f2)); 1375*cdf0e10cSrcweir const double f4(maRange.getCenter().getY() - fTop); 1376*cdf0e10cSrcweir const double f5(fBottom - maRange.getCenter().getY()); 1377*cdf0e10cSrcweir const double f6(std::min(f4, f5)); 1378*cdf0e10cSrcweir 1379*cdf0e10cSrcweir fNewX = f3 * 2.0; 1380*cdf0e10cSrcweir fNewY = f6 * 3.0; 1381*cdf0e10cSrcweir 1382*cdf0e10cSrcweir break; 1383*cdf0e10cSrcweir } 1384*cdf0e10cSrcweir case RP_RM: 1385*cdf0e10cSrcweir { 1386*cdf0e10cSrcweir fNewX = maWorkRange.getWidth() - ( fRight - maRange.getMaxX() ); 1387*cdf0e10cSrcweir fNewY = std::min( maRange.getCenter().getY() - fTop, fBottom - maRange.getCenter().getY() ) * 2.0; 1388*cdf0e10cSrcweir break; 1389*cdf0e10cSrcweir } 1390*cdf0e10cSrcweir case RP_LB: 1391*cdf0e10cSrcweir { 1392*cdf0e10cSrcweir fNewX = maWorkRange.getWidth() - ( maRange.getMinX() - fLeft ); 1393*cdf0e10cSrcweir fNewY = maWorkRange.getHeight() - ( fBottom - maRange.getMaxY() ); 1394*cdf0e10cSrcweir break; 1395*cdf0e10cSrcweir } 1396*cdf0e10cSrcweir case RP_MB: 1397*cdf0e10cSrcweir { 1398*cdf0e10cSrcweir fNewX = std::min( maRange.getCenter().getX() - fLeft, fRight - maRange.getCenter().getX() ) * 2.0; 1399*cdf0e10cSrcweir fNewY = maWorkRange.getHeight() - ( maRange.getMaxY() - fBottom ); 1400*cdf0e10cSrcweir break; 1401*cdf0e10cSrcweir } 1402*cdf0e10cSrcweir case RP_RB: 1403*cdf0e10cSrcweir { 1404*cdf0e10cSrcweir fNewX = maWorkRange.getWidth() - ( fRight - maRange.getMaxX() ); 1405*cdf0e10cSrcweir fNewY = maWorkRange.getHeight() - ( fBottom - maRange.getMaxY() ); 1406*cdf0e10cSrcweir break; 1407*cdf0e10cSrcweir } 1408*cdf0e10cSrcweir } 1409*cdf0e10cSrcweir 1410*cdf0e10cSrcweir // #i75273# normalizing when setting the min/max values was wrong, removed 1411*cdf0e10cSrcweir maMtrWidth.SetMax(basegfx::fround64(fNewX)); 1412*cdf0e10cSrcweir maMtrWidth.SetLast(basegfx::fround64(fNewX)); 1413*cdf0e10cSrcweir maMtrHeight.SetMax(basegfx::fround64(fNewY)); 1414*cdf0e10cSrcweir maMtrHeight.SetLast(basegfx::fround64(fNewY)); 1415*cdf0e10cSrcweir } 1416*cdf0e10cSrcweir 1417*cdf0e10cSrcweir //------------------------------------------------------------------------ 1418*cdf0e10cSrcweir 1419*cdf0e10cSrcweir void SvxPositionSizeTabPage::GetTopLeftPosition(double& rfX, double& rfY, const basegfx::B2DRange& rRange) 1420*cdf0e10cSrcweir { 1421*cdf0e10cSrcweir switch (maCtlPos.GetActualRP()) 1422*cdf0e10cSrcweir { 1423*cdf0e10cSrcweir case RP_LT: 1424*cdf0e10cSrcweir { 1425*cdf0e10cSrcweir break; 1426*cdf0e10cSrcweir } 1427*cdf0e10cSrcweir case RP_MT: 1428*cdf0e10cSrcweir { 1429*cdf0e10cSrcweir rfX -= rRange.getCenter().getX() - rRange.getMinX(); 1430*cdf0e10cSrcweir break; 1431*cdf0e10cSrcweir } 1432*cdf0e10cSrcweir case RP_RT: 1433*cdf0e10cSrcweir { 1434*cdf0e10cSrcweir rfX -= rRange.getWidth(); 1435*cdf0e10cSrcweir break; 1436*cdf0e10cSrcweir } 1437*cdf0e10cSrcweir case RP_LM: 1438*cdf0e10cSrcweir { 1439*cdf0e10cSrcweir rfY -= rRange.getCenter().getY() - rRange.getMinY(); 1440*cdf0e10cSrcweir break; 1441*cdf0e10cSrcweir } 1442*cdf0e10cSrcweir case RP_MM: 1443*cdf0e10cSrcweir { 1444*cdf0e10cSrcweir rfX -= rRange.getCenter().getX() - rRange.getMinX(); 1445*cdf0e10cSrcweir rfY -= rRange.getCenter().getY() - rRange.getMinY(); 1446*cdf0e10cSrcweir break; 1447*cdf0e10cSrcweir } 1448*cdf0e10cSrcweir case RP_RM: 1449*cdf0e10cSrcweir { 1450*cdf0e10cSrcweir rfX -= rRange.getWidth(); 1451*cdf0e10cSrcweir rfY -= rRange.getCenter().getY() - rRange.getMinY(); 1452*cdf0e10cSrcweir break; 1453*cdf0e10cSrcweir } 1454*cdf0e10cSrcweir case RP_LB: 1455*cdf0e10cSrcweir { 1456*cdf0e10cSrcweir rfY -= rRange.getHeight(); 1457*cdf0e10cSrcweir break; 1458*cdf0e10cSrcweir } 1459*cdf0e10cSrcweir case RP_MB: 1460*cdf0e10cSrcweir { 1461*cdf0e10cSrcweir rfX -= rRange.getCenter().getX() - rRange.getMinX(); 1462*cdf0e10cSrcweir rfY -= rRange.getHeight(); 1463*cdf0e10cSrcweir break; 1464*cdf0e10cSrcweir } 1465*cdf0e10cSrcweir case RP_RB: 1466*cdf0e10cSrcweir { 1467*cdf0e10cSrcweir rfX -= rRange.getWidth(); 1468*cdf0e10cSrcweir rfY -= rRange.getHeight(); 1469*cdf0e10cSrcweir break; 1470*cdf0e10cSrcweir } 1471*cdf0e10cSrcweir } 1472*cdf0e10cSrcweir } 1473*cdf0e10cSrcweir 1474*cdf0e10cSrcweir //------------------------------------------------------------------------ 1475*cdf0e10cSrcweir 1476*cdf0e10cSrcweir void SvxPositionSizeTabPage::PointChanged( Window* pWindow, RECT_POINT eRP ) 1477*cdf0e10cSrcweir { 1478*cdf0e10cSrcweir if( pWindow == &maCtlPos ) 1479*cdf0e10cSrcweir { 1480*cdf0e10cSrcweir SetMinMaxPosition(); 1481*cdf0e10cSrcweir switch( eRP ) 1482*cdf0e10cSrcweir { 1483*cdf0e10cSrcweir case RP_LT: 1484*cdf0e10cSrcweir { 1485*cdf0e10cSrcweir maMtrPosX.SetValue( basegfx::fround64(maRange.getMinX()) ); 1486*cdf0e10cSrcweir maMtrPosY.SetValue( basegfx::fround64(maRange.getMinY()) ); 1487*cdf0e10cSrcweir break; 1488*cdf0e10cSrcweir } 1489*cdf0e10cSrcweir case RP_MT: 1490*cdf0e10cSrcweir { 1491*cdf0e10cSrcweir maMtrPosX.SetValue( basegfx::fround64(maRange.getCenter().getX()) ); 1492*cdf0e10cSrcweir maMtrPosY.SetValue( basegfx::fround64(maRange.getMinY()) ); 1493*cdf0e10cSrcweir break; 1494*cdf0e10cSrcweir } 1495*cdf0e10cSrcweir case RP_RT: 1496*cdf0e10cSrcweir { 1497*cdf0e10cSrcweir maMtrPosX.SetValue( basegfx::fround64(maRange.getMaxX()) ); 1498*cdf0e10cSrcweir maMtrPosY.SetValue( basegfx::fround64(maRange.getMinY()) ); 1499*cdf0e10cSrcweir break; 1500*cdf0e10cSrcweir } 1501*cdf0e10cSrcweir case RP_LM: 1502*cdf0e10cSrcweir { 1503*cdf0e10cSrcweir maMtrPosX.SetValue( basegfx::fround64(maRange.getMinX()) ); 1504*cdf0e10cSrcweir maMtrPosY.SetValue( basegfx::fround64(maRange.getCenter().getY()) ); 1505*cdf0e10cSrcweir break; 1506*cdf0e10cSrcweir } 1507*cdf0e10cSrcweir case RP_MM: 1508*cdf0e10cSrcweir { 1509*cdf0e10cSrcweir maMtrPosX.SetValue( basegfx::fround64(maRange.getCenter().getX()) ); 1510*cdf0e10cSrcweir maMtrPosY.SetValue( basegfx::fround64(maRange.getCenter().getY()) ); 1511*cdf0e10cSrcweir break; 1512*cdf0e10cSrcweir } 1513*cdf0e10cSrcweir case RP_RM: 1514*cdf0e10cSrcweir { 1515*cdf0e10cSrcweir maMtrPosX.SetValue( basegfx::fround64(maRange.getMaxX()) ); 1516*cdf0e10cSrcweir maMtrPosY.SetValue( basegfx::fround64(maRange.getCenter().getY()) ); 1517*cdf0e10cSrcweir break; 1518*cdf0e10cSrcweir } 1519*cdf0e10cSrcweir case RP_LB: 1520*cdf0e10cSrcweir { 1521*cdf0e10cSrcweir maMtrPosX.SetValue( basegfx::fround64(maRange.getMinX()) ); 1522*cdf0e10cSrcweir maMtrPosY.SetValue( basegfx::fround64(maRange.getMaxY()) ); 1523*cdf0e10cSrcweir break; 1524*cdf0e10cSrcweir } 1525*cdf0e10cSrcweir case RP_MB: 1526*cdf0e10cSrcweir { 1527*cdf0e10cSrcweir maMtrPosX.SetValue( basegfx::fround64(maRange.getCenter().getX()) ); 1528*cdf0e10cSrcweir maMtrPosY.SetValue( basegfx::fround64(maRange.getMaxY()) ); 1529*cdf0e10cSrcweir break; 1530*cdf0e10cSrcweir } 1531*cdf0e10cSrcweir case RP_RB: 1532*cdf0e10cSrcweir { 1533*cdf0e10cSrcweir maMtrPosX.SetValue( basegfx::fround64(maRange.getMaxX()) ); 1534*cdf0e10cSrcweir maMtrPosY.SetValue( basegfx::fround64(maRange.getMaxY()) ); 1535*cdf0e10cSrcweir break; 1536*cdf0e10cSrcweir } 1537*cdf0e10cSrcweir } 1538*cdf0e10cSrcweir } 1539*cdf0e10cSrcweir else 1540*cdf0e10cSrcweir { 1541*cdf0e10cSrcweir meRP = eRP; 1542*cdf0e10cSrcweir 1543*cdf0e10cSrcweir Rectangle aTmpRect( GetRect() ); 1544*cdf0e10cSrcweir SetMinMaxPosition(); 1545*cdf0e10cSrcweir } 1546*cdf0e10cSrcweir } 1547*cdf0e10cSrcweir 1548*cdf0e10cSrcweir //------------------------------------------------------------------------ 1549*cdf0e10cSrcweir 1550*cdf0e10cSrcweir void SvxPositionSizeTabPage::DisableResize() 1551*cdf0e10cSrcweir { 1552*cdf0e10cSrcweir mbSizeDisabled = true; 1553*cdf0e10cSrcweir } 1554*cdf0e10cSrcweir 1555*cdf0e10cSrcweir //------------------------------------------------------------------------ 1556*cdf0e10cSrcweir 1557*cdf0e10cSrcweir void SvxPositionSizeTabPage::DisableProtect() 1558*cdf0e10cSrcweir { 1559*cdf0e10cSrcweir mbProtectDisabled = true; 1560*cdf0e10cSrcweir } 1561*cdf0e10cSrcweir 1562*cdf0e10cSrcweir //------------------------------------------------------------------------ 1563*cdf0e10cSrcweir 1564*cdf0e10cSrcweir Rectangle SvxPositionSizeTabPage::GetRect() 1565*cdf0e10cSrcweir { 1566*cdf0e10cSrcweir double fLeft(maRange.getMinX()); 1567*cdf0e10cSrcweir double fTop(maRange.getMinY()); 1568*cdf0e10cSrcweir double fRight(fLeft + (double)maMtrWidth.GetValue()); 1569*cdf0e10cSrcweir double fBottom(fTop + (double)maMtrHeight.GetValue()); 1570*cdf0e10cSrcweir 1571*cdf0e10cSrcweir switch ( maCtlSize.GetActualRP() ) 1572*cdf0e10cSrcweir { 1573*cdf0e10cSrcweir case RP_LT: 1574*cdf0e10cSrcweir { 1575*cdf0e10cSrcweir break; 1576*cdf0e10cSrcweir } 1577*cdf0e10cSrcweir case RP_MT: 1578*cdf0e10cSrcweir { 1579*cdf0e10cSrcweir fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ) / 2.0; 1580*cdf0e10cSrcweir break; 1581*cdf0e10cSrcweir } 1582*cdf0e10cSrcweir case RP_RT: 1583*cdf0e10cSrcweir { 1584*cdf0e10cSrcweir fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ); 1585*cdf0e10cSrcweir break; 1586*cdf0e10cSrcweir } 1587*cdf0e10cSrcweir case RP_LM: 1588*cdf0e10cSrcweir { 1589*cdf0e10cSrcweir fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ) / 2.0; 1590*cdf0e10cSrcweir break; 1591*cdf0e10cSrcweir } 1592*cdf0e10cSrcweir case RP_MM: 1593*cdf0e10cSrcweir { 1594*cdf0e10cSrcweir fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ) / 2.0; 1595*cdf0e10cSrcweir fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ) / 2.0; 1596*cdf0e10cSrcweir break; 1597*cdf0e10cSrcweir } 1598*cdf0e10cSrcweir case RP_RM: 1599*cdf0e10cSrcweir { 1600*cdf0e10cSrcweir fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ); 1601*cdf0e10cSrcweir fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ) / 2.0; 1602*cdf0e10cSrcweir break; 1603*cdf0e10cSrcweir } 1604*cdf0e10cSrcweir case RP_LB: 1605*cdf0e10cSrcweir { 1606*cdf0e10cSrcweir fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ); 1607*cdf0e10cSrcweir break; 1608*cdf0e10cSrcweir } 1609*cdf0e10cSrcweir case RP_MB: 1610*cdf0e10cSrcweir { 1611*cdf0e10cSrcweir fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ) / 2.0; 1612*cdf0e10cSrcweir fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ); 1613*cdf0e10cSrcweir break; 1614*cdf0e10cSrcweir } 1615*cdf0e10cSrcweir case RP_RB: 1616*cdf0e10cSrcweir { 1617*cdf0e10cSrcweir fLeft = maRange.getMinX() - ( fRight - maRange.getMaxX() ); 1618*cdf0e10cSrcweir fTop = maRange.getMinY() - ( fBottom - maRange.getMaxY() ); 1619*cdf0e10cSrcweir break; 1620*cdf0e10cSrcweir } 1621*cdf0e10cSrcweir } 1622*cdf0e10cSrcweir 1623*cdf0e10cSrcweir return Rectangle(basegfx::fround(fLeft), basegfx::fround(fTop), basegfx::fround(fRight), basegfx::fround(fBottom)); 1624*cdf0e10cSrcweir } 1625*cdf0e10cSrcweir 1626*cdf0e10cSrcweir //------------------------------------------------------------------------ 1627*cdf0e10cSrcweir 1628*cdf0e10cSrcweir IMPL_LINK( SvxPositionSizeTabPage, ChangeWidthHdl, void *, EMPTYARG ) 1629*cdf0e10cSrcweir { 1630*cdf0e10cSrcweir if( maCbxScale.IsChecked() && maCbxScale.IsEnabled() ) 1631*cdf0e10cSrcweir { 1632*cdf0e10cSrcweir sal_Int64 nHeight(basegfx::fround64((mfOldHeight * (double)maMtrWidth.GetValue()) / mfOldWidth)); 1633*cdf0e10cSrcweir 1634*cdf0e10cSrcweir if(nHeight <= maMtrHeight.GetMax(FUNIT_NONE)) 1635*cdf0e10cSrcweir { 1636*cdf0e10cSrcweir maMtrHeight.SetUserValue(nHeight, FUNIT_NONE); 1637*cdf0e10cSrcweir } 1638*cdf0e10cSrcweir else 1639*cdf0e10cSrcweir { 1640*cdf0e10cSrcweir nHeight = maMtrHeight.GetMax(FUNIT_NONE); 1641*cdf0e10cSrcweir maMtrHeight.SetUserValue(nHeight); 1642*cdf0e10cSrcweir 1643*cdf0e10cSrcweir const sal_Int64 nWidth(basegfx::fround64((mfOldWidth * (double)nHeight) / mfOldHeight)); 1644*cdf0e10cSrcweir maMtrWidth.SetUserValue(nWidth, FUNIT_NONE); 1645*cdf0e10cSrcweir } 1646*cdf0e10cSrcweir } 1647*cdf0e10cSrcweir 1648*cdf0e10cSrcweir return( 0L ); 1649*cdf0e10cSrcweir } 1650*cdf0e10cSrcweir 1651*cdf0e10cSrcweir //------------------------------------------------------------------------ 1652*cdf0e10cSrcweir 1653*cdf0e10cSrcweir IMPL_LINK( SvxPositionSizeTabPage, ChangeHeightHdl, void *, EMPTYARG ) 1654*cdf0e10cSrcweir { 1655*cdf0e10cSrcweir if( maCbxScale.IsChecked() && maCbxScale.IsEnabled() ) 1656*cdf0e10cSrcweir { 1657*cdf0e10cSrcweir sal_Int64 nWidth(basegfx::fround64((mfOldWidth * (double)maMtrHeight.GetValue()) / mfOldHeight)); 1658*cdf0e10cSrcweir 1659*cdf0e10cSrcweir if(nWidth <= maMtrWidth.GetMax(FUNIT_NONE)) 1660*cdf0e10cSrcweir { 1661*cdf0e10cSrcweir maMtrWidth.SetUserValue(nWidth, FUNIT_NONE); 1662*cdf0e10cSrcweir } 1663*cdf0e10cSrcweir else 1664*cdf0e10cSrcweir { 1665*cdf0e10cSrcweir nWidth = maMtrWidth.GetMax(FUNIT_NONE); 1666*cdf0e10cSrcweir maMtrWidth.SetUserValue(nWidth); 1667*cdf0e10cSrcweir 1668*cdf0e10cSrcweir const sal_Int64 nHeight(basegfx::fround64((mfOldHeight * (double)nWidth) / mfOldWidth)); 1669*cdf0e10cSrcweir maMtrHeight.SetUserValue(nHeight, FUNIT_NONE); 1670*cdf0e10cSrcweir } 1671*cdf0e10cSrcweir } 1672*cdf0e10cSrcweir 1673*cdf0e10cSrcweir return( 0L ); 1674*cdf0e10cSrcweir } 1675*cdf0e10cSrcweir 1676*cdf0e10cSrcweir //------------------------------------------------------------------------ 1677*cdf0e10cSrcweir 1678*cdf0e10cSrcweir IMPL_LINK( SvxPositionSizeTabPage, ClickSizeProtectHdl, void *, EMPTYARG ) 1679*cdf0e10cSrcweir { 1680*cdf0e10cSrcweir UpdateControlStates(); 1681*cdf0e10cSrcweir return( 0L ); 1682*cdf0e10cSrcweir } 1683*cdf0e10cSrcweir 1684*cdf0e10cSrcweir //------------------------------------------------------------------------ 1685*cdf0e10cSrcweir 1686*cdf0e10cSrcweir IMPL_LINK( SvxPositionSizeTabPage, ClickAutoHdl, void *, EMPTYARG ) 1687*cdf0e10cSrcweir { 1688*cdf0e10cSrcweir if( maCbxScale.IsChecked() ) 1689*cdf0e10cSrcweir { 1690*cdf0e10cSrcweir mfOldWidth = std::max( (double)GetCoreValue( maMtrWidth, mePoolUnit ), 1.0 ); 1691*cdf0e10cSrcweir mfOldHeight = std::max( (double)GetCoreValue( maMtrHeight, mePoolUnit ), 1.0 ); 1692*cdf0e10cSrcweir } 1693*cdf0e10cSrcweir 1694*cdf0e10cSrcweir return( 0L ); 1695*cdf0e10cSrcweir } 1696*cdf0e10cSrcweir 1697*cdf0e10cSrcweir //------------------------------------------------------------------------ 1698*cdf0e10cSrcweir 1699*cdf0e10cSrcweir void SvxPositionSizeTabPage::FillUserData() 1700*cdf0e10cSrcweir { 1701*cdf0e10cSrcweir // Abgleich wird in der Ini-Datei festgehalten 1702*cdf0e10cSrcweir UniString aStr = UniString::CreateFromInt32( (sal_Int32) maCbxScale.IsChecked() ); 1703*cdf0e10cSrcweir SetUserData( aStr ); 1704*cdf0e10cSrcweir } 1705*cdf0e10cSrcweir 1706*cdf0e10cSrcweir // eof 1707