diff options
author | Grzegorz Araminowicz <g.araminowicz@gmail.com> | 2017-07-19 22:08:38 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-07-20 10:03:08 +0200 |
commit | 558ded72d2a39fd0eac1f3f375b446c72b7141e5 (patch) | |
tree | c1773296ad948795da4fd3b0b4216f6c9d5b7f02 | |
parent | 47e52b47845265ba126c30eba149e90689538b93 (diff) |
SmartArt: shape styling
Change-Id: I7e9ab4c2286fd803cd518dd01ab8ebd5ac2d8428
-rw-r--r-- | oox/source/drawingml/diagram/diagramfragmenthandler.cxx | 10 | ||||
-rw-r--r-- | oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 41 |
2 files changed, 27 insertions, 24 deletions
diff --git a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx index a85fe611dd18..1ad24270477e 100644 --- a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx +++ b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx @@ -122,7 +122,7 @@ DiagramQStylesFragmentHandler::DiagramQStylesFragmentHandler( XmlFilterBase& rFi const AttributeList& rAttribs ) { // state-table like way of navigating the color fragment. we - // currently ignore everything except styleLbl in the colorsDef + // currently ignore everything except styleLbl in the styleDef // element switch( getCurrentElement() ) { @@ -136,16 +136,16 @@ DiagramQStylesFragmentHandler::DiagramQStylesFragmentHandler( XmlFilterBase& rFi { switch( nElement ) { - case DGM_TOKEN(lnRef) : // CT_StyleMatrixReference + case A_TOKEN(lnRef): // CT_StyleMatrixReference return createStyleMatrixContext(nElement,rAttribs, maStyleEntry.maLineStyle); - case DGM_TOKEN(fillRef) : // CT_StyleMatrixReference + case A_TOKEN(fillRef): // CT_StyleMatrixReference return createStyleMatrixContext(nElement,rAttribs, maStyleEntry.maFillStyle); - case DGM_TOKEN(effectRef) : // CT_StyleMatrixReference + case A_TOKEN(effectRef): // CT_StyleMatrixReference return createStyleMatrixContext(nElement,rAttribs, maStyleEntry.maEffectStyle); - case DGM_TOKEN(fontRef) : // CT_FontRe ference + case A_TOKEN(fontRef): // CT_FontReference return createStyleMatrixContext(nElement,rAttribs, maStyleEntry.maTextStyle); } diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index 1bad1f0f4ece..fef4ad22e44a 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -320,15 +320,16 @@ bool LayoutNode::setupShape( const ShapePtr& rShape, const Diagram& rDgm, sal_uI if( aDataNode != rDgm.getData()->getPointsPresNameMap().end() && aDataNode->second.size() > nIdx ) { + const dgm::Point* aPresNode = aDataNode->second.at(nIdx); SAL_INFO( "oox.drawingml", "Filling content from " << nIdx << "th layout node named \"" << msName << "\", modelId \"" - << aDataNode->second.at(nIdx)->msModelId << "\""); + << aPresNode->msModelId << "\""); // got the presentation node - now, need the actual data node: const DiagramData::StringMap::const_iterator aNodeName=rDgm.getData()->getPresOfNameMap().find( - aDataNode->second.at(nIdx)->msModelId); + aPresNode->msModelId); if( aNodeName != rDgm.getData()->getPresOfNameMap().end() ) { DiagramData::StringMap::value_type::second_type::const_iterator aVecIter=aNodeName->second.begin(); @@ -404,22 +405,30 @@ bool LayoutNode::setupShape( const ShapePtr& rShape, const Diagram& rDgm, sal_uI << " for layout node named \"" << msName << "\""); } - // TODO(Q1): apply styling & coloring - taking - // layout node's styleLbl for both style & color - // now, but docs are a bit unclear on this - if( !msStyleLabel.isEmpty() ) + // TODO(Q1): apply styling & coloring - take presentation + // point's presStyleLbl for both style & color + // if not found use layout node's styleLbl + // however, docs are a bit unclear on this + OUString aStyleLabel = aPresNode->msPresentationLayoutStyleLabel; + if (aStyleLabel.isEmpty()) + aStyleLabel = msStyleLabel; + if( !aStyleLabel.isEmpty() ) { - const DiagramQStyleMap::const_iterator aStyle=rDgm.getStyles().find(msStyleLabel); + const DiagramQStyleMap::const_iterator aStyle = rDgm.getStyles().find(aStyleLabel); if( aStyle != rDgm.getStyles().end() ) { - rShape->getShapeStyleRefs()[XML_fillRef] = aStyle->second.maFillStyle; - rShape->getShapeStyleRefs()[XML_lnRef] = aStyle->second.maLineStyle; - rShape->getShapeStyleRefs()[XML_effectRef] = aStyle->second.maEffectStyle; - rShape->getShapeStyleRefs()[XML_fontRef] = aStyle->second.maTextStyle; - Color aColor=aStyle->second.maTextStyle.maPhClr; + const DiagramStyle& rStyle = aStyle->second; + rShape->getShapeStyleRefs()[XML_fillRef] = rStyle.maFillStyle; + rShape->getShapeStyleRefs()[XML_lnRef] = rStyle.maLineStyle; + rShape->getShapeStyleRefs()[XML_effectRef] = rStyle.maEffectStyle; + rShape->getShapeStyleRefs()[XML_fontRef] = rStyle.maTextStyle; + } + else + { + SAL_WARN("oox.drawingml", "Style " << aStyleLabel << " not found"); } - const DiagramColorMap::const_iterator aColor=rDgm.getColors().find(msStyleLabel); + const DiagramColorMap::const_iterator aColor = rDgm.getColors().find(aStyleLabel); if( aColor != rDgm.getColors().end() ) { const DiagramColor& rColor=aColor->second; @@ -433,12 +442,6 @@ bool LayoutNode::setupShape( const ShapePtr& rShape, const Diagram& rDgm, sal_uI rShape->getShapeStyleRefs()[XML_fontRef].maPhClr = rColor.maTextFillColor; } } - else - { - // if no style label apply at least some fill color - rShape->getShapeStyleRefs()[XML_fillRef].maPhClr.setScrgbClr(0, 0, 0); - rShape->getShapeStyleRefs()[XML_fillRef].mnThemedIdx = 2; - } // even if no data node found, successful anyway. it's // contained at the layoutnode |