LCOV - code coverage report
Current view: top level - cui/source/tabpages - transfrm.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 752 0.0 %
Date: 2012-08-25 Functions: 0 54 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1212 0.0 %

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

Generated by: LCOV version 1.10