summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-10-09 14:41:38 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-06-11 11:30:59 +0100
commitdbc7c605d65cc2dc37af3d2077ac553754bc4f7d (patch)
treecf43716f48910dbc275cec2bfd39bb498a011ffc
parent45d011ba375c469771ef652c25bd42ce85d3071f (diff)
Resolves: #i121183# enhance export of ppt hatch masterpagebackground
(cherry picked from commit 60f299f255a8a2fd2c4aabde6933d4388af3643b) Conflicts: filter/source/msfilter/escherex.cxx sd/source/filter/eppt/eppt.cxx sd/source/filter/eppt/eppt.hxx Change-Id: I62d772ab67ed03bfa964040bd07b3684cf2dee8f
-rw-r--r--filter/source/msfilter/escherex.cxx49
-rw-r--r--sd/source/filter/eppt/eppt.cxx6
-rw-r--r--sd/source/filter/eppt/epptbase.hxx1
-rw-r--r--sd/source/filter/eppt/pptx-epptbase.cxx1
4 files changed, 34 insertions, 23 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index c53008162a77..a517f32a14d0 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1389,26 +1389,30 @@ sal_Bool EscherPropertyContainer::CreateEmbeddedBitmapProperties(
namespace {
-GraphicObject lclDrawHatch( const ::com::sun::star::drawing::Hatch& rHatch, const Color& rBackColor, bool bFillBackground )
+GraphicObject lclDrawHatch( const ::com::sun::star::drawing::Hatch& rHatch, const Color& rBackColor, bool bFillBackground, const Rectangle& rRect )
{
- const MapMode aMap100( MAP_100TH_MM );
- VirtualDevice aVDev( *Application::GetDefaultDevice(), 0, 1 );
- aVDev.SetMapMode( aMap100 );
-
- const Size aOutSize = aVDev.PixelToLogic( Size( 28, 28 ) );
- aVDev.SetOutputSize( aOutSize );
-
- Rectangle aRectangle( Point( 0, 0 ), aOutSize );
- const PolyPolygon aPolyPoly( aRectangle );
-
- aVDev.SetLineColor();
- aVDev.SetFillColor( bFillBackground ? rBackColor : Color( COL_TRANSPARENT ) );
- aVDev.DrawRect( Rectangle( Point(), aOutSize ) );
-
- Hatch aVclHatch( (HatchStyle) rHatch.Style, Color( rHatch.Color ), rHatch.Distance, (sal_uInt16)rHatch.Angle );
- aVDev.DrawHatch( aPolyPoly, aVclHatch );
-
- return GraphicObject( Graphic( aVDev.GetBitmapEx( Point(), aOutSize ) ) );
+ // #i121183# For hatch, do no longer create a bitmap with the fixed size of 28x28 pixels. Also
+ // do not create a bitmap in page size, that would explode file sizes (and have no good quality).
+ // Better use a MetaFile graphic in page size; thus we have good quality due to vector format and
+ // no bit file sizes.
+ VirtualDevice aOut;
+ GDIMetaFile aMtf;
+
+ aOut.SetOutputSizePixel(Size(2, 2));
+ aOut.EnableOutput(false);
+ aOut.SetMapMode(MapMode(MAP_100TH_MM));
+ aMtf.Clear();
+ aMtf.Record(&aOut);
+ aOut.SetLineColor();
+ aOut.SetFillColor(bFillBackground ? rBackColor : Color(COL_TRANSPARENT));
+ aOut.DrawRect(rRect);
+ aOut.DrawHatch(PolyPolygon(rRect), Hatch((HatchStyle)rHatch.Style, Color(rHatch.Color), rHatch.Distance, (sal_uInt16)rHatch.Angle));
+ aMtf.Stop();
+ aMtf.WindStart();
+ aMtf.SetPrefMapMode(MapMode(MAP_100TH_MM));
+ aMtf.SetPrefSize(rRect.GetSize());
+
+ return GraphicObject(Graphic(aMtf));
}
} // namespace
@@ -1416,7 +1420,8 @@ GraphicObject lclDrawHatch( const ::com::sun::star::drawing::Hatch& rHatch, cons
sal_Bool EscherPropertyContainer::CreateEmbeddedHatchProperties( const ::com::sun::star::drawing::Hatch& rHatch, const Color& rBackColor, bool bFillBackground )
{
- GraphicObject aGraphicObject = lclDrawHatch( rHatch, rBackColor, bFillBackground );
+ const Rectangle aRect(pShapeBoundRect ? *pShapeBoundRect : Rectangle(Point(0,0), Size(28000, 21000)));
+ GraphicObject aGraphicObject = lclDrawHatch( rHatch, rBackColor, bFillBackground, aRect );
OString aUniqueId = aGraphicObject.GetUniqueID();
sal_Bool bRetValue = ImplCreateEmbeddedBmp( aUniqueId );
if ( bRetValue )
@@ -1515,7 +1520,9 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties(
{
aAny >>= bFillBackground;
}
- aGraphicObject = lclDrawHatch( aHatch, aBackColor, bFillBackground );
+
+ const Rectangle aRect(Point(0, 0), pShapeBoundRect ? pShapeBoundRect->GetSize() : Size(28000, 21000));
+ aGraphicObject = lclDrawHatch( aHatch, aBackColor, bFillBackground, aRect );
aUniqueId = aGraphicObject.GetUniqueID();
eBitmapMode = ::com::sun::star::drawing::BitmapMode_REPEAT;
bIsGraphicMtf = aGraphicObject.GetType() == GRAPHIC_GDIMETAFILE;
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index dc0593837b2a..861d06abbf0f 100644
--- a/sd/source/filter/eppt/eppt.cxx
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -1202,8 +1202,10 @@ void PPTWriter::ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::su
mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt
- Point aEmptyPoint = Point();
- Rectangle aRect( aEmptyPoint, Size( 28000, 21000 ) );
+
+ // #i121183# Use real PageSize in 100th mm
+ Rectangle aRect(Point(0, 0), Size(maPageSize.Width, maPageSize.Height));
+
EscherPropertyContainer aPropOpt( mpPptEscherEx->GetGraphicProvider(), mpPicStrm, aRect );
aPropOpt.AddOpt( ESCHER_Prop_fillType, ESCHER_FillSolid );
::com::sun::star::drawing::FillStyle aFS( ::com::sun::star::drawing::FillStyle_NONE );
diff --git a/sd/source/filter/eppt/epptbase.hxx b/sd/source/filter/eppt/epptbase.hxx
index f84360db01d6..212e3e3d64d0 100644
--- a/sd/source/filter/eppt/epptbase.hxx
+++ b/sd/source/filter/eppt/epptbase.hxx
@@ -353,6 +353,7 @@ protected:
MapMode maMapModeSrc;
MapMode maMapModeDest;
::com::sun::star::awt::Size maDestPageSize;
+ ::com::sun::star::awt::Size maPageSize; // #i121183# Keep size in logic coordinates (100th mm)
::com::sun::star::awt::Size maNotesPageSize;
PageType meLatestPageType;
diff --git a/sd/source/filter/eppt/pptx-epptbase.cxx b/sd/source/filter/eppt/pptx-epptbase.cxx
index 8e9ff5c4fbc7..7f829e9b3b5b 100644
--- a/sd/source/filter/eppt/pptx-epptbase.cxx
+++ b/sd/source/filter/eppt/pptx-epptbase.cxx
@@ -197,6 +197,7 @@ void PPTWriterBase::exportPPT( const std::vector< com::sun::star::beans::Propert
if ( ImplGetPropertyValue( mXPagePropSet, OUString( "Height" ) ) )
mAny >>= nHeight;
maDestPageSize = MapSize( awt::Size( nWidth, nHeight ) );
+ maPageSize = awt::Size(nWidth, nHeight);
DBG(printf( "call exportDocumentPre()\n"));
exportPPTPre(rMediaData);