diff options
Diffstat (limited to 'sd/source/ui/view/drviews2.cxx')
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 68 |
1 files changed, 41 insertions, 27 deletions
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 53e3a760036c..1ac1f0dbace8 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1,31 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. +/* + * This file is part of the LibreOffice project. * - * 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. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. * - * 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). + * This file incorporates work covered by the following license notice: * - * 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. - * - ************************************************************************/ - + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ #include "DrawViewShell.hxx" #include "ViewShellImplementation.hxx" @@ -679,7 +669,9 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) else { if( mpDrawView->IsVectorizeAllowed() ) + { SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); + } else { WaitObject aWait( (Window*)GetActiveWindow() ); @@ -752,7 +744,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { // switch on undo for the next operations mpDrawView->BegUndo( String( SdResId( STR_UNDO_CONVERT_TO_METAFILE ))); - GDIMetaFile aMetaFile(mpDrawView->GetAllMarkedMetaFile ()); + GDIMetaFile aMetaFile(mpDrawView->GetMarkedObjMetaFile()); aGraphic = Graphic(aMetaFile); } break; @@ -760,8 +752,30 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) { // switch on undo for the next operations mpDrawView->BegUndo( String( SdResId( STR_UNDO_CONVERT_TO_BITMAP ))); - Bitmap aBitmap (mpDrawView->GetAllMarkedBitmap ()); - aGraphic = Graphic(aBitmap); + bool bDone(false); + + // I have to get the image here directly since GetMarkedObjBitmapEx works + // based on Bitmaps, but not on BitmapEx, thus throwing away the alpha + // channel. Argh! GetMarkedObjBitmapEx itself is too widely used to safely + // change that, e.g. in the exchange formats. For now I can only add this + // exception to get good results for Svgs. This is how the code gets more + // and more crowded, at last I made a remark for myself to change this + // as one of the next tasks. + if(1 == mpDrawView->GetMarkedObjectCount()) + { + const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(mpDrawView->GetMarkedObjectByIndex(0)); + + if(pSdrGrafObj && pSdrGrafObj->isEmbeddedSvg()) + { + aGraphic = Graphic(pSdrGrafObj->GetGraphic().getSvgData()->getReplacement()); + bDone = true; + } + } + + if(!bDone) + { + aGraphic = Graphic(mpDrawView->GetMarkedObjBitmapEx()); + } } break; } |