You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2014/07/04 10:34:31 UTC

svn commit: r1607796 - in /openoffice/branches/AOO410/main/sw: ./ source/core/doc/notxtfrm.cxx

Author: alg
Date: Fri Jul  4 08:34:30 2014
New Revision: 1607796

URL: http://svn.apache.org/r1607796
Log:
i125171 support lossless embedding of linked jpegs in writer for PDF export

Modified:
    openoffice/branches/AOO410/main/sw/   (props changed)
    openoffice/branches/AOO410/main/sw/source/core/doc/notxtfrm.cxx

Propchange: openoffice/branches/AOO410/main/sw/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Fri Jul  4 08:34:30 2014
@@ -0,0 +1,5 @@
+/openoffice/branches/AOO400/main/sw:1503684
+/openoffice/branches/ia2/main/sw:1417739-1541842
+/openoffice/branches/ooxml-osba/main/sw:1546391,1546395,1546574,1546934,1547030,1547392,1551920,1551954,1551958,1552283
+/openoffice/branches/rejuvenate01/main/sw:1480411,1534063,1534098,1536312,1549902,1560617
+/openoffice/trunk/main/sw:1571617,1571677,1572569,1572577,1574058,1574101,1575922,1576216,1576748,1578786,1579934,1580657,1580779,1581746,1581840,1582359,1582365,1582709,1583336,1583418,1583589,1583988,1585261,1586242,1586249,1586583,1587468,1589050,1592692,1592716,1594206,1595847,1595851,1595858,1596218,1596491,1596494,1597076,1597102,1597109,1599169,1599173-1599174,1600581,1600587,1600590,1600630,1600861,1600863,1600883,1602434,1602823,1602850,1603416,1603897,1603941,1604028,1604709,1605355,1605689,1607649

Modified: openoffice/branches/AOO410/main/sw/source/core/doc/notxtfrm.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/sw/source/core/doc/notxtfrm.cxx?rev=1607796&r1=1607795&r2=1607796&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/sw/source/core/doc/notxtfrm.cxx (original)
+++ openoffice/branches/AOO410/main/sw/source/core/doc/notxtfrm.cxx Fri Jul  4 08:34:30 2014
@@ -993,13 +993,54 @@ void SwNoTxtFrm::PaintPicture( OutputDev
                         basegfx::tools::createScaleTranslateB2DHomMatrix(
                             aTargetRange.getRange(),
                             aTargetRange.getMinimum()));
-                    drawinglayer::primitive2d::Primitive2DSequence aContent;
+                    drawinglayer::primitive2d::Primitive2DSequence aContent(1);
+                    bool bDone(false);
 
-                    aContent.realloc(1);
-                    aContent[0] = new drawinglayer::primitive2d::GraphicPrimitive2D(
-                        aTargetTransform,
-                        rGrfObj.GetGraphic(),
-                        aGrfAttr);
+                    // #i125171# The mechanism to get lossless jpegs into pdf is based on having the original
+                    // file data (not the bitmap data) at the Graphic in the GfxLink (which has *nothing* to
+                    // do with the graphic being linked). This works well for DrawingLayer GraphicObjects (linked
+                    // and unlinked) but fails for linked Writer GraphicObjects. These have the URL in the
+                    // GraphicObject, but no GfxLink with the original file data when it's a linked graphic.
+                    // Since this blows up PDF size by a factor of 10 (the graphics get embedded as pixel maps
+                    // then) it is okay to add this workarund: In the needed case, load the graphic in a way to
+                    // get the GfxLink in the needed form and use that Graphic temporarily. Do this only when
+                    // - we have PDF export
+                    // - the GraphicObject is linked
+                    // - the Graphic has no GfxLink
+                    // - LosslessCompression is activated
+                    // - it's indeed a jpeg graphic (could be checked by the url ending, but is more reliable to check later)
+                    // In all other cases (normal repaint, print, etc...) use the available Graphic with the
+                    // already loaded pixel graphic as before this change.
+                    if(pOut->GetExtOutDevData() && rGrfObj.HasLink() && !rGrfObj.GetGraphic().IsLink())
+                    {
+                        const vcl::PDFExtOutDevData* pPDFExt = dynamic_cast< const vcl::PDFExtOutDevData* >(pOut->GetExtOutDevData());
+
+                        if(pPDFExt && pPDFExt->GetIsLosslessCompression())
+                        {
+                            Graphic aTempGraphic;
+                            INetURLObject aURL(rGrfObj.GetLink());
+
+                            if(GRFILTER_OK == GraphicFilter::GetGraphicFilter()->ImportGraphic(aTempGraphic, aURL))
+                            {
+                                if(aTempGraphic.IsLink() && GFX_LINK_TYPE_NATIVE_JPG == aTempGraphic.GetLink().GetType())
+                                {
+                                    aContent[0] = new drawinglayer::primitive2d::GraphicPrimitive2D(
+                                        aTargetTransform,
+                                        aTempGraphic,
+                                        aGrfAttr);
+                                    bDone = true;
+                                }
+                            }
+                        }
+                    }
+
+                    if(!bDone)
+                    {
+                        aContent[0] = new drawinglayer::primitive2d::GraphicPrimitive2D(
+                            aTargetTransform,
+                            rGrfObj.GetGraphic(),
+                            aGrfAttr);
+                    }
 
                     paintUsingPrimitivesHelper(
                         *pOut,