[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - include/oox oox/source sd/qa
include/oox/drawingml/textbodyproperties.hxx |2 oox/source/drawingml/shape.cxx |2 oox/source/drawingml/textbodyproperties.cxx |8 sd/qa/unit/data/n902652.pptx |binary sd/qa/unit/data/xml/n902652_0.xml| 309 +++ sd/qa/unit/import-tests.cxx |1 6 files changed, 316 insertions(+), 6 deletions(-) New commits: commit d2809580d8e520bfa05152a9bba9ff686fdfb1d6 Author: Andras Timar andras.ti...@collabora.com Date: Mon Mar 30 21:37:47 2015 +0200 bnc#902652 OOXML: fix import of insets when shape and/or shape text is rotated 5ac575ee3e109 did not get it right, the vert attribute (i.e. the rotation of text) is relevant, not the rotation of the shape. In that case both text and shape rotation were 270 degrees. I checked that the bugdoc of bnc#773048 looked good after this. Reviewed-on: https://gerrit.libreoffice.org/15076 Tested-by: Jenkins c...@libreoffice.org Reviewed-by: Andras Timar andras.ti...@collabora.com (cherry picked from commit af686aa8694903bde5952656cd69993c8c8393d7) Conflicts: sd/qa/unit/import-tests.cxx Change-Id: I6e0401cd138a82040df82d7da1a47311db7771e4 Reviewed-on: https://gerrit.libreoffice.org/15085 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com diff --git a/include/oox/drawingml/textbodyproperties.hxx b/include/oox/drawingml/textbodyproperties.hxx index e6ed0fc..c7a98cb 100644 --- a/include/oox/drawingml/textbodyproperties.hxx +++ b/include/oox/drawingml/textbodyproperties.hxx @@ -45,7 +45,7 @@ struct TextBodyProperties explicitTextBodyProperties(); -voidpushRotationAdjustments( sal_Int32 nRotation ); +voidpushRotationAdjustments(); voidpushVertSimulation(); }; diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 7fea778..265eea9 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -656,7 +656,7 @@ Reference XShape Shape::createAndInsert( // add properties from textbody to shape properties if( mpTextBody.get() ) { -mpTextBody-getTextProperties().pushRotationAdjustments( mnRotation ); +mpTextBody-getTextProperties().pushRotationAdjustments(); aShapeProps.assignUsed( mpTextBody-getTextProperties().maPropertyMap ); // Push char properties as well - specifically useful when this is a placeholder if( mpMasterTextListStyle mpMasterTextListStyle-getListStyle()[0]-getTextCharacterProperties().moHeight.has() ) diff --git a/oox/source/drawingml/textbodyproperties.cxx b/oox/source/drawingml/textbodyproperties.cxx index dfa3d60..264c469 100644 --- a/oox/source/drawingml/textbodyproperties.cxx +++ b/oox/source/drawingml/textbodyproperties.cxx @@ -60,17 +60,17 @@ void TextBodyProperties::pushVertSimulation() } /* Push adjusted values, taking into consideration Shape Rotation */ -void TextBodyProperties::pushRotationAdjustments( sal_Int32 nRotation ) +void TextBodyProperties::pushRotationAdjustments() { sal_Int32 nOff = 0; sal_Int32 aProps[] = { PROP_TextLeftDistance, PROP_TextUpperDistance, PROP_TextRightDistance, PROP_TextLowerDistance }; sal_Int32 n = ( sal_Int32 )( sizeof( aProps ) / sizeof( sal_Int32 ) ); -switch( nRotation ) // TODO: What happens for part rotations ? +switch( moRotation.get(0) ) { -case (90*1*6): nOff = 1; break; +case (90*1*6): nOff = 3; break; case (90*2*6): nOff = 2; break; -case (90*3*6): nOff = 3; break; +case (90*3*6): nOff = 1; break; default: break; } diff --git a/sd/qa/unit/data/n902652.pptx b/sd/qa/unit/data/n902652.pptx new file mode 100644 index 000..8726600 Binary files /dev/null and b/sd/qa/unit/data/n902652.pptx differ diff --git a/sd/qa/unit/data/xml/n902652_0.xml b/sd/qa/unit/data/xml/n902652_0.xml new file mode 100644 index 000..de8ed91 --- /dev/null +++ b/sd/qa/unit/data/xml/n902652_0.xml @@ -0,0 +1,309 @@ +?xml version=1.0? +XShapes + XShape positionX=899 positionY=9525 sizeX=9000 sizeY=4800 type=com.sun.star.drawing.CustomShape name=Rounded Rectangle 3 text= LibreOffice fontHeight=18.00 fontColor= textAutoGrowHeight=false textAutoGrowWidth=false textContourFrame=false textFitToSize=NONE textHorizontalAdjust=BLOCK textVerticalAdjust=TOP textLeftDistance=3000 textRightDistance=500 textUpperDistance=300 textLowerDistance=3000 textMaximumFrameHeight=0 textMaximumFrameWidth=0 textMinimumFrameHeight=0 textMinimumFrameWidth=0 textAnimationAmount=0 textAnimationCount=0 textAnimationDelay=0 textAnimationDirection=LEFT textAnimationKind=NONE textAnimationStartInside=false textAnimationStopInside=false textWritingMode=LR_TB fillStyle=SOLID
[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - include/oox oox/source sd/qa
include/oox/drawingml/shape.hxx |1 oox/source/drawingml/fillproperties.cxx |8 - oox/source/drawingml/table/tablecell.cxx | 36 +++--- sd/qa/unit/data/pptx/bnc480256.pptx |binary sd/qa/unit/import-tests.cxx | 49 +++ 5 files changed, 88 insertions(+), 6 deletions(-) New commits: commit aa653d4e34e2b982caffe4cb9a5f2da3aaa52ed7 Author: Matúš Kukan matus.ku...@collabora.com Date: Tue Sep 9 10:37:23 2014 +0200 bnc#480256: OOXML import: Respect table background properties a bit more Only getBackgroundFillProperties() (fill) was used. Use also getBackgroundFillStyleRef() (fillRef). Also, do not replace table background color value with cell color, we have to interpolate the two colors (if cell color is transparent). Unfortunately, we don't use background table property in LibreOffice, so this seems to be a best workaround. (cherry picked from commit 43efd9b40d40b791a2c2deedcac36b99f7efb2cf) And add unit test. (cherry picked from commit 5681725f1a2535a13b86104d8b8a33f750f34efc) Change-Id: I21bcc87a149c9f6d865ebee4012132ccc3a54af2 Reviewed-on: https://gerrit.libreoffice.org/11353 Reviewed-by: Miklos Vajna vmik...@collabora.co.uk Tested-by: Miklos Vajna vmik...@collabora.co.uk diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index f8e1b7c..1f0411a 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -50,6 +50,7 @@ struct ShapeStyleRef { Color maPhClr; sal_Int32 mnThemedIdx; +ShapeStyleRef() : mnThemedIdx(0) {} }; typedef ::std::map sal_Int32, ShapeStyleRef ShapeStyleRefMap; diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 330054d..5fc0dd9 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -233,7 +233,13 @@ Color FillProperties::getBestSolidColor() const break; case XML_gradFill: if( !maGradientProps.maGradientStops.empty() ) -aSolidColor = maGradientProps.maGradientStops.begin()-second; +{ +GradientFillProperties::GradientStopMap::const_iterator aGradientStop = +maGradientProps.maGradientStops.begin(); +if (maGradientProps.maGradientStops.size() 2) +++aGradientStop; +aSolidColor = aGradientStop-second; +} break; case XML_pattFill: aSolidColor = maPatternProps.maPattBgColor.isUsed() ? maPatternProps.maPattBgColor : maPatternProps.maPattFgColor; diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx index baa1556..2c1fa3c 100644 --- a/oox/source/drawingml/table/tablecell.cxx +++ b/oox/source/drawingml/table/tablecell.cxx @@ -21,8 +21,11 @@ #include oox/drawingml/table/tableproperties.hxx #include oox/drawingml/shapepropertymap.hxx #include oox/drawingml/textbody.hxx +#include oox/drawingml/theme.hxx #include oox/core/xmlfilterbase.hxx #include oox/helper/propertyset.hxx +#include basegfx/color/bcolor.hxx +#include tools/color.hxx #include com/sun/star/container/XNameContainer.hpp #include com/sun/star/beans/XMultiPropertySet.hpp #include com/sun/star/table/XTable.hpp @@ -99,7 +102,7 @@ void applyTableStylePart( oox::drawingml::FillProperties rFillProperties, oox::drawingml::LineProperties rBottomLeftToTopRightBorder, TableStylePart rTableStylePart ) { -boost::shared_ptr ::oox::drawingml::FillProperties rPartFillPropertiesPtr( rTableStylePart.getFillProperties() ); +::oox::drawingml::FillPropertiesPtr rPartFillPropertiesPtr( rTableStylePart.getFillProperties() ); if ( rPartFillPropertiesPtr.get() ) rFillProperties.assignUsed( *rPartFillPropertiesPtr ); @@ -168,10 +171,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase rFilterBase, ::oo oox::drawingml::LineProperties aLinePropertiesTopLeftToBottomRight; oox::drawingml::LineProperties aLinePropertiesBottomLeftToTopRight; -boost::shared_ptr ::oox::drawingml::FillProperties rBackgroundFillPropertiesPtr( rTable.getBackgroundFillProperties() ); -if ( rBackgroundFillPropertiesPtr.get() ) -aFillProperties.assignUsed( *rBackgroundFillPropertiesPtr ); - applyTableStylePart( aFillProperties, aTextStyleProps, aLinePropertiesLeft, aLinePropertiesRight, @@ -352,6 +351,33 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase rFilterBase, ::oo aFillProperties.assignUsed( maFillProperties ); ShapePropertyMap aPropMap( rFilterBase.getModelObjectHelper() ); + +Color aBgColor; +sal_Int32 nPhClr = API_RGB_TRANSPARENT; +boost::shared_ptr ::oox::drawingml::FillProperties
[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - include/oox oox/source sd/qa
include/oox/drawingml/graphicshapecontext.hxx |2 + include/oox/ppt/pptshapegroupcontext.hxx |3 -- oox/source/drawingml/graphicshapecontext.cxx | 14 +-- oox/source/ppt/pptshapegroupcontext.cxx |7 - sd/qa/unit/data/pptx/bnc880763.pptx |binary sd/qa/unit/data/xml/n819614_0.xml | 16 ++--- sd/qa/unit/import-tests.cxx | 32 +++--- 7 files changed, 52 insertions(+), 22 deletions(-) New commits: commit 7c7c7dc785750769d661df1dc36201b9f5566ea1 Author: Zolnai Tamás tamas.zol...@collabora.com Date: Fri Jun 6 15:57:43 2014 +0200 bnc#880763: PPTX import: wrong z-order becuause of wrong import order importExtDrawings() must be called as soon as possible, before parser starts to parse the next shape. Call it when graphicFrame tag is closed. This tag include the reference to the SmartArt. Plus fix up import tests. Change-Id: I9e8d54c2b1afeb78a1122390dc4982d580c152ae (cherry picked from commit 46d682eec92bb241f4604a4b6ab42a3859cd0d48) diff --git a/include/oox/drawingml/graphicshapecontext.hxx b/include/oox/drawingml/graphicshapecontext.hxx index 72881fe..fe4b216 100644 --- a/include/oox/drawingml/graphicshapecontext.hxx +++ b/include/oox/drawingml/graphicshapecontext.hxx @@ -44,9 +44,11 @@ public: GraphicalObjectFrameContext( ::oox::core::ContextHandler2Helper rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr, bool bEmbedShapesInChart ); virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList rAttribs ) SAL_OVERRIDE; +virtual void onEndElement() SAL_OVERRIDE; private: boolmbEmbedShapesInChart; +::oox::core::ContextHandler2Helper* mpParent; }; diff --git a/include/oox/ppt/pptshapegroupcontext.hxx b/include/oox/ppt/pptshapegroupcontext.hxx index 847d9b6..5cae54d 100644 --- a/include/oox/ppt/pptshapegroupcontext.hxx +++ b/include/oox/ppt/pptshapegroupcontext.hxx @@ -32,7 +32,6 @@ class PPTShapeGroupContext : public ::oox::drawingml::ShapeGroupContext ShapeLocation meShapeLocation; oox::drawingml::ShapePtrpGraphicShape; -voidimportExtDrawings(); voidapplyFontRefColor(oox::drawingml::ShapePtr pShape, const oox::drawingml::Color rFontRefColor); public: @@ -46,7 +45,7 @@ public: virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList rAttribs ) SAL_OVERRIDE; -virtual void onEndElement() SAL_OVERRIDE; +void importExtDrawings(); protected: diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx index ebd2028..db04d5c 100644 --- a/oox/source/drawingml/graphicshapecontext.cxx +++ b/oox/source/drawingml/graphicshapecontext.cxx @@ -36,6 +36,7 @@ #include oox/drawingml/transform2dcontext.hxx #include oox/helper/binaryinputstream.hxx #include oox/helper/binaryoutputstream.hxx +#include oox/ppt/pptshapegroupcontext.hxx #include comphelper/processfactory.hxx using namespace ::com::sun::star; @@ -103,7 +104,8 @@ ContextHandlerRef GraphicShapeContext::onCreateContext( sal_Int32 aElementToken, GraphicalObjectFrameContext::GraphicalObjectFrameContext( ContextHandler2Helper rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr, bool bEmbedShapesInChart ) : ShapeContext( rParent, pMasterShapePtr, pShapePtr ), -mbEmbedShapesInChart( bEmbedShapesInChart ) +mbEmbedShapesInChart( bEmbedShapesInChart ), +mpParent(rParent) { } @@ -146,7 +148,15 @@ ContextHandlerRef GraphicalObjectFrameContext::onCreateContext( sal_Int32 aEleme return ShapeContext::onCreateContext( aElementToken, rAttribs ); } - +void GraphicalObjectFrameContext::onEndElement() +{ +if( getCurrentElement() == PPT_TOKEN( graphicFrame ) mpParent ) +{ +oox::ppt::PPTShapeGroupContext* pParent = dynamic_castoox::ppt::PPTShapeGroupContext*(mpParent); +if( pParent ) +pParent-importExtDrawings(); +} +} OleObjectGraphicDataContext::OleObjectGraphicDataContext( ContextHandler2Helper rParent, ShapePtr xShape ) : ShapeContext( rParent, ShapePtr(), xShape ), diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx index 0fd517f..9bf3d2b 100644 --- a/oox/source/ppt/pptshapegroupcontext.cxx +++ b/oox/source/ppt/pptshapegroupcontext.cxx @@ -109,8 +109,6 @@ ContextHandlerRef PPTShapeGroupContext::onCreateContext( sal_Int32 aElementToken return new PPTGraphicShapeContext( *this, mpSlidePersistPtr, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, com.sun.star.drawing.GraphicObjectShape ) ) ); case PPT_TOKEN( graphicFrame ): // CT_GraphicalObjectFrame { -if( pGraphicShape ) -importExtDrawings(); pGraphicShape =