summaryrefslogtreecommitdiff
path: root/svgio
diff options
context:
space:
mode:
authorChr. Rossmanith <ChrRossmanith@gmx.de>2014-11-01 22:22:38 +0100
committerChristina Roßmanith <ChrRossmanith@web.de>2014-11-01 21:33:33 +0000
commit501f25e3291dd0ab38e3612de2fc160d953c1846 (patch)
tree427a5904a589fe2c92d8ad217d82e4afae49d7c6 /svgio
parenta51aa75d92eadaa613192a1773e0b78b0df74527 (diff)
SVG: handle visibility property
improve import of masking-path-08-b.svg of the W3C svg test suite when using insert->media->image Change-Id: Ib4d48165f982e394e2171ac82e6cc06911553904 Reviewed-on: https://gerrit.libreoffice.org/12168 Reviewed-by: Christina Roßmanith <ChrRossmanith@web.de> Tested-by: Christina Roßmanith <ChrRossmanith@web.de>
Diffstat (limited to 'svgio')
-rw-r--r--svgio/inc/svgio/svgreader/svgstyleattributes.hxx13
-rw-r--r--svgio/inc/svgio/svgreader/svgtoken.hxx1
-rw-r--r--svgio/source/svgreader/svgnode.cxx24
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx24
-rw-r--r--svgio/source/svgreader/svgtoken.cxx2
5 files changed, 56 insertions, 8 deletions
diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
index ab40e9de0f4b..693772b31501 100644
--- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
+++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx
@@ -153,6 +153,14 @@ namespace svgio
BaselineShift_Length
};
+ enum Visibility
+ {
+ Visibility_visible,
+ Visibility_hidden,
+ Visibility_collapse,
+ Visibility_inherit
+ };
+
class SvgStyleAttributes
{
private:
@@ -185,6 +193,7 @@ namespace svgio
TextAnchor maTextAnchor;
SvgPaint maColor;
SvgNumber maOpacity;
+ Visibility maVisibility;
OUString maTitle;
OUString maDesc;
@@ -401,6 +410,10 @@ namespace svgio
SvgNumber getOpacity() const { return maOpacity; }
void setOpacity(const SvgNumber& rOpacity = SvgNumber()) { maOpacity = rOpacity; }
+ /// Visibility
+ Visibility getVisibility() const { return maVisibility; }
+ void setVisibility(Visibility eVisibility) { maVisibility = eVisibility; }
+
// Title content
const OUString& getTitle() const { return maTitle; }
void setTitle(const OUString& rNew) { maTitle = rNew; }
diff --git a/svgio/inc/svgio/svgreader/svgtoken.hxx b/svgio/inc/svgio/svgreader/svgtoken.hxx
index 87d23b663b49..8d6084776488 100644
--- a/svgio/inc/svgio/svgreader/svgtoken.hxx
+++ b/svgio/inc/svgio/svgreader/svgtoken.hxx
@@ -102,6 +102,7 @@ namespace svgio
SVGTokenPatternContentUnits,
SVGTokenPatternTransform,
SVGTokenOpacity,
+ SVGTokenVisibility,
SVGTokenTitle,
SVGTokenDesc,
diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx
index 723ddbf490f3..d0848680c6b9 100644
--- a/svgio/source/svgreader/svgnode.cxx
+++ b/svgio/source/svgreader/svgnode.cxx
@@ -496,6 +496,12 @@ namespace svgio
return;
}
+ const SvgStyleAttributes* pStyles = getSvgStyleAttributes();
+ if(pStyles && (Visibility_hidden == pStyles->getVisibility() || Visibility_collapse == pStyles->getVisibility()))
+ {
+ return;
+ }
+
if(!bReferenced)
{
if(SVGTokenDefs == getType() ||
@@ -534,16 +540,20 @@ namespace svgio
if(pCandidate && Display_none != pCandidate->getDisplay())
{
- drawinglayer::primitive2d::Primitive2DSequence aNewTarget;
+ const SvgStyleAttributes* pChildStyles = pCandidate->getSvgStyleAttributes();
+ if(pChildStyles && Visibility_hidden != pChildStyles->getVisibility())
+ {
+ drawinglayer::primitive2d::Primitive2DSequence aNewTarget;
- pCandidate->decomposeSvgNode(aNewTarget, bReferenced);
+ pCandidate->decomposeSvgNode(aNewTarget, bReferenced);
- if(aNewTarget.hasElements())
- {
- drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aNewTarget);
+ if(aNewTarget.hasElements())
+ {
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aNewTarget);
+ }
}
}
- else
+ else if(!pCandidate)
{
OSL_ENSURE(false, "Null-Pointer in child node list (!)");
}
@@ -551,8 +561,6 @@ namespace svgio
if(rTarget.hasElements())
{
- const SvgStyleAttributes* pStyles = getSvgStyleAttributes();
-
if(pStyles)
{
// check if we have Title or Desc
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index f2ba4b5ecfa8..73fe7f8f2178 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1212,6 +1212,7 @@ namespace svgio
maTextAnchor(TextAnchor_notset),
maColor(),
maOpacity(1.0),
+ maVisibility(Visibility_visible),
maTitle(),
maDesc(),
maClipPathXLink(),
@@ -1736,6 +1737,29 @@ namespace svgio
}
break;
}
+ case SVGTokenVisibility:
+ {
+ if(!aContent.isEmpty())
+ {
+ if(aContent.startsWith("visible"))
+ {
+ setVisibility(Visibility_visible);
+ }
+ else if(aContent.startsWith("hidden"))
+ {
+ setVisibility(Visibility_hidden);
+ }
+ else if(aContent.startsWith("collapse"))
+ {
+ setVisibility(Visibility_collapse);
+ }
+ else if(aContent.startsWith("inherit"))
+ {
+ setVisibility(Visibility_inherit);
+ }
+ }
+ break;
+ }
case SVGTokenTitle:
{
setTitle(aContent);
diff --git a/svgio/source/svgreader/svgtoken.cxx b/svgio/source/svgreader/svgtoken.cxx
index fa5d7ba44bca..f0ff8031de2c 100644
--- a/svgio/source/svgreader/svgtoken.cxx
+++ b/svgio/source/svgreader/svgtoken.cxx
@@ -91,6 +91,7 @@ namespace svgio
static OUString aSVGStrPatternContentUnits("patternContentUnits");
static OUString aSVGStrPatternTransform("patternTransform");
static OUString aSVGStrOpacity("opacity");
+ static OUString aSVGStrVisibility("visibility");
static OUString aSVGStrTitle("title");
static OUString aSVGStrDesc("desc");
@@ -236,6 +237,7 @@ namespace svgio
aSVGTokenMapperList.insert(SVGTokenValueType(aSVGStrPatternContentUnits, SVGTokenPatternContentUnits));
aSVGTokenMapperList.insert(SVGTokenValueType(aSVGStrPatternTransform, SVGTokenPatternTransform));
aSVGTokenMapperList.insert(SVGTokenValueType(aSVGStrOpacity, SVGTokenOpacity));
+ aSVGTokenMapperList.insert(SVGTokenValueType(aSVGStrVisibility, SVGTokenVisibility));
aSVGTokenMapperList.insert(SVGTokenValueType(aSVGStrTitle, SVGTokenTitle));
aSVGTokenMapperList.insert(SVGTokenValueType(aSVGStrDesc, SVGTokenDesc));