LCOV - code coverage report
Current view: top level - sd/source/ui/view - drviews8.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 210 0.0 %
Date: 2012-08-25 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 273 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include "DrawViewShell.hxx"
      31                 :            : 
      32                 :            : #include "ViewShellHint.hxx"
      33                 :            : 
      34                 :            : #include <toolkit/unohlp.hxx>
      35                 :            : #include <sfx2/dispatch.hxx>
      36                 :            : #include <svx/svxids.hrc>
      37                 :            : #include <vcl/msgbox.hxx>
      38                 :            : #include <svx/svddef.hxx>
      39                 :            : #include <sfx2/bindings.hxx>
      40                 :            : #include <sfx2/request.hxx>
      41                 :            : #include <sfx2/viewfrm.hxx>
      42                 :            : #include <svx/svdograf.hxx>
      43                 :            : #include <svx/svdpagv.hxx>
      44                 :            : 
      45                 :            : #include "app.hrc"
      46                 :            : #include "strings.hrc"
      47                 :            : 
      48                 :            : #include "fuzoom.hxx"
      49                 :            : #include "fudspord.hxx"
      50                 :            : #include "futransf.hxx"
      51                 :            : #include "fuline.hxx"
      52                 :            : #include "fuarea.hxx"
      53                 :            : #include "fuchar.hxx"
      54                 :            : #include "fuparagr.hxx"
      55                 :            : #include "fubullet.hxx"
      56                 :            : #include "futempl.hxx"
      57                 :            : #include "fuinsert.hxx"
      58                 :            : #include "fuprlout.hxx"
      59                 :            : #include "fupage.hxx"
      60                 :            : #include "fuoaprms.hxx"
      61                 :            : #include "fucopy.hxx"
      62                 :            : #include "fulinend.hxx"
      63                 :            : #include "fusnapln.hxx"
      64                 :            : #include "fuolbull.hxx"
      65                 :            : #include "fuinsfil.hxx"
      66                 :            : #include "fulink.hxx"
      67                 :            : #include "futhes.hxx"
      68                 :            : #include "futxtatt.hxx"
      69                 :            : #include "fumeasur.hxx"
      70                 :            : #include "fuconnct.hxx"
      71                 :            : #include "fumorph.hxx"
      72                 :            : #include "fuvect.hxx"
      73                 :            : #include "sdresid.hxx"
      74                 :            : #include "Window.hxx"
      75                 :            : #include "drawview.hxx"
      76                 :            : #include "zoomlist.hxx"
      77                 :            : #include <osl/mutex.hxx>
      78                 :            : #include <tools/helpers.hxx>
      79                 :            : #include <vcl/svapp.hxx>
      80                 :            : 
      81                 :            : namespace sd {
      82                 :            : 
      83                 :            : /*************************************************************************
      84                 :            : |*
      85                 :            : |* SfxRequests fuer temporaere Funktionen
      86                 :            : |*
      87                 :            : \************************************************************************/
      88                 :            : 
      89                 :          0 : void DrawViewShell::FuTemp01(SfxRequest& rReq)
      90                 :            : {
      91   [ #  #  #  #  :          0 :     switch(rReq.GetSlot())
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
      92                 :            :     {
      93                 :            :         case SID_ATTRIBUTES_LINE:  // BASIC
      94                 :            :         {
      95         [ #  # ]:          0 :             SetCurrentFunction( FuLine::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
      96                 :          0 :             Cancel();
      97                 :            :         }
      98                 :          0 :         break;
      99                 :            : 
     100                 :            :         case SID_ATTRIBUTES_AREA:  // BASIC
     101                 :            :         {
     102         [ #  # ]:          0 :             SetCurrentFunction( FuArea::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     103                 :          0 :             Cancel();
     104                 :            :         }
     105                 :          0 :         break;
     106                 :            : 
     107                 :            :         case SID_ATTR_TRANSFORM:
     108                 :            :         {
     109         [ #  # ]:          0 :             SetCurrentFunction( FuTransform::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     110                 :          0 :             Invalidate(SID_RULER_OBJECT);
     111                 :          0 :             Cancel();
     112                 :            :         }
     113                 :          0 :         break;
     114                 :            : 
     115                 :            :         case SID_CHAR_DLG:  // BASIC
     116                 :            :         {
     117         [ #  # ]:          0 :             SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     118                 :          0 :             Cancel();
     119                 :            :         }
     120                 :          0 :         break;
     121                 :            : 
     122                 :            :         case SID_PARA_DLG:
     123                 :            :         {
     124         [ #  # ]:          0 :             SetCurrentFunction( FuParagraph::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     125                 :          0 :             Cancel();
     126                 :            :         }
     127                 :          0 :         break;
     128                 :            : 
     129                 :            :         case SID_OUTLINE_BULLET:
     130                 :            :         {
     131         [ #  # ]:          0 :             SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     132                 :          0 :             Cancel();
     133                 :            :         }
     134                 :          0 :         break;
     135                 :            : 
     136                 :            :         case FN_INSERT_SOFT_HYPHEN:
     137                 :            :         case FN_INSERT_HARDHYPHEN:
     138                 :            :         case FN_INSERT_HARD_SPACE:
     139                 :            :         case SID_INSERT_RLM :
     140                 :            :         case SID_INSERT_LRM :
     141                 :            :         case SID_INSERT_ZWNBSP :
     142                 :            :         case SID_INSERT_ZWSP:
     143                 :            :         case SID_CHARMAP:
     144                 :            :         {
     145         [ #  # ]:          0 :             SetCurrentFunction( FuBullet::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     146                 :          0 :             Cancel();
     147                 :            :         }
     148                 :          0 :         break;
     149                 :            : 
     150                 :            :         case SID_PRESENTATION_LAYOUT:
     151                 :            :         {
     152         [ #  # ]:          0 :             SetCurrentFunction( FuPresentationLayout::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
     153                 :          0 :             Cancel();
     154                 :            :         }
     155                 :          0 :         break;
     156                 :            : 
     157                 :            :         case SID_PASTE_SPECIAL:
     158                 :            :         {
     159         [ #  # ]:          0 :             SetCurrentFunction( FuInsertClipboard::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     160                 :          0 :             Cancel();
     161                 :          0 :             rReq.Ignore ();
     162                 :            :         }
     163                 :          0 :         break;
     164                 :            : 
     165                 :            :         case SID_INSERT_GRAPHIC:
     166                 :            :         {
     167         [ #  # ]:          0 :             SetCurrentFunction( FuInsertGraphic::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     168                 :          0 :             Cancel();
     169                 :          0 :             rReq.Ignore ();
     170                 :          0 :             Invalidate(SID_DRAWTBX_INSERT);
     171                 :            :         }
     172                 :          0 :         break;
     173                 :            : 
     174                 :            :         case SID_INSERT_AVMEDIA:
     175                 :            :         {
     176         [ #  # ]:          0 :             SetCurrentFunction( FuInsertAVMedia::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     177                 :            : 
     178                 :          0 :             Cancel();
     179                 :          0 :             rReq.Ignore ();
     180                 :            : 
     181                 :          0 :             Invalidate(SID_DRAWTBX_INSERT);
     182                 :            :         }
     183                 :          0 :         break;
     184                 :            : 
     185                 :            :         case SID_INSERT_OBJECT:
     186                 :            :         case SID_INSERT_PLUGIN:
     187                 :            :         case SID_INSERT_SOUND:
     188                 :            :         case SID_INSERT_VIDEO:
     189                 :            :         case SID_INSERT_FLOATINGFRAME:
     190                 :            :         case SID_INSERT_MATH:
     191                 :            :         case SID_INSERT_DIAGRAM:
     192                 :            :         case SID_ATTR_TABLE:
     193                 :            :         {
     194         [ #  # ]:          0 :             SetCurrentFunction( FuInsertOLE::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     195                 :            : 
     196                 :          0 :             Cancel();
     197                 :          0 :             rReq.Ignore ();
     198                 :            : 
     199                 :          0 :             Invalidate(SID_DRAWTBX_INSERT);
     200                 :            :         }
     201                 :          0 :         break;
     202                 :            : 
     203                 :            :         case SID_COPYOBJECTS:
     204                 :            :         {
     205         [ #  # ]:          0 :             if ( mpDrawView->IsPresObjSelected(sal_False, sal_True) )
     206                 :            :             {
     207                 :          0 :                 ::sd::Window* pWindow = GetActiveWindow();
     208 [ #  # ][ #  # ]:          0 :                 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
         [ #  # ][ #  # ]
                 [ #  # ]
     209                 :            :             }
     210                 :            :             else
     211                 :            :             {
     212         [ #  # ]:          0 :                 if ( mpDrawView->IsTextEdit() )
     213                 :            :                 {
     214                 :          0 :                     mpDrawView->SdrEndTextEdit();
     215                 :            :                 }
     216                 :            : 
     217         [ #  # ]:          0 :                 SetCurrentFunction( FuCopy::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     218                 :            :             }
     219                 :          0 :             Cancel();
     220                 :          0 :             rReq.Ignore ();
     221                 :            :         }
     222                 :          0 :         break;
     223                 :            : 
     224                 :            :         case SID_INSERTFILE:  // BASIC
     225                 :            :         {
     226         [ #  # ]:          0 :             Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START));
     227         [ #  # ]:          0 :             SetCurrentFunction( FuInsertFile::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     228         [ #  # ]:          0 :             Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END));
     229                 :          0 :             Cancel();
     230                 :          0 :             rReq.Done ();
     231                 :            : 
     232                 :          0 :             Invalidate(SID_DRAWTBX_INSERT);
     233                 :            :         }
     234                 :          0 :         break;
     235                 :            : 
     236                 :            :         case SID_SELECT_BACKGROUND:
     237                 :            :         case SID_PAGESETUP:  // BASIC ??
     238                 :            :         {
     239         [ #  # ]:          0 :             SetCurrentFunction( FuPage::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     240                 :          0 :             Cancel();
     241                 :          0 :             rReq.Ignore (); // es werden eigenstaendige macros generiert !!
     242                 :            :         }
     243                 :          0 :         break;
     244                 :            : 
     245                 :            :         case SID_ZOOM_OUT:
     246                 :            :         case SID_ZOOM_PANNING:
     247                 :            :         {
     248                 :          0 :             mbZoomOnPage = sal_False;
     249         [ #  # ]:          0 :             SetCurrentFunction( FuZoom::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
     250                 :            :             // Beendet sich selbst, kein Cancel() notwendig!
     251                 :          0 :             Invalidate( SID_ZOOM_TOOLBOX );
     252                 :          0 :             rReq.Ignore ();
     253                 :            :         }
     254                 :          0 :         break;
     255                 :            : 
     256                 :            :         case SID_BEFORE_OBJ:
     257                 :            :         case SID_BEHIND_OBJ:
     258                 :            :         {
     259         [ #  # ]:          0 :             SetCurrentFunction( FuDisplayOrder::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
     260                 :          0 :             Invalidate( SID_POSITION );
     261                 :          0 :             rReq.Ignore ();
     262                 :            :             // Beendet sich selbst, kein Cancel() notwendig!
     263                 :            :         }
     264                 :          0 :         break;
     265                 :            : 
     266                 :            :         case SID_REVERSE_ORDER:   // BASIC
     267                 :            :         {
     268                 :          0 :             mpDrawView->ReverseOrderOfMarked();
     269                 :          0 :             Invalidate( SID_POSITION );
     270                 :          0 :             Cancel();
     271                 :          0 :             rReq.Done ();
     272                 :            :         }
     273                 :          0 :         break;
     274                 :            : 
     275                 :            :         case SID_ANIMATION_EFFECTS:
     276                 :            :         {
     277         [ #  # ]:          0 :             SetCurrentFunction( FuObjectAnimationParameters::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
     278                 :          0 :             Cancel();
     279                 :            :         }
     280                 :          0 :         break;
     281                 :            : 
     282                 :            :         case SID_LINEEND_POLYGON:
     283                 :            :         {
     284         [ #  # ]:          0 :             SetCurrentFunction( FuLineEnd::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     285                 :          0 :             Cancel();
     286                 :            :         }
     287                 :          0 :         break;
     288                 :            : 
     289                 :            :         case SID_CAPTUREPOINT:
     290                 :            :             // negative Werte um Aufruf aus Menue zu signalisieren
     291                 :          0 :             maMousePos = Point(-1,-1);
     292                 :            :         case SID_SET_SNAPITEM:
     293                 :            :         {
     294         [ #  # ]:          0 :             SetCurrentFunction( FuSnapLine::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
     295                 :          0 :             Cancel();
     296                 :            :         }
     297                 :          0 :         break;
     298                 :            : 
     299                 :            :         case SID_MANAGE_LINKS:
     300                 :            :         {
     301         [ #  # ]:          0 :             SetCurrentFunction( FuLink::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     302                 :          0 :             Cancel();
     303                 :          0 :             rReq.Ignore ();
     304                 :            :         }
     305                 :          0 :         break;
     306                 :            : 
     307                 :            :         case SID_THESAURUS:
     308                 :            :         {
     309         [ #  # ]:          0 :             SetCurrentFunction( FuThesaurus::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     310                 :          0 :             Cancel();
     311                 :          0 :             rReq.Ignore ();
     312                 :            :         }
     313                 :          0 :         break;
     314                 :            : 
     315                 :            :         case SID_TEXTATTR_DLG:
     316                 :            :         {
     317         [ #  # ]:          0 :             SetCurrentFunction( FuTextAttrDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     318                 :          0 :             Cancel();
     319                 :          0 :             rReq.Ignore ();
     320                 :            :         }
     321                 :          0 :         break;
     322                 :            : 
     323                 :            :         case SID_MEASURE_DLG:
     324                 :            :         {
     325         [ #  # ]:          0 :             SetCurrentFunction( FuMeasureDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     326                 :          0 :             Cancel();
     327                 :          0 :             rReq.Ignore ();
     328                 :            :         }
     329                 :          0 :         break;
     330                 :            : 
     331                 :            :         case SID_CONNECTION_DLG:
     332                 :            :         {
     333         [ #  # ]:          0 :             SetCurrentFunction( FuConnectionDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     334                 :          0 :             Cancel();
     335                 :          0 :             rReq.Done();
     336                 :            :         }
     337                 :          0 :         break;
     338                 :            : 
     339                 :            :         case SID_CONNECTION_NEW_ROUTING:
     340                 :            :         {
     341         [ #  # ]:          0 :             SfxItemSet aDefAttr( GetPool(), SDRATTR_EDGELINE1DELTA, SDRATTR_EDGELINE3DELTA );
     342         [ #  # ]:          0 :             GetView()->SetAttributes( aDefAttr, sal_True ); // (ReplaceAll)
     343                 :            : 
     344         [ #  # ]:          0 :             Cancel();
     345 [ #  # ][ #  # ]:          0 :             rReq.Done();
     346                 :            :         }
     347                 :          0 :         break;
     348                 :            : 
     349                 :            :         case SID_TWAIN_SELECT:
     350                 :            :         {
     351         [ #  # ]:          0 :             if( mxScannerManager.is() )
     352                 :            :             {
     353                 :            :                 try
     354                 :            :                 {
     355                 :            :                     const ::com::sun::star::uno::Sequence< ::com::sun::star::scanner::ScannerContext >
     356 [ #  # ][ #  # ]:          0 :                         aContexts( mxScannerManager->getAvailableScanners() );
     357                 :            : 
     358         [ #  # ]:          0 :                     if( aContexts.getLength() )
     359                 :            :                     {
     360                 :          0 :                         ::com::sun::star::scanner::ScannerContext aContext( aContexts.getConstArray()[ 0 ] );
     361 [ #  # ][ #  # ]:          0 :                         mxScannerManager->configureScannerAndScan( aContext, mxScannerListener );
     362         [ #  # ]:          0 :                     }
     363                 :            :                 }
     364                 :          0 :                 catch(...)
     365                 :            :                 {
     366                 :            :                 }
     367                 :            :             }
     368                 :            : 
     369                 :          0 :             Cancel();
     370                 :          0 :             rReq.Done();
     371                 :            :         }
     372                 :          0 :         break;
     373                 :            : 
     374                 :            :         case SID_TWAIN_TRANSFER:
     375                 :            :         {
     376                 :          0 :             sal_Bool bDone = sal_False;
     377                 :            : 
     378         [ #  # ]:          0 :             if( mxScannerManager.is() )
     379                 :            :             {
     380                 :            :                 try
     381                 :            :                 {
     382 [ #  # ][ #  # ]:          0 :                     const ::com::sun::star::uno::Sequence< ::com::sun::star::scanner::ScannerContext > aContexts( mxScannerManager->getAvailableScanners() );
     383                 :            : 
     384         [ #  # ]:          0 :                     if( aContexts.getLength() )
     385                 :            :                     {
     386 [ #  # ][ #  # ]:          0 :                         mxScannerManager->startScan( aContexts.getConstArray()[ 0 ], mxScannerListener );
     387                 :          0 :                         bDone = sal_True;
     388         [ #  # ]:          0 :                     }
     389                 :            :                 }
     390                 :          0 :                 catch( ... )
     391                 :            :                 {
     392                 :            :                 }
     393                 :            :             }
     394                 :            : 
     395         [ #  # ]:          0 :             if( !bDone )
     396                 :            :             {
     397                 :            : #ifndef UNX
     398                 :            :                 const sal_uInt16 nId = STR_TWAIN_NO_SOURCE;
     399                 :            : #else
     400                 :          0 :                 const sal_uInt16 nId = STR_TWAIN_NO_SOURCE_UNX;
     401                 :            : #endif
     402                 :            : 
     403                 :          0 :                 ::sd::Window* pWindow = GetActiveWindow();
     404 [ #  # ][ #  # ]:          0 :                 InfoBox(pWindow, String( SdResId( nId ) ) ).Execute();
         [ #  # ][ #  # ]
                 [ #  # ]
     405                 :            :             }
     406                 :            :             else
     407                 :            :             {
     408                 :          0 :                 SfxBindings& rBindings = GetViewFrame()->GetBindings();
     409                 :          0 :                 rBindings.Invalidate( SID_TWAIN_SELECT );
     410                 :          0 :                 rBindings.Invalidate( SID_TWAIN_TRANSFER );
     411                 :            :             }
     412                 :            : 
     413                 :          0 :             Cancel();
     414                 :          0 :             rReq.Done();
     415                 :            :         }
     416                 :          0 :         break;
     417                 :            : 
     418                 :            :         case SID_POLYGON_MORPHING:
     419                 :            :         {
     420         [ #  # ]:          0 :             SetCurrentFunction( FuMorph::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     421                 :          0 :             Cancel();
     422                 :            :         }
     423                 :          0 :         break;
     424                 :            : 
     425                 :            :         case SID_VECTORIZE:
     426                 :            :         {
     427         [ #  # ]:          0 :             SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
     428                 :          0 :             Cancel();
     429                 :            :         }
     430                 :          0 :         break;
     431                 :            : 
     432                 :            :         default:
     433                 :            :         {
     434                 :            :             // switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die
     435                 :            :             // eine Fu???? -Funktion aufrufen, sind in die Methode FuTemp01 (drviews8),
     436                 :            :             // FuTemp02 (drviewsb) gewandert.
     437                 :          0 :             FuTemp02(rReq);
     438                 :            :         }
     439                 :          0 :         break;
     440                 :            :     }
     441                 :          0 : }
     442                 :            : 
     443                 :            : /*************************************************************************
     444                 :            : |*
     445                 :            : |* Scanner-Event
     446                 :            : |*
     447                 :            : \************************************************************************/
     448                 :            : 
     449                 :          0 : void DrawViewShell::ScannerEvent( const ::com::sun::star::lang::EventObject& )
     450                 :            : {
     451         [ #  # ]:          0 :     if( mxScannerManager.is() )
     452                 :            :     {
     453 [ #  # ][ #  # ]:          0 :         const ::com::sun::star::scanner::ScannerContext aContext( mxScannerManager->getAvailableScanners().getConstArray()[ 0 ] );
                 [ #  # ]
     454 [ #  # ][ #  # ]:          0 :         const ::com::sun::star::scanner::ScanError      eError = mxScannerManager->getError( aContext );
     455                 :            : 
     456         [ #  # ]:          0 :         if( ::com::sun::star::scanner::ScanError_ScanErrorNone == eError )
     457                 :            :         {
     458 [ #  # ][ #  # ]:          0 :             const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBitmap( mxScannerManager->getBitmap( aContext ) );
     459                 :            : 
     460         [ #  # ]:          0 :             if( xBitmap.is() )
     461                 :            :             {
     462         [ #  # ]:          0 :                 const BitmapEx aScanBmp( VCLUnoHelper::GetBitmap( xBitmap ) );
     463                 :            : 
     464         [ #  # ]:          0 :                 if( !!aScanBmp )
     465                 :            :                 {
     466         [ #  # ]:          0 :                     const SolarMutexGuard aGuard;
     467                 :          0 :                     SdrPage*            pPage = mpDrawView->GetSdrPageView()->GetPage();
     468         [ #  # ]:          0 :                     Size                aBmpSize( aScanBmp.GetPrefSize() ), aPageSize( pPage->GetSize() );
     469         [ #  # ]:          0 :                     const MapMode       aMap100( MAP_100TH_MM );
     470                 :            : 
     471 [ #  # ][ #  # ]:          0 :                     if( !aBmpSize.Width() || !aBmpSize.Height() )
                 [ #  # ]
     472                 :          0 :                         aBmpSize = aScanBmp.GetSizePixel();
     473                 :            : 
     474         [ #  # ]:          0 :                     if( aScanBmp.GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
     475 [ #  # ][ #  # ]:          0 :                         aBmpSize = GetActiveWindow()->PixelToLogic( aBmpSize, aMap100 );
     476                 :            :                     else
     477         [ #  # ]:          0 :                         aBmpSize = OutputDevice::LogicToLogic( aBmpSize, aScanBmp.GetPrefMapMode(), aMap100 );
     478                 :            : 
     479 [ #  # ][ #  # ]:          0 :                     aPageSize.Width() -= pPage->GetLftBorder() + pPage->GetRgtBorder();
     480 [ #  # ][ #  # ]:          0 :                     aPageSize.Height() -= pPage->GetUppBorder() + pPage->GetLwrBorder();
     481                 :            : 
     482 [ #  # ][ #  # ]:          0 :                     if( ( ( aBmpSize.Height() > aPageSize.Height() ) || ( aBmpSize.Width() > aPageSize.Width() ) ) && aBmpSize.Height() && aPageSize.Height() )
         [ #  # ][ #  # ]
                 [ #  # ]
     483                 :            :                     {
     484                 :          0 :                         double fGrfWH = (double) aBmpSize.Width() / aBmpSize.Height();
     485                 :          0 :                         double fWinWH = (double) aPageSize.Width() / aPageSize.Height();
     486                 :            : 
     487         [ #  # ]:          0 :                         if( fGrfWH < fWinWH )
     488                 :            :                         {
     489                 :          0 :                             aBmpSize.Width() = FRound( aPageSize.Height() * fGrfWH );
     490                 :          0 :                             aBmpSize.Height()= aPageSize.Height();
     491                 :            :                         }
     492         [ #  # ]:          0 :                         else if( fGrfWH > 0.F )
     493                 :            :                         {
     494                 :          0 :                             aBmpSize.Width() = aPageSize.Width();
     495                 :          0 :                             aBmpSize.Height()= FRound( aPageSize.Width() / fGrfWH );
     496                 :            :                         }
     497                 :            :                     }
     498                 :            : 
     499                 :          0 :                     Point aPnt ( ( aPageSize.Width() - aBmpSize.Width() ) >> 1, ( aPageSize.Height() - aBmpSize.Height() ) >> 1 );
     500 [ #  # ][ #  # ]:          0 :                     aPnt += Point( pPage->GetLftBorder(), pPage->GetUppBorder() );
     501         [ #  # ]:          0 :                     Rectangle   aRect( aPnt, aBmpSize );
     502                 :          0 :                     SdrGrafObj* pGrafObj = NULL;
     503                 :          0 :                     sal_Bool        bInsertNewObject = sal_True;
     504                 :            : 
     505         [ #  # ]:          0 :                     if( GetView()->AreObjectsMarked() )
     506                 :            :                     {
     507                 :          0 :                         const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
     508                 :            : 
     509         [ #  # ]:          0 :                         if( rMarkList.GetMarkCount() == 1 )
     510                 :            :                         {
     511         [ #  # ]:          0 :                             SdrMark*    pMark = rMarkList.GetMark(0);
     512         [ #  # ]:          0 :                             SdrObject*  pObj = pMark->GetMarkedSdrObj();
     513                 :            : 
     514 [ #  # ][ #  # ]:          0 :                             if( pObj->ISA( SdrGrafObj ) )
                 [ #  # ]
     515                 :            :                             {
     516                 :          0 :                                 pGrafObj = static_cast< SdrGrafObj* >( pObj );
     517                 :            : 
     518 [ #  # ][ #  # ]:          0 :                                 if( pGrafObj->IsEmptyPresObj() )
     519                 :            :                                 {
     520                 :          0 :                                     bInsertNewObject = sal_False;
     521         [ #  # ]:          0 :                                     pGrafObj->SetEmptyPresObj(sal_False);
     522         [ #  # ]:          0 :                                     pGrafObj->SetOutlinerParaObject(NULL);
     523 [ #  # ][ #  # ]:          0 :                                     pGrafObj->SetGraphic( Graphic( aScanBmp ) );
                 [ #  # ]
     524                 :            :                                 }
     525                 :            :                             }
     526                 :            :                         }
     527                 :            :                     }
     528                 :            : 
     529         [ #  # ]:          0 :                     if( bInsertNewObject )
     530                 :            :                     {
     531 [ #  # ][ #  # ]:          0 :                         pGrafObj = new SdrGrafObj( Graphic( aScanBmp ), aRect );
         [ #  # ][ #  # ]
     532                 :          0 :                         SdrPageView* pPV = GetView()->GetSdrPageView();
     533         [ #  # ]:          0 :                         GetView()->InsertObjectAtView( pGrafObj, *pPV, SDRINSERT_SETDEFLAYER );
     534 [ #  # ][ #  # ]:          0 :                     }
     535         [ #  # ]:          0 :                 }
     536                 :          0 :             }
     537                 :          0 :         }
     538                 :            :     }
     539                 :            : 
     540                 :          0 :     SfxBindings& rBindings = GetViewFrame()->GetBindings();
     541                 :          0 :     rBindings.Invalidate( SID_TWAIN_SELECT );
     542                 :          0 :     rBindings.Invalidate( SID_TWAIN_TRANSFER );
     543                 :          0 : }
     544                 :            : 
     545                 :            : } // end of namespace sd
     546                 :            : 
     547                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10