LCOV - code coverage report
Current view: top level - sd/source/ui/func - fupoor.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 41 441 9.3 %
Date: 2012-08-25 Functions: 8 36 22.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 22 666 3.3 %

           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 "fupoor.hxx"
      30                 :            : 
      31                 :            : #include <svx/svxids.hrc>
      32                 :            : #include <svl/aeitem.hxx>
      33                 :            : #include <svx/svdpagv.hxx>
      34                 :            : #include <svx/svdoole2.hxx>
      35                 :            : #include <svx/svdograf.hxx>
      36                 :            : #include <vcl/seleng.hxx>
      37                 :            : #include <sfx2/app.hxx>
      38                 :            : #include <sfx2/dispatch.hxx>
      39                 :            : #include <sfx2/bindings.hxx>
      40                 :            : #include <sfx2/request.hxx>
      41                 :            : #include <vcl/dialog.hxx>
      42                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      43                 :            : #include <com/sun/star/drawing/XLayer.hpp>
      44                 :            : #include <com/sun/star/drawing/XLayerManager.hpp>
      45                 :            : #include <com/sun/star/container/XChild.hpp>
      46                 :            : 
      47                 :            : #include "FrameView.hxx"
      48                 :            : #include "app.hrc"
      49                 :            : #include "fusel.hxx"
      50                 :            : #include "sdpage.hxx"
      51                 :            : #include "drawview.hxx"
      52                 :            : #include "DrawViewShell.hxx"
      53                 :            : #include "Window.hxx"
      54                 :            : #include "drawdoc.hxx"
      55                 :            : #include "DrawDocShell.hxx"
      56                 :            : #include "zoomlist.hxx"
      57                 :            : #include "Client.hxx"
      58                 :            : #include "slideshow.hxx"
      59                 :            : #include "LayerTabBar.hxx"
      60                 :            : 
      61                 :            : #include <sfx2/viewfrm.hxx>
      62                 :            : 
      63                 :            : #include <svx/svditer.hxx>
      64                 :            : 
      65                 :            : #include <editeng/editeng.hxx>
      66                 :            : 
      67                 :            : using namespace ::com::sun::star;
      68                 :            : using ::com::sun::star::uno::Reference;
      69                 :            : 
      70                 :            : namespace sd {
      71                 :            : 
      72         [ #  # ]:          0 : TYPEINIT0( FuPoor );
      73                 :            : 
      74                 :            : /*************************************************************************
      75                 :            : |*
      76                 :            : |* Konstruktor
      77                 :            : |*
      78                 :            : \************************************************************************/
      79                 :            : 
      80                 :        260 : FuPoor::FuPoor (
      81                 :            :     ViewShell* pViewSh,
      82                 :            :     ::sd::Window* pWin,
      83                 :            :     ::sd::View* pView,
      84                 :            :     SdDrawDocument* pDrDoc,
      85                 :            :     SfxRequest& rReq)
      86                 :            :     : mpView(pView),
      87                 :            :       mpViewShell(pViewSh),
      88                 :            :       mpWindow(pWin),
      89                 :        260 :       mpDocSh( pDrDoc->GetDocSh() ),
      90                 :            :       mpDoc(pDrDoc),
      91                 :        260 :       nSlotId( rReq.GetSlot() ),
      92                 :            :       nSlotValue(0),
      93                 :            :       pDialog(NULL),
      94                 :            :       bIsInDragMode(sal_False),
      95                 :            :       bNoScrollUntilInside (sal_True),
      96                 :            :       bScrollable (sal_False),
      97                 :            :       bDelayActive (sal_False),
      98                 :            :       bFirstMouseMove (sal_False),
      99                 :            :       // remember MouseButton state
     100 [ +  - ][ +  - ]:        520 :       mnCode(0)
                 [ +  - ]
     101                 :            : {
     102         [ +  - ]:        260 :     ReceiveRequest(rReq);
     103                 :            : 
     104         [ +  - ]:        260 :     aScrollTimer.SetTimeoutHdl( LINK(this, FuPoor, ScrollHdl) );
     105         [ +  - ]:        260 :     aScrollTimer.SetTimeout(SELENG_AUTOREPEAT_INTERVAL);
     106                 :            : 
     107         [ +  - ]:        260 :     aDragTimer.SetTimeoutHdl( LINK(this, FuPoor, DragHdl) );
     108         [ +  - ]:        260 :     aDragTimer.SetTimeout(SELENG_DRAGDROP_TIMEOUT);
     109                 :            : 
     110         [ +  - ]:        260 :     aDelayToScrollTimer.SetTimeoutHdl( LINK(this, FuPoor, DelayHdl) );
     111         [ +  - ]:        260 :     aDelayToScrollTimer.SetTimeout(2000);
     112                 :        260 : }
     113                 :            : 
     114                 :            : /*************************************************************************
     115                 :            : |*
     116                 :            : |* Destruktor
     117                 :            : |*
     118                 :            : \************************************************************************/
     119                 :            : 
     120 [ +  - ][ +  - ]:        260 : FuPoor::~FuPoor()
                 [ +  - ]
     121                 :            : {
     122         [ +  - ]:        260 :     aDragTimer.Stop();
     123         [ +  - ]:        260 :     aScrollTimer.Stop();
     124         [ +  - ]:        260 :     aDelayToScrollTimer.Stop ();
     125                 :            : 
     126         [ -  + ]:        260 :     if (pDialog)
     127 [ #  # ][ #  # ]:          0 :         delete pDialog;
     128         [ -  + ]:        260 : }
     129                 :            : 
     130                 :            : /*************************************************************************
     131                 :            : |*
     132                 :            : |* Function aktivieren
     133                 :            : |*
     134                 :            : \************************************************************************/
     135                 :            : 
     136                 :        550 : void FuPoor::Activate()
     137                 :            : {
     138         [ -  + ]:        550 :     if (pDialog)
     139                 :            :     {
     140                 :          0 :         pDialog->Show();
     141                 :            :     }
     142                 :        550 : }
     143                 :            : 
     144                 :            : /*************************************************************************
     145                 :            : |*
     146                 :            : |* Function deaktivieren
     147                 :            : |*
     148                 :            : \************************************************************************/
     149                 :            : 
     150                 :        940 : void FuPoor::Deactivate()
     151                 :            : {
     152                 :        940 :     aDragTimer.Stop();
     153                 :        940 :     aScrollTimer.Stop();
     154                 :        940 :     aDelayToScrollTimer.Stop ();
     155                 :            :         bScrollable  =
     156                 :        940 :         bDelayActive = sal_False;
     157                 :            : 
     158         [ -  + ]:        940 :     if (pDialog)
     159                 :            :     {
     160                 :          0 :         pDialog->Hide();
     161                 :            :     }
     162                 :            : 
     163         [ +  - ]:        940 :     if (mpWindow) mpWindow->ReleaseMouse ();
     164                 :        940 : }
     165                 :            : 
     166                 :            : /*************************************************************************
     167                 :            : |*
     168                 :            : |* Scrollen bei Erreichen des Fensterrandes; wird von
     169                 :            : |* MouseMove aufgerufen
     170                 :            : |*
     171                 :            : \************************************************************************/
     172                 :            : 
     173                 :          0 : void FuPoor::ForceScroll(const Point& aPixPos)
     174                 :            : {
     175                 :          0 :     aScrollTimer.Stop();
     176                 :            : 
     177   [ #  #  #  # ]:          0 :     if ( !mpView->IsDragHelpLine() && !mpView->IsSetPageOrg() &&
         [ #  # ][ #  # ]
     178                 :          0 :             !SlideShow::IsRunning( mpViewShell->GetViewShellBase() ) )
     179                 :            :     {
     180         [ #  # ]:          0 :         Point aPos = mpWindow->OutputToScreenPixel(aPixPos);
     181         [ #  # ]:          0 :         const Rectangle& rRect = mpViewShell->GetAllWindowRect();
     182                 :            : 
     183         [ #  # ]:          0 :         if ( bNoScrollUntilInside )
     184                 :            :         {
     185 [ #  # ][ #  # ]:          0 :             if ( rRect.IsInside(aPos) )
     186                 :          0 :                 bNoScrollUntilInside = sal_False;
     187                 :            :         }
     188                 :            :         else
     189                 :            :         {
     190                 :          0 :             short dx = 0, dy = 0;
     191                 :            : 
     192         [ #  # ]:          0 :             if ( aPos.X() <= rRect.Left()   ) dx = -1;
     193         [ #  # ]:          0 :             if ( aPos.X() >= rRect.Right()  ) dx =  1;
     194         [ #  # ]:          0 :             if ( aPos.Y() <= rRect.Top()    ) dy = -1;
     195         [ #  # ]:          0 :             if ( aPos.Y() >= rRect.Bottom() ) dy =  1;
     196                 :            : 
     197 [ #  # ][ #  # ]:          0 :             if ( dx != 0 || dy != 0 )
     198                 :            :             {
     199         [ #  # ]:          0 :                 if (bScrollable)
     200                 :            :                 {
     201                 :            :                     // Scrollaktion in abgeleiteter Klasse
     202         [ #  # ]:          0 :                     mpViewShell->ScrollLines(dx, dy);
     203         [ #  # ]:          0 :                     aScrollTimer.Start();
     204                 :            :                 }
     205 [ #  # ][ #  # ]:          0 :                 else if (! bDelayActive) StartDelayToScrollTimer ();
     206                 :            :             }
     207                 :            :         }
     208                 :            :     }
     209                 :          0 : }
     210                 :            : 
     211                 :            : /*************************************************************************
     212                 :            : |*
     213                 :            : |* Timer-Handler fuer Fensterscrolling
     214                 :            : |*
     215                 :            : \************************************************************************/
     216                 :            : 
     217                 :          0 : IMPL_LINK_NOARG_INLINE_START(FuPoor, ScrollHdl)
     218                 :            : {
     219         [ #  # ]:          0 :     Point aPnt(mpWindow->GetPointerPosPixel());
     220                 :            : 
     221                 :            :     // use remembered MouseButton state to create correct
     222                 :            :     // MouseEvents for this artifical MouseMove.
     223 [ #  # ][ #  # ]:          0 :     MouseMove(MouseEvent(aPnt, 1, 0, GetMouseButtonCode()));
     224                 :            : 
     225                 :          0 :     return 0;
     226                 :            : }
     227                 :          0 : IMPL_LINK_INLINE_END( FuPoor, ScrollHdl, Timer *, pTimer )
     228                 :            : 
     229                 :            : /*************************************************************************
     230                 :            : |*
     231                 :            : |* Tastaturereignisse bearbeiten
     232                 :            : |*
     233                 :            : |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
     234                 :            : |* sal_False.
     235                 :            : |*
     236                 :            : \************************************************************************/
     237                 :            : 
     238                 :          0 : sal_Bool FuPoor::KeyInput(const KeyEvent& rKEvt)
     239                 :            : {
     240                 :          0 :     sal_uInt16          nCode = rKEvt.GetKeyCode().GetCode();
     241                 :          0 :     sal_Bool            bReturn = sal_False;
     242                 :          0 :     sal_Bool            bSlideShow = SlideShow::IsRunning( mpViewShell->GetViewShellBase() );
     243                 :            : 
     244   [ #  #  #  #  :          0 :     switch (nCode)
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     245                 :            :     {
     246                 :            :         case KEY_RETURN:
     247                 :            :         {
     248         [ #  # ]:          0 :             if(rKEvt.GetKeyCode().IsMod1())
     249                 :            :             {
     250 [ #  # ][ #  # ]:          0 :                 if(mpViewShell && mpViewShell->ISA(DrawViewShell))
                 [ #  # ]
     251                 :            :                 {
     252                 :            :                     DrawViewShell* pDrawViewShell =
     253                 :          0 :                         static_cast<DrawViewShell*>(mpViewShell);
     254                 :          0 :                     SdPage* pActualPage = pDrawViewShell->GetActualPage();
     255                 :          0 :                     SdrTextObj* pCandidate = 0L;
     256                 :            : 
     257         [ #  # ]:          0 :                     if(pActualPage)
     258                 :            :                     {
     259         [ #  # ]:          0 :                         SdrObjListIter aIter(*pActualPage, IM_DEEPNOGROUPS);
     260                 :            : 
     261 [ #  # ][ #  # ]:          0 :                         while(aIter.IsMore() && !pCandidate)
                 [ #  # ]
     262                 :            :                         {
     263         [ #  # ]:          0 :                             SdrObject* pObj = aIter.Next();
     264                 :            : 
     265 [ #  # ][ #  # ]:          0 :                             if(pObj && pObj->ISA(SdrTextObj))
         [ #  # ][ #  # ]
                 [ #  # ]
     266                 :            :                             {
     267         [ #  # ]:          0 :                                 sal_uInt32 nInv(pObj->GetObjInventor());
     268         [ #  # ]:          0 :                                 sal_uInt16 nKnd(pObj->GetObjIdentifier());
     269                 :            : 
     270 [ #  # ][ #  # ]:          0 :                                 if(SdrInventor == nInv &&
         [ #  # ][ #  # ]
     271                 :            :                                     (OBJ_TITLETEXT == nKnd || OBJ_OUTLINETEXT == nKnd || OBJ_TEXT == nKnd))
     272                 :            :                                 {
     273                 :          0 :                                     pCandidate = (SdrTextObj*)pObj;
     274                 :            :                                 }
     275                 :            :                             }
     276                 :          0 :                         }
     277                 :            :                     }
     278                 :            : 
     279         [ #  # ]:          0 :                     if(pCandidate)
     280                 :            :                     {
     281                 :          0 :                         mpView->UnMarkAll();
     282                 :          0 :                         mpView->MarkObj(pCandidate, mpView->GetSdrPageView());
     283                 :            : 
     284                 :            :                         mpViewShell->GetViewFrame()->GetDispatcher()->Execute(
     285                 :          0 :                             SID_ATTR_CHAR, SFX_CALLMODE_ASYNCHRON);
     286                 :            :                     }
     287                 :            :                     else
     288                 :            :                     {
     289                 :            :                         // insert a new page with the same page layout
     290                 :            :                         mpViewShell->GetViewFrame()->GetDispatcher()->Execute(
     291                 :          0 :                             SID_INSERTPAGE_QUICK, SFX_CALLMODE_ASYNCHRON);
     292                 :            :                     }
     293                 :            : 
     294                 :            :                     // consumed
     295                 :          0 :                     bReturn = sal_True;
     296                 :            :                 }
     297                 :            :             }
     298                 :            :             else
     299                 :            :             {
     300                 :            :                 // activate OLE object on RETURN for selected object
     301                 :            :                 // activate text edit on RETURN for selected object
     302                 :          0 :                 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
     303                 :            : 
     304 [ #  # ][ #  # ]:          0 :                 if( !mpView->IsTextEdit() && 1 == rMarkList.GetMarkCount() )
                 [ #  # ]
     305                 :            :                 {
     306                 :          0 :                     SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
     307                 :            : 
     308 [ #  # ][ #  # ]:          0 :                     if( pObj && pObj->ISA( SdrOle2Obj ) && !mpDocSh->IsUIActive() )
         [ #  # ][ #  # ]
     309                 :            :                     {
     310                 :            :                         //HMHmpView->HideMarkHdl();
     311                 :          0 :                         mpViewShell->ActivateObject( static_cast< SdrOle2Obj* >( pObj ), 0 );
     312                 :            :                     }
     313 [ #  # ][ #  # ]:          0 :                     else if( pObj && pObj->IsEmptyPresObj() && pObj->ISA( SdrGrafObj ) )
         [ #  # ][ #  # ]
     314                 :            :                     {
     315                 :          0 :                         mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_GRAPHIC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
     316                 :            :                     }
     317                 :            :                     else
     318                 :            :                     {
     319                 :          0 :                         mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_ATTR_CHAR, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
     320                 :            :                     }
     321                 :            : 
     322                 :            :                     // consumed
     323                 :          0 :                     bReturn = sal_True;
     324                 :            :                 }
     325                 :            :             }
     326                 :            :         }
     327                 :          0 :         break;
     328                 :            : 
     329                 :            :         case KEY_TAB:
     330                 :            :         {
     331                 :            :             // handle Mod1 and Mod2 to get travelling running on different systems
     332 [ #  # ][ #  # ]:          0 :             if(rKEvt.GetKeyCode().IsMod1() || rKEvt.GetKeyCode().IsMod2())
                 [ #  # ]
     333                 :            :             {
     334                 :            :                 // do something with a selected handle?
     335                 :          0 :                 const SdrHdlList& rHdlList = mpView->GetHdlList();
     336                 :          0 :                 sal_Bool bForward(!rKEvt.GetKeyCode().IsShift());
     337                 :            : 
     338                 :          0 :                 ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward);
     339                 :            : 
     340                 :            :                 // guarantee visibility of focused handle
     341                 :          0 :                 SdrHdl* pHdl = rHdlList.GetFocusHdl();
     342                 :            : 
     343         [ #  # ]:          0 :                 if(pHdl)
     344                 :            :                 {
     345                 :          0 :                     Point aHdlPosition(pHdl->GetPos());
     346         [ #  # ]:          0 :                     Rectangle aVisRect(aHdlPosition - Point(100, 100), Size(200, 200));
     347         [ #  # ]:          0 :                     mpView->MakeVisible(aVisRect, *mpWindow);
     348                 :            :                 }
     349                 :            : 
     350                 :            :                 // consumed
     351                 :          0 :                 bReturn = sal_True;
     352                 :            :             }
     353                 :            :         }
     354                 :          0 :         break;
     355                 :            : 
     356                 :            :         case KEY_ESCAPE:
     357                 :            :         {
     358                 :          0 :             bReturn = FuPoor::cancel();
     359                 :            :         }
     360                 :          0 :         break;
     361                 :            : 
     362                 :            :         case KEY_ADD:
     363                 :            :         {
     364 [ #  # ][ #  # ]:          0 :             if (!mpView->IsTextEdit() && !bSlideShow && !mpDocSh->IsUIActive())
         [ #  # ][ #  # ]
     365                 :            :             {
     366                 :            :                 // Zoom vergroessern
     367                 :          0 :                 mpViewShell->SetZoom(mpWindow->GetZoom() * 3 / 2);
     368                 :            : 
     369         [ #  # ]:          0 :                 if (mpViewShell->ISA(DrawViewShell))
     370                 :            :                     static_cast<DrawViewShell*>(mpViewShell)
     371                 :          0 :                         ->SetZoomOnPage(sal_False);
     372                 :            : 
     373                 :          0 :                 bReturn = sal_True;
     374                 :            :             }
     375                 :            :         }
     376                 :          0 :         break;
     377                 :            : 
     378                 :            :         case KEY_SUBTRACT:
     379                 :            :         {
     380 [ #  # ][ #  # ]:          0 :             if (!mpView->IsTextEdit() && !bSlideShow && !mpDocSh->IsUIActive())
         [ #  # ][ #  # ]
     381                 :            :             {
     382                 :            :                 // Zoom verringern
     383                 :          0 :                 mpViewShell->SetZoom(mpWindow->GetZoom() * 2 / 3);
     384                 :            : 
     385         [ #  # ]:          0 :                 if (mpViewShell->ISA(DrawViewShell))
     386                 :            :                     static_cast<DrawViewShell*>(mpViewShell)
     387                 :          0 :                         ->SetZoomOnPage(sal_False);
     388                 :            : 
     389                 :          0 :                 bReturn = sal_True;
     390                 :            :             }
     391                 :            :         }
     392                 :          0 :         break;
     393                 :            : 
     394                 :            :         case KEY_MULTIPLY:
     395                 :            :         {
     396 [ #  # ][ #  # ]:          0 :             if (!mpView->IsTextEdit() && !bSlideShow)
                 [ #  # ]
     397                 :            :             {
     398                 :            :                 // Zoom auf Seite
     399                 :            :                 mpViewShell->GetViewFrame()->GetDispatcher()->
     400                 :          0 :                 Execute(SID_SIZE_PAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
     401                 :          0 :                 bReturn = sal_True;
     402                 :            :             }
     403                 :            :         }
     404                 :          0 :         break;
     405                 :            : 
     406                 :            :         case KEY_DIVIDE:
     407                 :            :         {
     408 [ #  # ][ #  # ]:          0 :             if (!mpView->IsTextEdit() && !bSlideShow)
                 [ #  # ]
     409                 :            :             {
     410                 :            :                 // Zoom auf selektierte Objekte
     411                 :            :                 mpViewShell->GetViewFrame()->GetDispatcher()->
     412                 :          0 :                 Execute(SID_SIZE_OPTIMAL, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
     413                 :          0 :                 bReturn = sal_True;
     414                 :            :             }
     415                 :            :         }
     416                 :          0 :         break;
     417                 :            : 
     418                 :            :         case KEY_POINT:
     419                 :            :         {
     420                 :          0 :             ZoomList* pZoomList = mpViewShell->GetZoomList();
     421                 :            : 
     422 [ #  # ][ #  # ]:          0 :             if (!mpView->IsTextEdit() && pZoomList->IsNextPossible() && !bSlideShow && !mpDocSh->IsUIActive())
         [ #  # ][ #  # ]
                 [ #  # ]
     423                 :            :             {
     424                 :            :                 // Naechstes ZoomRect einstellen
     425         [ #  # ]:          0 :                 mpViewShell->SetZoomRect(pZoomList->GetNextZoomRect());
     426                 :          0 :                 bReturn = sal_True;
     427                 :            :             }
     428                 :            :         }
     429                 :          0 :         break;
     430                 :            : 
     431                 :            :         case KEY_COMMA:
     432                 :            :         {
     433                 :          0 :             ZoomList* pZoomList = mpViewShell->GetZoomList();
     434                 :            : 
     435 [ #  # ][ #  # ]:          0 :             if (!mpView->IsTextEdit() && pZoomList->IsPreviousPossible() && !bSlideShow && !mpDocSh->IsUIActive())
         [ #  # ][ #  # ]
                 [ #  # ]
     436                 :            :             {
     437                 :            :                 // Vorheriges ZoomRect einstellen
     438         [ #  # ]:          0 :                 mpViewShell->SetZoomRect(pZoomList->GetPreviousZoomRect());
     439                 :          0 :                 bReturn = sal_True;
     440                 :            :             }
     441                 :            :         }
     442                 :          0 :         break;
     443                 :            : 
     444                 :            :         case KEY_HOME:
     445                 :            :         {
     446   [ #  #  #  # ]:          0 :             if (!mpView->IsTextEdit()
         [ #  # ][ #  # ]
     447                 :          0 :                 && mpViewShell->ISA(DrawViewShell)
     448                 :            :                 && !bSlideShow)
     449                 :            :             {
     450                 :            :                // Sprung zu erster Seite
     451                 :          0 :                static_cast<DrawViewShell*>(mpViewShell)->SwitchPage(0);
     452                 :          0 :                bReturn = sal_True;
     453                 :            :             }
     454                 :            :         }
     455                 :          0 :         break;
     456                 :            : 
     457                 :            :         case KEY_END:
     458                 :            :         {
     459   [ #  #  #  # ]:          0 :             if (!mpView->IsTextEdit()
         [ #  # ][ #  # ]
     460                 :          0 :                 && mpViewShell->ISA(DrawViewShell)
     461                 :            :                 && !bSlideShow)
     462                 :            :             {
     463                 :            :                 // Sprung zu letzter Seite
     464                 :            :                 SdPage* pPage =
     465                 :          0 :                     static_cast<DrawViewShell*>(mpViewShell)->GetActualPage();
     466                 :            :                 static_cast<DrawViewShell*>(mpViewShell)
     467                 :            :                     ->SwitchPage(mpDoc->GetSdPageCount(
     468                 :          0 :                         pPage->GetPageKind()) - 1);
     469                 :          0 :                 bReturn = sal_True;
     470                 :            :             }
     471                 :            :         }
     472                 :          0 :         break;
     473                 :            : 
     474                 :            :         case KEY_PAGEUP:
     475                 :            :         {
     476 [ #  # ][ #  # ]:          0 :             if( rKEvt.GetKeyCode().IsMod1() && rKEvt.GetKeyCode().IsMod2() )
                 [ #  # ]
     477                 :          0 :                 break;
     478                 :            : 
     479 [ #  # ][ #  # ]:          0 :             if(mpViewShell->ISA(DrawViewShell) && !bSlideShow)
                 [ #  # ]
     480                 :            :             {
     481                 :            :                 // The page-up key switches layers or pages depending on the
     482                 :            :                 // modifier key.
     483         [ #  # ]:          0 :                 if ( ! rKEvt.GetKeyCode().GetAllModifier())
     484                 :            :                 {
     485                 :            :                     // With no modifier pressed we move to the previous
     486                 :            :                     // slide.
     487                 :          0 :                     mpView->SdrEndTextEdit();
     488                 :            : 
     489                 :            :                     // Previous page.
     490                 :          0 :                     bReturn = sal_True;
     491                 :          0 :                     SdPage* pPage = static_cast<DrawViewShell*>(mpViewShell)->GetActualPage();
     492                 :          0 :                     sal_uInt16 nSdPage = (pPage->GetPageNum() - 1) / 2;
     493                 :            : 
     494         [ #  # ]:          0 :                     if (nSdPage > 0)
     495                 :            :                     {
     496                 :            :                         // Switch the page and send events regarding
     497                 :            :                         // deactivation the old page and activating the new
     498                 :            :                         // one.
     499                 :            :                         TabControl* pPageTabControl =
     500                 :            :                             static_cast<DrawViewShell*>(mpViewShell)
     501                 :          0 :                             ->GetPageTabControl();
     502         [ #  # ]:          0 :                         if (pPageTabControl->IsReallyShown())
     503                 :          0 :                             pPageTabControl->SendDeactivatePageEvent ();
     504                 :          0 :                         static_cast<DrawViewShell*>(mpViewShell)->SwitchPage(nSdPage - 1);
     505         [ #  # ]:          0 :                         if (pPageTabControl->IsReallyShown())
     506                 :          0 :                             pPageTabControl->SendActivatePageEvent ();
     507                 :            :                     }
     508                 :            :                 }
     509         [ #  # ]:          0 :                 else if (rKEvt.GetKeyCode().IsMod1())
     510                 :            :                 {
     511                 :            :                     // With the CONTROL modifier we switch layers.
     512         [ #  # ]:          0 :                     if (static_cast<DrawViewShell*>(mpViewShell)->IsLayerModeActive())
     513                 :            :                     {
     514                 :            :                         // Moves to the previous layer.
     515                 :          0 :                         SwitchLayer (-1);
     516                 :            :                     }
     517                 :            :                 }
     518                 :            :             }
     519                 :            :         }
     520                 :          0 :         break;
     521                 :            : 
     522                 :            :         case KEY_PAGEDOWN:
     523                 :            :         {
     524 [ #  # ][ #  # ]:          0 :             if( rKEvt.GetKeyCode().IsMod1() && rKEvt.GetKeyCode().IsMod2() )
                 [ #  # ]
     525                 :          0 :                 break;
     526 [ #  # ][ #  # ]:          0 :             if(mpViewShell->ISA(DrawViewShell) && !bSlideShow)
                 [ #  # ]
     527                 :            :             {
     528                 :            :                 // The page-down key switches layers or pages depending on the
     529                 :            :                 // modifier key.
     530         [ #  # ]:          0 :                 if ( ! rKEvt.GetKeyCode().GetAllModifier())
     531                 :            :                 {
     532                 :            :                     // With no modifier pressed we move to the next slide.
     533                 :          0 :                     mpView->SdrEndTextEdit();
     534                 :            : 
     535                 :            :                     // Next page.
     536                 :          0 :                     bReturn = sal_True;
     537                 :          0 :                     SdPage* pPage = static_cast<DrawViewShell*>(mpViewShell)->GetActualPage();
     538                 :          0 :                     sal_uInt16 nSdPage = (pPage->GetPageNum() - 1) / 2;
     539                 :            : 
     540         [ #  # ]:          0 :                     if (nSdPage < mpDoc->GetSdPageCount(pPage->GetPageKind()) - 1)
     541                 :            :                     {
     542                 :            :                         // Switch the page and send events regarding
     543                 :            :                         // deactivation the old page and activating the new
     544                 :            :                         // one.
     545                 :            :                         TabControl* pPageTabControl =
     546                 :          0 :                             static_cast<DrawViewShell*>(mpViewShell)->GetPageTabControl();
     547         [ #  # ]:          0 :                         if (pPageTabControl->IsReallyShown())
     548                 :          0 :                             pPageTabControl->SendDeactivatePageEvent ();
     549                 :          0 :                         static_cast<DrawViewShell*>(mpViewShell)->SwitchPage(nSdPage + 1);
     550         [ #  # ]:          0 :                         if (pPageTabControl->IsReallyShown())
     551                 :          0 :                             pPageTabControl->SendActivatePageEvent ();
     552                 :            :                     }
     553                 :            :                 }
     554         [ #  # ]:          0 :                 else if (rKEvt.GetKeyCode().IsMod1())
     555                 :            :                 {
     556                 :            :                     // With the CONTROL modifier we switch layers.
     557         [ #  # ]:          0 :                     if (static_cast<DrawViewShell*>(mpViewShell)->IsLayerModeActive())
     558                 :            :                     {
     559                 :            :                         // With the layer mode active pressing page-down
     560                 :            :                         // moves to the next layer.
     561                 :          0 :                         SwitchLayer (+1);
     562                 :            :                     }
     563                 :            :                 }
     564                 :            :             }
     565                 :            :         }
     566                 :          0 :         break;
     567                 :            : 
     568                 :            :         // change select state when focus is on poly point
     569                 :            :         case KEY_SPACE:
     570                 :            :         {
     571                 :          0 :             const SdrHdlList& rHdlList = mpView->GetHdlList();
     572                 :          0 :             SdrHdl* pHdl = rHdlList.GetFocusHdl();
     573                 :            : 
     574         [ #  # ]:          0 :             if(pHdl)
     575                 :            :             {
     576         [ #  # ]:          0 :                 if(pHdl->GetKind() == HDL_POLY)
     577                 :            :                 {
     578                 :            :                     // rescue ID of point with focus
     579                 :          0 :                     sal_uInt32 nPol(pHdl->GetPolyNum());
     580                 :          0 :                     sal_uInt32 nPnt(pHdl->GetPointNum());
     581                 :            : 
     582         [ #  # ]:          0 :                     if(mpView->IsPointMarked(*pHdl))
     583                 :            :                     {
     584         [ #  # ]:          0 :                         if(rKEvt.GetKeyCode().IsShift())
     585                 :            :                         {
     586                 :          0 :                             mpView->UnmarkPoint(*pHdl);
     587                 :            :                         }
     588                 :            :                     }
     589                 :            :                     else
     590                 :            :                     {
     591         [ #  # ]:          0 :                         if(!rKEvt.GetKeyCode().IsShift())
     592                 :            :                         {
     593                 :          0 :                             mpView->UnmarkAllPoints();
     594                 :            :                         }
     595                 :            : 
     596                 :          0 :                         mpView->MarkPoint(*pHdl);
     597                 :            :                     }
     598                 :            : 
     599         [ #  # ]:          0 :                     if(0L == rHdlList.GetFocusHdl())
     600                 :            :                     {
     601                 :            :                         // restore point with focus
     602                 :          0 :                         SdrHdl* pNewOne = 0L;
     603                 :            : 
     604 [ #  # ][ #  # ]:          0 :                         for(sal_uInt32 a(0); !pNewOne && a < rHdlList.GetHdlCount(); a++)
                 [ #  # ]
     605                 :            :                         {
     606                 :          0 :                             SdrHdl* pAct = rHdlList.GetHdl(a);
     607                 :            : 
     608 [ #  # ][ #  #  :          0 :                             if(pAct
          #  #  #  #  #  
                      # ]
     609                 :          0 :                                 && pAct->GetKind() == HDL_POLY
     610                 :          0 :                                 && pAct->GetPolyNum() == nPol
     611                 :          0 :                                 && pAct->GetPointNum() == nPnt)
     612                 :            :                             {
     613                 :          0 :                                 pNewOne = pAct;
     614                 :            :                             }
     615                 :            :                         }
     616                 :            : 
     617         [ #  # ]:          0 :                         if(pNewOne)
     618                 :            :                         {
     619                 :          0 :                             ((SdrHdlList&)rHdlList).SetFocusHdl(pNewOne);
     620                 :            :                         }
     621                 :            :                     }
     622                 :            : 
     623                 :          0 :                     bReturn = sal_True;
     624                 :            :                 }
     625                 :            :             }
     626                 :            :         }
     627                 :          0 :         break;
     628                 :            : 
     629                 :            :         case KEY_UP:
     630                 :            :         case KEY_DOWN:
     631                 :            :         case KEY_LEFT:
     632                 :            :         case KEY_RIGHT:
     633                 :            :         {
     634 [ #  # ][ #  # ]:          0 :             if (!mpView->IsTextEdit() && !bSlideShow)
                 [ #  # ]
     635                 :            :             {
     636                 :          0 :                 long nX = 0;
     637                 :          0 :                 long nY = 0;
     638                 :            : 
     639         [ #  # ]:          0 :                 if (nCode == KEY_UP)
     640                 :            :                 {
     641                 :            :                     // Scroll nach oben
     642                 :          0 :                     nX = 0;
     643                 :          0 :                     nY =-1;
     644                 :            :                 }
     645         [ #  # ]:          0 :                 else if (nCode == KEY_DOWN)
     646                 :            :                 {
     647                 :            :                     // Scroll nach unten
     648                 :          0 :                     nX = 0;
     649                 :          0 :                     nY = 1;
     650                 :            :                 }
     651         [ #  # ]:          0 :                 else if (nCode == KEY_LEFT)
     652                 :            :                 {
     653                 :            :                     // Scroll nach links
     654                 :          0 :                     nX =-1;
     655                 :          0 :                     nY = 0;
     656                 :            :                 }
     657         [ #  # ]:          0 :                 else if (nCode == KEY_RIGHT)
     658                 :            :                 {
     659                 :            :                     // Scroll nach rechts
     660                 :          0 :                     nX = 1;
     661                 :          0 :                     nY = 0;
     662                 :            :                 }
     663                 :            : 
     664         [ #  # ]:          0 :                 if (mpView->AreObjectsMarked() && !rKEvt.GetKeyCode().IsMod1() &&
           [ #  #  #  # ]
                 [ #  # ]
     665                 :          0 :                     !mpDocSh->IsReadOnly())
     666                 :            :                 {
     667                 :          0 :                     const SdrHdlList& rHdlList = mpView->GetHdlList();
     668                 :          0 :                     SdrHdl* pHdl = rHdlList.GetFocusHdl();
     669                 :            : 
     670                 :          0 :                     sal_Bool bIsMoveOfConnectedHandle(sal_False);
     671                 :          0 :                     sal_Bool bOldSuppress = false;
     672                 :          0 :                     SdrEdgeObj* pEdgeObj = 0L;
     673                 :            : 
     674 [ #  # ][ #  # ]:          0 :                     if(pHdl && pHdl->GetObj() && pHdl->GetObj()->ISA(SdrEdgeObj) && 0 == pHdl->GetPolyNum())
         [ #  # ][ #  # ]
                 [ #  # ]
     675                 :            :                     {
     676                 :          0 :                         pEdgeObj = (SdrEdgeObj*)pHdl->GetObj();
     677                 :            : 
     678         [ #  # ]:          0 :                         if(0L == pHdl->GetPointNum())
     679                 :            :                         {
     680         [ #  # ]:          0 :                             if(pEdgeObj->GetConnection(sal_True).GetObject())
     681                 :            :                             {
     682                 :          0 :                                 bIsMoveOfConnectedHandle = sal_True;
     683                 :            :                             }
     684                 :            :                         }
     685         [ #  # ]:          0 :                         if(1L == pHdl->GetPointNum())
     686                 :            :                         {
     687         [ #  # ]:          0 :                             if(pEdgeObj->GetConnection(sal_False).GetObject())
     688                 :            :                             {
     689                 :          0 :                                 bIsMoveOfConnectedHandle = sal_True;
     690                 :            :                             }
     691                 :            :                         }
     692                 :            :                     }
     693                 :            : 
     694         [ #  # ]:          0 :                     if(pEdgeObj)
     695                 :            :                     {
     696                 :            :                         // Suppress default connects to inside object and object center
     697                 :          0 :                         bOldSuppress = pEdgeObj->GetSuppressDefaultConnect();
     698                 :          0 :                         pEdgeObj->SetSuppressDefaultConnect(sal_True);
     699                 :            :                     }
     700                 :            : 
     701         [ #  # ]:          0 :                     if(bIsMoveOfConnectedHandle)
     702                 :            :                     {
     703         [ #  # ]:          0 :                         sal_uInt16 nMarkHdSiz(mpView->GetMarkHdlSizePixel());
     704                 :          0 :                         Size aHalfConSiz(nMarkHdSiz + 1, nMarkHdSiz + 1);
     705         [ #  # ]:          0 :                         aHalfConSiz = mpWindow->PixelToLogic(aHalfConSiz);
     706                 :            : 
     707         [ #  # ]:          0 :                         if(100 < aHalfConSiz.Width())
     708                 :          0 :                             nX *= aHalfConSiz.Width();
     709                 :            :                         else
     710                 :          0 :                             nX *= 100;
     711                 :            : 
     712         [ #  # ]:          0 :                         if(100 < aHalfConSiz.Height())
     713                 :          0 :                             nY *= aHalfConSiz.Height();
     714                 :            :                         else
     715                 :          0 :                             nY *= 100;
     716                 :            :                     }
     717         [ #  # ]:          0 :                     else if(rKEvt.GetKeyCode().IsMod2())
     718                 :            :                     {
     719                 :            :                         // move in 1 pixel distance
     720 [ #  # ][ #  # ]:          0 :                         Size aLogicSizeOnePixel = (mpWindow) ? mpWindow->PixelToLogic(Size(1,1)) : Size(100, 100);
         [ #  # ][ #  # ]
     721                 :          0 :                         nX *= aLogicSizeOnePixel.Width();
     722                 :          0 :                         nY *= aLogicSizeOnePixel.Height();
     723                 :            :                     }
     724         [ #  # ]:          0 :                     else if(rKEvt.GetKeyCode().IsShift())
     725                 :            :                     {
     726                 :          0 :                         nX *= 1000;
     727                 :          0 :                         nY *= 1000;
     728                 :            :                     }
     729                 :            :                     else
     730                 :            :                     {
     731                 :            :                         // old, fixed move distance
     732                 :          0 :                         nX *= 100;
     733                 :          0 :                         nY *= 100;
     734                 :            :                     }
     735                 :            : 
     736         [ #  # ]:          0 :                     if(0L == pHdl)
     737                 :            :                     {
     738                 :            :                         // only take action when move is allowed
     739         [ #  # ]:          0 :                         if(mpView->IsMoveAllowed())
     740                 :            :                         {
     741                 :            :                             // restrict movement to WorkArea
     742                 :          0 :                             const Rectangle& rWorkArea = mpView->GetWorkArea();
     743                 :            : 
     744         [ #  # ]:          0 :                             if(!rWorkArea.IsEmpty())
     745                 :            :                             {
     746         [ #  # ]:          0 :                                 Rectangle aMarkRect(mpView->GetMarkedObjRect());
     747         [ #  # ]:          0 :                                 aMarkRect.Move(nX, nY);
     748                 :            : 
     749 [ #  # ][ #  # ]:          0 :                                 if(!aMarkRect.IsInside(rWorkArea))
     750                 :            :                                 {
     751         [ #  # ]:          0 :                                     if(aMarkRect.Left() < rWorkArea.Left())
     752                 :            :                                     {
     753                 :          0 :                                         nX += rWorkArea.Left() - aMarkRect.Left();
     754                 :            :                                     }
     755                 :            : 
     756         [ #  # ]:          0 :                                     if(aMarkRect.Right() > rWorkArea.Right())
     757                 :            :                                     {
     758                 :          0 :                                         nX -= aMarkRect.Right() - rWorkArea.Right();
     759                 :            :                                     }
     760                 :            : 
     761         [ #  # ]:          0 :                                     if(aMarkRect.Top() < rWorkArea.Top())
     762                 :            :                                     {
     763                 :          0 :                                         nY += rWorkArea.Top() - aMarkRect.Top();
     764                 :            :                                     }
     765                 :            : 
     766         [ #  # ]:          0 :                                     if(aMarkRect.Bottom() > rWorkArea.Bottom())
     767                 :            :                                     {
     768                 :          0 :                                         nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
     769                 :            :                                     }
     770                 :            :                                 }
     771                 :            :                             }
     772                 :            : 
     773                 :            :                             // no handle selected
     774 [ #  # ][ #  # ]:          0 :                             if(0 != nX || 0 != nY)
     775                 :            :                             {
     776         [ #  # ]:          0 :                                 mpView->MoveAllMarked(Size(nX, nY));
     777                 :            : 
     778                 :          0 :                                 mpView->MakeVisible(mpView->GetAllMarkedRect(), *mpWindow);
     779                 :            :                             }
     780                 :            :                         }
     781                 :            :                     }
     782                 :            :                     else
     783                 :            :                     {
     784                 :            :                         // move handle with index nHandleIndex
     785 [ #  # ][ #  # ]:          0 :                         if(pHdl && (nX || nY))
                 [ #  # ]
     786                 :            :                         {
     787                 :            :                             // now move the Handle (nX, nY)
     788                 :          0 :                             Point aStartPoint(pHdl->GetPos());
     789                 :          0 :                             Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
     790                 :          0 :                             const SdrDragStat& rDragStat = mpView->GetDragStat();
     791                 :            : 
     792                 :            :                             // start dragging
     793         [ #  # ]:          0 :                             mpView->BegDragObj(aStartPoint, 0, pHdl, 0);
     794                 :            : 
     795         [ #  # ]:          0 :                             if(mpView->IsDragObj())
     796                 :            :                             {
     797                 :          0 :                                 bool bWasNoSnap = rDragStat.IsNoSnap();
     798                 :          0 :                                 sal_Bool bWasSnapEnabled = mpView->IsSnapEnabled();
     799                 :            : 
     800                 :            :                                 // switch snapping off
     801         [ #  # ]:          0 :                                 if(!bWasNoSnap)
     802                 :          0 :                                     ((SdrDragStat&)rDragStat).SetNoSnap(sal_True);
     803         [ #  # ]:          0 :                                 if(bWasSnapEnabled)
     804                 :          0 :                                     mpView->SetSnapEnabled(sal_False);
     805                 :            : 
     806         [ #  # ]:          0 :                                 mpView->MovAction(aEndPoint);
     807         [ #  # ]:          0 :                                 mpView->EndDragObj();
     808                 :            : 
     809                 :            :                                 // restore snap
     810         [ #  # ]:          0 :                                 if(!bWasNoSnap)
     811                 :          0 :                                     ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
     812         [ #  # ]:          0 :                                 if(bWasSnapEnabled)
     813                 :          0 :                                     mpView->SetSnapEnabled(bWasSnapEnabled);
     814                 :            :                             }
     815                 :            : 
     816                 :            :                             // make moved handle visible
     817         [ #  # ]:          0 :                             Rectangle aVisRect(aEndPoint - Point(100, 100), Size(200, 200));
     818         [ #  # ]:          0 :                             mpView->MakeVisible(aVisRect, *mpWindow);
     819                 :            :                         }
     820                 :            :                     }
     821                 :            : 
     822         [ #  # ]:          0 :                     if(pEdgeObj)
     823                 :            :                     {
     824                 :            :                         // Restore original suppress value
     825                 :          0 :                         pEdgeObj->SetSuppressDefaultConnect(bOldSuppress);
     826                 :            :                     }
     827                 :            :                 }
     828                 :            :                 else
     829                 :            :                 {
     830                 :            :                     // Seite scrollen
     831                 :          0 :                     mpViewShell->ScrollLines(nX, nY);
     832                 :            :                 }
     833                 :            : 
     834                 :          0 :                 bReturn = sal_True;
     835                 :            :             }
     836                 :            :         }
     837                 :          0 :         break;
     838                 :            :     }
     839                 :            : 
     840         [ #  # ]:          0 :     if (bReturn)
     841                 :            :     {
     842                 :          0 :         mpWindow->ReleaseMouse();
     843                 :            :     }
     844                 :            : 
     845                 :            :     // when a text-editable object is selected and the
     846                 :            :     // input character is printable, activate text edit on that object
     847                 :            :     // and feed character to object
     848 [ #  # ][ #  # ]:          0 :     if(!bReturn && !mpDocSh->IsReadOnly())
                 [ #  # ]
     849                 :            :     {
     850 [ #  # ][ #  # ]:          0 :         if(!mpView->IsTextEdit() && mpViewShell)
                 [ #  # ]
     851                 :            :         {
     852                 :          0 :             const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
     853                 :            : 
     854         [ #  # ]:          0 :             if(1 == rMarkList.GetMarkCount())
     855                 :            :             {
     856                 :          0 :                 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
     857                 :            : 
     858 [ #  # ][ #  # ]:          0 :                 if(pObj->ISA(SdrTextObj) && pObj->HasTextEdit() && !pObj->ISA(SdrOle2Obj))
         [ #  # ][ #  # ]
     859                 :            :                 {
     860                 :            :                     // use common IsSimpleCharInput from the EditEngine.
     861                 :          0 :                     sal_Bool bPrintable(EditEngine::IsSimpleCharInput(rKEvt));
     862                 :            : 
     863         [ #  # ]:          0 :                     if(bPrintable)
     864                 :            :                     {
     865                 :            :                         // try to activate textedit mode for the selected object
     866 [ #  # ][ #  # ]:          0 :                         SfxStringItem aInputString(SID_ATTR_CHAR, rtl::OUString(rKEvt.GetCharCode()));
                 [ #  # ]
     867                 :            : 
     868                 :            :                         mpViewShell->GetViewFrame()->GetDispatcher()->Execute(
     869                 :            :                             SID_ATTR_CHAR,
     870                 :            :                             SFX_CALLMODE_ASYNCHRON,
     871                 :            :                             &aInputString,
     872 [ #  # ][ #  # ]:          0 :                             0L);
     873                 :            : 
     874                 :            :                         // consumed
     875         [ #  # ]:          0 :                         bReturn = sal_True;
     876                 :            :                     }
     877                 :            :                 }
     878                 :            :             }
     879                 :            :             else
     880                 :            :             {
     881                 :            :                 // test if there is a title object there. If yes, try to
     882                 :            :                 // set it to edit mode and start typing...
     883   [ #  #  #  # ]:          0 :                 if(mpViewShell->ISA(DrawViewShell)
                 [ #  # ]
     884                 :          0 :                     && EditEngine::IsSimpleCharInput(rKEvt))
     885                 :            :                 {
     886                 :            :                     DrawViewShell* pDrawViewShell =
     887                 :          0 :                         static_cast<DrawViewShell*>(mpViewShell);
     888                 :          0 :                     SdPage* pActualPage = pDrawViewShell->GetActualPage();
     889                 :          0 :                     SdrTextObj* pCandidate = 0L;
     890                 :            : 
     891         [ #  # ]:          0 :                     if(pActualPage)
     892                 :            :                     {
     893         [ #  # ]:          0 :                         SdrObjListIter aIter(*pActualPage, IM_DEEPNOGROUPS);
     894                 :            : 
     895 [ #  # ][ #  # ]:          0 :                         while(aIter.IsMore() && !pCandidate)
                 [ #  # ]
     896                 :            :                         {
     897         [ #  # ]:          0 :                             SdrObject* pObj = aIter.Next();
     898                 :            : 
     899 [ #  # ][ #  # ]:          0 :                             if(pObj && pObj->ISA(SdrTextObj))
         [ #  # ][ #  # ]
                 [ #  # ]
     900                 :            :                             {
     901         [ #  # ]:          0 :                                 sal_uInt32 nInv(pObj->GetObjInventor());
     902         [ #  # ]:          0 :                                 sal_uInt16 nKnd(pObj->GetObjIdentifier());
     903                 :            : 
     904 [ #  # ][ #  # ]:          0 :                                 if(SdrInventor == nInv && OBJ_TITLETEXT == nKnd)
     905                 :            :                                 {
     906                 :          0 :                                     pCandidate = (SdrTextObj*)pObj;
     907                 :            :                                 }
     908                 :            :                             }
     909                 :          0 :                         }
     910                 :            :                     }
     911                 :            : 
     912                 :            :                     // when candidate found and candidate is untouched, start editing text...
     913 [ #  # ][ #  # ]:          0 :                     if(pCandidate && pCandidate->IsEmptyPresObj())
                 [ #  # ]
     914                 :            :                     {
     915         [ #  # ]:          0 :                         mpView->UnMarkAll();
     916         [ #  # ]:          0 :                         mpView->MarkObj(pCandidate, mpView->GetSdrPageView());
     917 [ #  # ][ #  # ]:          0 :                         SfxStringItem aInputString(SID_ATTR_CHAR, rtl::OUString(rKEvt.GetCharCode()));
                 [ #  # ]
     918                 :            : 
     919                 :            :                         mpViewShell->GetViewFrame()->GetDispatcher()->Execute(
     920                 :            :                             SID_ATTR_CHAR,
     921                 :            :                             SFX_CALLMODE_ASYNCHRON,
     922                 :            :                             &aInputString,
     923 [ #  # ][ #  # ]:          0 :                             0L);
     924                 :            : 
     925                 :            :                         // consumed
     926         [ #  # ]:          0 :                         bReturn = sal_True;
     927                 :            :                     }
     928                 :            :                 }
     929                 :            :             }
     930                 :            :         }
     931                 :            :     }
     932                 :            : 
     933                 :          0 :     return(bReturn);
     934                 :            : }
     935                 :            : 
     936                 :          0 : sal_Bool FuPoor::MouseMove(const MouseEvent& )
     937                 :            : {
     938                 :          0 :     return sal_False;
     939                 :            : }
     940                 :            : 
     941                 :        132 : void FuPoor::SelectionHasChanged()
     942                 :            : {
     943                 :        132 :     const SdrHdlList& rHdlList = mpView->GetHdlList();
     944                 :        132 :     ((SdrHdlList&)rHdlList).ResetFocusHdl();
     945                 :        132 : }
     946                 :            : 
     947                 :            : /*************************************************************************
     948                 :            : |*
     949                 :            : |* Cut object to clipboard
     950                 :            : |*
     951                 :            : \************************************************************************/
     952                 :            : 
     953                 :          0 : void FuPoor::DoCut()
     954                 :            : {
     955         [ #  # ]:          0 :     if (mpView)
     956                 :            :     {
     957                 :          0 :         mpView->DoCut(mpWindow);
     958                 :            :     }
     959                 :          0 : }
     960                 :            : 
     961                 :            : /*************************************************************************
     962                 :            : |*
     963                 :            : |* Copy object to clipboard
     964                 :            : |*
     965                 :            : \************************************************************************/
     966                 :            : 
     967                 :          0 : void FuPoor::DoCopy()
     968                 :            : {
     969         [ #  # ]:          0 :     if (mpView)
     970                 :            :     {
     971                 :          0 :         mpView->DoCopy(mpWindow);
     972                 :            :     }
     973                 :          0 : }
     974                 :            : 
     975                 :            : /*************************************************************************
     976                 :            : |*
     977                 :            : |* Paste object from clipboard
     978                 :            : |*
     979                 :            : \************************************************************************/
     980                 :            : 
     981                 :          0 : void FuPoor::DoPaste()
     982                 :            : {
     983         [ #  # ]:          0 :     if (mpView)
     984                 :            :     {
     985                 :          0 :         mpView->DoPaste(mpWindow);
     986                 :            :     }
     987                 :          0 : }
     988                 :            : 
     989                 :            : /*************************************************************************
     990                 :            : |*
     991                 :            : |* Timer-Handler fuer Drag&Drop
     992                 :            : |*
     993                 :            : \************************************************************************/
     994                 :            : 
     995                 :          0 : IMPL_LINK_NOARG(FuPoor, DragHdl)
     996                 :            : {
     997         [ #  # ]:          0 :     if( mpView )
     998                 :            :     {
     999         [ #  # ]:          0 :         sal_uInt16 nHitLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(HITPIX,0)).Width() );
    1000                 :          0 :         SdrHdl* pHdl = mpView->PickHandle(aMDPos);
    1001                 :            : 
    1002   [ #  #  #  # ]:          0 :         if ( pHdl==NULL && mpView->IsMarkedHit(aMDPos, nHitLog)
         [ #  # ][ #  # ]
    1003                 :          0 :              && !mpView->IsPresObjSelected(sal_False, sal_True) )
    1004                 :            :         {
    1005                 :          0 :             mpWindow->ReleaseMouse();
    1006                 :          0 :             bIsInDragMode = sal_True;
    1007                 :          0 :             mpView->StartDrag( aMDPos, mpWindow );
    1008                 :            :         }
    1009                 :            :     }
    1010                 :          0 :     return 0;
    1011                 :            : }
    1012                 :            : 
    1013                 :            : /*************************************************************************
    1014                 :            : |*
    1015                 :            : |* Command-event
    1016                 :            : |*
    1017                 :            : \************************************************************************/
    1018                 :            : 
    1019                 :          0 : sal_Bool FuPoor::Command(const CommandEvent& rCEvt)
    1020                 :            : {
    1021                 :          0 :     return( mpView->Command(rCEvt,mpWindow) );
    1022                 :            : }
    1023                 :            : 
    1024                 :            : /*************************************************************************
    1025                 :            : |*
    1026                 :            : |* Timer-Handler fuer Fensterscrolling
    1027                 :            : |*
    1028                 :            : \************************************************************************/
    1029                 :            : 
    1030                 :          0 : IMPL_LINK_NOARG_INLINE_START(FuPoor, DelayHdl)
    1031                 :            : {
    1032         [ #  # ]:          0 :     aDelayToScrollTimer.Stop ();
    1033                 :          0 :     bScrollable = sal_True;
    1034                 :            : 
    1035         [ #  # ]:          0 :     Point aPnt(mpWindow->GetPointerPosPixel());
    1036                 :            : 
    1037                 :            :     // use remembered MouseButton state to create correct
    1038                 :            :     // MouseEvents for this artifical MouseMove.
    1039 [ #  # ][ #  # ]:          0 :     MouseMove(MouseEvent(aPnt, 1, 0, GetMouseButtonCode()));
    1040                 :            : 
    1041                 :          0 :     return 0;
    1042                 :            : }
    1043                 :          0 : IMPL_LINK_INLINE_END( FuPoor, DelayHdl, Timer *, pTimer )
    1044                 :            : 
    1045                 :            : /*************************************************************************
    1046                 :            : |*
    1047                 :            : |* Handler fuer Maustaste
    1048                 :            : |*
    1049                 :            : \************************************************************************/
    1050                 :            : 
    1051                 :          0 : sal_Bool FuPoor::MouseButtonUp (const MouseEvent& rMEvt)
    1052                 :            : {
    1053                 :            :     // remember button state for creation of own MouseEvents
    1054                 :          0 :     SetMouseButtonCode(rMEvt.GetButtons());
    1055                 :            : 
    1056                 :          0 :     aDelayToScrollTimer.Stop ();
    1057                 :            :     return bScrollable  =
    1058                 :          0 :         bDelayActive = sal_False;
    1059                 :            : }
    1060                 :            : 
    1061                 :          0 : sal_Bool FuPoor::MouseButtonDown(const MouseEvent& rMEvt)
    1062                 :            : {
    1063                 :            :     // remember button state for creation of own MouseEvents
    1064                 :          0 :     SetMouseButtonCode(rMEvt.GetButtons());
    1065                 :            : 
    1066                 :          0 :     return sal_False;
    1067                 :            : }
    1068                 :            : 
    1069                 :            : /*************************************************************************
    1070                 :            : |*
    1071                 :            : |* Handler fuer Maustaste
    1072                 :            : |*
    1073                 :            : \************************************************************************/
    1074                 :            : 
    1075                 :          0 : void FuPoor::StartDelayToScrollTimer ()
    1076                 :            : {
    1077                 :          0 :     bDelayActive = sal_True;
    1078                 :          0 :     aDelayToScrollTimer.Start ();
    1079                 :          0 : }
    1080                 :            : 
    1081                 :            : /*************************************************************************
    1082                 :            : |*
    1083                 :            : |* Help-event
    1084                 :            : |*
    1085                 :            : \************************************************************************/
    1086                 :            : 
    1087                 :          0 : sal_Bool FuPoor::RequestHelp(const HelpEvent& rHEvt)
    1088                 :            : {
    1089                 :          0 :     sal_Bool bReturn = sal_False;
    1090                 :            : 
    1091                 :          0 :     SdrPageView* pPV = mpView->GetSdrPageView();
    1092                 :            : 
    1093         [ #  # ]:          0 :     if (pPV)
    1094                 :            :     {
    1095                 :          0 :         SdPage* pPage = (SdPage*) pPV->GetPage();
    1096                 :            : 
    1097         [ #  # ]:          0 :         if (pPage)
    1098                 :            :         {
    1099                 :          0 :             bReturn = pPage->RequestHelp(mpWindow, mpView, rHEvt);
    1100                 :            :         }
    1101                 :            :     }
    1102                 :            : 
    1103                 :          0 :     return(bReturn);
    1104                 :            : }
    1105                 :            : 
    1106                 :        972 : void FuPoor::Paint(const Rectangle&, ::sd::Window* )
    1107                 :            : {
    1108                 :        972 : }
    1109                 :            : 
    1110                 :            : /*************************************************************************
    1111                 :            : |*
    1112                 :            : |* Request verarbeiten
    1113                 :            : |*
    1114                 :            : \************************************************************************/
    1115                 :            : 
    1116                 :        260 : void FuPoor::ReceiveRequest(SfxRequest& rReq)
    1117                 :            : {
    1118                 :        260 :     const SfxItemSet* pSet = rReq.GetArgs();
    1119                 :            : 
    1120         [ -  + ]:        260 :     if (pSet)
    1121                 :            :     {
    1122         [ #  # ]:          0 :         if( pSet->GetItemState( nSlotId ) == SFX_ITEM_SET )
    1123                 :            :         {
    1124                 :          0 :             const SfxPoolItem& rItem = pSet->Get( nSlotId );
    1125                 :            : 
    1126         [ #  # ]:          0 :             if( rItem.ISA( SfxAllEnumItem ) )
    1127                 :            :             {
    1128                 :          0 :                 nSlotValue = ( ( const SfxAllEnumItem& ) rItem ).GetValue();
    1129                 :            :             }
    1130                 :            :         }
    1131                 :            :     }
    1132                 :        260 : }
    1133                 :            : 
    1134                 :          0 : SdrObject* FuPoor::CreateDefaultObject(const sal_uInt16, const Rectangle& )
    1135                 :            : {
    1136                 :            :     // empty base implementation
    1137                 :          0 :     return 0L;
    1138                 :            : }
    1139                 :            : 
    1140                 :          0 : void FuPoor::ImpForceQuadratic(Rectangle& rRect)
    1141                 :            : {
    1142         [ #  # ]:          0 :     if(rRect.GetWidth() > rRect.GetHeight())
    1143                 :            :     {
    1144                 :            :         rRect = Rectangle(
    1145 [ #  # ][ #  # ]:          0 :             Point(rRect.Left() + ((rRect.GetWidth() - rRect.GetHeight()) / 2), rRect.Top()),
    1146         [ #  # ]:          0 :             Size(rRect.GetHeight(), rRect.GetHeight()));
    1147                 :            :     }
    1148                 :            :     else
    1149                 :            :     {
    1150                 :            :         rRect = Rectangle(
    1151 [ #  # ][ #  # ]:          0 :             Point(rRect.Left(), rRect.Top() + ((rRect.GetHeight() - rRect.GetWidth()) / 2)),
    1152         [ #  # ]:          0 :             Size(rRect.GetWidth(), rRect.GetWidth()));
    1153                 :            :     }
    1154                 :          0 : }
    1155                 :            : 
    1156                 :            : 
    1157                 :            : 
    1158                 :            : 
    1159                 :          0 : void FuPoor::SwitchLayer (sal_Int32 nOffset)
    1160                 :            : {
    1161 [ #  # ][ #  # ]:          0 :     if(mpViewShell && mpViewShell->ISA(DrawViewShell))
                 [ #  # ]
    1162                 :            :     {
    1163                 :            :         DrawViewShell* pDrawViewShell =
    1164                 :          0 :             static_cast<DrawViewShell*>(mpViewShell);
    1165                 :            : 
    1166                 :            :         // Calculate the new index.
    1167                 :          0 :         sal_Int32 nIndex = pDrawViewShell->GetActiveTabLayerIndex() + nOffset;
    1168                 :            : 
    1169                 :            :         // Make sure the new index lies inside the range of valid indices.
    1170         [ #  # ]:          0 :         if (nIndex < 0)
    1171                 :          0 :             nIndex = 0;
    1172         [ #  # ]:          0 :         else if (nIndex >= pDrawViewShell->GetTabLayerCount ())
    1173                 :          0 :             nIndex = pDrawViewShell->GetTabLayerCount() - 1;
    1174                 :            : 
    1175                 :            :         // Set the new active layer.
    1176         [ #  # ]:          0 :         if (nIndex != pDrawViewShell->GetActiveTabLayerIndex ())
    1177                 :            :         {
    1178                 :            :             LayerTabBar* pLayerTabControl =
    1179                 :          0 :                 static_cast<DrawViewShell*>(mpViewShell)->GetLayerTabControl();
    1180         [ #  # ]:          0 :             if (pLayerTabControl != NULL)
    1181                 :          0 :                 pLayerTabControl->SendDeactivatePageEvent ();
    1182                 :            : 
    1183                 :          0 :             pDrawViewShell->SetActiveTabLayerIndex (nIndex);
    1184                 :            : 
    1185         [ #  # ]:          0 :             if (pLayerTabControl != NULL)
    1186                 :          0 :                 pLayerTabControl->SendActivatePageEvent ();
    1187                 :            :         }
    1188                 :            :     }
    1189                 :          0 : }
    1190                 :            : 
    1191                 :            : /** is called when the currenct function should be aborted. <p>
    1192                 :            :     This is used when a function gets a KEY_ESCAPE but can also
    1193                 :            :     be called directly.
    1194                 :            : 
    1195                 :            :     @returns true if a active function was aborted
    1196                 :            : */
    1197                 :          0 : bool FuPoor::cancel()
    1198                 :            : {
    1199         [ #  # ]:          0 :     if ( !this->ISA(FuSelection) )
    1200                 :            :     {
    1201                 :          0 :         mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
    1202                 :          0 :         return true;
    1203                 :            :     }
    1204                 :            : 
    1205                 :          0 :     return false;
    1206                 :            : }
    1207                 :            : 
    1208                 :            : // #i33136#
    1209                 :          0 : bool FuPoor::doConstructOrthogonal() const
    1210                 :            : {
    1211                 :            :     return (
    1212                 :            :         SID_DRAW_XLINE == nSlotId ||
    1213                 :            :         SID_DRAW_CIRCLEARC == nSlotId ||
    1214                 :            :         SID_DRAW_SQUARE == nSlotId ||
    1215                 :            :         SID_DRAW_SQUARE_NOFILL == nSlotId ||
    1216                 :            :         SID_DRAW_SQUARE_ROUND == nSlotId ||
    1217                 :            :         SID_DRAW_SQUARE_ROUND_NOFILL == nSlotId ||
    1218                 :            :         SID_DRAW_CIRCLE == nSlotId ||
    1219                 :            :         SID_DRAW_CIRCLE_NOFILL == nSlotId ||
    1220                 :            :         SID_DRAW_CIRCLEPIE == nSlotId ||
    1221                 :            :         SID_DRAW_CIRCLEPIE_NOFILL == nSlotId ||
    1222                 :            :         SID_DRAW_CIRCLECUT == nSlotId ||
    1223                 :            :         SID_DRAW_CIRCLECUT_NOFILL == nSlotId ||
    1224                 :            :         SID_DRAW_XPOLYGON == nSlotId ||
    1225                 :            :         SID_DRAW_XPOLYGON_NOFILL == nSlotId ||
    1226                 :            :         SID_3D_CUBE == nSlotId ||
    1227                 :            :         SID_3D_SPHERE == nSlotId ||
    1228                 :            :         SID_3D_SHELL == nSlotId ||
    1229                 :            :         SID_3D_HALF_SPHERE == nSlotId ||
    1230                 :            :         SID_3D_TORUS == nSlotId ||
    1231                 :            :         SID_3D_CYLINDER == nSlotId ||
    1232                 :            :         SID_3D_CONE == nSlotId ||
    1233 [ #  # ][ #  # ]:          0 :         SID_3D_PYRAMID == nSlotId);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1234                 :            : }
    1235                 :            : 
    1236                 :        130 : void FuPoor::DoExecute( SfxRequest& )
    1237                 :            : {
    1238                 :        130 : }
    1239                 :            : 
    1240                 :            : } // end of namespace sd
    1241                 :            : 
    1242                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10