LCOV - code coverage report
Current view: top level - basctl/source/dlged - dlgedfunc.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 277 0.0 %
Date: 2012-08-25 Functions: 0 22 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #include <vcl/scrbar.hxx>
      21                 :            : #include <svx/svdview.hxx>
      22                 :            : #include "dlgedfunc.hxx"
      23                 :            : #include "dlged.hxx"
      24                 :            : #include "dlgedview.hxx"
      25                 :            : #include <vcl/seleng.hxx>
      26                 :            : 
      27                 :            : 
      28                 :            : //----------------------------------------------------------------------------
      29                 :            : 
      30                 :          0 : IMPL_LINK_INLINE_START( DlgEdFunc, ScrollTimeout, Timer *, pTimer )
      31                 :            : {
      32                 :            :     (void)pTimer;
      33                 :          0 :     Window* pWindow = pParent->GetWindow();
      34                 :          0 :     Point aPos = pWindow->ScreenToOutputPixel( pWindow->GetPointerPosPixel() );
      35                 :          0 :     aPos = pWindow->PixelToLogic( aPos );
      36                 :          0 :     ForceScroll( aPos );
      37                 :          0 :     return 0;
      38                 :            : }
      39                 :          0 : IMPL_LINK_INLINE_END( DlgEdFunc, ScrollTimeout, Timer *, pTimer )
      40                 :            : 
      41                 :            : //----------------------------------------------------------------------------
      42                 :            : 
      43                 :          0 : void DlgEdFunc::ForceScroll( const Point& rPos )
      44                 :            : {
      45                 :          0 :     aScrollTimer.Stop();
      46                 :            : 
      47                 :          0 :     Window* pWindow  = pParent->GetWindow();
      48                 :            : 
      49                 :          0 :     static Point aDefPoint;
      50                 :          0 :     Rectangle aOutRect( aDefPoint, pWindow->GetOutputSizePixel() );
      51                 :          0 :     aOutRect = pWindow->PixelToLogic( aOutRect );
      52                 :            : 
      53                 :          0 :     ScrollBar* pHScroll = pParent->GetHScroll();
      54                 :          0 :     ScrollBar* pVScroll = pParent->GetVScroll();
      55                 :          0 :     long nDeltaX = pHScroll->GetLineSize();
      56                 :          0 :     long nDeltaY = pVScroll->GetLineSize();
      57                 :            : 
      58                 :          0 :     if( !aOutRect.IsInside( rPos ) )
      59                 :            :     {
      60                 :          0 :         if( rPos.X() < aOutRect.Left() )
      61                 :          0 :             nDeltaX = -nDeltaX;
      62                 :            :         else
      63                 :          0 :         if( rPos.X() <= aOutRect.Right() )
      64                 :          0 :             nDeltaX = 0;
      65                 :            : 
      66                 :          0 :         if( rPos.Y() < aOutRect.Top() )
      67                 :          0 :             nDeltaY = -nDeltaY;
      68                 :            :         else
      69                 :          0 :         if( rPos.Y() <= aOutRect.Bottom() )
      70                 :          0 :             nDeltaY = 0;
      71                 :            : 
      72                 :          0 :         if( nDeltaX )
      73                 :          0 :             pHScroll->SetThumbPos( pHScroll->GetThumbPos() + nDeltaX );
      74                 :          0 :         if( nDeltaY )
      75                 :          0 :             pVScroll->SetThumbPos( pVScroll->GetThumbPos() + nDeltaY );
      76                 :            : 
      77                 :          0 :         if( nDeltaX )
      78                 :          0 :             pParent->DoScroll( pHScroll );
      79                 :          0 :         if( nDeltaY )
      80                 :          0 :             pParent->DoScroll( pVScroll );
      81                 :            :     }
      82                 :            : 
      83                 :          0 :     aScrollTimer.Start();
      84                 :          0 : }
      85                 :            : 
      86                 :            : //----------------------------------------------------------------------------
      87                 :            : 
      88                 :          0 : DlgEdFunc::DlgEdFunc( DlgEditor* pParent_ )
      89                 :            : {
      90                 :          0 :     DlgEdFunc::pParent = pParent_;
      91                 :          0 :     aScrollTimer.SetTimeoutHdl( LINK( this, DlgEdFunc, ScrollTimeout ) );
      92                 :          0 :     aScrollTimer.SetTimeout( SELENG_AUTOREPEAT_INTERVAL );
      93                 :          0 : }
      94                 :            : 
      95                 :            : //----------------------------------------------------------------------------
      96                 :            : 
      97                 :          0 : DlgEdFunc::~DlgEdFunc()
      98                 :            : {
      99                 :          0 : }
     100                 :            : 
     101                 :            : //----------------------------------------------------------------------------
     102                 :            : 
     103                 :          0 : bool DlgEdFunc::MouseButtonDown( const MouseEvent& )
     104                 :            : {
     105                 :          0 :     return true;
     106                 :            : }
     107                 :            : 
     108                 :            : //----------------------------------------------------------------------------
     109                 :            : 
     110                 :          0 : bool DlgEdFunc::MouseButtonUp( const MouseEvent& )
     111                 :            : {
     112                 :          0 :     aScrollTimer.Stop();
     113                 :          0 :     return true;
     114                 :            : }
     115                 :            : 
     116                 :            : //----------------------------------------------------------------------------
     117                 :            : 
     118                 :          0 : bool DlgEdFunc::MouseMove( const MouseEvent& )
     119                 :            : {
     120                 :          0 :     return true;
     121                 :            : }
     122                 :            : 
     123                 :            : //----------------------------------------------------------------------------
     124                 :            : 
     125                 :          0 : bool DlgEdFunc::KeyInput( const KeyEvent& rKEvt )
     126                 :            : {
     127                 :          0 :     bool bReturn = false;
     128                 :            : 
     129                 :          0 :     SdrView* pView = pParent->GetView();
     130                 :          0 :     Window* pWindow = pParent->GetWindow();
     131                 :            : 
     132                 :          0 :     KeyCode aCode = rKEvt.GetKeyCode();
     133                 :          0 :     sal_uInt16 nCode = aCode.GetCode();
     134                 :            : 
     135                 :          0 :     switch ( nCode )
     136                 :            :     {
     137                 :            :         case KEY_ESCAPE:
     138                 :            :         {
     139                 :          0 :             if ( pView->IsAction() )
     140                 :            :             {
     141                 :          0 :                 pView->BrkAction();
     142                 :          0 :                 bReturn = true;
     143                 :            :             }
     144                 :          0 :             else if ( pView->AreObjectsMarked() )
     145                 :            :             {
     146                 :          0 :                 const SdrHdlList& rHdlList = pView->GetHdlList();
     147                 :          0 :                 SdrHdl* pHdl = rHdlList.GetFocusHdl();
     148                 :          0 :                 if ( pHdl )
     149                 :          0 :                     ((SdrHdlList&)rHdlList).ResetFocusHdl();
     150                 :            :                 else
     151                 :          0 :                     pView->UnmarkAll();
     152                 :            : 
     153                 :          0 :                 bReturn = true;
     154                 :            :             }
     155                 :            :         }
     156                 :          0 :         break;
     157                 :            :         case KEY_TAB:
     158                 :            :         {
     159                 :          0 :             if ( !aCode.IsMod1() && !aCode.IsMod2() )
     160                 :            :             {
     161                 :            :                 // mark next object
     162                 :          0 :                 if ( !pView->MarkNextObj( !aCode.IsShift() ) )
     163                 :            :                 {
     164                 :            :                     // if no next object, mark first/last
     165                 :          0 :                     pView->UnmarkAllObj();
     166                 :          0 :                     pView->MarkNextObj( !aCode.IsShift() );
     167                 :            :                 }
     168                 :            : 
     169                 :          0 :                 if ( pView->AreObjectsMarked() )
     170                 :          0 :                     pView->MakeVisible( pView->GetAllMarkedRect(), *pWindow );
     171                 :            : 
     172                 :          0 :                 bReturn = true;
     173                 :            :             }
     174                 :          0 :             else if ( aCode.IsMod1() )
     175                 :            :             {
     176                 :            :                 // selected handle
     177                 :          0 :                 const SdrHdlList& rHdlList = pView->GetHdlList();
     178                 :          0 :                 ((SdrHdlList&)rHdlList).TravelFocusHdl( !aCode.IsShift() );
     179                 :            : 
     180                 :            :                 // guarantee visibility of focused handle
     181                 :          0 :                 SdrHdl* pHdl = rHdlList.GetFocusHdl();
     182                 :          0 :                 if ( pHdl )
     183                 :            :                 {
     184                 :          0 :                     Point aHdlPosition( pHdl->GetPos() );
     185                 :          0 :                     Rectangle aVisRect( aHdlPosition - Point( 100, 100 ), Size( 200, 200 ) );
     186                 :          0 :                     pView->MakeVisible( aVisRect, *pWindow );
     187                 :            :                 }
     188                 :            : 
     189                 :          0 :                 bReturn = true;
     190                 :            :             }
     191                 :            :         }
     192                 :          0 :         break;
     193                 :            :         case KEY_UP:
     194                 :            :         case KEY_DOWN:
     195                 :            :         case KEY_LEFT:
     196                 :            :         case KEY_RIGHT:
     197                 :            :         {
     198                 :          0 :             long nX = 0;
     199                 :          0 :             long nY = 0;
     200                 :            : 
     201                 :          0 :             if ( nCode == KEY_UP )
     202                 :            :             {
     203                 :            :                 // scroll up
     204                 :          0 :                 nX =  0;
     205                 :          0 :                 nY = -1;
     206                 :            :             }
     207                 :          0 :             else if ( nCode == KEY_DOWN )
     208                 :            :             {
     209                 :            :                 // scroll down
     210                 :          0 :                 nX =  0;
     211                 :          0 :                 nY =  1;
     212                 :            :             }
     213                 :          0 :             else if ( nCode == KEY_LEFT )
     214                 :            :             {
     215                 :            :                 // scroll left
     216                 :          0 :                 nX = -1;
     217                 :          0 :                 nY =  0;
     218                 :            :             }
     219                 :          0 :             else if ( nCode == KEY_RIGHT )
     220                 :            :             {
     221                 :            :                 // scroll right
     222                 :          0 :                 nX =  1;
     223                 :          0 :                 nY =  0;
     224                 :            :             }
     225                 :            : 
     226                 :          0 :             if ( pView->AreObjectsMarked() && !aCode.IsMod1() )
     227                 :            :             {
     228                 :          0 :                 if ( aCode.IsMod2() )
     229                 :            :                 {
     230                 :            :                     // move in 1 pixel distance
     231                 :          0 :                     Size aPixelSize = pWindow ? pWindow->PixelToLogic( Size( 1, 1 ) ) : Size( 100, 100 );
     232                 :          0 :                     nX *= aPixelSize.Width();
     233                 :          0 :                     nY *= aPixelSize.Height();
     234                 :            :                 }
     235                 :            :                 else
     236                 :            :                 {
     237                 :            :                     // move in 1 mm distance
     238                 :          0 :                     nX *= 100;
     239                 :          0 :                     nY *= 100;
     240                 :            :                 }
     241                 :            : 
     242                 :          0 :                 const SdrHdlList& rHdlList = pView->GetHdlList();
     243                 :          0 :                 SdrHdl* pHdl = rHdlList.GetFocusHdl();
     244                 :            : 
     245                 :          0 :                 if ( pHdl == 0 )
     246                 :            :                 {
     247                 :            :                     // no handle selected
     248                 :          0 :                     if ( pView->IsMoveAllowed() )
     249                 :            :                     {
     250                 :            :                         // restrict movement to work area
     251                 :          0 :                         const Rectangle& rWorkArea = pView->GetWorkArea();
     252                 :            : 
     253                 :          0 :                         if ( !rWorkArea.IsEmpty() )
     254                 :            :                         {
     255                 :          0 :                             Rectangle aMarkRect( pView->GetMarkedObjRect() );
     256                 :          0 :                             aMarkRect.Move( nX, nY );
     257                 :            : 
     258                 :          0 :                             if ( !rWorkArea.IsInside( aMarkRect ) )
     259                 :            :                             {
     260                 :          0 :                                 if ( aMarkRect.Left() < rWorkArea.Left() )
     261                 :          0 :                                     nX += rWorkArea.Left() - aMarkRect.Left();
     262                 :            : 
     263                 :          0 :                                 if ( aMarkRect.Right() > rWorkArea.Right() )
     264                 :          0 :                                     nX -= aMarkRect.Right() - rWorkArea.Right();
     265                 :            : 
     266                 :          0 :                                 if ( aMarkRect.Top() < rWorkArea.Top() )
     267                 :          0 :                                     nY += rWorkArea.Top() - aMarkRect.Top();
     268                 :            : 
     269                 :          0 :                                 if ( aMarkRect.Bottom() > rWorkArea.Bottom() )
     270                 :          0 :                                     nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
     271                 :            :                             }
     272                 :            :                         }
     273                 :            : 
     274                 :          0 :                         if ( nX != 0 || nY != 0 )
     275                 :            :                         {
     276                 :          0 :                             pView->MoveAllMarked( Size( nX, nY ) );
     277                 :          0 :                             pView->MakeVisible( pView->GetAllMarkedRect(), *pWindow );
     278                 :            :                         }
     279                 :            :                     }
     280                 :            :                 }
     281                 :            :                 else
     282                 :            :                 {
     283                 :            :                     // move the handle
     284                 :          0 :                     if ( pHdl && ( nX || nY ) )
     285                 :            :                     {
     286                 :          0 :                         Point aStartPoint( pHdl->GetPos() );
     287                 :          0 :                         Point aEndPoint( pHdl->GetPos() + Point( nX, nY ) );
     288                 :          0 :                         const SdrDragStat& rDragStat = pView->GetDragStat();
     289                 :            : 
     290                 :            :                         // start dragging
     291                 :          0 :                         pView->BegDragObj( aStartPoint, 0, pHdl, 0 );
     292                 :            : 
     293                 :          0 :                         if ( pView->IsDragObj() )
     294                 :            :                         {
     295                 :          0 :                             bool const bWasNoSnap = rDragStat.IsNoSnap();
     296                 :          0 :                             bool const bWasSnapEnabled = pView->IsSnapEnabled();
     297                 :            : 
     298                 :            :                             // switch snapping off
     299                 :          0 :                             if ( !bWasNoSnap )
     300                 :          0 :                                 ((SdrDragStat&)rDragStat).SetNoSnap(true);
     301                 :          0 :                             if ( bWasSnapEnabled )
     302                 :          0 :                                 pView->SetSnapEnabled(false);
     303                 :            : 
     304                 :          0 :                             pView->MovAction( aEndPoint );
     305                 :          0 :                             pView->EndDragObj();
     306                 :            : 
     307                 :            :                             // restore snap
     308                 :          0 :                             if ( !bWasNoSnap )
     309                 :          0 :                                 ((SdrDragStat&)rDragStat).SetNoSnap( bWasNoSnap );
     310                 :          0 :                             if ( bWasSnapEnabled )
     311                 :          0 :                                 pView->SetSnapEnabled( bWasSnapEnabled );
     312                 :            :                         }
     313                 :            : 
     314                 :            :                         // make moved handle visible
     315                 :          0 :                         Rectangle aVisRect( aEndPoint - Point( 100, 100 ), Size( 200, 200 ) );
     316                 :          0 :                         pView->MakeVisible( aVisRect, *pWindow );
     317                 :            :                     }
     318                 :            :                 }
     319                 :            :             }
     320                 :            :             else
     321                 :            :             {
     322                 :            :                 // scroll page
     323                 :          0 :                 ScrollBar* pScrollBar = ( nX != 0 ) ? pParent->GetHScroll() : pParent->GetVScroll();
     324                 :          0 :                 if ( pScrollBar )
     325                 :            :                 {
     326                 :          0 :                     long nRangeMin = pScrollBar->GetRangeMin();
     327                 :          0 :                     long nRangeMax = pScrollBar->GetRangeMax();
     328                 :          0 :                     long nThumbPos = pScrollBar->GetThumbPos() + ( ( nX != 0 ) ? nX : nY ) * pScrollBar->GetLineSize();
     329                 :          0 :                     if ( nThumbPos < nRangeMin )
     330                 :          0 :                         nThumbPos = nRangeMin;
     331                 :          0 :                     if ( nThumbPos > nRangeMax )
     332                 :          0 :                         nThumbPos = nRangeMax;
     333                 :          0 :                     pScrollBar->SetThumbPos( nThumbPos );
     334                 :          0 :                     pParent->DoScroll( pScrollBar );
     335                 :            :                 }
     336                 :            :             }
     337                 :            : 
     338                 :          0 :             bReturn = true;
     339                 :            :         }
     340                 :          0 :         break;
     341                 :            :         default:
     342                 :            :         {
     343                 :            :         }
     344                 :          0 :         break;
     345                 :            :     }
     346                 :            : 
     347                 :          0 :     if ( bReturn )
     348                 :          0 :         pWindow->ReleaseMouse();
     349                 :            : 
     350                 :          0 :     return bReturn;
     351                 :            : }
     352                 :            : 
     353                 :            : //----------------------------------------------------------------------------
     354                 :            : 
     355                 :          0 : DlgEdFuncInsert::DlgEdFuncInsert( DlgEditor* pParent_ ) :
     356                 :          0 :     DlgEdFunc( pParent_ )
     357                 :            : {
     358                 :          0 :     pParent_->GetView()->SetCreateMode(true);
     359                 :          0 : }
     360                 :            : 
     361                 :            : //----------------------------------------------------------------------------
     362                 :            : 
     363                 :          0 : DlgEdFuncInsert::~DlgEdFuncInsert()
     364                 :            : {
     365                 :          0 :     pParent->GetView()->SetEditMode( true );
     366                 :          0 : }
     367                 :            : 
     368                 :            : //----------------------------------------------------------------------------
     369                 :            : 
     370                 :          0 : bool DlgEdFuncInsert::MouseButtonDown( const MouseEvent& rMEvt )
     371                 :            : {
     372                 :          0 :     if( !rMEvt.IsLeft() )
     373                 :          0 :         return true;
     374                 :            : 
     375                 :          0 :     SdrView* pView  = pParent->GetView();
     376                 :          0 :     Window*  pWindow= pParent->GetWindow();
     377                 :          0 :     pView->SetActualWin( pWindow );
     378                 :            : 
     379                 :          0 :     Point aPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
     380                 :          0 :     sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() );
     381                 :          0 :     sal_uInt16 nDrgLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() );
     382                 :            : 
     383                 :          0 :     pWindow->CaptureMouse();
     384                 :            : 
     385                 :          0 :     if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 1 )
     386                 :            :     {
     387                 :          0 :         SdrHdl* pHdl = pView->PickHandle(aPos);
     388                 :            : 
     389                 :            :         // if selected object was hit, drag object
     390                 :          0 :         if ( pHdl!=NULL || pView->IsMarkedHit(aPos, nHitLog) )
     391                 :          0 :             pView->BegDragObj(aPos, (OutputDevice*) NULL, pHdl, nDrgLog);
     392                 :          0 :         else if ( pView->AreObjectsMarked() )
     393                 :          0 :             pView->UnmarkAll();
     394                 :            : 
     395                 :            :         // if no action, create object
     396                 :          0 :         if ( !pView->IsAction() )
     397                 :          0 :             pView->BegCreateObj(aPos);
     398                 :            :     }
     399                 :          0 :     else if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 2 )
     400                 :            :     {
     401                 :            :         // if object was hit, show property browser
     402                 :          0 :         if ( pView->IsMarkedHit(aPos, nHitLog) && pParent->GetMode() != DLGED_READONLY )
     403                 :          0 :             pParent->ShowProperties();
     404                 :            :     }
     405                 :            : 
     406                 :          0 :     return true;
     407                 :            : }
     408                 :            : 
     409                 :            : //----------------------------------------------------------------------------
     410                 :            : 
     411                 :          0 : bool DlgEdFuncInsert::MouseButtonUp( const MouseEvent& rMEvt )
     412                 :            : {
     413                 :          0 :     DlgEdFunc::MouseButtonUp( rMEvt );
     414                 :            : 
     415                 :          0 :     SdrView* pView  = pParent->GetView();
     416                 :          0 :     Window*  pWindow= pParent->GetWindow();
     417                 :          0 :     pView->SetActualWin( pWindow );
     418                 :            : 
     419                 :          0 :     pWindow->ReleaseMouse();
     420                 :            : 
     421                 :            :     // object creation active?
     422                 :          0 :     if ( pView->IsCreateObj() )
     423                 :            :     {
     424                 :          0 :         pView->EndCreateObj(SDRCREATE_FORCEEND);
     425                 :            : 
     426                 :          0 :         if ( !pView->AreObjectsMarked() )
     427                 :            :         {
     428                 :          0 :             sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() );
     429                 :          0 :             Point aPos( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
     430                 :          0 :             pView->MarkObj(aPos, nHitLog);
     431                 :            :         }
     432                 :            : 
     433                 :          0 :         return pView->AreObjectsMarked();
     434                 :            :     }
     435                 :            :     else
     436                 :            :     {
     437                 :          0 :         if ( pView->IsDragObj() )
     438                 :          0 :              pView->EndDragObj( rMEvt.IsMod1() );
     439                 :          0 :         return true;
     440                 :            :     }
     441                 :            : }
     442                 :            : 
     443                 :            : //----------------------------------------------------------------------------
     444                 :            : 
     445                 :          0 : bool DlgEdFuncInsert::MouseMove( const MouseEvent& rMEvt )
     446                 :            : {
     447                 :          0 :     SdrView* pView  = pParent->GetView();
     448                 :          0 :     Window*  pWindow= pParent->GetWindow();
     449                 :          0 :     pView->SetActualWin( pWindow );
     450                 :            : 
     451                 :          0 :     Point   aPos( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
     452                 :          0 :     sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() );
     453                 :            : 
     454                 :          0 :     if ( pView->IsAction() )
     455                 :            :     {
     456                 :          0 :         ForceScroll(aPos);
     457                 :          0 :         pView->MovAction(aPos);
     458                 :            :     }
     459                 :            : 
     460                 :          0 :     pWindow->SetPointer( pView->GetPreferedPointer( aPos, pWindow, nHitLog ) );
     461                 :            : 
     462                 :          0 :     return true;
     463                 :            : }
     464                 :            : 
     465                 :            : //----------------------------------------------------------------------------
     466                 :            : 
     467                 :          0 : DlgEdFuncSelect::DlgEdFuncSelect( DlgEditor* pParent_ ) :
     468                 :            :     DlgEdFunc( pParent_ ),
     469                 :          0 :     bMarkAction(false)
     470                 :            : {
     471                 :          0 : }
     472                 :            : 
     473                 :            : //----------------------------------------------------------------------------
     474                 :            : 
     475                 :          0 : DlgEdFuncSelect::~DlgEdFuncSelect()
     476                 :            : {
     477                 :          0 : }
     478                 :            : 
     479                 :            : //----------------------------------------------------------------------------
     480                 :            : 
     481                 :          0 : bool DlgEdFuncSelect::MouseButtonDown( const MouseEvent& rMEvt )
     482                 :            : {
     483                 :            :     // get view from parent
     484                 :          0 :     SdrView* pView   = pParent->GetView();
     485                 :          0 :     Window*  pWindow = pParent->GetWindow();
     486                 :          0 :     pView->SetActualWin( pWindow );
     487                 :            : 
     488                 :          0 :     sal_uInt16 nDrgLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() );
     489                 :          0 :     sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() );
     490                 :          0 :     Point  aMDPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
     491                 :            : 
     492                 :          0 :     if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 1 )
     493                 :            :     {
     494                 :          0 :         SdrHdl* pHdl = pView->PickHandle(aMDPos);
     495                 :            :         SdrObject* pObj;
     496                 :            :         SdrPageView* pPV;
     497                 :            : 
     498                 :            :         // hit selected object?
     499                 :          0 :         if ( pHdl!=NULL || pView->IsMarkedHit(aMDPos, nHitLog) )
     500                 :            :         {
     501                 :          0 :             pView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
     502                 :            :         }
     503                 :            :         else
     504                 :            :         {
     505                 :            :             // if not multi selection, unmark all
     506                 :          0 :             if ( !rMEvt.IsShift() )
     507                 :          0 :                 pView->UnmarkAll();
     508                 :            :             else
     509                 :            :             {
     510                 :          0 :                 if( pView->PickObj( aMDPos, nHitLog, pObj, pPV ) )
     511                 :            :                 {
     512                 :            :                     //if (dynamic_cast<DlgEdForm*>(pObj))
     513                 :            :                     //  pView->UnmarkAll();
     514                 :            :                     //else
     515                 :            :                     //  pParent->UnmarkDialog();
     516                 :            :                 }
     517                 :            :             }
     518                 :            : 
     519                 :          0 :             if ( pView->MarkObj(aMDPos, nHitLog) )
     520                 :            :             {
     521                 :            :                 // drag object
     522                 :          0 :                 pHdl=pView->PickHandle(aMDPos);
     523                 :          0 :                 pView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl, nDrgLog);
     524                 :            :             }
     525                 :            :             else
     526                 :            :             {
     527                 :            :                 // select object
     528                 :          0 :                 pView->BegMarkObj(aMDPos);
     529                 :          0 :                 bMarkAction = true;
     530                 :            :             }
     531                 :            :         }
     532                 :            :     }
     533                 :          0 :     else if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 2 )
     534                 :            :     {
     535                 :            :         // if object was hit, show property browser
     536                 :          0 :         if ( pView->IsMarkedHit(aMDPos, nHitLog) && pParent->GetMode() != DLGED_READONLY )
     537                 :          0 :             pParent->ShowProperties();
     538                 :            :     }
     539                 :            : 
     540                 :          0 :     return true;
     541                 :            : }
     542                 :            : 
     543                 :            : //----------------------------------------------------------------------------
     544                 :            : 
     545                 :          0 : bool DlgEdFuncSelect::MouseButtonUp( const MouseEvent& rMEvt )
     546                 :            : {
     547                 :          0 :     DlgEdFunc::MouseButtonUp( rMEvt );
     548                 :            : 
     549                 :            :     // get view from parent
     550                 :          0 :     SdrView* pView  = pParent->GetView();
     551                 :          0 :     Window*  pWindow= pParent->GetWindow();
     552                 :          0 :     pView->SetActualWin( pWindow );
     553                 :            : 
     554                 :          0 :     Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
     555                 :          0 :     sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() );
     556                 :            : 
     557                 :          0 :     if ( rMEvt.IsLeft() )
     558                 :            :     {
     559                 :          0 :         if ( pView->IsDragObj() )
     560                 :            :         {
     561                 :            :             // object was dragged
     562                 :          0 :             pView->EndDragObj( rMEvt.IsMod1() );
     563                 :          0 :             pView->ForceMarkedToAnotherPage();
     564                 :            :         }
     565                 :            :         else
     566                 :          0 :         if (pView->IsAction() )
     567                 :            :         {
     568                 :          0 :             pView->EndAction();
     569                 :            :         }
     570                 :            :     }
     571                 :            : 
     572                 :          0 :     bMarkAction = false;
     573                 :            : 
     574                 :          0 :     pWindow->SetPointer( pView->GetPreferedPointer( aPnt, pWindow, nHitLog ) );
     575                 :          0 :     pWindow->ReleaseMouse();
     576                 :            : 
     577                 :          0 :     return true;
     578                 :            : }
     579                 :            : 
     580                 :            : //----------------------------------------------------------------------------
     581                 :            : 
     582                 :          0 : bool DlgEdFuncSelect::MouseMove( const MouseEvent& rMEvt )
     583                 :            : {
     584                 :          0 :     SdrView* pView  = pParent->GetView();
     585                 :          0 :     Window*  pWindow= pParent->GetWindow();
     586                 :          0 :     pView->SetActualWin( pWindow );
     587                 :            : 
     588                 :          0 :     Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
     589                 :          0 :     sal_uInt16 nHitLog = sal_uInt16 ( pWindow->PixelToLogic(Size(3,0)).Width() );
     590                 :            : 
     591                 :          0 :     if ( pView->IsAction() )
     592                 :            :     {
     593                 :          0 :         Point aPix(rMEvt.GetPosPixel());
     594                 :          0 :         Point aPnt_(pWindow->PixelToLogic(aPix));
     595                 :            : 
     596                 :          0 :         ForceScroll(aPnt_);
     597                 :          0 :         pView->MovAction(aPnt_);
     598                 :            :     }
     599                 :            : 
     600                 :          0 :     pWindow->SetPointer( pView->GetPreferedPointer( aPnt, pWindow, nHitLog ) );
     601                 :            : 
     602                 :          0 :     return true;
     603                 :            : }
     604                 :            : 
     605                 :            : //----------------------------------------------------------------------------
     606                 :            : 
     607                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10