summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFridrich Štrba <fridrich.strba@bluewin.ch>2014-02-04 13:39:05 +0100
committerFridrich Štrba <fridrich.strba@bluewin.ch>2014-02-04 13:39:05 +0100
commit3e4d354f8fa163548d710fb87b5d8e18b531229c (patch)
tree1585b8fb28338f2ec7b6a82dce625cd6de789722
parent17843d542375641f707d9737fa77fff5180ec031 (diff)
Some other ideas about handling the theming
Change-Id: Iec8c5f49827ee2b18ddf97d37077b2f0798a0685
-rw-r--r--src/lib/VSDCollector.h5
-rw-r--r--src/lib/VSDContentCollector.cpp23
-rw-r--r--src/lib/VSDContentCollector.h7
-rw-r--r--src/lib/VSDStencils.cpp13
-rw-r--r--src/lib/VSDStencils.h1
-rw-r--r--src/lib/VSDStyles.cpp13
-rw-r--r--src/lib/VSDStyles.h52
-rw-r--r--src/lib/VSDStylesCollector.cpp23
-rw-r--r--src/lib/VSDStylesCollector.h4
9 files changed, 129 insertions, 12 deletions
diff --git a/src/lib/VSDCollector.h b/src/lib/VSDCollector.h
index 7733fd0..26875f5 100644
--- a/src/lib/VSDCollector.h
+++ b/src/lib/VSDCollector.h
@@ -39,6 +39,8 @@ public:
const boost::optional<unsigned char> &fillPattern, const boost::optional<double> &fillFGTransparency,
const boost::optional<double> &fillBGTransparency, const boost::optional<unsigned char> &shadowPattern,
const boost::optional<Colour> &shfgc) = 0;
+ virtual void collectThemeReference(unsigned level, const boost::optional<long> &lineColour, const boost::optional<long> &fillColour,
+ const boost::optional<long> &shadowColour, const boost::optional<long> &fontColour) = 0;
virtual void collectGeometry(unsigned id, unsigned level, bool noFill, bool noLine, bool noShow) = 0;
virtual void collectMoveTo(unsigned id, unsigned level, double x, double y) = 0;
virtual void collectLineTo(unsigned id, unsigned level, double x, double y) = 0;
@@ -129,6 +131,9 @@ public:
const boost::optional<unsigned char> &verticalAlign, const boost::optional<bool> &isBgFilled,
const boost::optional<Colour> &bgColour, const boost::optional<double> &defaultTabStop,
const boost::optional<unsigned char> &textDirection) = 0;
+ virtual void collectStyleThemeReference(unsigned level, const boost::optional<long> &lineColour, const boost::optional<long> &fillColour,
+ const boost::optional<long> &shadowColour, const boost::optional<long> &fontColour) = 0;
+
// Field list
virtual void collectFieldList(unsigned id, unsigned level) = 0;
virtual void collectTextField(unsigned id, unsigned level, int nameId, int formatStringId) = 0;
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index 7bb1c43..9de0d30 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -75,8 +75,8 @@ libvisio::VSDContentCollector::VSDContentCollector(
m_pageOutputDrawing(), m_pageOutputText(), m_documentPageShapeOrders(documentPageShapeOrders),
m_pageShapeOrder(m_documentPageShapeOrders.begin()), m_isFirstGeometry(true), m_NURBSData(), m_polylineData(),
m_textStream(), m_names(), m_stencilNames(), m_fields(), m_stencilFields(), m_fieldIndex(0),
- m_textFormat(VSD_TEXT_ANSI), m_charFormats(), m_paraFormats(), m_lineStyle(), m_fillStyle(),
- m_textBlockStyle(), m_defaultCharStyle(), m_defaultParaStyle(), m_currentStyleSheet(0), m_styles(styles),
+ m_textFormat(VSD_TEXT_ANSI), m_charFormats(), m_paraFormats(), m_lineStyle(), m_fillStyle(), m_textBlockStyle(),
+ m_themeReference(), m_defaultCharStyle(), m_defaultParaStyle(), m_currentStyleSheet(0), m_styles(styles),
m_stencils(stencils), m_stencilShape(0), m_isStencilStarted(false), m_currentGeometryCount(0),
m_backgroundPageID(MINUS_ONE), m_currentPageID(0), m_currentPage(), m_pages(),
m_splineControlPoints(), m_splineKnotVector(), m_splineX(0.0), m_splineY(0.0),
@@ -1053,12 +1053,20 @@ void libvisio::VSDContentCollector::collectFillAndShadow(unsigned level, const b
}
void libvisio::VSDContentCollector::collectFillAndShadow(unsigned level, const boost::optional<Colour> &colourFG, const boost::optional<Colour> &colourBG,
- const boost::optional<unsigned char> &fillPattern, const boost::optional<double> &fillFGTransparency, const boost::optional<double> &fillBGTransparency,
+ const boost::optional<unsigned char> &fillPattern, const boost::optional<double> &fillFGTransparency,
+ const boost::optional<double> &fillBGTransparency,
const boost::optional<unsigned char> &shadowPattern, const boost::optional<Colour> &shfgc)
{
collectFillAndShadow(level, colourFG, colourBG, fillPattern, fillFGTransparency, fillBGTransparency, shadowPattern, shfgc, m_shadowOffsetX, m_shadowOffsetY);
}
+void libvisio::VSDContentCollector::collectThemeReference(unsigned level, const boost::optional<long> &lineColour, const boost::optional<long> &fillColour,
+ const boost::optional<long> &shadowColour, const boost::optional<long> &fontColour)
+{
+ _handleLevelChange(level);
+ m_themeReference.override(VSDOptionalThemeReference(lineColour, fillColour, shadowColour, fontColour));
+}
+
void libvisio::VSDContentCollector::collectForeignData(unsigned level, const librevenge::RVNGBinaryData &binaryData)
{
_handleLevelChange(level);
@@ -2611,6 +2619,15 @@ void libvisio::VSDContentCollector::_fillAndShadowProperties(const VSDFillStyle
}
}
+void libvisio::VSDContentCollector::collectStyleThemeReference(unsigned /* level */, const boost::optional<long> &lineColour,
+ const boost::optional<long> &fillColour, const boost::optional<long> &shadowColour,
+ const boost::optional<long> &fontColour)
+{
+ VSDOptionalThemeReference themeReference(lineColour, fillColour, shadowColour, fontColour);
+ m_styles.addStyleThemeReference(m_currentStyleSheet, themeReference);
+}
+
+
void libvisio::VSDContentCollector::collectFieldList(unsigned /* id */, unsigned level)
{
_handleLevelChange(level);
diff --git a/src/lib/VSDContentCollector.h b/src/lib/VSDContentCollector.h
index 9ffcdba..38c6f72 100644
--- a/src/lib/VSDContentCollector.h
+++ b/src/lib/VSDContentCollector.h
@@ -58,6 +58,8 @@ public:
const boost::optional<unsigned char> &fillPattern, const boost::optional<double> &fillFGTransparency,
const boost::optional<double> &fillBGTransparency, const boost::optional<unsigned char> &shadowPattern,
const boost::optional<Colour> &shfgc);
+ void collectThemeReference(unsigned level, const boost::optional<long> &lineColour, const boost::optional<long> &fillColour,
+ const boost::optional<long> &shadowColour, const boost::optional<long> &fontColour);
void collectGeometry(unsigned id, unsigned level, bool noFill, bool noLine, bool noShow);
void collectMoveTo(unsigned id, unsigned level, double x, double y);
void collectLineTo(unsigned id, unsigned level, double x, double y);
@@ -150,6 +152,9 @@ public:
const boost::optional<unsigned char> &verticalAlign, const boost::optional<bool> &isBgFilled,
const boost::optional<Colour> &bgColour, const boost::optional<double> &defaultTabStop,
const boost::optional<unsigned char> &textDirection);
+ void collectStyleThemeReference(unsigned level, const boost::optional<long> &lineColour, const boost::optional<long> &fillColour,
+ const boost::optional<long> &shadowColour, const boost::optional<long> &fontColour);
+
// Field list
void collectFieldList(unsigned id, unsigned level);
@@ -266,6 +271,8 @@ private:
VSDFillStyle m_fillStyle;
VSDTextBlockStyle m_textBlockStyle;
+ VSDThemeReference m_themeReference;
+
VSDCharStyle m_defaultCharStyle;
VSDParaStyle m_defaultParaStyle;
diff --git a/src/lib/VSDStencils.cpp b/src/lib/VSDStencils.cpp
index c866bfa..8477984 100644
--- a/src/lib/VSDStencils.cpp
+++ b/src/lib/VSDStencils.cpp
@@ -13,9 +13,10 @@
libvisio::VSDShape::VSDShape()
: m_geometries(), m_shapeList(), m_fields(), m_foreign(0), m_parent(0), m_masterPage(MINUS_ONE),
m_masterShape(MINUS_ONE), m_shapeId(MINUS_ONE), m_lineStyleId(MINUS_ONE), m_fillStyleId(MINUS_ONE),
- m_textStyleId(MINUS_ONE), m_lineStyle(), m_fillStyle(), m_textBlockStyle(), m_charStyle(), m_charList(),
- m_paraStyle(), m_paraList(), m_text(), m_names(), m_textFormat(libvisio::VSD_TEXT_UTF16),
- m_nurbsData(), m_polylineData(), m_xform(), m_txtxform(0), m_misc()
+ m_textStyleId(MINUS_ONE), m_lineStyle(), m_fillStyle(), m_textBlockStyle(), m_charStyle(),
+ m_themeRef(), m_charList(), m_paraStyle(), m_paraList(), m_text(), m_names(),
+ m_textFormat(libvisio::VSD_TEXT_UTF16), m_nurbsData(), m_polylineData(), m_xform(), m_txtxform(0),
+ m_misc()
{
}
@@ -25,8 +26,8 @@ libvisio::VSDShape::VSDShape(const libvisio::VSDShape &shape)
m_masterPage(shape.m_masterPage), m_masterShape(shape.m_masterShape), m_shapeId(shape.m_shapeId),
m_lineStyleId(shape.m_lineStyleId), m_fillStyleId(shape.m_fillStyleId), m_textStyleId(shape.m_textStyleId),
m_lineStyle(shape.m_lineStyle), m_fillStyle(shape.m_fillStyle), m_textBlockStyle(shape.m_textBlockStyle),
- m_charStyle(shape.m_charStyle), m_charList(shape.m_charList), m_paraStyle(shape.m_paraStyle),
- m_paraList(shape.m_paraList), m_text(shape.m_text), m_names(shape.m_names),
+ m_charStyle(shape.m_charStyle), m_themeRef(shape.m_themeRef), m_charList(shape.m_charList),
+ m_paraStyle(shape.m_paraStyle), m_paraList(shape.m_paraList), m_text(shape.m_text), m_names(shape.m_names),
m_textFormat(shape.m_textFormat), m_nurbsData(shape.m_nurbsData), m_polylineData(shape.m_polylineData),
m_xform(shape.m_xform), m_txtxform(shape.m_txtxform ? new XForm(*(shape.m_txtxform)) : 0), m_misc(shape.m_misc)
{
@@ -58,6 +59,7 @@ libvisio::VSDShape &libvisio::VSDShape::operator=(const libvisio::VSDShape &shap
m_fillStyle = shape.m_fillStyle;
m_textBlockStyle = shape.m_textBlockStyle;
m_charStyle = shape.m_charStyle;
+ m_themeRef = shape.m_themeRef;
m_charList = shape.m_charList;
m_paraStyle = shape.m_paraStyle;
m_paraList = shape.m_paraList;
@@ -91,6 +93,7 @@ void libvisio::VSDShape::clear()
m_fillStyle = VSDOptionalFillStyle();
m_textBlockStyle = VSDOptionalTextBlockStyle();
m_charStyle = VSDOptionalCharStyle();
+ m_themeRef = VSDOptionalThemeReference();
m_charList.clear();
m_paraStyle = VSDOptionalParaStyle();
m_paraList.clear();
diff --git a/src/lib/VSDStencils.h b/src/lib/VSDStencils.h
index 0200573..0e9b83d 100644
--- a/src/lib/VSDStencils.h
+++ b/src/lib/VSDStencils.h
@@ -42,6 +42,7 @@ public:
VSDOptionalFillStyle m_fillStyle;
VSDOptionalTextBlockStyle m_textBlockStyle;
VSDOptionalCharStyle m_charStyle;
+ VSDOptionalThemeReference m_themeRef;
VSDCharacterList m_charList;
VSDOptionalParaStyle m_paraStyle;
VSDParagraphList m_paraList;
diff --git a/src/lib/VSDStyles.cpp b/src/lib/VSDStyles.cpp
index d16a0ef..41dc6d6 100644
--- a/src/lib/VSDStyles.cpp
+++ b/src/lib/VSDStyles.cpp
@@ -70,6 +70,11 @@ void libvisio::VSDStyles::addParaStyle(unsigned textStyleIndex, const VSDOptiona
m_paraStyles[textStyleIndex] = paraStyle;
}
+void libvisio::VSDStyles::addStyleThemeReference(unsigned styleIndex, const VSDOptionalThemeReference &themeRef)
+{
+ m_themeRefs[styleIndex] = themeRef;
+}
+
void libvisio::VSDStyles::addLineStyleMaster(unsigned lineStyleIndex, unsigned lineStyleMaster)
{
m_lineStyleMasters[lineStyleIndex] = lineStyleMaster;
@@ -217,4 +222,12 @@ libvisio::VSDOptionalParaStyle libvisio::VSDStyles::getOptionalParaStyle(unsigne
return paraStyle;
}
+libvisio::VSDOptionalThemeReference libvisio::VSDStyles::getOptionalThemeReference(unsigned styleIndex) const
+{
+ VSDOptionalThemeReference themeReference;
+ if (MINUS_ONE == styleIndex)
+ return themeReference;
+ return themeReference;
+}
+
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/VSDStyles.h b/src/lib/VSDStyles.h
index 7e2dca6..425d5ff 100644
--- a/src/lib/VSDStyles.h
+++ b/src/lib/VSDStyles.h
@@ -18,6 +18,55 @@
namespace libvisio
{
+struct VSDOptionalThemeReference
+{
+ VSDOptionalThemeReference() :
+ qsLineColour(), qsFillColour(), qsShadowColour(), qsFontColour() {}
+ VSDOptionalThemeReference(const boost::optional<long> &lineColour, const boost::optional<long> &fillColour,
+ const boost::optional<long> &shadowColour, const boost::optional<long> &fontColour) :
+ qsLineColour(lineColour), qsFillColour(fillColour), qsShadowColour(shadowColour), qsFontColour(fontColour) {}
+ VSDOptionalThemeReference(const VSDOptionalThemeReference &themeRef) :
+ qsLineColour(themeRef.qsLineColour), qsFillColour(themeRef.qsFillColour),
+ qsShadowColour(themeRef.qsShadowColour), qsFontColour(themeRef.qsFontColour) {}
+ ~VSDOptionalThemeReference() {}
+ void override(const VSDOptionalThemeReference &themeRef)
+ {
+ ASSIGN_OPTIONAL(themeRef.qsLineColour, qsLineColour);
+ ASSIGN_OPTIONAL(themeRef.qsFillColour, qsFillColour);
+ ASSIGN_OPTIONAL(themeRef.qsShadowColour, qsShadowColour);
+ ASSIGN_OPTIONAL(themeRef.qsFontColour, qsFontColour);
+ }
+
+ boost::optional<long> qsLineColour;
+ boost::optional<long> qsFillColour;
+ boost::optional<long> qsShadowColour;
+ boost::optional<long> qsFontColour;
+};
+
+struct VSDThemeReference
+{
+ VSDThemeReference() :
+ qsLineColour(-1), qsFillColour(-1), qsShadowColour(-1), qsFontColour(-1) {}
+ VSDThemeReference(long lineColour, long fillColour, long shadowColour, long fontColour) :
+ qsLineColour(lineColour), qsFillColour(fillColour), qsShadowColour(shadowColour), qsFontColour(fontColour) {}
+ VSDThemeReference(const VSDThemeReference &themeRef) :
+ qsLineColour(themeRef.qsLineColour), qsFillColour(themeRef.qsFillColour),
+ qsShadowColour(themeRef.qsShadowColour), qsFontColour(themeRef.qsFontColour) {}
+ ~VSDThemeReference() {}
+ void override(const VSDOptionalThemeReference &themeRef)
+ {
+ ASSIGN_OPTIONAL(themeRef.qsLineColour, qsLineColour);
+ ASSIGN_OPTIONAL(themeRef.qsFillColour, qsFillColour);
+ ASSIGN_OPTIONAL(themeRef.qsShadowColour, qsShadowColour);
+ ASSIGN_OPTIONAL(themeRef.qsFontColour, qsFontColour);
+ }
+
+ long qsLineColour;
+ long qsFillColour;
+ long qsShadowColour;
+ long qsFontColour;
+};
+
struct VSDOptionalLineStyle
{
VSDOptionalLineStyle() :
@@ -423,6 +472,7 @@ public:
void addTextBlockStyle(unsigned textStyleIndex, const VSDOptionalTextBlockStyle &textBlockStyle);
void addCharStyle(unsigned textStyleIndex, const VSDOptionalCharStyle &charStyle);
void addParaStyle(unsigned textStyleIndex, const VSDOptionalParaStyle &paraStyle);
+ void addStyleThemeReference(unsigned styleIndex, const VSDOptionalThemeReference &themeRef);
void addLineStyleMaster(unsigned lineStyleIndex, unsigned lineStyleMaster);
void addFillStyleMaster(unsigned fillStyleIndex, unsigned fillStyleMaster);
@@ -434,6 +484,7 @@ public:
VSDOptionalTextBlockStyle getOptionalTextBlockStyle(unsigned textStyleIndex) const;
VSDOptionalCharStyle getOptionalCharStyle(unsigned textStyleIndex) const;
VSDOptionalParaStyle getOptionalParaStyle(unsigned textStyleIndex) const;
+ VSDOptionalThemeReference getOptionalThemeReference(unsigned styleIndex) const;
private:
std::map<unsigned, VSDOptionalLineStyle> m_lineStyles;
@@ -441,6 +492,7 @@ private:
std::map<unsigned, VSDOptionalTextBlockStyle> m_textBlockStyles;
std::map<unsigned, VSDOptionalCharStyle> m_charStyles;
std::map<unsigned, VSDOptionalParaStyle> m_paraStyles;
+ std::map<unsigned, VSDOptionalThemeReference> m_themeRefs;
std::map<unsigned, unsigned> m_lineStyleMasters;
std::map<unsigned, unsigned> m_fillStyleMasters;
std::map<unsigned, unsigned> m_textStyleMasters;
diff --git a/src/lib/VSDStylesCollector.cpp b/src/lib/VSDStylesCollector.cpp
index 1bdab2e..4fc82f6 100644
--- a/src/lib/VSDStylesCollector.cpp
+++ b/src/lib/VSDStylesCollector.cpp
@@ -75,6 +75,12 @@ void libvisio::VSDStylesCollector::collectFillAndShadow(unsigned level, const bo
_handleLevelChange(level);
}
+void libvisio::VSDStylesCollector::collectThemeReference(unsigned level, const boost::optional<long> & /* lineColour */, const boost::optional<long> & /* fillColour */,
+ const boost::optional<long> & /* shadowColour */, const boost::optional<long> & /* fontColour */)
+{
+ _handleLevelChange(level);
+}
+
void libvisio::VSDStylesCollector::collectGeometry(unsigned /* id */, unsigned level, bool /* noFill */, bool /* noLine */, bool /* noShow */)
{
_handleLevelChange(level);
@@ -343,21 +349,30 @@ void libvisio::VSDStylesCollector::collectCharIXStyle(unsigned /* id */, unsigne
}
void libvisio::VSDStylesCollector::collectParaIXStyle(unsigned /* id */, unsigned level, unsigned /* charCount */, const boost::optional<double> & /* indFirst */,
- const boost::optional<double> & /* indLeft */, const boost::optional<double> & /* indRight */, const boost::optional<double> & /* spLine */, const boost::optional<double> & /* spBefore */,
- const boost::optional<double> & /* spAfter */, const boost::optional<unsigned char> & /* align */, const boost::optional<unsigned> & /* flags */)
+ const boost::optional<double> & /* indLeft */, const boost::optional<double> & /* indRight */,
+ const boost::optional<double> & /* spLine */, const boost::optional<double> & /* spBefore */,
+ const boost::optional<double> & /* spAfter */, const boost::optional<unsigned char> & /* align */,
+ const boost::optional<unsigned> & /* flags */)
{
_handleLevelChange(level);
}
void libvisio::VSDStylesCollector::collectTextBlockStyle(unsigned level, const boost::optional<double> & /* leftMargin */, const boost::optional<double> & /* rightMargin */,
- const boost::optional<double> & /* topMargin */, const boost::optional<double> & /* bottomMargin */, const boost::optional<unsigned char> & /* verticalAlign */,
- const boost::optional<bool> & /* isBgFilled */, const boost::optional<Colour> & /* bgColour */, const boost::optional<double> & /* defaultTabStop */,
+ const boost::optional<double> & /* topMargin */, const boost::optional<double> & /* bottomMargin */,
+ const boost::optional<unsigned char> & /* verticalAlign */, const boost::optional<bool> & /* isBgFilled */,
+ const boost::optional<Colour> & /* bgColour */, const boost::optional<double> & /* defaultTabStop */,
const boost::optional<unsigned char> & /* textDirection */)
{
_handleLevelChange(level);
}
+void libvisio::VSDStylesCollector::collectStyleThemeReference(unsigned level, const boost::optional<long> & /* lineColour */, const boost::optional<long> & /* fillColour */,
+ const boost::optional<long> & /* shadowColour */, const boost::optional<long> & /* fontColour */)
+{
+ _handleLevelChange(level);
+}
+
void libvisio::VSDStylesCollector::collectFieldList(unsigned /* id */, unsigned level)
{
_handleLevelChange(level);
diff --git a/src/lib/VSDStylesCollector.h b/src/lib/VSDStylesCollector.h
index e490801..38c9082 100644
--- a/src/lib/VSDStylesCollector.h
+++ b/src/lib/VSDStylesCollector.h
@@ -50,6 +50,8 @@ public:
const boost::optional<unsigned char> &fillPattern, const boost::optional<double> &fillFGTransparency,
const boost::optional<double> &fillBGTransparency, const boost::optional<unsigned char> &shadowPattern,
const boost::optional<Colour> &shfgc);
+ void collectThemeReference(unsigned level, const boost::optional<long> &lineColour, const boost::optional<long> &fillColour,
+ const boost::optional<long> &shadowColour, const boost::optional<long> &fontColour);
void collectGeometry(unsigned id, unsigned level, bool noFill, bool noLine, bool noShow);
void collectMoveTo(unsigned id, unsigned level, double x, double y);
void collectLineTo(unsigned id, unsigned level, double x, double y);
@@ -142,6 +144,8 @@ public:
const boost::optional<unsigned char> &verticalAlign, const boost::optional<bool> &isBgFilled,
const boost::optional<Colour> &bgColour, const boost::optional<double> &defaultTabStop,
const boost::optional<unsigned char> &textDirection);
+ void collectStyleThemeReference(unsigned level, const boost::optional<long> &lineColour, const boost::optional<long> &fillColour,
+ const boost::optional<long> &shadowColour, const boost::optional<long> &fontColour);
// Field list
void collectFieldList(unsigned id, unsigned level);