LCOV - code coverage report
Current view: top level - libreoffice/cui/source/tabpages - transfrm.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 728 0.1 %
Date: 2012-12-17 Functions: 2 54 3.7 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10