incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1396082 - in /incubator/ooo/trunk/main: filter/source/msfilter/escherex.cxx sd/source/filter/eppt/eppt.cxx sd/source/filter/eppt/eppt.hxx
Date Tue, 09 Oct 2012 15:41:38 GMT
Author: alg
Date: Tue Oct  9 15:41:38 2012
New Revision: 1396082

URL: http://svn.apache.org/viewvc?rev=1396082&view=rev
Log:
#121183# enhance export of hatch masterpagebackgrund for ppt format

Modified:
    incubator/ooo/trunk/main/filter/source/msfilter/escherex.cxx
    incubator/ooo/trunk/main/sd/source/filter/eppt/eppt.cxx
    incubator/ooo/trunk/main/sd/source/filter/eppt/eppt.hxx

Modified: incubator/ooo/trunk/main/filter/source/msfilter/escherex.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/msfilter/escherex.cxx?rev=1396082&r1=1396081&r2=1396082&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/msfilter/escherex.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/msfilter/escherex.cxx Tue Oct  9 15:41:38 2012
@@ -1416,26 +1416,30 @@ sal_Bool EscherPropertyContainer::Create
 
 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 );
+    // #121183# 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());
 
-    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 ) ) );
+    return GraphicObject(Graphic(aMtf));
 }
 
 } // namespace
@@ -1443,7 +1447,8 @@ GraphicObject lclDrawHatch( const ::com:
 
 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
);
     ByteString aUniqueId = aGraphicObject.GetUniqueID();
     sal_Bool bRetValue = ImplCreateEmbeddedBmp( aUniqueId );
     if ( bRetValue )
@@ -1544,7 +1549,9 @@ sal_Bool EscherPropertyContainer::Create
                 {
                     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;

Modified: incubator/ooo/trunk/main/sd/source/filter/eppt/eppt.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sd/source/filter/eppt/eppt.cxx?rev=1396082&r1=1396081&r2=1396082&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sd/source/filter/eppt/eppt.cxx (original)
+++ incubator/ooo/trunk/main/sd/source/filter/eppt/eppt.cxx Tue Oct  9 15:41:38 2012
@@ -172,6 +172,7 @@ PPTWriter::PPTWriter( const std::vector<
     if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Height"
) ) ) )
         mAny >>= nHeight;
     maDestPageSize = ImplMapSize( ::com::sun::star::awt::Size( nWidth, nHeight ) );
+    maPageSize = Size(nWidth, nHeight);
 
     mrStg = rSvStorage;
     if ( !mrStg.Is() )
@@ -1704,8 +1705,10 @@ void PPTWriter::ImplWriteBackground( ::c
 
     mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
     mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 );                     //
Flags: Connector | Background | HasSpt
-    Point aEmptyPoint = Point();
-    Rectangle aRect( aEmptyPoint, Size( 28000, 21000 ) );
+
+    // #121183# Use real PageSize in 100th mm
+    Rectangle aRect(Point(0, 0), maPageSize);
+
     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 );

Modified: incubator/ooo/trunk/main/sd/source/filter/eppt/eppt.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sd/source/filter/eppt/eppt.hxx?rev=1396082&r1=1396081&r2=1396082&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sd/source/filter/eppt/eppt.hxx (original)
+++ incubator/ooo/trunk/main/sd/source/filter/eppt/eppt.hxx Tue Oct  9 15:41:38 2012
@@ -689,6 +689,7 @@ class PPTWriter : public GroupTable, pub
 		MapMode							maMapModeSrc;
 		MapMode							maMapModeDest;
 		::com::sun::star::awt::Size		maDestPageSize;
+        Size                            maPageSize; // #121183# Keep size in logic coordinates
(100th mm)
 		::com::sun::star::awt::Size		maNotesPageSize;
 		PageType						meLatestPageType;
 		List							maSlideNameList;



Mime
View raw message