LibreOffice Module sd (master) 1
fuvect.cxx
Go to the documentation of this file.
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 <svx/svdograf.hxx>
22
23#include <View.hxx>
24#include <Window.hxx>
25#include <strings.hrc>
26#include <sdresid.hxx>
27#include <sdabstdlg.hxx>
28
29namespace sd
30{
31
32
34 ViewShell* pViewSh,
35 ::sd::Window* pWin,
36 ::sd::View* pView,
37 SdDrawDocument* pDoc,
38 SfxRequest& rReq)
39 : FuPoor (pViewSh, pWin, pView, pDoc, rReq)
40{
41}
42
44{
45 rtl::Reference<FuPoor> xFunc( new FuVectorize( pViewSh, pWin, pView, pDoc, rReq ) );
46 xFunc->DoExecute(rReq);
47 return xFunc;
48}
49
51{
52 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
53
54 if( rMarkList.GetMarkCount() != 1 )
55 return;
56
57 SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
58
59 auto pSdrGrafObj = dynamic_cast< const SdrGrafObj *>( pObj );
60 if( !pSdrGrafObj )
61 return;
62
65 pFact->CreateSdVectorizeDlg(mpWindow ? mpWindow->GetFrameWeld() : nullptr,
66 pSdrGrafObj->GetGraphic().GetBitmapEx().GetBitmap(), mpDocSh ) );
67 if( pDlg->Execute() != RET_OK )
68 return;
69
70 const GDIMetaFile& rMtf = pDlg->GetGDIMetaFile();
71 SdrPageView* pPageView = mpView->GetSdrPageView();
72
73 if( pPageView && rMtf.GetActionSize() )
74 {
77 " " + SdResId( STR_UNDO_VECTORIZE );
79 pVectObj->SetGraphic( rMtf );
80 mpView->ReplaceObjectAtView( pObj, *pPageView, pVectObj.get() );
81 mpView->EndUndo();
82 }
83}
84
85} // end of namespace sd
86
87/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
size_t GetActionSize() const
virtual VclPtr< AbstractSdVectorizeDlg > CreateSdVectorizeDlg(weld::Window *pParent, const Bitmap &rBmp, ::sd::DrawDocShell *pDocShell)=0
static SD_DLLPUBLIC SdAbstractDialogFactory * Create()
Definition: sdabstdlg.cxx:38
void ReplaceObjectAtView(SdrObject *pOldObj, SdrPageView &rPV, SdrObject *pNewObj, bool bMark=true)
void BegUndo()
void EndUndo()
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
OUString const & GetDescriptionOfMarkedObjects() const
SdrObject * GetMarkedSdrObj() const
static rtl::Reference< T > Clone(T const &rObj, SdrModel &rTargetModel)
SdrModel & getSdrModelFromSdrObject() const
SdrPageView * GetSdrPageView() const
Base class for all functions.
Definition: fupoor.hxx:48
VclPtr< ::sd::Window > mpWindow
Definition: fupoor.hxx:146
DrawDocShell * mpDocSh
Definition: fupoor.hxx:147
::sd::View * mpView
Definition: fupoor.hxx:144
virtual void DoExecute(SfxRequest &rReq) override
Definition: fuvect.cxx:50
FuVectorize(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq)
Definition: fuvect.cxx:33
static rtl::Reference< FuPoor > Create(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq)
Definition: fuvect.cxx:43
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
aStr
OUString SdResId(TranslateId aId)
Definition: sdmod.cxx:83
RET_OK