[Libreoffice-commits] core.git: external/libabw

Fridrich Å trba fridrich.strba at bluewin.ch
Tue Jan 14 00:08:59 PST 2014


 external/libabw/UnpackedTarball_libabw.mk        |    4 
 external/libabw/libabw-0.0.0-footendnote.patch.1 |  101 +++++++++++++++++++++++
 2 files changed, 105 insertions(+)

New commits:
commit 766f718ebb4deda1a294cc1cfe137a75dfb0f6f8
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Tue Jan 14 08:57:35 2014 +0100

    Fix a silly with ABW footnotes/endnotes
    
    Change-Id: I026f9c664ff7dec51e511ad439ab563d2cc0c201

diff --git a/external/libabw/UnpackedTarball_libabw.mk b/external/libabw/UnpackedTarball_libabw.mk
index 6288b0e..8a565fb 100644
--- a/external/libabw/UnpackedTarball_libabw.mk
+++ b/external/libabw/UnpackedTarball_libabw.mk
@@ -11,4 +11,8 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,libabw))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,libabw,$(ABW_TARBALL)))
 
+$(eval $(call gb_UnpackedTarball_add_patches,libabw,\
+	external/libabw/libabw-0.0.0-footendnote.patch.1 \
+))
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/libabw/libabw-0.0.0-footendnote.patch.1 b/external/libabw/libabw-0.0.0-footendnote.patch.1
new file mode 100644
index 0000000..4c9e813
--- /dev/null
+++ b/external/libabw/libabw-0.0.0-footendnote.patch.1
@@ -0,0 +1,101 @@
+--- a/src/lib/ABWContentCollector.cpp
++++ b/src/lib/ABWContentCollector.cpp
+@@ -289,6 +289,7 @@ libabw::ABWContentParsingState::ABWContentParsingState() :
+   m_isSpanOpened(false),
+   m_isParagraphOpened(false),
+   m_isListElementOpened(false),
++  m_inParagraphOrListElement(false),
+ 
+   m_currentSectionStyle(),
+   m_currentParagraphStyle(),
+@@ -334,6 +335,7 @@ libabw::ABWContentParsingState::ABWContentParsingState(const ABWContentParsingSt
+   m_isSpanOpened(ps.m_isSpanOpened),
+   m_isParagraphOpened(ps.m_isParagraphOpened),
+   m_isListElementOpened(ps.m_isListElementOpened),
++  m_inParagraphOrListElement(ps.m_inParagraphOrListElement),
+ 
+   m_currentSectionStyle(ps.m_currentSectionStyle),
+   m_currentParagraphStyle(ps.m_currentParagraphStyle),
+@@ -500,6 +502,7 @@ void libabw::ABWContentCollector::collectParagraphProperties(const char *level,
+     parsePropString(props, tmpProps);
+   for (std::map<std::string, std::string>::const_iterator iter = tmpProps.begin(); iter != tmpProps.end(); ++iter)
+     m_ps->m_currentParagraphStyle[iter->first] = iter->second;
++  m_ps->m_inParagraphOrListElement = true;
+ }
+ 
+ void libabw::ABWContentCollector::collectCharacterProperties(const char *style, const char *props)
+@@ -748,6 +751,7 @@ void libabw::ABWContentCollector::closeParagraphOrListElement()
+   _closeParagraph();
+   _closeListElement();
+   m_ps->m_currentParagraphStyle.clear();
++  m_ps->m_inParagraphOrListElement = false;
+ }
+ 
+ void libabw::ABWContentCollector::openLink(const char *href)
+@@ -807,6 +811,8 @@ void libabw::ABWContentCollector::insertPageBreak()
+ 
+ void libabw::ABWContentCollector::insertText(const WPXString &text)
+ {
++  if (!m_ps->m_inParagraphOrListElement)
++    return;
+   if (!m_ps->m_isSpanOpened)
+     _openSpan();
+ 
+--- a/src/lib/ABWContentCollector.h
++++ b/src/lib/ABWContentCollector.h
+@@ -71,6 +71,7 @@ struct ABWContentParsingState
+   bool m_isSpanOpened;
+   bool m_isParagraphOpened;
+   bool m_isListElementOpened;
++  bool m_inParagraphOrListElement;
+ 
+   std::map<std::string, std::string> m_currentSectionStyle;
+   std::map<std::string, std::string> m_currentParagraphStyle;
+--- a/src/lib/ABWParser.cpp
++++ b/src/lib/ABWParser.cpp
+@@ -92,7 +92,7 @@ void appendFromBase64(WPXBinaryData &data, const char *base64Data)
+ } // namespace libabw
+ 
+ libabw::ABWParser::ABWParser(WPXInputStream *input, WPXDocumentInterface *iface)
+-  : m_input(input), m_iface(iface), m_collector(0), m_inParagraph(false)
++  : m_input(input), m_iface(iface), m_collector(0)
+ {
+ }
+ 
+@@ -173,8 +173,7 @@ void libabw::ABWParser::processXmlNode(xmlTextReaderPtr reader)
+   {
+     WPXString text((const char *)xmlTextReaderConstValue(reader));
+     ABW_DEBUG_MSG(("ABWParser::processXmlNode: text %s\n", text.cstr()));
+-    if (m_inParagraph && m_collector)
+-      m_collector->insertText(text);
++    m_collector->insertText(text);
+   }
+   switch (tokenId)
+   {
+@@ -219,16 +218,10 @@ void libabw::ABWParser::processXmlNode(xmlTextReaderPtr reader)
+     break;
+   case XML_P:
+     if (XML_READER_TYPE_ELEMENT == tokenType)
+-    {
+       readP(reader);
+-      m_inParagraph = true;
+-    }
+     if (XML_READER_TYPE_END_ELEMENT == tokenType || emptyToken > 0)
+-    {
+-      m_inParagraph = false;
+       if (m_collector)
+         m_collector->closeParagraphOrListElement();
+-    }
+     break;
+   case XML_C:
+     if (XML_READER_TYPE_ELEMENT == tokenType)
+--- a/src/lib/ABWParser.h
++++ b/src/lib/ABWParser.h
+@@ -61,7 +61,6 @@ private:
+   WPXInputStream *m_input;
+   WPXDocumentInterface *m_iface;
+   ABWCollector *m_collector;
+-  bool m_inParagraph;
+ };
+ 
+ } // namespace libabw


More information about the Libreoffice-commits mailing list