[Libreoffice-commits] core.git: sd/source svtools/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Jun 28 10:50:00 UTC 2016
sd/source/ui/view/drviews2.cxx | 6 +++---
svtools/source/graphic/grfcache.cxx | 8 ++++++++
2 files changed, 11 insertions(+), 3 deletions(-)
New commits:
commit f7d6f3e4e3fda3cd4936880918e2831246634a3e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Jun 28 11:15:19 2016 +0200
svtools: survive swapout/in of graphic with embedded pdf
Use case is to insert a pdf file in Impress, then choose Save from the
context menu of the image. On one hand, for some reason only bitmap
images can be saved, so add an exception for the graphic-with-pdf case.
SVG is not affected, as it counts as bitmap with its PNG replacement
image, it seems.
On the other hand, copying the GraphicObject around triggers
swapout/swapin of the graphic, and there the original pdf data was lost,
fix that.
Change-Id: I8b4b67cd951e39b0250a101766f487ddb1088cab
Reviewed-on: https://gerrit.libreoffice.org/26739
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index b603583..bec691d 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -926,10 +926,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
if( rMarkList.GetMarkCount() == 1 )
{
- SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
- if( pObj && dynamic_cast< const SdrGrafObj *>( pObj ) != nullptr && static_cast<SdrGrafObj*>(pObj)->GetGraphicType() == GraphicType::Bitmap )
+ const SdrGrafObj* pObj = dynamic_cast<const SdrGrafObj*>(rMarkList.GetMark(0)->GetMarkedSdrObj());
+ if (pObj && (pObj->GetGraphicType() == GraphicType::Bitmap || pObj->GetGraphicObject().GetGraphic().getPdfData().hasElements()))
{
- GraphicObject aGraphicObject( static_cast<SdrGrafObj*>( pObj )->GetGraphicObject() );
+ GraphicObject aGraphicObject(pObj->GetGraphicObject());
{
GraphicHelper::ExportGraphic( aGraphicObject.GetGraphic(), "" );
}
diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx
index fa3f9bf..43f4d07 100644
--- a/svtools/source/graphic/grfcache.cxx
+++ b/svtools/source/graphic/grfcache.cxx
@@ -34,6 +34,8 @@
#define MAX_BMP_EXTENT 4096
+using namespace com::sun::star;
+
static const char aHexData[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
class GraphicID
@@ -155,6 +157,7 @@ private:
// SvgData support
SvgDataPtr maSvgData;
+ uno::Sequence<sal_Int8> maPdfData;
bool ImplInit( const GraphicObject& rObj );
void ImplFillSubstitute( Graphic& rSubstitute );
@@ -247,6 +250,8 @@ bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj )
case GraphicType::GdiMetafile:
{
mpMtf = new GDIMetaFile( rGraphic.GetGDIMetaFile() );
+ if (rGraphic.getPdfData().hasElements())
+ maPdfData = rGraphic.getPdfData();
}
break;
@@ -293,6 +298,8 @@ void GraphicCacheEntry::ImplFillSubstitute( Graphic& rSubstitute )
else if( mpMtf )
{
rSubstitute = *mpMtf;
+ if (maPdfData.hasElements())
+ rSubstitute.setPdfData(maPdfData);
}
else
{
@@ -379,6 +386,7 @@ void GraphicCacheEntry::GraphicObjectWasSwappedOut( const GraphicObject& /*rObj*
// #119176# also reset SvgData
maSvgData.reset();
+ maPdfData = uno::Sequence<sal_Int8>();
}
}
More information about the Libreoffice-commits
mailing list