diff options
author | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2012-06-18 09:57:16 +0200 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2012-06-18 09:57:26 +0200 |
commit | 96fd597185cff3fb42e3f2882367f9596aff3aef (patch) | |
tree | ea942bc2bc9e996d12425433138ec888a2797f0a | |
parent | fec099556e1aa6e9d4177908530900dd02e17136 (diff) |
Some belts and braces
-rw-r--r-- | src/lib/VSDXContentCollector.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/lib/VSDXContentCollector.cpp b/src/lib/VSDXContentCollector.cpp index 4fc0e48..5342736 100644 --- a/src/lib/VSDXContentCollector.cpp +++ b/src/lib/VSDXContentCollector.cpp @@ -91,7 +91,8 @@ void libvisio::VSDXContentCollector::_fillAndShadowProperties(unsigned colourInd else if (m_fillPattern == 1) { m_fillType = "solid"; - m_styleProps.insert("draw:fill-color", getColourString(m_colours[colourIndexFG])); + if (colourIndexFG < m_colours.size()) + m_styleProps.insert("draw:fill-color", getColourString(m_colours[colourIndexFG])); if (m_fillFGTransparency > 0) m_styleProps.insert("draw:opacity", (double)(1 - m_fillFGTransparency/255.0), WPX_PERCENT); else @@ -101,8 +102,10 @@ void libvisio::VSDXContentCollector::_fillAndShadowProperties(unsigned colourInd { m_fillType = "gradient"; m_styleProps.insert("draw:style", "axial"); - m_styleProps.insert("draw:start-color", getColourString(m_colours[colourIndexFG])); - m_styleProps.insert("draw:end-color", getColourString(m_colours[colourIndexBG])); + if (colourIndexFG < m_colours.size()) + m_styleProps.insert("draw:start-color", getColourString(m_colours[colourIndexFG])); + if (colourIndexBG < m_colours.size()) + m_styleProps.insert("draw:end-color", getColourString(m_colours[colourIndexBG])); m_styleProps.remove("draw:opacity"); if (m_fillBGTransparency > 0) m_styleProps.insert("libwpg:start-opacity", (double)(1 - m_fillBGTransparency/255.0), WPX_PERCENT); @@ -123,8 +126,10 @@ void libvisio::VSDXContentCollector::_fillAndShadowProperties(unsigned colourInd { m_fillType = "gradient"; m_styleProps.insert("draw:style", "linear"); - m_styleProps.insert("draw:start-color", getColourString(m_colours[colourIndexBG])); - m_styleProps.insert("draw:end-color", getColourString(m_colours[colourIndexFG])); + if (colourIndexBG < m_colours.size()) + m_styleProps.insert("draw:start-color", getColourString(m_colours[colourIndexBG])); + if (colourIndexFG < m_colours.size()) + m_styleProps.insert("draw:end-color", getColourString(m_colours[colourIndexFG])); m_styleProps.remove("draw:opacity"); if (m_fillBGTransparency > 0) m_styleProps.insert("libwpg:start-opacity", (double)(1 - m_fillBGTransparency/255.0), WPX_PERCENT); @@ -170,8 +175,10 @@ void libvisio::VSDXContentCollector::_fillAndShadowProperties(unsigned colourInd m_styleProps.insert("draw:style", "rectangular"); m_styleProps.insert("svg:cx", 0.5, WPX_PERCENT); m_styleProps.insert("svg:cy", 0.5, WPX_PERCENT); - m_styleProps.insert("draw:start-color", getColourString(m_colours[colourIndexBG])); - m_styleProps.insert("draw:end-color", getColourString(m_colours[colourIndexFG])); + if (colourIndexBG < m_colours.size()) + m_styleProps.insert("draw:start-color", getColourString(m_colours[colourIndexBG])); + if (colourIndexFG < m_colours.size()) + m_styleProps.insert("draw:end-color", getColourString(m_colours[colourIndexFG])); m_styleProps.remove("draw:opacity"); if (m_fillBGTransparency > 0) m_styleProps.insert("libwpg:start-opacity", (double)(1 - m_fillBGTransparency/255.0), WPX_PERCENT); @@ -188,8 +195,10 @@ void libvisio::VSDXContentCollector::_fillAndShadowProperties(unsigned colourInd { m_fillType = "gradient"; m_styleProps.insert("draw:style", "radial"); - m_styleProps.insert("draw:start-color", getColourString(m_colours[colourIndexBG])); - m_styleProps.insert("draw:end-color", getColourString(m_colours[colourIndexFG])); + if (colourIndexBG < m_colours.size()) + m_styleProps.insert("draw:start-color", getColourString(m_colours[colourIndexBG])); + if (colourIndexFG < m_colours.size()) + m_styleProps.insert("draw:end-color", getColourString(m_colours[colourIndexFG])); m_styleProps.remove("draw:opacity"); if (m_fillBGTransparency > 0) m_styleProps.insert("libwpg:start-opacity", (double)(1 - m_fillBGTransparency/255.0), WPX_PERCENT); |