[Libreoffice-commits] libvisio.git: src/lib

Fridrich Štrba fridrich.strba at bluewin.ch
Wed Dec 23 01:21:34 PST 2015


 src/lib/VSD5Parser.cpp          |   11 +++++++---
 src/lib/VSD6Parser.cpp          |   11 +++++++---
 src/lib/VSDCollector.h          |    3 ++
 src/lib/VSDContentCollector.cpp |   30 +++++++++++++++++++++++------
 src/lib/VSDContentCollector.h   |    5 +++-
 src/lib/VSDParagraphList.cpp    |   31 ++++++++++++++++++------------
 src/lib/VSDParagraphList.h      |    1 
 src/lib/VSDParser.cpp           |   25 +++++++++++++++++++-----
 src/lib/VSDStyles.h             |   28 +++++++++++++++++++--------
 src/lib/VSDStylesCollector.cpp  |    5 +++-
 src/lib/VSDStylesCollector.h    |    5 +++-
 src/lib/VSDTypes.h              |   14 +++++++++++--
 src/lib/VSDXMLParserBase.cpp    |   41 ++++++++++++++++++++++++++++++++++++----
 src/lib/tokens.txt              |    2 +
 14 files changed, 166 insertions(+), 46 deletions(-)

New commits:
commit dd3e1aa57823acd021c8c37076bc2624b6946bfe
Author: Fridrich Štrba <fridrich.strba at bluewin.ch>
Date:   Wed Dec 23 10:21:10 2015 +0100

    Parse bulletFont and bulletFontSize where applicable
    
    Change-Id: Ibc5ad36a379a3a5bac0c8d561d1d2b33fbde9f91

diff --git a/src/lib/VSD5Parser.cpp b/src/lib/VSD5Parser.cpp
index 20c4430..31cc1c0 100644
--- a/src/lib/VSD5Parser.cpp
+++ b/src/lib/VSD5Parser.cpp
@@ -237,12 +237,15 @@ void libvisio::VSD5Parser::readParaIX(librevenge::RVNGInputStream *input)
 
   unsigned char bullet(0);
   VSDName bulletStr;
+  VSDName bulletFont;
+  double bulletFontSize(0.0);
   double textPosAfterTab(0.0);
   unsigned flags(0);
 
   if (m_isInStyles)
     m_collector->collectParaIXStyle(m_header.id, m_header.level, charCount, indFirst, indLeft, indRight,
-                                    spLine, spBefore, spAfter, align, bullet, bulletStr, textPosAfterTab, flags);
+                                    spLine, spBefore, spAfter, align, bullet, bulletStr,
+                                    bulletFont, bulletFontSize, textPosAfterTab, flags);
   else
   {
     if (m_isStencilStarted)
@@ -252,9 +255,11 @@ void libvisio::VSD5Parser::readParaIX(librevenge::RVNGInputStream *input)
 
     m_shape.m_paraStyle.override(VSDOptionalParaStyle(charCount, indFirst, indLeft, indRight,
                                                       spLine, spBefore, spAfter, align, bullet,
-                                                      bulletStr, textPosAfterTab, flags));
+                                                      bulletStr, bulletFont, bulletFontSize,
+                                                      textPosAfterTab, flags));
     m_shape.m_paraList.addParaIX(m_header.id, m_header.level, charCount, indFirst, indLeft, indRight,
-                                 spLine, spBefore, spAfter, align, bullet, bulletStr, textPosAfterTab, flags);
+                                 spLine, spBefore, spAfter, align, bullet, bulletStr, bulletFont,
+                                 bulletFontSize, textPosAfterTab, flags);
   }
 }
 
diff --git a/src/lib/VSD6Parser.cpp b/src/lib/VSD6Parser.cpp
index e8707c6..d126433 100644
--- a/src/lib/VSD6Parser.cpp
+++ b/src/lib/VSD6Parser.cpp
@@ -192,6 +192,9 @@ void libvisio::VSD6Parser::readParaIX(librevenge::RVNGInputStream *input)
   long remainingData = m_header.dataLength - input->tell() + startPosition;
   unsigned blockLength = 0;
   VSDName bulletStr;
+  VSDName bulletFont;
+  double bulletFontSize(0.0);
+  double textPosAfterBullet(0.0);
 
   while (remainingData >= 4 && (blockLength = readU32(input)))
   {
@@ -219,7 +222,8 @@ void libvisio::VSD6Parser::readParaIX(librevenge::RVNGInputStream *input)
 
   if (m_isInStyles)
     m_collector->collectParaIXStyle(m_header.id, m_header.level, charCount, indFirst, indLeft, indRight,
-                                    spLine, spBefore, spAfter, align, bullet, bulletStr, 0.0, flags);
+                                    spLine, spBefore, spAfter, align, bullet, bulletStr, bulletFont,
+                                    bulletFontSize, textPosAfterBullet, flags);
   else
   {
     if (m_isStencilStarted)
@@ -229,9 +233,10 @@ void libvisio::VSD6Parser::readParaIX(librevenge::RVNGInputStream *input)
 
     m_shape.m_paraStyle.override(VSDOptionalParaStyle(charCount, indFirst, indLeft, indRight,
                                                       spLine, spBefore, spAfter, align, bullet,
-                                                      bulletStr, 0.0, flags));
+                                                      bulletStr,bulletFont, bulletFontSize, textPosAfterBullet, flags));
     m_shape.m_paraList.addParaIX(m_header.id, m_header.level, charCount, indFirst, indLeft, indRight,
-                                 spLine, spBefore, spAfter, align, bullet, bulletStr, 0.0, flags);
+                                 spLine, spBefore, spAfter, align, bullet, bulletStr, bulletFont,
+                                 bulletFontSize, textPosAfterBullet, flags);
   }
 }
 
diff --git a/src/lib/VSDCollector.h b/src/lib/VSDCollector.h
index 56f6b82..201a759 100644
--- a/src/lib/VSDCollector.h
+++ b/src/lib/VSDCollector.h
@@ -90,11 +90,13 @@ public:
                              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 char> &bullet, const boost::optional<VSDName> &bulletStr,
+                             const boost::optional<VSDName> &bulletFont, const boost::optional<double> &bulletFontSize,
                              const boost::optional<double> &textPosAfterBullet, const boost::optional<unsigned> &flags) = 0;
   virtual void collectDefaultParaStyle(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 char> &bullet, const boost::optional<VSDName> &bulletStr,
+                                       const boost::optional<VSDName> &bulletFont, const boost::optional<double> &bulletFontSize,
                                        const boost::optional<double> &textPosAfterBullet, const boost::optional<unsigned> &flags) = 0;
   virtual void collectTextBlock(unsigned level, const boost::optional<double> &leftMargin, const boost::optional<double> &rightMargin,
                                 const boost::optional<double> &topMargin, const boost::optional<double> &bottomMargin,
@@ -132,6 +134,7 @@ public:
                                   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 char> &bullet, const boost::optional<VSDName> &bulletStr,
+                                  const boost::optional<VSDName> &bulletFont, const boost::optional<double> &bulletFontSize,
                                   const boost::optional<double> &textPosAfterBullet, const boost::optional<unsigned> &flags) = 0;
   virtual void collectTextBlockStyle(unsigned level, const boost::optional<double> &leftMargin, const boost::optional<double> &rightMargin,
                                      const boost::optional<double> &topMargin, const boost::optional<double> &bottomMargin,
diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index 190eb84..1e59e86 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -2212,12 +2212,13 @@ void libvisio::VSDContentCollector::collectParaIX(unsigned /* id */ , unsigned l
                                                   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 char> &bullet, const boost::optional<VSDName> &bulletStr,
+                                                  const boost::optional<VSDName> &bulletFont, const boost::optional<double> &bulletFontSize,
                                                   const boost::optional<double> &textPosAfterBullet,  const boost::optional<unsigned> &flags)
 {
   _handleLevelChange(level);
   VSDParaStyle format(m_defaultParaStyle);
   format.override(VSDOptionalParaStyle(charCount, indFirst, indLeft, indRight, spLine, spBefore, spAfter, align,
-                                       bullet, bulletStr, textPosAfterBullet, flags));
+                                       bullet, bulletStr, bulletFont, bulletFontSize, textPosAfterBullet, flags));
   format.charCount = charCount;
   m_paraFormats.push_back(format);
 }
@@ -2227,10 +2228,11 @@ void libvisio::VSDContentCollector::collectDefaultParaStyle(unsigned charCount,
                                                             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 char> &bullet, const boost::optional<VSDName> &bulletStr,
+                                                            const boost::optional<VSDName> &bulletFont, const boost::optional<double> &bulletFontSize,
                                                             const boost::optional<double> &textPosAfterBullet, const boost::optional<unsigned> &flags)
 {
   m_defaultParaStyle.override(VSDOptionalParaStyle(charCount, indFirst, indLeft, indRight, spLine, spBefore, spAfter, align,
-                                                   bullet, bulletStr, textPosAfterBullet, flags));
+                                                   bullet, bulletStr, bulletFont, bulletFontSize, textPosAfterBullet, flags));
 }
 
 void libvisio::VSDContentCollector::collectCharIX(unsigned /* id */ , unsigned level, unsigned charCount,
@@ -2352,11 +2354,12 @@ void libvisio::VSDContentCollector::collectParaIXStyle(unsigned /* id */, unsign
                                                        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 char> &bullet,
-                                                       const boost::optional<VSDName> &bulletStr, const boost::optional<double> &textPosAfterBullet,
+                                                       const boost::optional<VSDName> &bulletStr, const boost::optional<VSDName> &bulletFont,
+                                                       const boost::optional<double> &bulletFontSize, const boost::optional<double> &textPosAfterBullet,
                                                        const boost::optional<unsigned> &flags)
 {
   VSDOptionalParaStyle paraStyle(charCount, indFirst, indLeft, indRight, spLine, spBefore, spAfter, align,
-                                 bullet, bulletStr, textPosAfterBullet, flags);
+                                 bullet, bulletStr, bulletFont, bulletFontSize, textPosAfterBullet, flags);
   m_styles.addParaStyle(m_currentStyleSheet, paraStyle);
 }
 
@@ -3330,14 +3333,22 @@ void libvisio::VSDContentCollector::_appendVisibleAndPrintable(librevenge::RVNGP
 void libvisio::VSDContentCollector::_bulletFromParaFormat(libvisio::VSDBullet &bullet, const libvisio::VSDParaStyle &paraStyle)
 {
   bullet.m_textPosAfterBullet = paraStyle.textPosAfterBullet;
+  bullet.m_bulletFontSize = paraStyle.bulletFontSize;
+  VSDName name = paraStyle.bulletFont;
+  if (name.m_data.empty())
+    bullet.m_bulletFont.clear();
+  else
+    _convertDataToString(bullet.m_bulletFont, name.m_data, name.m_format);
   if (!paraStyle.bullet)
   {
     bullet.m_bulletStr.clear();
+    bullet.m_bulletFont.clear();
+    bullet.m_bulletFontSize = 0.0;
     bullet.m_textPosAfterBullet = 0.0;
   }
   else
   {
-    VSDName name = paraStyle.bulletStr;
+    name = paraStyle.bulletStr;
     if (name.m_data.empty())
       bullet.m_bulletStr.clear();
     else
@@ -3381,7 +3392,14 @@ void libvisio::VSDContentCollector::_listLevelFromBullet(librevenge::RVNGPropert
     return;
   propList.insert("librevenge:level", 1);
   propList.insert("text:bullet-char", bullet.m_bulletStr);
-  propList.insert("fo:font-size", 1.0, librevenge::RVNG_PERCENT);
+  if (!(bullet.m_bulletFont.empty()))
+    propList.insert("fo:font-family", bullet.m_bulletFont);
+  if (bullet.m_bulletFontSize > 0.0)
+    propList.insert("fo:font-size", bullet.m_bulletFontSize*72.0, librevenge::RVNG_POINT);
+  else if (bullet.m_bulletFontSize < 0.0)
+    propList.insert("fo:font-size", -bullet.m_bulletFontSize, librevenge::RVNG_PERCENT);
+  else
+    propList.insert("fo:font-size", 1.0, librevenge::RVNG_PERCENT);
   if (bullet.m_textPosAfterBullet > 0.0)
     propList.insert("text:min-label-width", bullet.m_textPosAfterBullet);
   else
diff --git a/src/lib/VSDContentCollector.h b/src/lib/VSDContentCollector.h
index 6cc8da1..67decfb 100644
--- a/src/lib/VSDContentCollector.h
+++ b/src/lib/VSDContentCollector.h
@@ -109,12 +109,14 @@ public:
   void collectParaIX(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 char> &bullet, const boost::optional<VSDName> &bulletStr, const boost::optional<double> &textPosAfterBullet,
+                     const boost::optional<unsigned char> &bullet, const boost::optional<VSDName> &bulletStr, const boost::optional<VSDName> &bulletFont,
+                     const boost::optional<double> &bulletFontSize, const boost::optional<double> &textPosAfterBullet,
                      const boost::optional<unsigned> &flags);
   void collectDefaultParaStyle(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 char> &bullet, const boost::optional<VSDName> &bulletStr,
+                               const boost::optional<VSDName> &bulletFont, const boost::optional<double> &bulletFontSize,
                                const boost::optional<double> &textPosAfterBullet, const boost::optional<unsigned> &flags);
   void collectTextBlock(unsigned level, const boost::optional<double> &leftMargin, const boost::optional<double> &rightMargin,
                         const boost::optional<double> &topMargin, const boost::optional<double> &bottomMargin,
@@ -152,6 +154,7 @@ public:
                           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 char> &bullet, const boost::optional<VSDName> &bulletStr,
+                          const boost::optional<VSDName> &bulletFont, const boost::optional<double> &bulletFontSize,
                           const boost::optional<double> &textPosAfterBullet, const boost::optional<unsigned> &flags);
   void collectTextBlockStyle(unsigned level, const boost::optional<double> &leftMargin, const boost::optional<double> &rightMargin,
                              const boost::optional<double> &topMargin, const boost::optional<double> &bottomMargin,
diff --git a/src/lib/VSDParagraphList.cpp b/src/lib/VSDParagraphList.cpp
index 27c66f0..6c20516 100644
--- a/src/lib/VSDParagraphList.cpp
+++ b/src/lib/VSDParagraphList.cpp
@@ -34,10 +34,11 @@ public:
             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 char> &bullet, const boost::optional<VSDName> &bulletStr,
+            const boost::optional<VSDName> &bulletFont, const boost::optional<double> &bulletFontSize,
             const boost::optional<double> &textPosAfterBullet, const boost::optional<unsigned> &flags) :
     VSDParagraphListElement(id, level),
     m_style(charCount, indFirst, indLeft, indRight, spLine, spBefore, spAfter,
-            align, bullet, bulletStr, textPosAfterBullet, flags) {}
+            align, bullet, bulletStr, bulletFont, bulletFontSize, textPosAfterBullet, flags) {}
   ~VSDParaIX() {}
   void handle(VSDCollector *collector) const;
   VSDParagraphListElement *clone();
@@ -57,16 +58,18 @@ public:
 
 void libvisio::VSDParaIX::handle(VSDCollector *collector) const
 {
-  collector->collectParaIX(m_id, m_level, m_style.charCount, m_style.indFirst, m_style.indLeft, m_style.indRight,
-                           m_style.spLine, m_style.spBefore, m_style.spAfter, m_style.align, m_style.bullet,
-                           m_style.bulletStr, m_style.textPosAfterBullet, m_style.flags);
+  collector->collectParaIX(m_id, m_level, m_style.charCount, m_style.indFirst, m_style.indLeft,
+                           m_style.indRight, m_style.spLine, m_style.spBefore, m_style.spAfter,
+                           m_style.align, m_style.bullet, m_style.bulletStr, m_style.bulletFont,
+                           m_style.bulletFontSize, m_style.textPosAfterBullet, m_style.flags);
 }
 
 libvisio::VSDParagraphListElement *libvisio::VSDParaIX::clone()
 {
-  return new VSDParaIX(m_id, m_level, m_style.charCount, m_style.indFirst, m_style.indLeft, m_style.indRight,
-                       m_style.spLine, m_style.spBefore, m_style.spAfter, m_style.align, m_style.bullet,
-                       m_style.bulletStr, m_style.textPosAfterBullet, m_style.flags);
+  return new VSDParaIX(m_id, m_level, m_style.charCount, m_style.indFirst, m_style.indLeft,
+                       m_style.indRight, m_style.spLine, m_style.spBefore, m_style.spAfter,
+                       m_style.align, m_style.bullet, m_style.bulletStr, m_style.bulletFont,
+                       m_style.bulletFontSize, m_style.textPosAfterBullet, m_style.flags);
 }
 
 
@@ -105,6 +108,7 @@ void libvisio::VSDParagraphList::addParaIX(unsigned id, unsigned level, unsigned
                                            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 char> &bullet, const boost::optional<VSDName> &bulletStr,
+                                           const boost::optional<VSDName> &bulletFont, const boost::optional<double> &bulletFontSize,
                                            const boost::optional<double> &textPosAfterBullet, const boost::optional<unsigned> &flags)
 {
   VSDParaIX *tmpElement = dynamic_cast<VSDParaIX *>(m_elements[id]);
@@ -118,19 +122,22 @@ void libvisio::VSDParagraphList::addParaIX(unsigned id, unsigned level, unsigned
       m_elements.erase(iter);
     }
 
-    m_elements[id] = new VSDParaIX(id, level, charCount, indFirst, indLeft, indRight, spLine, spBefore, spAfter,
-                                   align, bullet, bulletStr, textPosAfterBullet, flags);
+    m_elements[id] = new VSDParaIX(id, level, charCount, indFirst, indLeft, indRight, spLine, spBefore,
+                                   spAfter, align, bullet, bulletStr, bulletFont, bulletFontSize,
+                                   textPosAfterBullet, flags);
   }
   else
-    tmpElement->m_style.override(VSDOptionalParaStyle(charCount, indFirst, indLeft, indRight, spLine, spBefore, spAfter,
-                                                      align, bullet, bulletStr, textPosAfterBullet, flags));
+    tmpElement->m_style.override(VSDOptionalParaStyle(charCount, indFirst, indLeft, indRight, spLine, spBefore,
+                                                      spAfter, align, bullet, bulletStr, bulletFont, bulletFontSize,
+                                                      textPosAfterBullet, flags));
 }
 
 void libvisio::VSDParagraphList::addParaIX(unsigned id, unsigned level, const VSDOptionalParaStyle &style)
 {
   addParaIX(id, level, style.charCount, style.indFirst, style.indLeft, style.indRight,
             style.spLine, style.spBefore, style.spAfter, style.align,
-            style.bullet, style.bulletStr, style.textPosAfterBullet, style.flags);
+            style.bullet, style.bulletStr, style.bulletFont, style.bulletFontSize,
+            style.textPosAfterBullet, style.flags);
 }
 
 unsigned libvisio::VSDParagraphList::getCharCount(unsigned id) const
diff --git a/src/lib/VSDParagraphList.h b/src/lib/VSDParagraphList.h
index 72ff37f..090ce91 100644
--- a/src/lib/VSDParagraphList.h
+++ b/src/lib/VSDParagraphList.h
@@ -31,6 +31,7 @@ public:
                  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 char> &bullet, const boost::optional<VSDName> &bulletStr,
+                 const boost::optional<VSDName> &bulletFont, const boost::optional<double> &bulletFontSize,
                  const boost::optional<double> &textPosAfterBullet, const boost::optional<unsigned> &flags);
   void addParaIX(unsigned id, unsigned level, const VSDOptionalParaStyle &style);
   unsigned getCharCount(unsigned id) const;
diff --git a/src/lib/VSDParser.cpp b/src/lib/VSDParser.cpp
index bdf4abe..e82a678 100644
--- a/src/lib/VSDParser.cpp
+++ b/src/lib/VSDParser.cpp
@@ -683,7 +683,8 @@ void libvisio::VSDParser::_flushShape()
   m_collector->collectDefaultParaStyle(m_shape.m_paraStyle.charCount, m_shape.m_paraStyle.indFirst, m_shape.m_paraStyle.indLeft,
                                        m_shape.m_paraStyle.indRight, m_shape.m_paraStyle.spLine, m_shape.m_paraStyle.spBefore,
                                        m_shape.m_paraStyle.spAfter, m_shape.m_paraStyle.align, m_shape.m_paraStyle.bullet,
-                                       m_shape.m_paraStyle.bulletStr, m_shape.m_paraStyle.textPosAfterBullet, m_shape.m_paraStyle.flags);
+                                       m_shape.m_paraStyle.bulletStr, m_shape.m_paraStyle.bulletFont, m_shape.m_paraStyle.bulletFontSize,
+                                       m_shape.m_paraStyle.textPosAfterBullet, m_shape.m_paraStyle.flags);
 
   m_shape.m_paraList.handle(m_collector);
 }
@@ -1919,7 +1920,18 @@ void libvisio::VSDParser::readParaIX(librevenge::RVNGInputStream *input)
   double spAfter = readDouble(input);
   unsigned char align = readU8(input);
   unsigned char bullet = readU8(input);
-  input->seek(17, librevenge::RVNG_SEEK_CUR);
+  input->seek(4, librevenge::RVNG_SEEK_CUR);
+  unsigned fontID = readU16(input);
+  VSDName bulletFont;
+  if (fontID)
+  {
+    std::map<unsigned, VSDName>::const_iterator iter = m_fonts.find(fontID);
+    if (iter != m_fonts.end())
+      bulletFont = iter->second;
+  }
+  input->seek(2, librevenge::RVNG_SEEK_CUR);
+  double bulletFontSize = readDouble(input);
+  input->seek(1, librevenge::RVNG_SEEK_CUR);
   double textPosAfterBullet = readDouble(input);
   unsigned flags = readU32(input);
   input->seek(34, librevenge::RVNG_SEEK_CUR);
@@ -1954,7 +1966,8 @@ void libvisio::VSDParser::readParaIX(librevenge::RVNGInputStream *input)
 
   if (m_isInStyles)
     m_collector->collectParaIXStyle(m_header.id, m_header.level, charCount, indFirst, indLeft, indRight,
-                                    spLine, spBefore, spAfter, align, bullet, bulletStr, textPosAfterBullet, flags);
+                                    spLine, spBefore, spAfter, align, bullet, bulletStr, bulletFont,
+                                    bulletFontSize, textPosAfterBullet, flags);
   else
   {
     if (m_isStencilStarted)
@@ -1964,10 +1977,12 @@ void libvisio::VSDParser::readParaIX(librevenge::RVNGInputStream *input)
 
     m_shape.m_paraStyle.override(VSDOptionalParaStyle(charCount, indFirst, indLeft, indRight,
                                                       spLine, spBefore, spAfter, align, bullet,
-                                                      bulletStr, textPosAfterBullet, flags));
+                                                      bulletStr, bulletFont, bulletFontSize,
+                                                      textPosAfterBullet, flags));
     m_shape.m_paraList.addParaIX(m_header.id, m_header.level, charCount, indFirst,
                                  indLeft, indRight, spLine, spBefore, spAfter, align,
-                                 bullet, bulletStr, textPosAfterBullet, flags);
+                                 bullet, bulletStr, bulletFont, bulletFontSize,
+                                 textPosAfterBullet, flags);
   }
 }
 
diff --git a/src/lib/VSDStyles.h b/src/lib/VSDStyles.h
index a4245ac..2a592fa 100644
--- a/src/lib/VSDStyles.h
+++ b/src/lib/VSDStyles.h
@@ -321,17 +321,19 @@ struct VSDOptionalParaStyle
 {
   VSDOptionalParaStyle() :
     charCount(0), indFirst(), indLeft(), indRight(), spLine(), spBefore(), spAfter(), align(), bullet(),
-    bulletStr(), textPosAfterBullet(0.0), flags() {}
+    bulletStr(), bulletFont(), bulletFontSize(0.0), textPosAfterBullet(0.0), flags() {}
   VSDOptionalParaStyle(unsigned cc, const boost::optional<double> &ifst, const boost::optional<double> &il,
                        const boost::optional<double> &ir, const boost::optional<double> &sl, const boost::optional<double> &sb,
                        const boost::optional<double> &sa, const boost::optional<unsigned char> &a, const boost::optional<unsigned char> &b,
-                       const boost::optional<VSDName> &bs, const boost::optional<double> &tpab, const boost::optional<unsigned> &f) :
+                       const boost::optional<VSDName> &bs, const boost::optional<VSDName> &bf, const boost::optional<double> bfs,
+                       const boost::optional<double> &tpab, const boost::optional<unsigned> &f) :
     charCount(cc), indFirst(ifst), indLeft(il), indRight(ir), spLine(sl), spBefore(sb), spAfter(sa), align(a), bullet(b),
-    bulletStr(bs), textPosAfterBullet(tpab), flags(f) {}
+    bulletStr(bs), bulletFont(bf), bulletFontSize(bfs), textPosAfterBullet(tpab), flags(f) {}
   VSDOptionalParaStyle(const VSDOptionalParaStyle &style) :
     charCount(style.charCount), indFirst(style.indFirst), indLeft(style.indLeft), indRight(style.indRight), spLine(style.spLine),
     spBefore(style.spBefore), spAfter(style.spAfter), align(style.align), bullet(style.bullet), bulletStr(style.bulletStr),
-    textPosAfterBullet(style.textPosAfterBullet), flags(style.flags) {}
+    bulletFont(style.bulletFont), bulletFontSize(style.bulletFontSize), textPosAfterBullet(style.textPosAfterBullet),
+    flags(style.flags) {}
   ~VSDOptionalParaStyle() {}
   void override(const VSDOptionalParaStyle &style)
   {
@@ -344,6 +346,8 @@ struct VSDOptionalParaStyle
     ASSIGN_OPTIONAL(style.align, align);
     ASSIGN_OPTIONAL(style.bullet, bullet);
     ASSIGN_OPTIONAL(style.bulletStr, bulletStr);
+    ASSIGN_OPTIONAL(style.bulletFont, bulletFont);
+    ASSIGN_OPTIONAL(style.bulletFontSize, bulletFontSize);
     ASSIGN_OPTIONAL(style.textPosAfterBullet, textPosAfterBullet);
     ASSIGN_OPTIONAL(style.flags, flags);
   }
@@ -358,6 +362,8 @@ struct VSDOptionalParaStyle
   boost::optional<unsigned char> align;
   boost::optional<unsigned char> bullet;
   boost::optional<VSDName> bulletStr;
+  boost::optional<VSDName> bulletFont;
+  boost::optional<double> bulletFontSize;
   boost::optional<double> textPosAfterBullet;
   boost::optional<unsigned> flags;
 };
@@ -366,15 +372,17 @@ struct VSDParaStyle
 {
   VSDParaStyle() :
     charCount(0), indFirst(0.0), indLeft(0.0), indRight(0.0), spLine(-1.2), spBefore(0.0), spAfter(0.0), align(1),
-    bullet(0), bulletStr(), textPosAfterBullet(0.0), flags(0) {}
+    bullet(0), bulletStr(), bulletFont(), bulletFontSize(0.0), textPosAfterBullet(0.0), flags(0) {}
   VSDParaStyle(unsigned cc, double ifst, double il, double ir, double sl, double sb,
-               double sa, unsigned char a, unsigned b, const VSDName &bs, double tpab, unsigned f) :
+               double sa, unsigned char a, unsigned b, const VSDName &bs,
+               const VSDName &bf, double bfs, double tpab, unsigned f) :
     charCount(cc), indFirst(ifst), indLeft(il), indRight(ir), spLine(sl), spBefore(sb), spAfter(sa), align(a),
-    bullet(b), bulletStr(bs), textPosAfterBullet(tpab), flags(f) {}
+    bullet(b), bulletStr(bs), bulletFont(bf), bulletFontSize(bfs), textPosAfterBullet(tpab), flags(f) {}
   VSDParaStyle(const VSDParaStyle &style) :
     charCount(style.charCount), indFirst(style.indFirst), indLeft(style.indLeft), indRight(style.indRight),
     spLine(style.spLine), spBefore(style.spBefore), spAfter(style.spAfter), align(style.align),
-    bullet(style.bullet), bulletStr(style.bulletStr), textPosAfterBullet(style.textPosAfterBullet), flags(style.flags) {}
+    bullet(style.bullet), bulletStr(style.bulletStr), bulletFont(style.bulletFont),
+    bulletFontSize(style.bulletFontSize), textPosAfterBullet(style.textPosAfterBullet), flags(style.flags) {}
   ~VSDParaStyle() {}
   void override(const VSDOptionalParaStyle &style)
   {
@@ -387,6 +395,8 @@ struct VSDParaStyle
     ASSIGN_OPTIONAL(style.align, align);
     ASSIGN_OPTIONAL(style.bullet, bullet);
     ASSIGN_OPTIONAL(style.bulletStr, bulletStr);
+    ASSIGN_OPTIONAL(style.bulletFont, bulletFont);
+    ASSIGN_OPTIONAL(style.bulletFontSize, bulletFontSize);
     ASSIGN_OPTIONAL(style.textPosAfterBullet, textPosAfterBullet);
     ASSIGN_OPTIONAL(style.flags, flags);
   }
@@ -401,6 +411,8 @@ struct VSDParaStyle
   unsigned char align;
   unsigned char bullet;
   VSDName bulletStr;
+  VSDName bulletFont;
+  double bulletFontSize;
   double textPosAfterBullet;
   unsigned flags;
 };
diff --git a/src/lib/VSDStylesCollector.cpp b/src/lib/VSDStylesCollector.cpp
index bb7333e..934b7c3 100644
--- a/src/lib/VSDStylesCollector.cpp
+++ b/src/lib/VSDStylesCollector.cpp
@@ -274,7 +274,8 @@ void libvisio::VSDStylesCollector::collectParaIX(unsigned /* id */, unsigned lev
                                                  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 char> & /* bullet */,
-                                                 const boost::optional<VSDName> & /* bulletStr */, const boost::optional<double> & /* textPosAfterBullet */,
+                                                 const boost::optional<VSDName> & /* bulletStr */, const boost::optional<VSDName> & /* bulletFont */,
+                                                 const boost::optional<double> & /* bulletFontSize */, const boost::optional<double> & /* textPosAfterBullet */,
                                                  const boost::optional<unsigned> & /* flags */)
 {
   _handleLevelChange(level);
@@ -285,6 +286,7 @@ void libvisio::VSDStylesCollector::collectDefaultParaStyle(unsigned /* charCount
                                                            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 char> & /* bullet */, const boost::optional<VSDName> & /* bulletStr */,
+                                                           const boost::optional<VSDName> & /* bulletFont */, const boost::optional<double> & /* bulletFontSize */,
                                                            const boost::optional<double> & /* textPosAfterBullet */, const boost::optional<unsigned> & /* flags */)
 {
 }
@@ -379,6 +381,7 @@ void libvisio::VSDStylesCollector::collectParaIXStyle(unsigned /* id */, unsigne
                                                       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 char> & /* bullet */, const boost::optional<VSDName> & /* bulletStr */,
+                                                      const boost::optional<VSDName> & /* bulletFont */, const boost::optional<double> & /* bulletFontSize */,
                                                       const boost::optional<double> & /* textPosAfterBullet */, const boost::optional<unsigned> & /* flags */)
 {
   _handleLevelChange(level);
diff --git a/src/lib/VSDStylesCollector.h b/src/lib/VSDStylesCollector.h
index 1e8048a..a619ad4 100644
--- a/src/lib/VSDStylesCollector.h
+++ b/src/lib/VSDStylesCollector.h
@@ -99,12 +99,14 @@ public:
   void collectParaIX(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 char> &bullet, const boost::optional<VSDName> &bulletStr, const boost::optional<double> &textPosAfterBullet,
+                     const boost::optional<unsigned char> &bullet, const boost::optional<VSDName> &bulletStr, const boost::optional<VSDName> &bulletFont,
+                     const boost::optional<double> &bulletFontSize, const boost::optional<double> &textPosAfterBullet,
                      const boost::optional<unsigned> &flags);
   void collectDefaultParaStyle(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 char> &bullet, const boost::optional<VSDName> &bulletStr,
+                               const boost::optional<VSDName> &bulletFont, const boost::optional<double> &bulletFontSize,
                                const boost::optional<double> &textPosAfterBullet, const boost::optional<unsigned> &flags);
   void collectTextBlock(unsigned level, const boost::optional<double> &leftMargin, const boost::optional<double> &rightMargin,
                         const boost::optional<double> &topMargin, const boost::optional<double> &bottomMargin,
@@ -145,6 +147,7 @@ public:
                           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 char> &bullet, const boost::optional<VSDName> &bulletStr,
+                          const boost::optional<VSDName> &bulletFont, const boost::optional<double> &bulletFontSize,
                           const boost::optional<double> &textPosAfterBullet, const boost::optional<unsigned> &flags);
   void collectTextBlockStyle(unsigned level, const boost::optional<double> &leftMargin, const boost::optional<double> &rightMargin,
                              const boost::optional<double> &topMargin, const boost::optional<double> &bottomMargin,
diff --git a/src/lib/VSDTypes.h b/src/lib/VSDTypes.h
index ef74271..ae0abd9 100644
--- a/src/lib/VSDTypes.h
+++ b/src/lib/VSDTypes.h
@@ -233,14 +233,24 @@ struct VSDTabSet
 struct VSDBullet
 {
   librevenge::RVNGString m_bulletStr;
+  librevenge::RVNGString m_bulletFont;
+  double m_bulletFontSize;
   double m_textPosAfterBullet;
-  VSDBullet() : m_bulletStr(), m_textPosAfterBullet(0.0) {}
+  VSDBullet()
+    : m_bulletStr(),
+      m_bulletFont(),
+      m_bulletFontSize(0.0),
+      m_textPosAfterBullet(0.0) {}
   VSDBullet(const VSDBullet &bullet) :
     m_bulletStr(bullet.m_bulletStr),
+    m_bulletFont(bullet.m_bulletFont),
+    m_bulletFontSize(bullet.m_bulletFontSize),
     m_textPosAfterBullet(bullet.m_textPosAfterBullet) {}
   inline bool operator==(const VSDBullet &bullet) const
   {
     return ((m_bulletStr == bullet.m_bulletStr) &&
+            (m_bulletFont == bullet.m_bulletFont) &&
+            (m_bulletFontSize == bullet.m_bulletFontSize) &&
             (m_textPosAfterBullet == bullet.m_textPosAfterBullet));
   }
   inline bool operator!=(const VSDBullet &bullet) const
@@ -249,7 +259,7 @@ struct VSDBullet
   }
   inline bool operator!() const
   {
-    return (m_bulletStr.empty() && m_textPosAfterBullet == 0.0);
+    return m_bulletStr.empty();
   }
 };
 
diff --git a/src/lib/VSDXMLParserBase.cpp b/src/lib/VSDXMLParserBase.cpp
index fa375c2..96b4a8e 100644
--- a/src/lib/VSDXMLParserBase.cpp
+++ b/src/lib/VSDXMLParserBase.cpp
@@ -1422,6 +1422,8 @@ void libvisio::VSDXMLParserBase::readParaIX(xmlTextReaderPtr reader)
   boost::optional<unsigned char> align;
   boost::optional<unsigned char> bullet;
   boost::optional<VSDName> bulletStr;
+  boost::optional<VSDName> bulletFont;
+  boost::optional<double> bulletFontSize;
   boost::optional<double> textPosAfterBullet;
   boost::optional<unsigned> flags;
 
@@ -1487,6 +1489,35 @@ void libvisio::VSDXMLParserBase::readParaIX(xmlTextReaderPtr reader)
         }
       }
       break;
+    case XML_BULLETFONT:
+      if (XML_READER_TYPE_ELEMENT == tokenType)
+      {
+        const shared_ptr<xmlChar> stringValue(readStringData(reader), xmlFree);
+        if (stringValue && !xmlStrEqual(stringValue.get(), BAD_CAST("Themed")))
+        {
+          try
+          {
+            unsigned fontIndex = (unsigned)xmlStringToLong(stringValue);
+            if (fontIndex)
+            {
+              std::map<unsigned, VSDName>::const_iterator iter = m_fonts.find(fontIndex);
+              if (iter != m_fonts.end())
+                bulletFont = iter->second;
+              else
+                bulletFont = VSDName(librevenge::RVNGBinaryData(stringValue.get(), xmlStrlen(stringValue.get())), VSD_TEXT_UTF8);
+            }
+          }
+          catch (const XmlParserException &)
+          {
+            bulletFont = VSDName(librevenge::RVNGBinaryData(stringValue.get(), xmlStrlen(stringValue.get())), VSD_TEXT_UTF8);
+          }
+        }
+      }
+      break;
+    case XML_BULLETFONTSIZE:
+      if (XML_READER_TYPE_ELEMENT == tokenType)
+        readDoubleData(bulletFontSize, reader);
+      break;
     case XML_TEXTPOSAFTERBULLET:
       if (XML_READER_TYPE_ELEMENT == tokenType)
         readDoubleData(textPosAfterBullet, reader);
@@ -1500,17 +1531,18 @@ void libvisio::VSDXMLParserBase::readParaIX(xmlTextReaderPtr reader)
   if (m_isInStyles)
     m_collector->collectParaIXStyle(ix, level, charCount, indFirst, indLeft, indRight,
                                     spLine, spBefore, spAfter, align, bullet, bulletStr,
-                                    textPosAfterBullet, flags);
+                                    bulletFont, bulletFontSize, textPosAfterBullet, flags);
   else
   {
     if (!ix || m_shape.m_paraList.empty()) // paragraph style 0 is the default paragraph style
       m_shape.m_paraStyle.override(VSDOptionalParaStyle(charCount, indFirst, indLeft, indRight,
                                                         spLine, spBefore, spAfter, align, bullet,
-                                                        bulletStr, textPosAfterBullet, flags));
+                                                        bulletStr, bulletFont, bulletFontSize,
+                                                        textPosAfterBullet, flags));
 
     m_shape.m_paraList.addParaIX(ix, level, charCount, indFirst, indLeft, indRight,
                                  spLine, spBefore, spAfter, align, bullet, bulletStr,
-                                 textPosAfterBullet, flags);
+                                 bulletFont, bulletFontSize, textPosAfterBullet, flags);
   }
 }
 
@@ -1796,7 +1828,8 @@ void libvisio::VSDXMLParserBase::_flushShape()
   m_collector->collectDefaultParaStyle(m_shape.m_paraStyle.charCount, m_shape.m_paraStyle.indFirst, m_shape.m_paraStyle.indLeft,
                                        m_shape.m_paraStyle.indRight, m_shape.m_paraStyle.spLine, m_shape.m_paraStyle.spBefore,
                                        m_shape.m_paraStyle.spAfter, m_shape.m_paraStyle.align, m_shape.m_paraStyle.bullet,
-                                       m_shape.m_paraStyle.bulletStr, m_shape.m_paraStyle.textPosAfterBullet, m_shape.m_paraStyle.flags);
+                                       m_shape.m_paraStyle.bulletStr, m_shape.m_paraStyle.bulletFont, m_shape.m_paraStyle.bulletFontSize,
+                                       m_shape.m_paraStyle.textPosAfterBullet, m_shape.m_paraStyle.flags);
 
   m_shape.m_paraList.handle(m_collector);
 
diff --git a/src/lib/tokens.txt b/src/lib/tokens.txt
index caeb9eb..4e85524 100644
--- a/src/lib/tokens.txt
+++ b/src/lib/tokens.txt
@@ -57,6 +57,8 @@ BeginX
 BeginY
 BottomMargin
 Bullet
+BulletFont
+BulletFontSize
 BulletStr
 C
 Case


More information about the Libreoffice-commits mailing list