Uploading libabw-0.0.1 (support of zabw files too)

Change-Id: Ie04cae9b9a362cb43b671fe8986545865822a953
This commit is contained in:
Fridrich Štrba 2014-01-15 13:57:57 +01:00
parent bf535c4772
commit 838c888949
7 changed files with 4 additions and 192 deletions

View File

@ -1,5 +1,5 @@
ABW_MD5SUM := dffe43760ff660c831c9a89c992dd18c
export ABW_TARBALL := libabw-0.0.0.tar.bz2
ABW_MD5SUM := af3ccc1f1884e68389088d490d596409
export ABW_TARBALL := libabw-0.0.1.tar.bz2
CDR_MD5SUM := d88f9b94df880d2c05be943b000ca112
export CDR_TARBALL := libcdr-0.0.14.tar.bz2
EBOOK_MD5SUM := 3a62e10c57270718cabfdfc4b7b4e095

View File

@ -19,6 +19,7 @@ $(eval $(call gb_ExternalProject_use_externals,libabw,\
boost_headers \
libxml2 \
wpd \
zlib \
))
$(call gb_ExternalProject_get_state_target,libabw,build) :
@ -35,8 +36,6 @@ $(call gb_ExternalProject_get_state_target,libabw,build) :
CXXFLAGS="$(if $(filter NO,$(SYSTEM_BOOST)),-I$(call gb_UnpackedTarball_get_dir,boost) -I$(BUILDDIR)/config_$(gb_Side),$(BOOST_CPPFLAGS)) \
$(if $(filter NO,$(SYSTEM_LIBXML)),-I$(call gb_UnpackedTarball_get_dir,xml2)/include)" \
$(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
LIBXML2_CFLAGS="$(LIBXML_CFLAGS)" \
LIBXML2_LIBS="$(LIBXML_LIBS)" \
&& (cd $(EXTERNAL_WORKDIR)/src/lib && \
$(if $(VERBOSE)$(verbose),V=1) \
$(MAKE)) \

View File

@ -11,10 +11,4 @@ $(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 \
external/libabw/libabw-0.0.0-listshape.patch.1 \
external/libabw/libabw-0.0.0-mimetype.patch.1 \
))
# vim: set noet sw=4 ts=4:

View File

@ -1,101 +0,0 @@
--- 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

View File

@ -1,67 +0,0 @@
--- a/src/lib/ABWContentCollector.cpp
+++ b/src/lib/ABWContentCollector.cpp
@@ -928,7 +928,8 @@ void libabw::ABWContentCollector::_openHeader()
m_ps->m_isHeaderOpened = true;
}
-void libabw::ABWContentCollector::_fillParagraphProperties(WPXPropertyList &propList, WPXPropertyListVector &tabStops)
+void libabw::ABWContentCollector::_fillParagraphProperties(WPXPropertyList &propList, WPXPropertyListVector &tabStops,
+ bool isListElement)
{
ABWUnit unit(ABW_NONE);
double value(0.0);
@@ -937,17 +938,20 @@ void libabw::ABWContentCollector::_fillParagraphProperties(WPXPropertyList &prop
if (findDouble(_findParagraphProperty("margin-right"), value, unit) && unit == ABW_IN)
propList.insert("fo:margin-right", value);
- if (findDouble(_findParagraphProperty("margin-left"), value, unit) && unit == ABW_IN)
- propList.insert("fo:margin-left", value);
-
if (findDouble(_findParagraphProperty("margin-top"), value, unit) && unit == ABW_IN)
propList.insert("fo:margin-top", value);
if (findDouble(_findParagraphProperty("margin-bottom"), value, unit) && unit == ABW_IN)
propList.insert("fo:margin-bottom", value);
- if (findDouble(_findParagraphProperty("text-indent"), value, unit) && unit == ABW_IN)
- propList.insert("fo:text-indent", value);
+ if (!isListElement)
+ {
+ if (findDouble(_findParagraphProperty("margin-left"), value, unit) && unit == ABW_IN)
+ propList.insert("fo:margin-left", value);
+
+ if (findDouble(_findParagraphProperty("text-indent"), value, unit) && unit == ABW_IN)
+ propList.insert("fo:text-indent", value);
+ }
std::string sValue = _findParagraphProperty("text-align");
if (!sValue.empty())
@@ -1029,7 +1033,7 @@ void libabw::ABWContentCollector::_openParagraph()
WPXPropertyList propList;
WPXPropertyListVector tabStops;
- _fillParagraphProperties(propList, tabStops);
+ _fillParagraphProperties(propList, tabStops, false);
m_ps->m_deferredPageBreak = false;
m_ps->m_deferredColumnBreak = false;
@@ -1070,7 +1074,7 @@ void libabw::ABWContentCollector::_openListElement()
WPXPropertyList propList;
WPXPropertyListVector tabStops;
- _fillParagraphProperties(propList, tabStops);
+ _fillParagraphProperties(propList, tabStops, true);
m_outputElements.addOpenListElement(propList, tabStops);
--- a/src/lib/ABWContentCollector.h
+++ b/src/lib/ABWContentCollector.h
@@ -194,7 +194,7 @@ private:
std::string _findCellProperty(const char *name);
std::string _findSectionProperty(const char *name);
- void _fillParagraphProperties(WPXPropertyList &propList, WPXPropertyListVector &tabStops);
+ void _fillParagraphProperties(WPXPropertyList &propList, WPXPropertyListVector &tabStops, bool isListElement);
ABWContentParsingState *m_ps;
WPXDocumentInterface *m_iface;

View File

@ -1,13 +0,0 @@
diff --git a/src/lib/ABWContentCollector.cpp b/src/lib/ABWContentCollector.cpp
index 53b8d81..14dd840 100644
--- a/src/lib/ABWContentCollector.cpp
+++ b/src/lib/ABWContentCollector.cpp
@@ -1537,7 +1537,7 @@ void libabw::ABWContentCollector::insertImage(const char *dataid, const char *pr
m_outputElements.addOpenFrame(propList);
propList.clear();
- propList.insert("libwpd:mime-type", iter->second.m_mimeType);
+ propList.insert("libwpd:mimetype", iter->second.m_mimeType);
m_outputElements.addInsertBinaryObject(propList, iter->second.m_binaryData);

View File

@ -18,7 +18,7 @@
<node oor:name="writer_AbiWord_Document" oor:op="replace" >
<prop oor:name="DetectService"><value>com.sun.star.comp.Writer.AbiWordImportFilter</value></prop>
<prop oor:name="URLPattern"/>
<prop oor:name="Extensions"><value>abw</value></prop>
<prop oor:name="Extensions"><value>abw zabw</value></prop>
<prop oor:name="MediaType"><value>application/x-abiword</value></prop>
<prop oor:name="Preferred"><value>true</value></prop>
<prop oor:name="PreferredFilter"><value>AbiWord</value></prop>