LCOV - code coverage report
Current view: top level - sd/source/ui/func - fuvect.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 29 3.4 %
Date: 2015-06-13 12:38:46 Functions: 2 10 20.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "fuvect.hxx"
      21             : #include <tools/poly.hxx>
      22             : #include <svx/svdograf.hxx>
      23             : #include <vcl/msgbox.hxx>
      24             : #include <svx/svdedtv.hxx>
      25             : 
      26             : #include "View.hxx"
      27             : #include "ViewShell.hxx"
      28             : #include "Window.hxx"
      29             : #include "strings.hrc"
      30             : #include "sdresid.hxx"
      31             : #include "sdabstdlg.hxx"
      32             : #include <boost/scoped_ptr.hpp>
      33             : 
      34             : namespace sd
      35             : {
      36             : 
      37           0 : TYPEINIT1( FuVectorize, FuPoor );
      38             : 
      39           0 : FuVectorize::FuVectorize (
      40             :     ViewShell* pViewSh,
      41             :     ::sd::Window* pWin,
      42             :     ::sd::View* pView,
      43             :     SdDrawDocument* pDoc,
      44             :     SfxRequest& rReq)
      45           0 :     : FuPoor (pViewSh, pWin, pView, pDoc, rReq)
      46             : {
      47           0 : }
      48             : 
      49           0 : rtl::Reference<FuPoor> FuVectorize::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
      50             : {
      51           0 :     rtl::Reference<FuPoor> xFunc( new FuVectorize( pViewSh, pWin, pView, pDoc, rReq ) );
      52           0 :     xFunc->DoExecute(rReq);
      53           0 :     return xFunc;
      54             : }
      55             : 
      56           0 : void FuVectorize::DoExecute( SfxRequest& )
      57             : {
      58           0 :     const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
      59             : 
      60           0 :     if( rMarkList.GetMarkCount() == 1 )
      61             :     {
      62           0 :         SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
      63             : 
      64           0 :         if( pObj && pObj->ISA( SdrGrafObj ) )
      65             :         {
      66           0 :             SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
      67           0 :             boost::scoped_ptr<AbstractSdVectorizeDlg> pDlg(pFact ? pFact->CreateSdVectorizeDlg( mpWindow, static_cast<SdrGrafObj*>( pObj )->GetGraphic().GetBitmap(), mpDocSh ) : 0);
      68           0 :             if( pDlg && pDlg->Execute() == RET_OK )
      69             :             {
      70           0 :                 const GDIMetaFile&  rMtf = pDlg->GetGDIMetaFile();
      71           0 :                 SdrPageView*        pPageView = mpView->GetSdrPageView();
      72             : 
      73           0 :                 if( pPageView && rMtf.GetActionSize() )
      74             :                 {
      75           0 :                     SdrGrafObj* pVectObj = static_cast<SdrGrafObj*>( pObj->Clone() );
      76           0 :                     OUString aStr( mpView->GetDescriptionOfMarkedObjects() );
      77           0 :                     aStr += " " + SD_RESSTR( STR_UNDO_VECTORIZE );
      78           0 :                     mpView->BegUndo( aStr );
      79           0 :                     pVectObj->SetGraphic( rMtf );
      80           0 :                     mpView->ReplaceObjectAtView( pObj, *pPageView, pVectObj );
      81           0 :                     mpView->EndUndo();
      82             :                 }
      83           0 :             }
      84             :         }
      85             :     }
      86           0 : }
      87             : 
      88          66 : } // end of namespace sd
      89             : 
      90             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11