LCOV - code coverage report
Current view: top level - svx/source/dialog - _contdlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 402 0.2 %
Date: 2012-08-25 Functions: 2 50 4.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 801 0.1 %

           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 <vcl/wrkwin.hxx>
      30                 :            : #include <sot/factory.hxx>
      31                 :            : #include <tools/shl.hxx>
      32                 :            : #include <tools/helpers.hxx>
      33                 :            : #include <vcl/msgbox.hxx>
      34                 :            : #include <svl/eitem.hxx>
      35                 :            : #include <sfx2/dispatch.hxx>
      36                 :            : #include <sfx2/viewfrm.hxx>
      37                 :            : #include <svtools/miscopt.hxx>
      38                 :            : #include <unotools/localedatawrapper.hxx>
      39                 :            : #include <comphelper/processfactory.hxx>
      40                 :            : 
      41                 :            : #include <svx/dialmgr.hxx>
      42                 :            : #include "svx/xoutbmp.hxx"
      43                 :            : #include <svx/dialogs.hrc>
      44                 :            : #include <svx/svxids.hrc>
      45                 :            : #include <svx/contdlg.hxx>
      46                 :            : #include "contimp.hxx"
      47                 :            : #include "contdlg.hrc"
      48                 :            : #include "contwnd.hxx"
      49                 :            : #include <svx/svdtrans.hxx>
      50                 :            : #include <svx/svdopath.hxx>
      51                 :            : #include "svx/dlgutil.hxx"
      52                 :            : #include <vcl/svapp.hxx>
      53                 :            : #include <vcl/virdev.hxx>
      54                 :            : #include "dlgunit.hxx"
      55                 :            : 
      56 [ #  # ][ +  - ]:        146 : SFX_IMPL_FLOATINGWINDOW_WITHID( SvxContourDlgChildWindow, SID_CONTOUR_DLG );
                 [ #  # ]
      57                 :            : 
      58                 :            : 
      59                 :            : /******************************************************************************/
      60                 :            : 
      61                 :          0 : SvxContourDlgItem::SvxContourDlgItem( sal_uInt16 _nId, SvxSuperContourDlg& rContourDlg, SfxBindings& rBindings ) :
      62                 :            :             SfxControllerItem   ( _nId, rBindings ),
      63                 :          0 :             rDlg                ( rContourDlg )
      64                 :            : {
      65                 :          0 : }
      66                 :            : 
      67                 :          0 : void SvxContourDlgItem::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/, const SfxPoolItem* pItem )
      68                 :            : {
      69 [ #  # ][ #  # ]:          0 :     if ( pItem && ( SID_CONTOUR_EXEC == nSID ) )
      70                 :            :     {
      71 [ #  # ][ #  # ]:          0 :         const SfxBoolItem* pStateItem = PTR_CAST( SfxBoolItem, pItem );
      72                 :            : 
      73                 :            :         DBG_ASSERT( pStateItem || pItem == 0, "SfxBoolItem expected ");
      74                 :            : 
      75                 :          0 :         rDlg.SetExecState( !pStateItem->GetValue() );
      76                 :            :     }
      77                 :          0 : }
      78                 :            : 
      79                 :            : 
      80                 :            : /******************************************************************************/
      81                 :            : 
      82                 :          0 : SvxContourDlgChildWindow::SvxContourDlgChildWindow( Window* _pParent, sal_uInt16 nId,
      83                 :            :                                                     SfxBindings* pBindings, SfxChildWinInfo* pInfo ) :
      84                 :          0 :             SfxChildWindow( _pParent, nId )
      85                 :            : {
      86 [ #  # ][ #  # ]:          0 :     SvxSuperContourDlg* pDlg = new SvxSuperContourDlg( pBindings, this, _pParent, CONT_RESID( RID_SVXDLG_CONTOUR ) );
                 [ #  # ]
      87                 :          0 :     pWindow = pDlg;
      88                 :            : 
      89         [ #  # ]:          0 :     if ( pInfo->nFlags & SFX_CHILDWIN_ZOOMIN )
      90         [ #  # ]:          0 :         pDlg->RollUp();
      91                 :            : 
      92                 :          0 :     eChildAlignment = SFX_ALIGN_NOALIGNMENT;
      93                 :            : 
      94         [ #  # ]:          0 :     pDlg->Initialize( pInfo );
      95                 :          0 : }
      96                 :            : 
      97                 :          0 : SvxContourDlg::SvxContourDlg( SfxBindings* _pBindings, SfxChildWindow* pCW,
      98                 :            :                               Window* _pParent, const ResId& rResId ) :
      99                 :            : 
     100                 :          0 :     SfxFloatingWindow   ( _pBindings, pCW, _pParent, rResId )
     101                 :            : 
     102                 :            : {
     103                 :          0 : }
     104                 :            : 
     105                 :          0 : SvxContourDlg::~SvxContourDlg()
     106                 :            : {
     107         [ #  # ]:          0 : }
     108                 :            : 
     109                 :          0 : PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic,
     110                 :            :                                               const Rectangle* pRect,
     111                 :            :                                               const sal_uIntPtr nFlags )
     112                 :            : {
     113         [ #  # ]:          0 :     Bitmap  aBmp;
     114                 :          0 :     sal_uIntPtr nContourFlags = XOUTBMP_CONTOUR_HORZ;
     115                 :            : 
     116 [ #  # ][ #  # ]:          0 :     if ( rGraphic.GetType() == GRAPHIC_BITMAP )
     117                 :            :     {
     118 [ #  # ][ #  # ]:          0 :         if( rGraphic.IsAnimated() )
     119                 :            :         {
     120         [ #  # ]:          0 :             VirtualDevice       aVDev;
     121         [ #  # ]:          0 :             MapMode             aTransMap;
     122         [ #  # ]:          0 :             PolyPolygon         aAnimPolyPoly;
     123         [ #  # ]:          0 :             const Animation     aAnim( rGraphic.GetAnimation() );
     124                 :          0 :             const Size&         rSizePix = aAnim.GetDisplaySizePixel();
     125                 :          0 :             const sal_uInt16        nCount = aAnim.Count();
     126                 :            : 
     127 [ #  # ][ #  # ]:          0 :             if ( aVDev.SetOutputSizePixel( rSizePix ) )
     128                 :            :             {
     129         [ #  # ]:          0 :                 aVDev.SetLineColor( Color( COL_BLACK ) );
     130         [ #  # ]:          0 :                 aVDev.SetFillColor( Color( COL_BLACK ) );
     131                 :            : 
     132         [ #  # ]:          0 :                 for( sal_uInt16 i = 0; i < nCount; i++ )
     133                 :            :                 {
     134         [ #  # ]:          0 :                     const AnimationBitmap& rStepBmp = aAnim.Get( i );
     135                 :            : 
     136                 :            :                     // Push Polygon output to the right place; this is the
     137                 :            :                     // offset of the sub-image within the total animation
     138         [ #  # ]:          0 :                     aTransMap.SetOrigin( Point( rStepBmp.aPosPix.X(), rStepBmp.aPosPix.Y() ) );
     139         [ #  # ]:          0 :                     aVDev.SetMapMode( aTransMap );
     140 [ #  # ][ #  # ]:          0 :                     aVDev.DrawPolyPolygon( CreateAutoContour( rStepBmp.aBmpEx, pRect, nFlags ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     141                 :            :                 }
     142                 :            : 
     143         [ #  # ]:          0 :                 aTransMap.SetOrigin( Point() );
     144         [ #  # ]:          0 :                 aVDev.SetMapMode( aTransMap );
     145 [ #  # ][ #  # ]:          0 :                 aBmp = aVDev.GetBitmap( Point(), rSizePix );
                 [ #  # ]
     146         [ #  # ]:          0 :                 aBmp.Convert( BMP_CONVERSION_1BIT_THRESHOLD );
     147 [ #  # ][ #  # ]:          0 :             }
         [ #  # ][ #  # ]
     148                 :            :         }
     149 [ #  # ][ #  # ]:          0 :         else if( rGraphic.IsTransparent() )
     150 [ #  # ][ #  # ]:          0 :             aBmp = rGraphic.GetBitmapEx().GetMask();
         [ #  # ][ #  # ]
                 [ #  # ]
     151                 :            :         else
     152                 :            :         {
     153 [ #  # ][ #  # ]:          0 :             aBmp = rGraphic.GetBitmap();
                 [ #  # ]
     154                 :          0 :             nContourFlags |= XOUTBMP_CONTOUR_EDGEDETECT;
     155                 :            :         }
     156                 :            :     }
     157 [ #  # ][ #  # ]:          0 :     else if( rGraphic.GetType() != GRAPHIC_NONE )
     158                 :            :     {
     159 [ #  # ][ #  # ]:          0 :         const Graphic   aTmpGrf( rGraphic.GetGDIMetaFile().GetMonochromeMtf( Color( COL_BLACK ) ) );
         [ #  # ][ #  # ]
     160         [ #  # ]:          0 :         VirtualDevice   aVDev;
     161 [ #  # ][ #  # ]:          0 :         Size            aSizePix( aVDev.LogicToPixel( aTmpGrf.GetPrefSize(), aTmpGrf.GetPrefMapMode() ) );
         [ #  # ][ #  # ]
     162                 :            : 
     163 [ #  # ][ #  # ]:          0 :         if( aSizePix.Width() && aSizePix.Height() && ( aSizePix.Width() > 512 || aSizePix.Height() > 512 ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     164                 :            :         {
     165                 :          0 :             double fWH = (double) aSizePix.Width() / aSizePix.Height();
     166                 :            : 
     167         [ #  # ]:          0 :             if( fWH <= 1.0 )
     168                 :          0 :                 aSizePix.Width() = FRound( ( aSizePix.Height() = 512 ) * fWH );
     169                 :            :             else
     170                 :          0 :                 aSizePix.Height() = FRound( ( aSizePix.Width() = 512 ) / fWH );
     171                 :            :         }
     172                 :            : 
     173 [ #  # ][ #  # ]:          0 :         if( aVDev.SetOutputSizePixel( aSizePix ) )
     174                 :            :         {
     175                 :          0 :             const Point aPt;
     176         [ #  # ]:          0 :             aTmpGrf.Draw( &aVDev, aPt, aSizePix );
     177 [ #  # ][ #  # ]:          0 :             aBmp = aVDev.GetBitmap( aPt, aSizePix );
                 [ #  # ]
     178                 :            :         }
     179                 :            : 
     180 [ #  # ][ #  # ]:          0 :         nContourFlags |= XOUTBMP_CONTOUR_EDGEDETECT;
     181                 :            :     }
     182                 :            : 
     183         [ #  # ]:          0 :     aBmp.SetPrefSize( rGraphic.GetPrefSize() );
     184 [ #  # ][ #  # ]:          0 :     aBmp.SetPrefMapMode( rGraphic.GetPrefMapMode() );
                 [ #  # ]
     185                 :            : 
     186 [ #  # ][ #  # ]:          0 :     return PolyPolygon( XOutBitmap::GetCountour( aBmp, nContourFlags, 128, pRect ) );
         [ #  # ][ #  # ]
     187                 :            : }
     188                 :            : 
     189                 :            : // Loop through to super class, no virtual Methods to not become incompatible
     190                 :            : // due to IF changes
     191                 :            : 
     192                 :          0 : const Graphic& SvxContourDlg::GetGraphic() const
     193                 :            : {
     194                 :          0 :     return pSuperClass->GetGraphic();
     195                 :            : }
     196                 :            : 
     197                 :          0 : sal_Bool SvxContourDlg::IsGraphicChanged() const
     198                 :            : {
     199                 :          0 :     return pSuperClass->IsGraphicChanged();
     200                 :            : }
     201                 :            : 
     202                 :          0 : PolyPolygon SvxContourDlg::GetPolyPolygon()
     203                 :            : {
     204                 :          0 :     return pSuperClass->GetPolyPolygon( sal_True );
     205                 :            : }
     206                 :            : 
     207                 :          0 : const void* SvxContourDlg::GetEditingObject() const
     208                 :            : {
     209                 :          0 :     return pSuperClass->GetEditingObject();
     210                 :            : }
     211                 :            : 
     212                 :          0 : void SvxContourDlg::Update( const Graphic& rGraphic, sal_Bool bGraphicLinked,
     213                 :            :                             const PolyPolygon* pPolyPoly, void* pEditingObj )
     214                 :            : {
     215                 :          0 :     pSuperClass->UpdateGraphic( rGraphic, bGraphicLinked, pPolyPoly, pEditingObj );
     216                 :          0 : }
     217                 :            : 
     218                 :          0 : SvxSuperContourDlg::SvxSuperContourDlg( SfxBindings *_pBindings, SfxChildWindow *pCW,
     219                 :            :                                         Window* _pParent, const ResId& rResId ) :
     220                 :            :         SvxContourDlg       ( _pBindings, pCW, _pParent, rResId ),
     221                 :            :         pCheckObj           ( NULL ),
     222                 :            :         aContourItem        ( SID_CONTOUR_EXEC, *this, *_pBindings ),
     223                 :          0 :         aTbx1               ( this, ResId( TBX1, *rResId.GetResMgr() ) ),
     224                 :          0 :         aMtfTolerance       ( this, ResId( MTF_TOLERANCE, *rResId.GetResMgr() ) ),
     225                 :          0 :         aContourWnd         ( this, ResId( CTL_CONTOUR, *rResId.GetResMgr() ) ),
     226                 :            :         aStbStatus          ( this, WB_BORDER | WB_3DLOOK | WB_LEFT ),
     227                 :            :         nGrfChanged         ( 0UL ),
     228                 :            :         bExecState          ( sal_False ),
     229                 :            :         bGraphicLinked      ( sal_False ),
     230 [ #  # ][ #  # ]:          0 :         maImageList         ( SVX_RES( CD_IMAPDLG ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
          #  #  #  #  #  
              # ][ #  # ]
         [ #  # ][ #  # ]
     231                 :            : {
     232         [ #  # ]:          0 :     ApplyImageList();
     233                 :            : 
     234         [ #  # ]:          0 :     FreeResource();
     235                 :            : 
     236                 :          0 :     SvxContourDlg::SetSuperClass( *this );
     237                 :            : 
     238         [ #  # ]:          0 :     aContourWnd.SetMousePosLink( LINK( this, SvxSuperContourDlg, MousePosHdl ) );
     239         [ #  # ]:          0 :     aContourWnd.SetGraphSizeLink( LINK( this, SvxSuperContourDlg, GraphSizeHdl ) );
     240         [ #  # ]:          0 :     aContourWnd.SetUpdateLink( LINK( this, SvxSuperContourDlg, StateHdl ) );
     241         [ #  # ]:          0 :     aContourWnd.SetPipetteHdl( LINK( this, SvxSuperContourDlg, PipetteHdl ) );
     242         [ #  # ]:          0 :     aContourWnd.SetPipetteClickHdl( LINK( this, SvxSuperContourDlg, PipetteClickHdl ) );
     243         [ #  # ]:          0 :     aContourWnd.SetWorkplaceClickHdl( LINK( this, SvxSuperContourDlg, WorkplaceClickHdl ) );
     244                 :            : 
     245         [ #  # ]:          0 :     const Size      aTbxSize( aTbx1.CalcWindowSizePixel() );
     246         [ #  # ]:          0 :     Point           aPos( aTbx1.GetPosPixel() );
     247         [ #  # ]:          0 :       SvtMiscOptions  aMiscOptions;
     248                 :            : 
     249 [ #  # ][ #  # ]:          0 :     aMiscOptions.AddListenerLink( LINK( this, SvxSuperContourDlg, MiscHdl ) );
     250                 :            : 
     251 [ #  # ][ #  # ]:          0 :     aTbx1.SetOutStyle( aMiscOptions.GetToolboxStyle() );
     252         [ #  # ]:          0 :     aTbx1.SetSizePixel( aTbxSize );
     253         [ #  # ]:          0 :     aTbx1.SetSelectHdl( LINK( this, SvxSuperContourDlg, Tbx1ClickHdl ) );
     254                 :            : 
     255 [ #  # ][ #  # ]:          0 :     aPos.X() += aTbxSize.Width() + LogicToPixel( Size( 3, 0 ), MapMode( MAP_APPFONT ) ).Width();
                 [ #  # ]
     256         [ #  # ]:          0 :     aMtfTolerance.SetPosPixel( aPos );
     257         [ #  # ]:          0 :     aMtfTolerance.SetValue( 10L );
     258                 :            : 
     259         [ #  # ]:          0 :     SetMinOutputSizePixel( aLastSize = GetOutputSizePixel() );
     260                 :            : 
     261         [ #  # ]:          0 :     aStbStatus.InsertItem( 1, 130, SIB_LEFT | SIB_IN | SIB_AUTOSIZE );
     262 [ #  # ][ #  # ]:          0 :     aStbStatus.InsertItem( 2, 10 + GetTextWidth( rtl::OUString(" 9999,99 cm / 9999,99 cm ") ), SIB_CENTER | SIB_IN );
         [ #  # ][ #  # ]
     263 [ #  # ][ #  # ]:          0 :     aStbStatus.InsertItem( 3, 10 + GetTextWidth( rtl::OUString(" 9999,99 cm x 9999,99 cm ") ), SIB_CENTER | SIB_IN );
         [ #  # ][ #  # ]
     264         [ #  # ]:          0 :     aStbStatus.InsertItem( 4, 20, SIB_CENTER | SIB_IN );
     265                 :            : 
     266         [ #  # ]:          0 :     Resize();
     267                 :            : 
     268         [ #  # ]:          0 :     aUpdateTimer.SetTimeout( 100 );
     269         [ #  # ]:          0 :     aUpdateTimer.SetTimeoutHdl( LINK( this, SvxSuperContourDlg, UpdateHdl ) );
     270                 :            : 
     271         [ #  # ]:          0 :     aCreateTimer.SetTimeout( 50 );
     272 [ #  # ][ #  # ]:          0 :     aCreateTimer.SetTimeoutHdl( LINK( this, SvxSuperContourDlg, CreateHdl ) );
     273                 :          0 : }
     274                 :            : 
     275 [ #  # ][ #  # ]:          0 : SvxSuperContourDlg::~SvxSuperContourDlg()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     276                 :            : {
     277         [ #  # ]:          0 : }
     278                 :            : 
     279                 :            : // Resize methods
     280                 :            : 
     281                 :          0 : void SvxSuperContourDlg::Resize()
     282                 :            : {
     283         [ #  # ]:          0 :     SfxFloatingWindow::Resize();
     284                 :            : 
     285                 :          0 :     Size aMinSize( GetMinOutputSizePixel() );
     286                 :          0 :     Size aNewSize( GetOutputSizePixel() );
     287                 :            : 
     288         [ #  # ]:          0 :     if ( aNewSize.Height() >= aMinSize.Height() )
     289                 :            :     {
     290         [ #  # ]:          0 :         Size    _aSize( aStbStatus.GetSizePixel() );
     291                 :          0 :         Point   aPoint( 0, aNewSize.Height() - _aSize.Height() );
     292                 :            : 
     293                 :            :         // Position the StatusBar
     294         [ #  # ]:          0 :         aStbStatus.SetPosSizePixel( aPoint, Size( aNewSize.Width(), _aSize.Height() ) );
     295         [ #  # ]:          0 :         aStbStatus.Show();
     296                 :            : 
     297                 :            :         // Position the EditWindow
     298                 :          0 :         _aSize.Width() = aNewSize.Width() - 18;
     299         [ #  # ]:          0 :         _aSize.Height() = aPoint.Y() - aContourWnd.GetPosPixel().Y() - 6;
     300         [ #  # ]:          0 :         aContourWnd.SetSizePixel( _aSize );
     301                 :            : 
     302                 :          0 :         aLastSize = aNewSize;
     303                 :            :     }
     304                 :          0 : }
     305                 :            : 
     306                 :            : // Close methods
     307                 :            : 
     308                 :          0 : sal_Bool SvxSuperContourDlg::Close()
     309                 :            : {
     310                 :          0 :     sal_Bool bRet = sal_True;
     311                 :            : 
     312         [ #  # ]:          0 :     if ( aTbx1.IsItemEnabled( TBI_APPLY ) )
     313                 :            :     {
     314                 :            :         QueryBox    aQBox( this, WB_YES_NO_CANCEL | WB_DEF_YES,
     315 [ #  # ][ #  # ]:          0 :                            String( CONT_RESID( STR_CONTOURDLG_MODIFY ) ) );
         [ #  # ][ #  # ]
     316         [ #  # ]:          0 :         const long  nRet = aQBox.Execute();
     317                 :            : 
     318         [ #  # ]:          0 :         if ( nRet == RET_YES )
     319                 :            :         {
     320         [ #  # ]:          0 :             SfxBoolItem aBoolItem( SID_CONTOUR_EXEC, sal_True );
     321                 :          0 :             GetBindings().GetDispatcher()->Execute(
     322 [ #  # ][ #  # ]:          0 :                 SID_CONTOUR_EXEC, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD, &aBoolItem, 0L );
     323                 :            :         }
     324         [ #  # ]:          0 :         else if ( nRet == RET_CANCEL )
     325         [ #  # ]:          0 :             bRet = sal_False;
     326                 :            :     }
     327                 :            : 
     328         [ #  # ]:          0 :     return( bRet ? SfxFloatingWindow::Close() : sal_False );
     329                 :            : }
     330                 :            : 
     331                 :            : // Enabled or disabled all Controls
     332                 :            : 
     333                 :          0 : void SvxSuperContourDlg::SetExecState( sal_Bool bEnable )
     334                 :            : {
     335                 :          0 :     bExecState = bEnable;
     336                 :          0 : }
     337                 :            : 
     338                 :          0 : void SvxSuperContourDlg::SetGraphic( const Graphic& rGraphic )
     339                 :            : {
     340 [ #  # ][ #  # ]:          0 :     aUndoGraphic = aRedoGraphic = Graphic();
     341                 :          0 :     aGraphic = rGraphic;
     342                 :          0 :     nGrfChanged = 0UL;
     343                 :          0 :     aContourWnd.SetGraphic( aGraphic );
     344                 :          0 : }
     345                 :            : 
     346                 :          0 : void SvxSuperContourDlg::SetPolyPolygon( const PolyPolygon& rPolyPoly )
     347                 :            : {
     348                 :            :     DBG_ASSERT(  aContourWnd.GetGraphic().GetType() != GRAPHIC_NONE, "Graphic must've been set first!" );
     349                 :            : 
     350         [ #  # ]:          0 :     PolyPolygon     aPolyPoly( rPolyPoly );
     351         [ #  # ]:          0 :     const MapMode   aMap100( MAP_100TH_MM );
     352         [ #  # ]:          0 :     const MapMode   aGrfMap( aGraphic.GetPrefMapMode() );
     353         [ #  # ]:          0 :     OutputDevice*   pOutDev = Application::GetDefaultDevice();
     354                 :          0 :     sal_Bool            bPixelMap = aGrfMap.GetMapUnit() == MAP_PIXEL;
     355                 :            : 
     356 [ #  # ][ #  # ]:          0 :     for ( sal_uInt16 j = 0, nPolyCount = aPolyPoly.Count(); j < nPolyCount; j++ )
     357                 :            :     {
     358         [ #  # ]:          0 :         Polygon& rPoly = aPolyPoly[ j ];
     359                 :            : 
     360 [ #  # ][ #  # ]:          0 :         for ( sal_uInt16 i = 0, nCount = rPoly.GetSize(); i < nCount; i++ )
     361                 :            :         {
     362         [ #  # ]:          0 :             Point& rPt = rPoly[ i ];
     363                 :            : 
     364         [ #  # ]:          0 :             if ( !bPixelMap )
     365         [ #  # ]:          0 :                 rPt = pOutDev->LogicToPixel( rPt, aGrfMap );
     366                 :            : 
     367         [ #  # ]:          0 :             rPt = pOutDev->PixelToLogic( rPt, aMap100 );
     368                 :            :         }
     369                 :            :     }
     370                 :            : 
     371         [ #  # ]:          0 :     aContourWnd.SetPolyPolygon( aPolyPoly );
     372 [ #  # ][ #  # ]:          0 :     aContourWnd.GetSdrModel()->SetChanged( sal_True );
         [ #  # ][ #  # ]
     373                 :          0 : }
     374                 :            : 
     375                 :          0 : PolyPolygon SvxSuperContourDlg::GetPolyPolygon( sal_Bool bRescaleToGraphic )
     376                 :            : {
     377                 :          0 :     PolyPolygon aRetPolyPoly( aContourWnd.GetPolyPolygon() );
     378                 :            : 
     379         [ #  # ]:          0 :     if ( bRescaleToGraphic )
     380                 :            :     {
     381         [ #  # ]:          0 :         const MapMode   aMap100( MAP_100TH_MM );
     382         [ #  # ]:          0 :         const MapMode   aGrfMap( aGraphic.GetPrefMapMode() );
     383         [ #  # ]:          0 :         OutputDevice*   pOutDev = Application::GetDefaultDevice();
     384                 :          0 :         sal_Bool            bPixelMap = aGrfMap.GetMapUnit() == MAP_PIXEL;
     385                 :            : 
     386 [ #  # ][ #  # ]:          0 :         for ( sal_uInt16 j = 0, nPolyCount = aRetPolyPoly.Count(); j < nPolyCount; j++ )
     387                 :            :         {
     388         [ #  # ]:          0 :             Polygon& rPoly = aRetPolyPoly[ j ];
     389                 :            : 
     390 [ #  # ][ #  # ]:          0 :             for ( sal_uInt16 i = 0, nCount = rPoly.GetSize(); i < nCount; i++ )
     391                 :            :             {
     392         [ #  # ]:          0 :                 Point& rPt = rPoly[ i ];
     393                 :            : 
     394         [ #  # ]:          0 :                 rPt = pOutDev->LogicToPixel( rPt, aMap100  );
     395                 :            : 
     396         [ #  # ]:          0 :                 if ( !bPixelMap )
     397         [ #  # ]:          0 :                     rPt = pOutDev->PixelToLogic( rPt, aGrfMap  );
     398                 :            :             }
     399 [ #  # ][ #  # ]:          0 :         }
     400                 :            :     }
     401                 :            : 
     402                 :          0 :     return aRetPolyPoly;
     403                 :            : }
     404                 :            : 
     405                 :          0 : void SvxSuperContourDlg::UpdateGraphic( const Graphic& rGraphic, sal_Bool _bGraphicLinked,
     406                 :            :                                  const PolyPolygon* pPolyPoly, void* pEditingObj )
     407                 :            : {
     408                 :          0 :     aUpdateGraphic = rGraphic;
     409                 :          0 :     bUpdateGraphicLinked = _bGraphicLinked;
     410                 :          0 :     pUpdateEditingObject = pEditingObj;
     411                 :            : 
     412         [ #  # ]:          0 :     if ( pPolyPoly )
     413                 :          0 :         aUpdatePolyPoly = *pPolyPoly;
     414                 :            :     else
     415         [ #  # ]:          0 :         aUpdatePolyPoly = PolyPolygon();
     416                 :            : 
     417                 :          0 :     aUpdateTimer.Start();
     418                 :          0 : }
     419                 :            : 
     420                 :          0 : sal_Bool SvxSuperContourDlg::IsUndoPossible() const
     421                 :            : {
     422                 :          0 :     return aUndoGraphic.GetType() != GRAPHIC_NONE;
     423                 :            : }
     424                 :            : 
     425                 :          0 : sal_Bool SvxSuperContourDlg::IsRedoPossible() const
     426                 :            : {
     427                 :          0 :     return aRedoGraphic.GetType() != GRAPHIC_NONE;
     428                 :            : }
     429                 :            : 
     430                 :            : // Click handler for ToolBox
     431                 :            : 
     432                 :          0 : IMPL_LINK( SvxSuperContourDlg, Tbx1ClickHdl, ToolBox*, pTbx )
     433                 :            : {
     434                 :          0 :     sal_uInt16 nNewItemId = pTbx->GetCurItemId();
     435                 :            : 
     436   [ #  #  #  #  :          0 :     switch( pTbx->GetCurItemId() )
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     437                 :            :     {
     438                 :            :         case( TBI_APPLY ):
     439                 :            :         {
     440         [ #  # ]:          0 :             SfxBoolItem aBoolItem( SID_CONTOUR_EXEC, sal_True );
     441                 :          0 :             GetBindings().GetDispatcher()->Execute(
     442 [ #  # ][ #  # ]:          0 :                 SID_CONTOUR_EXEC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aBoolItem, 0L );
     443                 :            :         }
     444                 :          0 :         break;
     445                 :            : 
     446                 :            :         case( TBI_WORKPLACE ):
     447                 :            :         {
     448         [ #  # ]:          0 :             if ( aTbx1.IsItemChecked( TBI_WORKPLACE ) )
     449                 :            :             {
     450 [ #  # ][ #  # ]:          0 :                 QueryBox aQBox( this, WB_YES_NO | WB_DEF_NO, String( CONT_RESID( STR_CONTOURDLG_WORKPLACE ) ) );
         [ #  # ][ #  # ]
     451                 :            : 
     452 [ #  # ][ #  # ]:          0 :                 if ( !aContourWnd.IsContourChanged() || ( aQBox.Execute() == RET_YES ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     453                 :          0 :                     aContourWnd.SetWorkplaceMode( sal_True );
     454                 :            :                 else
     455 [ #  # ][ #  # ]:          0 :                     aTbx1.CheckItem( TBI_WORKPLACE, sal_False );
     456                 :            :             }
     457                 :            :             else
     458                 :          0 :                 aContourWnd.SetWorkplaceMode( sal_False );
     459                 :            :         }
     460                 :          0 :         break;
     461                 :            : 
     462                 :            :         case( TBI_SELECT ):
     463                 :            :         {
     464                 :          0 :             pTbx->CheckItem( nNewItemId, sal_True );
     465                 :          0 :             aContourWnd.SetEditMode( sal_True );
     466                 :            :         }
     467                 :          0 :         break;
     468                 :            : 
     469                 :            :         case( TBI_RECT ):
     470                 :            :         {
     471                 :          0 :             pTbx->CheckItem( nNewItemId, sal_True );
     472                 :          0 :             aContourWnd.SetObjKind( OBJ_RECT );
     473                 :            :         }
     474                 :          0 :         break;
     475                 :            : 
     476                 :            :         case( TBI_CIRCLE ):
     477                 :            :         {
     478                 :          0 :             pTbx->CheckItem( nNewItemId, sal_True );
     479                 :          0 :             aContourWnd.SetObjKind( OBJ_CIRC );
     480                 :            : 
     481                 :            :         }
     482                 :          0 :         break;
     483                 :            : 
     484                 :            :         case( TBI_POLY ):
     485                 :            :         {
     486                 :          0 :             pTbx->CheckItem( nNewItemId, sal_True );
     487                 :          0 :             aContourWnd.SetObjKind( OBJ_POLY );
     488                 :            :         }
     489                 :          0 :         break;
     490                 :            : 
     491                 :            :         case( TBI_FREEPOLY ):
     492                 :            :         {
     493                 :          0 :             pTbx->CheckItem( nNewItemId, sal_True );
     494                 :          0 :             aContourWnd.SetObjKind( OBJ_FREEFILL );
     495                 :            :         }
     496                 :          0 :         break;
     497                 :            : 
     498                 :            :         case( TBI_POLYEDIT ):
     499         [ #  # ]:          0 :             aContourWnd.SetPolyEditMode( pTbx->IsItemChecked( TBI_POLYEDIT ) ? SID_BEZIER_MOVE : 0 );
     500                 :          0 :         break;
     501                 :            : 
     502                 :            :         case( TBI_POLYMOVE ):
     503                 :          0 :             aContourWnd.SetPolyEditMode( SID_BEZIER_MOVE );
     504                 :          0 :         break;
     505                 :            : 
     506                 :            :         case( TBI_POLYINSERT ):
     507                 :          0 :             aContourWnd.SetPolyEditMode( SID_BEZIER_INSERT );
     508                 :          0 :         break;
     509                 :            : 
     510                 :            :         case( TBI_POLYDELETE ):
     511                 :          0 :             aContourWnd.GetSdrView()->DeleteMarkedPoints();
     512                 :          0 :         break;
     513                 :            : 
     514                 :            :         case( TBI_UNDO ):
     515                 :            :         {
     516         [ #  # ]:          0 :             nGrfChanged = nGrfChanged ? nGrfChanged - 1 : 0UL;
     517                 :          0 :             aRedoGraphic = aGraphic;
     518                 :          0 :             aGraphic = aUndoGraphic;
     519         [ #  # ]:          0 :             aUndoGraphic = Graphic();
     520                 :          0 :             aContourWnd.SetGraphic( aGraphic, sal_False );
     521                 :            :         }
     522                 :          0 :         break;
     523                 :            : 
     524                 :            :         case( TBI_REDO ):
     525                 :            :         {
     526                 :          0 :             nGrfChanged++;
     527                 :          0 :             aUndoGraphic = aGraphic;
     528                 :          0 :             aGraphic = aRedoGraphic;
     529         [ #  # ]:          0 :             aRedoGraphic = Graphic();
     530                 :          0 :             aContourWnd.SetGraphic( aGraphic, sal_False );
     531                 :            :         }
     532                 :          0 :         break;
     533                 :            : 
     534                 :            :         case( TBI_AUTOCONTOUR ):
     535                 :          0 :             aCreateTimer.Start();
     536                 :          0 :         break;
     537                 :            : 
     538                 :            :         case( TBI_PIPETTE ):
     539                 :            :         {
     540                 :          0 :             sal_Bool bPipette = aTbx1.IsItemChecked( TBI_PIPETTE );
     541                 :            : 
     542         [ #  # ]:          0 :             if ( !bPipette )
     543                 :          0 :                 aStbStatus.Invalidate();
     544         [ #  # ]:          0 :             else if ( bGraphicLinked )
     545                 :            :             {
     546 [ #  # ][ #  # ]:          0 :                 QueryBox aQBox( this, WB_YES_NO | WB_DEF_YES, String( CONT_RESID( STR_CONTOURDLG_LINKED ) ) );
         [ #  # ][ #  # ]
     547                 :            : 
     548 [ #  # ][ #  # ]:          0 :                 if ( aQBox.Execute() != RET_YES )
     549                 :            :                 {
     550         [ #  # ]:          0 :                     aTbx1.CheckItem( TBI_PIPETTE, bPipette = sal_False );
     551         [ #  # ]:          0 :                     aStbStatus.Invalidate();
     552         [ #  # ]:          0 :                 }
     553                 :            :             }
     554                 :            : 
     555                 :          0 :             aContourWnd.SetPipetteMode( bPipette );
     556                 :            :         }
     557                 :          0 :         break;
     558                 :            : 
     559                 :            :         default:
     560                 :          0 :         break;
     561                 :            :     }
     562                 :            : 
     563                 :          0 :     return 0L;
     564                 :            : }
     565                 :            : 
     566                 :          0 : IMPL_LINK( SvxSuperContourDlg, MousePosHdl, ContourWindow*, pWnd )
     567                 :            : {
     568         [ #  # ]:          0 :     String aStr;
     569 [ #  # ][ #  # ]:          0 :     const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
     570                 :          0 :     const Point& rMousePos = pWnd->GetMousePos();
     571 [ #  # ][ #  # ]:          0 :     LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
         [ #  # ][ #  # ]
     572         [ #  # ]:          0 :     const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep()[0];
     573                 :            : 
     574 [ #  # ][ #  # ]:          0 :     aStr.Assign( GetUnitString( rMousePos.X(), eFieldUnit, cSep ) );
                 [ #  # ]
     575 [ #  # ][ #  # ]:          0 :     aStr.Append( rtl::OUString(" / ") );
                 [ #  # ]
     576 [ #  # ][ #  # ]:          0 :     aStr.Append( GetUnitString( rMousePos.Y(), eFieldUnit, cSep ) );
                 [ #  # ]
     577                 :            : 
     578         [ #  # ]:          0 :     aStbStatus.SetItemText( 2, aStr );
     579                 :            : 
     580 [ #  # ][ #  # ]:          0 :     return 0L;
     581                 :            : }
     582                 :            : 
     583                 :          0 : IMPL_LINK( SvxSuperContourDlg, GraphSizeHdl, ContourWindow*, pWnd )
     584                 :            : {
     585         [ #  # ]:          0 :     String aStr;
     586 [ #  # ][ #  # ]:          0 :     const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
     587                 :          0 :     const Size& rSize = pWnd->GetGraphicSize();
     588 [ #  # ][ #  # ]:          0 :     LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
         [ #  # ][ #  # ]
     589         [ #  # ]:          0 :     const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep()[0];
     590                 :            : 
     591 [ #  # ][ #  # ]:          0 :     aStr.Assign( GetUnitString( rSize.Width(), eFieldUnit, cSep ) );
                 [ #  # ]
     592 [ #  # ][ #  # ]:          0 :     aStr.Append( rtl::OUString(" x ") );
                 [ #  # ]
     593 [ #  # ][ #  # ]:          0 :     aStr.Append( GetUnitString( rSize.Height(), eFieldUnit, cSep ) );
                 [ #  # ]
     594                 :            : 
     595         [ #  # ]:          0 :     aStbStatus.SetItemText( 3, aStr );
     596                 :            : 
     597 [ #  # ][ #  # ]:          0 :     return 0L;
     598                 :            : }
     599                 :            : 
     600                 :          0 : IMPL_LINK_NOARG(SvxSuperContourDlg, UpdateHdl)
     601                 :            : {
     602                 :          0 :     aUpdateTimer.Stop();
     603                 :            : 
     604         [ #  # ]:          0 :     if ( pUpdateEditingObject != pCheckObj )
     605                 :            :     {
     606         [ #  # ]:          0 :         if( !GetEditingObject() )
     607                 :          0 :             aContourWnd.GrabFocus();
     608                 :            : 
     609                 :          0 :         SetGraphic( aUpdateGraphic );
     610                 :          0 :         SetPolyPolygon( aUpdatePolyPoly );
     611                 :          0 :         SetEditingObject( pUpdateEditingObject );
     612                 :          0 :         bGraphicLinked = bUpdateGraphicLinked;
     613                 :            : 
     614         [ #  # ]:          0 :         aUpdateGraphic = Graphic();
     615         [ #  # ]:          0 :         aUpdatePolyPoly = PolyPolygon();
     616                 :          0 :         bUpdateGraphicLinked = sal_False;
     617                 :            : 
     618                 :          0 :         aContourWnd.GetSdrModel()->SetChanged( sal_False );
     619                 :            :     }
     620                 :            : 
     621                 :          0 :     GetBindings().Invalidate( SID_CONTOUR_EXEC );
     622                 :            : 
     623                 :          0 :     return 0L;
     624                 :            : }
     625                 :            : 
     626                 :          0 : IMPL_LINK_NOARG(SvxSuperContourDlg, CreateHdl)
     627                 :            : {
     628         [ #  # ]:          0 :     aCreateTimer.Stop();
     629                 :            : 
     630 [ #  # ][ #  # ]:          0 :     const Rectangle aWorkRect = aContourWnd.LogicToPixel( aContourWnd.GetWorkRect(), MapMode( MAP_100TH_MM ) );
                 [ #  # ]
     631                 :          0 :     const Graphic&  rGraphic = aContourWnd.GetGraphic();
     632 [ #  # ][ #  # ]:          0 :     const sal_Bool      bValid = aWorkRect.Left() != aWorkRect.Right() && aWorkRect.Top() != aWorkRect.Bottom();
     633                 :            : 
     634         [ #  # ]:          0 :     EnterWait();
     635 [ #  # ][ #  # ]:          0 :     SetPolyPolygon( CreateAutoContour( rGraphic, bValid ? &aWorkRect : NULL ) );
         [ #  # ][ #  # ]
     636         [ #  # ]:          0 :     LeaveWait();
     637                 :            : 
     638                 :          0 :     return 0L;
     639                 :            : }
     640                 :            : 
     641                 :          0 : IMPL_LINK( SvxSuperContourDlg, StateHdl, ContourWindow*, pWnd )
     642                 :            : {
     643                 :          0 :     const SdrObject*    pObj = pWnd->GetSelectedSdrObject();
     644                 :          0 :     const SdrView*      pView = pWnd->GetSdrView();
     645 [ #  # ][ #  # ]:          0 :     const sal_Bool          bPolyEdit = ( pObj != NULL ) && pObj->ISA( SdrPathObj );
     646 [ #  # ][ #  # ]:          0 :     const sal_Bool          bDrawEnabled = !( bPolyEdit && aTbx1.IsItemChecked( TBI_POLYEDIT ) );
     647                 :          0 :     const sal_Bool          bPipette = aTbx1.IsItemChecked( TBI_PIPETTE );
     648                 :          0 :     const sal_Bool          bWorkplace = aTbx1.IsItemChecked( TBI_WORKPLACE );
     649 [ #  # ][ #  # ]:          0 :     const sal_Bool          bDontHide = !( bPipette || bWorkplace );
     650                 :          0 :     const sal_Bool          bBitmap = pWnd->GetGraphic().GetType() == GRAPHIC_BITMAP;
     651                 :            : 
     652 [ #  # ][ #  # ]:          0 :     aTbx1.EnableItem( TBI_APPLY, bDontHide && bExecState && pWnd->IsChanged() );
                 [ #  # ]
     653                 :            : 
     654 [ #  # ][ #  # ]:          0 :     aTbx1.EnableItem( TBI_WORKPLACE, !bPipette && bDrawEnabled );
     655                 :            : 
     656 [ #  # ][ #  # ]:          0 :     aTbx1.EnableItem( TBI_SELECT, bDontHide && bDrawEnabled );
     657 [ #  # ][ #  # ]:          0 :     aTbx1.EnableItem( TBI_RECT, bDontHide && bDrawEnabled );
     658 [ #  # ][ #  # ]:          0 :     aTbx1.EnableItem( TBI_CIRCLE, bDontHide && bDrawEnabled );
     659 [ #  # ][ #  # ]:          0 :     aTbx1.EnableItem( TBI_POLY, bDontHide && bDrawEnabled );
     660 [ #  # ][ #  # ]:          0 :     aTbx1.EnableItem( TBI_FREEPOLY, bDontHide && bDrawEnabled );
     661                 :            : 
     662 [ #  # ][ #  # ]:          0 :     aTbx1.EnableItem( TBI_POLYEDIT, bDontHide && bPolyEdit );
     663 [ #  # ][ #  # ]:          0 :     aTbx1.EnableItem( TBI_POLYMOVE, bDontHide && !bDrawEnabled );
     664 [ #  # ][ #  # ]:          0 :     aTbx1.EnableItem( TBI_POLYINSERT, bDontHide && !bDrawEnabled );
     665 [ #  # ][ #  # ]:          0 :     aTbx1.EnableItem( TBI_POLYDELETE, bDontHide && !bDrawEnabled && pView->IsDeleteMarkedPointsPossible() );
                 [ #  # ]
     666                 :            : 
     667 [ #  # ][ #  # ]:          0 :     aTbx1.EnableItem( TBI_AUTOCONTOUR, bDontHide && bDrawEnabled );
     668 [ #  # ][ #  # ]:          0 :     aTbx1.EnableItem( TBI_PIPETTE, !bWorkplace && bDrawEnabled && bBitmap );
                 [ #  # ]
     669                 :            : 
     670 [ #  # ][ #  # ]:          0 :     aTbx1.EnableItem( TBI_UNDO, bDontHide && IsUndoPossible() );
     671 [ #  # ][ #  # ]:          0 :     aTbx1.EnableItem( TBI_REDO, bDontHide && IsRedoPossible() );
     672                 :            : 
     673         [ #  # ]:          0 :     if ( bPolyEdit )
     674                 :            :     {
     675                 :          0 :         sal_uInt16 nId = 0;
     676                 :            : 
     677      [ #  #  # ]:          0 :         switch( pWnd->GetPolyEditMode() )
     678                 :            :         {
     679                 :          0 :             case( SID_BEZIER_MOVE ): nId = TBI_POLYMOVE; break;
     680                 :          0 :             case( SID_BEZIER_INSERT ): nId = TBI_POLYINSERT; break;
     681                 :            : 
     682                 :            :             default:
     683                 :          0 :             break;
     684                 :            :         }
     685                 :            : 
     686                 :          0 :         aTbx1.CheckItem( nId, sal_True );
     687                 :            :     }
     688                 :            :     else
     689                 :            :     {
     690                 :          0 :         aTbx1.CheckItem( TBI_POLYEDIT, sal_False );
     691                 :          0 :         aTbx1.CheckItem( TBI_POLYMOVE, sal_True );
     692                 :          0 :         aTbx1.CheckItem( TBI_POLYINSERT, sal_False );
     693                 :          0 :         pWnd->SetPolyEditMode( 0 );
     694                 :            :     }
     695                 :            : 
     696                 :          0 :     return 0L;
     697                 :            : }
     698                 :            : 
     699                 :          0 : IMPL_LINK( SvxSuperContourDlg, PipetteHdl, ContourWindow*, pWnd )
     700                 :            : {
     701                 :          0 :     const Color& rOldLineColor = aStbStatus.GetLineColor();
     702                 :          0 :     const Color& rOldFillColor = aStbStatus.GetFillColor();
     703                 :            : 
     704         [ #  # ]:          0 :     Rectangle       aRect( aStbStatus.GetItemRect( 4 ) );
     705                 :          0 :     const Color&    rColor = pWnd->GetPipetteColor();
     706                 :            : 
     707         [ #  # ]:          0 :     aStbStatus.SetLineColor( rColor );
     708         [ #  # ]:          0 :     aStbStatus.SetFillColor( rColor );
     709                 :            : 
     710                 :          0 :     aRect.Left() += 4;
     711                 :          0 :     aRect.Top() += 4;
     712                 :          0 :     aRect.Right() -= 4;
     713                 :          0 :     aRect.Bottom() -= 4;
     714                 :            : 
     715         [ #  # ]:          0 :     aStbStatus.DrawRect( aRect );
     716                 :            : 
     717         [ #  # ]:          0 :     aStbStatus.SetLineColor( rOldLineColor );
     718         [ #  # ]:          0 :     aStbStatus.SetFillColor( rOldFillColor );
     719                 :            : 
     720                 :          0 :     return 0L;
     721                 :            : }
     722                 :            : 
     723                 :          0 : IMPL_LINK( SvxSuperContourDlg, PipetteClickHdl, ContourWindow*, pWnd )
     724                 :            : {
     725         [ #  # ]:          0 :     if ( pWnd->IsClickValid() )
     726                 :            :     {
     727         [ #  # ]:          0 :         Bitmap          aMask;
     728                 :          0 :         const Color&    rColor = pWnd->GetPipetteColor();
     729                 :            : 
     730         [ #  # ]:          0 :         EnterWait();
     731                 :            : 
     732 [ #  # ][ #  # ]:          0 :         if( aGraphic.GetType() == GRAPHIC_BITMAP )
     733                 :            :         {
     734         [ #  # ]:          0 :             Bitmap      aBmp( aGraphic.GetBitmap() );
     735         [ #  # ]:          0 :             const long  nTol = static_cast<long>(aMtfTolerance.GetValue() * 255L / 100L);
     736                 :            : 
     737 [ #  # ][ #  # ]:          0 :             aMask = aBmp.CreateMask( rColor, nTol );
                 [ #  # ]
     738                 :            : 
     739 [ #  # ][ #  # ]:          0 :             if( aGraphic.IsTransparent() )
     740 [ #  # ][ #  # ]:          0 :                 aMask.CombineSimple( aGraphic.GetBitmapEx().GetMask(), BMP_COMBINE_OR );
         [ #  # ][ #  # ]
                 [ #  # ]
     741                 :            : 
     742         [ #  # ]:          0 :             if( !!aMask )
     743                 :            :             {
     744 [ #  # ][ #  # ]:          0 :                 QueryBox    aQBox( this, WB_YES_NO | WB_DEF_YES, String( CONT_RESID( STR_CONTOURDLG_NEWPIPETTE ) ) );
         [ #  # ][ #  # ]
     745                 :            :                 sal_Bool        bNewContour;
     746                 :            : 
     747 [ #  # ][ #  # ]:          0 :                 aRedoGraphic = Graphic();
                 [ #  # ]
     748         [ #  # ]:          0 :                 aUndoGraphic = aGraphic;
     749 [ #  # ][ #  # ]:          0 :                 aGraphic = Graphic( BitmapEx( aBmp, aMask ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     750                 :          0 :                 nGrfChanged++;
     751                 :            : 
     752         [ #  # ]:          0 :                 bNewContour = ( aQBox.Execute() == RET_YES );
     753         [ #  # ]:          0 :                 pWnd->SetGraphic( aGraphic, bNewContour );
     754                 :            : 
     755         [ #  # ]:          0 :                 if( bNewContour )
     756 [ #  # ][ #  # ]:          0 :                     aCreateTimer.Start();
     757         [ #  # ]:          0 :             }
     758                 :            :         }
     759                 :            : 
     760 [ #  # ][ #  # ]:          0 :         LeaveWait();
     761                 :            :     }
     762                 :            : 
     763                 :          0 :     aTbx1.CheckItem( TBI_PIPETTE, sal_False );
     764                 :          0 :     pWnd->SetPipetteMode( sal_False );
     765                 :          0 :     aStbStatus.Invalidate();
     766                 :            : 
     767                 :          0 :     return 0L;
     768                 :            : }
     769                 :            : 
     770                 :          0 : IMPL_LINK( SvxSuperContourDlg, WorkplaceClickHdl, ContourWindow*, pWnd )
     771                 :            : {
     772                 :          0 :     aTbx1.CheckItem( TBI_WORKPLACE, sal_False );
     773                 :          0 :     aTbx1.CheckItem( TBI_SELECT, sal_True );
     774                 :          0 :     pWnd->SetWorkplaceMode( sal_False );
     775                 :            : 
     776                 :          0 :     return 0L;
     777                 :            : }
     778                 :            : 
     779                 :          0 : void SvxSuperContourDlg::ApplyImageList()
     780                 :            : {
     781                 :          0 :     ImageList& rImgLst = maImageList;
     782                 :            : 
     783                 :          0 :     aTbx1.SetImageList( rImgLst );
     784                 :          0 : }
     785                 :            : 
     786                 :          0 : void SvxSuperContourDlg::DataChanged( const DataChangedEvent& rDCEvt )
     787                 :            : {
     788                 :          0 :     SfxFloatingWindow::DataChanged( rDCEvt );
     789                 :            : 
     790 [ #  # ][ #  # ]:          0 :     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
                 [ #  # ]
     791                 :          0 :             ApplyImageList();
     792                 :          0 : }
     793                 :            : 
     794                 :          0 : IMPL_LINK_NOARG(SvxSuperContourDlg, MiscHdl)
     795                 :            : {
     796         [ #  # ]:          0 :        SvtMiscOptions aMiscOptions;
     797 [ #  # ][ #  # ]:          0 :     aTbx1.SetOutStyle( aMiscOptions.GetToolboxStyle() );
     798                 :            : 
     799         [ #  # ]:          0 :     return 0L;
     800                 :            : }
     801                 :            : 
     802                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10