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

Generated by: LCOV version 1.10