2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 19:29:00 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 19:29:00 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 19:29:00 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 19:29:00 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 19:29:00 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-10 19:29:00 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 17:58:23 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sd.hxx"
|
|
|
|
|
2004-01-20 12:42:42 +00:00
|
|
|
|
|
|
|
#include "fuvect.hxx"
|
2004-01-06 17:46:08 +00:00
|
|
|
#include <tools/poly.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <svx/svdograf.hxx>
|
|
|
|
#include <vcl/msgbox.hxx>
|
|
|
|
#include <svx/svdograf.hxx>
|
|
|
|
#include <svx/svdedtv.hxx>
|
|
|
|
|
|
|
|
|
2004-01-20 12:42:42 +00:00
|
|
|
#include "View.hxx"
|
|
|
|
#include "ViewShell.hxx"
|
|
|
|
#include "Window.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "strings.hrc"
|
|
|
|
#include "sdresid.hxx"
|
2006-12-12 16:26:45 +00:00
|
|
|
#include "sdabstdlg.hxx"
|
|
|
|
|
|
|
|
namespace sd
|
|
|
|
{
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
TYPEINIT1( FuVectorize, FuPoor );
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Konstruktor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2004-01-20 12:42:42 +00:00
|
|
|
FuVectorize::FuVectorize (
|
|
|
|
ViewShell* pViewSh,
|
|
|
|
::sd::Window* pWin,
|
|
|
|
::sd::View* pView,
|
|
|
|
SdDrawDocument* pDoc,
|
|
|
|
SfxRequest& rReq)
|
|
|
|
: FuPoor (pViewSh, pWin, pView, pDoc, rReq)
|
2005-12-14 16:06:14 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
FunctionReference FuVectorize::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
|
|
|
|
{
|
|
|
|
FunctionReference xFunc( new FuVectorize( pViewSh, pWin, pView, pDoc, rReq ) );
|
|
|
|
xFunc->DoExecute(rReq);
|
|
|
|
return xFunc;
|
|
|
|
}
|
|
|
|
|
2006-12-12 16:26:45 +00:00
|
|
|
void FuVectorize::DoExecute( SfxRequest& )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-12-12 16:26:45 +00:00
|
|
|
const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( rMarkList.GetMarkCount() == 1 )
|
|
|
|
{
|
2006-07-25 10:43:16 +00:00
|
|
|
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( pObj && pObj->ISA( SdrGrafObj ) )
|
|
|
|
{
|
2005-12-14 16:06:14 +00:00
|
|
|
SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
|
2006-12-12 16:26:45 +00:00
|
|
|
AbstractSdVectorizeDlg* pDlg = pFact ? pFact->CreateSdVectorizeDlg( mpWindow, ( (SdrGrafObj*) pObj )->GetGraphic().GetBitmap(), mpDocSh ) : 0;
|
2005-12-14 16:06:14 +00:00
|
|
|
if( pDlg && pDlg->Execute() == RET_OK )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-12-12 16:26:45 +00:00
|
|
|
const GDIMetaFile& rMtf = pDlg->GetGDIMetaFile();
|
|
|
|
SdrPageView* pPageView = mpView->GetSdrPageView();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if( pPageView && rMtf.GetActionCount() )
|
|
|
|
{
|
|
|
|
SdrGrafObj* pVectObj = (SdrGrafObj*) pObj->Clone();
|
2006-12-12 16:26:45 +00:00
|
|
|
String aStr( mpView->GetDescriptionOfMarkedObjects() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
aStr.Append( sal_Unicode(' ') );
|
|
|
|
aStr.Append( String( SdResId( STR_UNDO_VECTORIZE ) ) );
|
2006-12-12 16:26:45 +00:00
|
|
|
mpView->BegUndo( aStr );
|
2000-09-18 16:07:07 +00:00
|
|
|
pVectObj->SetGraphic( rMtf );
|
2006-12-12 16:26:45 +00:00
|
|
|
mpView->ReplaceObjectAtView( pObj, *pPageView, pVectObj );
|
|
|
|
mpView->EndUndo();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2005-12-14 16:06:14 +00:00
|
|
|
delete pDlg;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-20 12:42:42 +00:00
|
|
|
} // end of namespace sd
|