[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 sw/qa
include/oox/export/utils.hxx | 4 oox/source/drawingml/lineproperties.cxx | 15 +- oox/source/drawingml/linepropertiescontext.cxx| 46 +++ oox/source/export/drawingml.cxx | 49 +-- sw/qa/extras/ooxmlexport/data/dashed_line_custdash_1000th_of_percent.docx |binary sw/qa/extras/ooxmlexport/data/dashed_line_custdash_percentage.docx |binary sw/qa/extras/ooxmlexport/data/dashed_line_preset.docx |binary sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx | 62 ++ 8 files changed, 156 insertions(+), 20 deletions(-) New commits: commit 1af3d8a211852da5a1f130aa22e00ab329301ee7 Author: Adam Co rattles2...@gmail.com Date: Sun Jun 8 16:35:32 2014 +0300 Rewrite import and export of custom dashes in ooxml filter (fix) The import mechanism of custom-dash (a:custDash) was wrong, and imported wrong values, which causes that if you would import-export-import-export - you would get inflated values, which might cause a corruption. The attributes for custom-dash nodes (a:ds) are of type 'PositivePercentage'. Office will read percentages formatted with a trailing percent sign or formatted as 1000th of a percent without a trailing percent sign, but only write percentages as 1000th's of a percent without a trailing percent sign. During import - LO did not check if it was in '%' format or in '1000th of a percent' format. So that was fixed. Also - when exporting - it always exports now in '1000th of a percent' format. Reviewed-on: https://gerrit.libreoffice.org/9681 Reviewed-by: Miklos Vajna vmik...@collabora.co.uk Tested-by: Miklos Vajna vmik...@collabora.co.uk (cherry picked from commit 2211a67cc5e577f8abdcc96c9c63865be5fb988d) Conflicts: oox/source/export/drawingml.cxx Change-Id: I6bd74df26951974f85173227c832386c70034afb diff --git a/include/oox/export/utils.hxx b/include/oox/export/utils.hxx index 588d231..2c4fcec 100644 --- a/include/oox/export/utils.hxx +++ b/include/oox/export/utils.hxx @@ -50,9 +50,9 @@ static inline sal_Int64 TwipsToEMU( sal_Int32 nTwips ) } template typename T -OString writePercentage(T number) +OString write1000thOfAPercent(T number) { -return OString::number(number) + %; +return OString::number( number * 1000 ); } #endif diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx index 2044095..372740b 100644 --- a/oox/source/drawingml/lineproperties.cxx +++ b/oox/source/drawingml/lineproperties.cxx @@ -107,19 +107,26 @@ void lclConvertCustomDash( LineDash orLineDash, const LineProperties::DashStopV sal_Int16 nDashes = 0; sal_Int32 nDashLen = 0; sal_Int32 nDistance = 0; +sal_Int32 nConvertedLen = 0; +sal_Int32 nConvertedDistance = 0; for( LineProperties::DashStopVector::const_iterator aIt = rCustomDash.begin(), aEnd = rCustomDash.end(); aIt != aEnd; ++aIt ) { -if( aIt-first = 2 ) +// Get from 1000th of percent == percent == multiplier +nConvertedLen = aIt-first / 1000 / 100; +nConvertedDistance = aIt-second / 1000 / 100; + +// Check if it is a dot (100% = dot) +if( nConvertedLen == 1 ) { ++nDots; -nDotLen += aIt-first; +nDotLen += nConvertedLen; } else { ++nDashes; -nDashLen += aIt-first; +nDashLen += nConvertedLen; } -nDistance += aIt-second; +nDistance += nConvertedDistance; } orLineDash.DotLen = (nDots 0) ? ::std::max sal_Int32 ( nDotLen / nDots, 1 ) : 0; orLineDash.Dots = nDots; diff --git a/oox/source/drawingml/linepropertiescontext.cxx b/oox/source/drawingml/linepropertiescontext.cxx index 3195e56..ee49fba 100644 --- a/oox/source/drawingml/linepropertiescontext.cxx +++ b/oox/source/drawingml/linepropertiescontext.cxx @@ -66,8 +66,50 @@ ContextHandlerRef LinePropertiesContext::onCreateContext( sal_Int32 nElement, co return this; break; case A_TOKEN( ds ): -mrLineProperties.maCustomDash.push_back( LineProperties::DashStop( -rAttribs.getInteger( XML_d, 0 ), rAttribs.getInteger( XML_sp, 0 ) ) ); +{ +// 'a:ds' has 2 attributes : 'd' and 'sp' +// both are of type 'a:ST_PositivePercentage' +// according to the specs Office will read percentages formatted with a trailing percent sign +// or formatted as 1000th of a percent without a trailing percent sign, but only write percentages +// as 1000th's of a percent without a trailing percent sign. +// The code below takes care of both scenarios by converting to '1000th of a percent'
[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - include/oox oox/source
include/oox/ppt/pptshape.hxx |7 ++ oox/source/ppt/pptgraphicshapecontext.cxx | 13 + oox/source/ppt/pptshape.cxx | 72 +- oox/source/ppt/pptshapecontext.cxx| 60 ++--- 4 files changed, 76 insertions(+), 76 deletions(-) New commits: commit 64157c4598606b094f5783804b38cfb4c901a88a Author: Matúš Kukan matus.ku...@collabora.com Date: Thu Aug 7 13:25:51 2014 +0200 bnc#821916: Better algorithm to find placeholder shape. Placeholder type seems to be more relevant than index. Change-Id: I9d6c6cad8e0a51b2385801f65d7d1c697ad7998e Reviewed-on: https://gerrit.libreoffice.org/10844 Reviewed-by: David Tardon dtar...@redhat.com Tested-by: David Tardon dtar...@redhat.com diff --git a/include/oox/ppt/pptshape.hxx b/include/oox/ppt/pptshape.hxx index 41941fd..18126d3 100644 --- a/include/oox/ppt/pptshape.hxx +++ b/include/oox/ppt/pptshape.hxx @@ -58,8 +58,11 @@ public: void setPlaceholder( oox::drawingml::ShapePtr pPlaceholder ) { mpPlaceholder = pPlaceholder; } void setModelId( const OUString rId ) { msModelId = rId; } -static oox::drawingml::ShapePtr findPlaceholder( const sal_Int32 nMasterPlaceholder, std::vector oox::drawingml::ShapePtr rShapes, bool bMasterOnly = false ); -static oox::drawingml::ShapePtr findPlaceholderByIndex( const sal_Int32 nIdx, std::vector oox::drawingml::ShapePtr rShapes, bool bMasterOnly = false ); +static oox::drawingml::ShapePtr findPlaceholder( const sal_Int32 nFirstSubType, +const sal_Int32 nSecondSubType, const OptValue sal_Int32 oSubTypeIndex, +std::vector oox::drawingml::ShapePtr rShapes, bool bMasterOnly = false ); +static oox::drawingml::ShapePtr findPlaceholderByIndex( const sal_Int32 nIdx, +std::vector oox::drawingml::ShapePtr rShapes, bool bMasterOnly = false ); static oox::drawingml::TextListStylePtr getSubTypeTextListStyle( const SlidePersist rSlidePersist, sal_Int32 nSubType ); diff --git a/oox/source/ppt/pptgraphicshapecontext.cxx b/oox/source/ppt/pptgraphicshapecontext.cxx index b0772a8..47a808d 100644 --- a/oox/source/ppt/pptgraphicshapecontext.cxx +++ b/oox/source/ppt/pptgraphicshapecontext.cxx @@ -53,13 +53,6 @@ PPTGraphicShapeContext::PPTGraphicShapeContext( ContextHandler2Helper rParent, { } -// if nFirstPlaceholder can't be found, it will be searched for nSecondPlaceholder -static oox::drawingml::ShapePtr findPlaceholder( sal_Int32 nFirstPlaceholder, sal_Int32 nSecondPlaceholder, std::vector oox::drawingml::ShapePtr rShapes ) -{ -oox::drawingml::ShapePtr pPlaceholder = PPTShape::findPlaceholder( nFirstPlaceholder, rShapes ); -return !nSecondPlaceholder || pPlaceholder.get() ? pPlaceholder : PPTShape::findPlaceholder( nSecondPlaceholder, rShapes ); -} - ContextHandlerRef PPTGraphicShapeContext::onCreateContext( sal_Int32 aElementToken, const AttributeList rAttribs ) { switch( aElementToken ) @@ -135,12 +128,14 @@ ContextHandlerRef PPTGraphicShapeContext::onCreateContext( sal_Int32 aElementTok if ( nFirstPlaceholder ) { if ( eShapeLocation == Layout ) // for layout objects the referenced object can be found within the same shape tree -pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, mpSlidePersistPtr-getShapes()-getChildren() ); +pPlaceholder = PPTShape::findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, +pPPTShapePtr-getSubTypeIndex(), mpSlidePersistPtr-getShapes()-getChildren(), true ); else if ( eShapeLocation == Slide ) // normal slide shapes have to search within the corresponding master tree for referenced objects { SlidePersistPtr pMasterPersist( mpSlidePersistPtr-getMasterPersist() ); if ( pMasterPersist.get() ) -pPlaceholder = findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, pMasterPersist-getShapes()-getChildren() ); +pPlaceholder = PPTShape::findPlaceholder( nFirstPlaceholder, nSecondPlaceholder, +pPPTShapePtr-getSubTypeIndex(), pMasterPersist-getShapes()-getChildren() ); } } } diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index 0c5ebe0..70b2d79 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -228,7 +228,7 @@ void PPTShape::addShape( if( mnSubType getSubTypeIndex().has() meShapeLocation == Layout ) { oox::drawingml::ShapePtr pPlaceholder = PPTShape::findPlaceholderByIndex( getSubTypeIndex().get(), rSlidePersist.getShapes()-getChildren(), true );
[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - include/oox oox/source
include/oox/helper/graphichelper.hxx |3 +++ oox/source/drawingml/chart/chartspaceconverter.cxx |8 +++- oox/source/helper/graphichelper.cxx|5 + oox/source/ppt/pptimport.cxx |6 ++ 4 files changed, 21 insertions(+), 1 deletion(-) New commits: commit e9f77854e20433287ca32569af01eb1508ca51a5 Author: Kohei Yoshida kohei.yosh...@collabora.com Date: Fri Aug 1 21:39:49 2014 -0400 bnc#886540: Default chart background for pptx docs should be transparent. Charts in docx and xlsx OTOH use solid white as the default fill style. (cherry picked from commit 4a8f2431718f99de6fd9ee3461d703d007261c03) (cherry picked from commit 013744a5b475e151ca0918565fb369e22dfbc1db) Conflicts: oox/source/drawingml/chart/chartspaceconverter.cxx Change-Id: Ic4351fe65cabc12d60214b67c7026a317841f2c7 Reviewed-on: https://gerrit.libreoffice.org/10736 Reviewed-by: Matúš Kukan matus.ku...@collabora.com Tested-by: Matúš Kukan matus.ku...@collabora.com diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx index f74963c..5981445 100644 --- a/include/oox/helper/graphichelper.hxx +++ b/include/oox/helper/graphichelper.hxx @@ -24,6 +24,7 @@ #include map #include rtl/ustring.hxx #include com/sun/star/awt/DeviceInfo.hpp +#include com/sun/star/drawing/FillStyle.hpp #include com/sun/star/uno/Reference.hxx #include oox/helper/binarystreambase.hxx #include oox/helper/storagebase.hxx @@ -75,6 +76,8 @@ public: /** Derived classes may implement to resolve a palette index to an RGB color. */ virtual sal_Int32 getPaletteColor( sal_Int32 nPaletteIdx ) const; +virtual css::drawing::FillStyle getDefaultChartAreaFillStyle() const; + // Device info and device dependent unit conversion --- /** Returns information about the output device. */ diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx index 2238fe2..b63bfe9 100644 --- a/oox/source/drawingml/chart/chartspaceconverter.cxx +++ b/oox/source/drawingml/chart/chartspaceconverter.cxx @@ -25,12 +25,14 @@ #include com/sun/star/chart2/XTitled.hpp #include com/sun/star/chart2/data/XDataReceiver.hpp #include com/sun/star/drawing/XDrawPageSupplier.hpp +#include com/sun/star/drawing/FillStyle.hpp #include oox/core/xmlfilterbase.hxx #include oox/drawingml/chart/chartconverter.hxx #include oox/drawingml/chart/chartdrawingfragment.hxx #include oox/drawingml/chart/chartspacemodel.hxx #include oox/drawingml/chart/plotareaconverter.hxx #include oox/drawingml/chart/titleconverter.hxx +#include oox/helper/graphichelper.hxx using namespace ::com::sun::star; using ::com::sun::star::uno::Reference; @@ -90,8 +92,12 @@ void ChartSpaceConverter::convertFromModel( const Reference XShapes rxExtern { } -// formatting of the chart background +// formatting of the chart background. The default fill style varies with applications. PropertySet aBackPropSet( getChartDocument()-getPageBackground() ); +aBackPropSet.setProperty( +PROP_FillStyle, + uno::makeAny(getFilter().getGraphicHelper().getDefaultChartAreaFillStyle())); + if( mrModel.mxShapeProp.is() ) { getFormatter().convertFrameFormatting( aBackPropSet, mrModel.mxShapeProp, OBJECTTYPE_CHARTSPACE ); diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx index 135a91c..5281da2 100644 --- a/oox/source/helper/graphichelper.cxx +++ b/oox/source/helper/graphichelper.cxx @@ -158,6 +158,11 @@ sal_Int32 GraphicHelper::getPaletteColor( sal_Int32 /*nPaletteIdx*/ ) const return API_RGB_TRANSPARENT; } +drawing::FillStyle GraphicHelper::getDefaultChartAreaFillStyle() const +{ +return drawing::FillStyle_SOLID; +} + // Device info and device dependent unit conversion --- const awt::DeviceInfo GraphicHelper::getDeviceInfo() const diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx index c3aa2208..df15d77 100644 --- a/oox/source/ppt/pptimport.cxx +++ b/oox/source/ppt/pptimport.cxx @@ -190,6 +190,7 @@ class PptGraphicHelper : public GraphicHelper public: explicitPptGraphicHelper( const PowerPointImport rFilter ); virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const SAL_OVERRIDE; +virtual drawing::FillStyle getDefaultChartAreaFillStyle() const SAL_OVERRIDE; private: const PowerPointImport mrFilter; }; @@ -205,6 +206,11 @@ sal_Int32 PptGraphicHelper::getSchemeColor( sal_Int32 nToken ) const return mrFilter.getSchemeColor( nToken ); } +drawing::FillStyle PptGraphicHelper::getDefaultChartAreaFillStyle() const +{ +return drawing::FillStyle_NONE; +} + } // namespace GraphicHelper* PowerPointImport::implCreateGraphicHelper() const
[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - include/oox oox/source
include/oox/export/chartexport.hxx |4 include/oox/export/utils.hxx |1 oox/source/drawingml/chart/seriesconverter.cxx | 28 +++ oox/source/export/chartexport.cxx | 219 + oox/source/token/properties.txt|3 5 files changed, 115 insertions(+), 140 deletions(-) New commits: commit a7e5fc1485fc3a44a05168910430a57aee2b211e Author: Kohei Yoshida kohei.yosh...@collabora.com Date: Wed Jul 23 15:49:11 2014 -0400 bnc#885825: OOXML import and export of data label borders. (cherry picked from commit 48f31a924280a418046f0c816f8a7d20b672dac6) Conflicts: oox/source/export/chartexport.cxx Change-Id: I0fd808145aaeb0aa36d3ec30d7b977890642dcff Reviewed-on: https://gerrit.libreoffice.org/10562 Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com Tested-by: Markus Mohrhard markus.mohrh...@googlemail.com diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx index 4252135..8d570ec 100644 --- a/include/oox/export/chartexport.hxx +++ b/include/oox/export/chartexport.hxx @@ -157,9 +157,7 @@ private: void exportDataPoints( const ::com::sun::star::uno::Reference ::com::sun::star::beans::XPropertySet xSeriesProperties, sal_Int32 nSeriesLength ); -void exportDataLabels( -const ::com::sun::star::uno::Reference ::com::sun::star::beans::XPropertySet xSeriesProperties, -sal_Int32 nSeriesLength ); +void exportDataLabels( const css::uno::Referencecss::chart2::XDataSeries xSeries, sal_Int32 nSeriesLength ); void exportGrouping( bool isBar = false ); void exportTrendlines( ::com::sun::star::uno::Reference ::com::sun::star::chart2::XDataSeries xSeries ); void exportMarker( ::com::sun::star::uno::Reference ::com::sun::star::chart2::XDataSeries xSeries ); diff --git a/include/oox/export/utils.hxx b/include/oox/export/utils.hxx index 06ddfe3..588d231 100644 --- a/include/oox/export/utils.hxx +++ b/include/oox/export/utils.hxx @@ -23,6 +23,7 @@ #define I32S(x) OString::number( (sal_Int32) x ).getStr() #define I64S(x) OString::number( (sal_Int64) x ).getStr() #define IS(x) OString::number( x ).getStr() +#define BS(x) (x ? 1:0) #define USS(x) OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr() #ifndef DBG diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index 0357114..bcb8d60 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -34,11 +34,13 @@ #include oox/drawingml/chart/typegroupconverter.hxx #include oox/drawingml/chart/typegroupmodel.hxx #include oox/helper/containerhelper.hxx +#include oox/drawingml/lineproperties.hxx namespace oox { namespace drawingml { namespace chart { +using namespace com::sun::star; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::chart2; using namespace ::com::sun::star::chart2::data; @@ -162,6 +164,20 @@ void lclConvertLabelFormatting( PropertySet rPropSet, ObjectFormatter rFormatt } } +void importBorderProperties( PropertySet rPropSet, Shape rShape, const GraphicHelper rGraphicHelper ) +{ +LineProperties rLP = rShape.getLineProperties(); +if (rLP.moLineWidth.has()) +{ +sal_Int32 nWidth = convertEmuToHmm(rLP.moLineWidth.get()); +rPropSet.setProperty(PROP_LabelBorderWidth, uno::makeAny(nWidth)); +rPropSet.setProperty(PROP_LabelBorderStyle, uno::makeAny(drawing::LineStyle_SOLID)); +} +const Color aColor = rLP.maLineFill.maFillColor; +sal_Int32 nColor = aColor.getColor(rGraphicHelper); +rPropSet.setProperty(PROP_LabelBorderColor, uno::makeAny(nColor)); +} + } // namespace DataLabelConverter::DataLabelConverter( const ConverterRoot rParent, DataLabelModel rModel ) : @@ -175,7 +191,10 @@ DataLabelConverter::~DataLabelConverter() void DataLabelConverter::convertFromModel( const Reference XDataSeries rxDataSeries, const TypeGroupConverter rTypeGroup ) { -if( rxDataSeries.is() ) try +if (!rxDataSeries.is()) +return; + +try { PropertySet aPropSet( rxDataSeries-getDataPointByIndex( mrModel.mnIndex ) ); lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, false ); @@ -201,6 +220,9 @@ void DataLabelConverter::convertFromModel( const Reference XDataSeries rxDat aPropSet.setProperty( PROP_LabelPlacement, aPositionsLookupTable[ simplifiedX+1 + 3*(simplifiedY+1) ] ); } + +if (mrModel.mxShapeProp) +importBorderProperties(aPropSet, *mrModel.mxShapeProp, getFilter().getGraphicHelper()); } catch( Exception ) { @@ -222,6 +244,10 @@ void DataLabelsConverter::convertFromModel( const Reference XDataSeries rxDa { PropertySet aPropSet( rxDataSeries );
[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - include/oox oox/source
include/oox/drawingml/chart/axisconverter.hxx| 10 ++ oox/source/drawingml/chart/axisconverter.cxx | 38 ++- oox/source/drawingml/chart/plotareaconverter.cxx |6 +-- 3 files changed, 38 insertions(+), 16 deletions(-) New commits: commit 4656a2635a7b6032b955e1223bbe81df8b05f436 Author: Kohei Yoshida kohei.yosh...@collabora.com Date: Mon Jul 7 16:38:29 2014 -0400 bnc#881025: Mark axis a percent axis only when all data series are percent. (cherry picked from commit b8c444a46b2f41dae673c6118d84276be0e6c87d) Conflicts: oox/inc/drawingml/chart/axisconverter.hxx Change-Id: I302cc1e5b164b2ce087293b034ec930951af Reviewed-on: https://gerrit.libreoffice.org/10124 Reviewed-by: Matúš Kukan matus.ku...@collabora.com Tested-by: Matúš Kukan matus.ku...@collabora.com diff --git a/include/oox/drawingml/chart/axisconverter.hxx b/include/oox/drawingml/chart/axisconverter.hxx index 3b7a587..15feb26 100644 --- a/include/oox/drawingml/chart/axisconverter.hxx +++ b/include/oox/drawingml/chart/axisconverter.hxx @@ -60,12 +60,10 @@ public: virtual ~AxisConverter(); /** Creates a chart2 axis and inserts it into the passed coordinate system. */ -voidconvertFromModel( -const ::com::sun::star::uno::Reference ::com::sun::star::chart2::XCoordinateSystem rxCoordSystem, -TypeGroupConverter rTypeGroup, -const AxisModel* pCrossingAxis, -sal_Int32 nAxesSetIdx, -sal_Int32 nAxisIdx ); +void convertFromModel( +const css::uno::Referencecss::chart2::XCoordinateSystem rxCoordSystem, +RefVectorTypeGroupConverter rTypeGroups, const AxisModel* pCrossingAxis, +sal_Int32 nAxesSetIdx, sal_Int32 nAxisIdx ); }; diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx index a15c23e..4133ae1 100644 --- a/oox/source/drawingml/chart/axisconverter.cxx +++ b/oox/source/drawingml/chart/axisconverter.cxx @@ -107,6 +107,26 @@ sal_Int32 lclGetTickMark( sal_Int32 nToken ) return NONE; } +/** + * The groups is of percent type only when all of its members are of percent + * type. + */ +bool isPercent( const RefVectorTypeGroupConverter rTypeGroups ) +{ +if (rTypeGroups.empty()) +return false; + +RefVectorTypeGroupConverter::const_iterator it = rTypeGroups.begin(), itEnd = rTypeGroups.end(); +for (; it != itEnd; ++it) +{ +TypeGroupConverter rConv = **it; +if (!rConv.isPercent()) +return false; +} + +return true; +} + } // namespace @@ -120,16 +140,20 @@ AxisConverter::~AxisConverter() { } -void AxisConverter::convertFromModel( const Reference XCoordinateSystem rxCoordSystem, -TypeGroupConverter rTypeGroup, const AxisModel* pCrossingAxis, sal_Int32 nAxesSetIdx, sal_Int32 nAxisIdx ) +void AxisConverter::convertFromModel( +const Reference XCoordinateSystem rxCoordSystem, +RefVectorTypeGroupConverter rTypeGroups, const AxisModel* pCrossingAxis, sal_Int32 nAxesSetIdx, sal_Int32 nAxisIdx ) { +if (rTypeGroups.empty()) +return; + Reference XAxis xAxis; try { namespace cssc = ::com::sun::star::chart; namespace cssc2 = ::com::sun::star::chart2; -const TypeGroupInfo rTypeInfo = rTypeGroup.getTypeInfo(); +const TypeGroupInfo rTypeInfo = rTypeGroups.front()-getTypeInfo(); ObjectFormatter rFormatter = getFormatter(); // create the axis object (always) @@ -189,7 +213,7 @@ void AxisConverter::convertFromModel( const Reference XCoordinateSystem rxCo currently). */ aScaleData.AxisType = (bDateAxis !mrModel.mbAuto) ? cssc2::AxisType::DATE : cssc2::AxisType::CATEGORY; aScaleData.AutoDateAxis = mrModel.mbAuto; -aScaleData.Categories = rTypeGroup.createCategorySequence(); +aScaleData.Categories = rTypeGroups.front()-createCategorySequence(); } else { @@ -199,11 +223,11 @@ void AxisConverter::convertFromModel( const Reference XCoordinateSystem rxCo break; case API_Y_AXIS: OSL_ENSURE( mrModel.mnTypeId == C_TOKEN( valAx ), AxisConverter::convertFromModel - unexpected axis model type (must: c:valAx) ); -aScaleData.AxisType = rTypeGroup.isPercent() ? cssc2::AxisType::PERCENT : cssc2::AxisType::REALNUMBER; +aScaleData.AxisType = isPercent(rTypeGroups) ? cssc2::AxisType::PERCENT : cssc2::AxisType::REALNUMBER; break; case API_Z_AXIS: OSL_ENSURE( mrModel.mnTypeId == C_TOKEN( serAx ), AxisConverter::convertFromModel - unexpected axis model type (must: c:serAx) ); -
[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - include/oox oox/source
include/oox/drawingml/shapepropertymap.hxx |8 oox/source/drawingml/chart/objectformatter.cxx |5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) New commits: commit 9afdc6c3b4eb077b3e4279c5eec1e3dd9a4a8512 Author: Caolán McNamara caol...@redhat.com Date: Mon Jul 7 11:44:23 2014 +0100 fix crash loading ooo100546-1.xls regressions around inserted extra enum values into ShapePropertyId (cherry picked from commit aacfd5038d05a02f8b1eade3a5896d3d7e959f3d) Conflicts: oox/source/drawingml/chart/objectformatter.cxx Change-Id: I06696c8cfe4acc3836723c31d5e714bd7d8439b3 Reviewed-on: https://gerrit.libreoffice.org/10108 Reviewed-by: Matúš Kukan matus.ku...@collabora.com Tested-by: Matúš Kukan matus.ku...@collabora.com diff --git a/include/oox/drawingml/shapepropertymap.hxx b/include/oox/drawingml/shapepropertymap.hxx index f451cc0..13e8e50 100644 --- a/include/oox/drawingml/shapepropertymap.hxx +++ b/include/oox/drawingml/shapepropertymap.hxx @@ -30,12 +30,14 @@ namespace oox { class ModelObjectHelper; } namespace oox { namespace drawingml { - - /** Enumeration for various properties related to drawing shape formatting. This is an abstraction for shape formatting properties that have different names in various implementations, e.g. drawing shapes vs. chart objects. + +If you *insert* ids into this list, then update spnCommonPropIds, spnLinearPropIds +and spnFilledPropIds of oox/source/drawingml/chart/objectformatter.cxx if +the newly inserted enum is inside the range they cover */ enum ShapePropertyId { @@ -69,8 +71,6 @@ enum ShapePropertyId SHAPEPROP_END }; - - struct OOX_DLLPUBLIC ShapePropertyInfo { std::vectorsal_Int32 maPropertyIds; diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index adcc3f3..54ef18a 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -460,7 +460,7 @@ const AutoTextEntry* lclGetAutoTextEntry( const AutoTextEntry* pEntries, sal_Int return 0; } - +// These PropIds arrays will be indexed into using a ShapePropertyId enum (include/oox/drawingml/shapepropertymap.hxx) /** Property identifiers for common chart objects, to be used in ShapePropertyInfo. */ static const sal_Int32 spnCommonPropIds[] = @@ -478,7 +478,7 @@ static const sal_Int32 spnLinearPropIds[] = { PROP_LineStyle, PROP_LineWidth, PROP_Color, PROP_Transparency, PROP_LineDashName, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, -PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, +PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_END_LIST @@ -502,6 +502,7 @@ static const sal_Int32 spnFilledPropIds[] = PROP_FillStyle, PROP_Color, PROP_Transparency, +PROP_INVALID, PROP_GradientName, PROP_FillBitmapName, PROP_FillBitmapMode, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[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 =