From 82bc56b46735096fe493cc6d129e32f91d726bf7 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Sun, 3 Nov 2013 13:25:55 +0100 Subject: [PATCH] adapt to libmwaw 0.2 --- 0001-update-libmwaw-to-0.2.0.patch | 1002 ++++++++++++++++++++++++++++ libreoffice.spec | 13 +- 2 files changed, 1010 insertions(+), 5 deletions(-) create mode 100644 0001-update-libmwaw-to-0.2.0.patch diff --git a/0001-update-libmwaw-to-0.2.0.patch b/0001-update-libmwaw-to-0.2.0.patch new file mode 100644 index 0000000..2be40b8 --- /dev/null +++ b/0001-update-libmwaw-to-0.2.0.patch @@ -0,0 +1,1002 @@ +From b253d44327d659b014a2b5adefa5e207aa6d11e7 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Sun, 3 Nov 2013 09:34:36 +0100 +Subject: [PATCH] update libmwaw to 0.2.0 + +Change-Id: Ia66d7557e5056398e03ede9d54bf61317e84f2f3 +--- + RepositoryExternal.mk | 2 +- + configure.ac | 2 +- + download.lst | 4 +- + external/libmwaw/ExternalProject_libmwaw.mk | 1 + + writerperfect/source/writer/MWAWImportFilter.cxx | 831 +---------------------- + 5 files changed, 34 insertions(+), 806 deletions(-) + +diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk +index 568d2ac..0ace68b 100644 +--- a/RepositoryExternal.mk ++++ b/RepositoryExternal.mk +@@ -1576,19 +1576,19 @@ $(call gb_LinkTarget_set_include,$(1),\ + else # !SYSTEM_MWAW + + $(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \ +- mwaw-0.1 \ ++ mwaw-0.2 \ + )) + + define gb_LinkTarget__use_mwaw + $(call gb_LinkTarget_set_include,$(1),\ + -I$(call gb_UnpackedTarball_get_dir,libmwaw)/inc \ + $$(INCLUDE) \ + ) + $(call gb_LinkTarget_use_package,$(1),\ + libmwaw \ + ) + $(call gb_LinkTarget_use_static_libraries,$(1),\ +- mwaw-0.1 \ ++ mwaw-0.2 \ + ) + + endef +diff --git a/configure.ac b/configure.ac +index 7f992a5..57f14fb 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -7714,7 +7714,7 @@ libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.0]) + dnl =================================================================== + dnl Check for system libmwaw + dnl =================================================================== +-libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.1]) ++libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.2]) + + dnl =================================================================== + dnl Check for system libvisio +diff --git a/download.lst b/download.lst +index 9d21fed..28d92aa 100644 +--- a/download.lst ++++ b/download.lst +@@ -6,6 +6,6 @@ FREEHAND_MD5SUM := 496dd00028afcc19f896b01394769043 + MSPUB_MD5SUM := 1120705cd0f0d9bd5506360bf57b6c2e + export MSPUB_TARBALL := libmspub-0.0.6.tar.bz2 +-MWAW_MD5SUM := 828dd03510791fbe037081a2b4a1a8ff +-export MWAW_TARBALL := libmwaw-0.1.11.tar.bz2 ++MWAW_MD5SUM := d794625f156a9fb1c53b3f8a8aa13b5e ++export MWAW_TARBALL := libmwaw-0.2.0.tar.bz2 + VISIO_MD5SUM := 82628333418f101a20cd21f980cf9f40 + export VISIO_TARBALL := libvisio-0.0.31.tar.bz2 +diff --git a/libmwaw/ExternalProject_libmwaw.mk b/libmwaw/ExternalProject_libmwaw.mk +index a500192..b838339 100644 +--- a/libmwaw/ExternalProject_libmwaw.mk ++++ b/libmwaw/ExternalProject_libmwaw.mk +@@ -18,6 +18,7 @@ $(eval $(call gb_ExternalProject_register_targets,libmwaw,\ + $(eval $(call gb_ExternalProject_use_externals,libmwaw,\ + boost_headers \ + wpd \ ++ wpg \ + )) + + $(call gb_ExternalProject_get_state_target,libmwaw,build) : +diff --git a/writerperfect/source/writer/MWAWImportFilter.cxx b/writerperfect/source/writer/MWAWImportFilter.cxx +index ff4d7af..11d6cd8 100644 +--- a/writerperfect/source/writer/MWAWImportFilter.cxx ++++ b/writerperfect/source/writer/MWAWImportFilter.cxx +@@ -9,9 +9,6 @@ + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +-#include +-#include +- + #include + #include + #include +@@ -31,8 +28,6 @@ + #include "common/WPXSvStream.hxx" + #include "MWAWImportFilter.hxx" + +-#include +- + using namespace ::com::sun::star::uno; + using com::sun::star::uno::Sequence; + using com::sun::star::uno::Reference; +@@ -53,780 +48,12 @@ using com::sun::star::xml::sax::XAttributeList; + using com::sun::star::xml::sax::XDocumentHandler; + using com::sun::star::xml::sax::XParser; + +-namespace +-{ +- +-//! Internal: creates the string "f pt" +-static std::string getStringPt(double f) +-{ +- std::stringstream s; +- s << float(f) << "pt"; +- return s.str(); +-} +- +-static double getSizeInPt(WPXProperty const &prop) +-{ +- WPXString str = prop.getStr(); +- if (!str.len()) return 0.0; +- +- // we have a string, so we can not use getDouble +- std::istringstream iss(str.cstr()); +- double res = 0.0; +- iss >> res; +- +- // try to guess the type +- // point->pt, twip->*, inch -> in +- char c = str.len() ? str.cstr()[str.len()-1] : ' '; +- if (c == '*') res /= 1440.; +- else if (c == 't') res /= 72.; +- else if (c == 'n') ; +- else if (c == '%') +- { +- SAL_WARN("writerperfect", "MWAWObjectHandlerInternal::getSizeInPoint: called with a percent property"); +- } +- return res *= 72.; +-} +- +-static std::string getStringSizeInPt(WPXProperty const &prop) +-{ +- return getStringPt(getSizeInPt(prop)); +-} +- +-static std::string getStyleName(int id) +-{ +- std::stringstream s; +- s.str(""); +- s << "bd" << id+1; +- return s.str(); +-} +- +-} // anonymous namespace +- +-namespace MWAWObjectHandlerInternal +-{ +-class Shape +-{ +-public: +- Shape() : m_type(BAD), m_styleId(-1), m_w(0), m_h(0), m_rw(0), m_rh(0), +- m_x(), m_y(), m_angle(), m_path("") +- { +- } +- bool read(const char *psName, WPXPropertyList const &xPropList, int styleId); +- bool write(OdfDocumentHandler *output) const; +- bool ok() const +- { +- return m_type != BAD; +- } +- +-protected: +- bool drawLine(OdfDocumentHandler *output) const; +- bool drawRectangle(OdfDocumentHandler *output) const; +- bool drawCircle(OdfDocumentHandler *output) const; +- bool drawArc(OdfDocumentHandler *output) const; +- bool drawPath(OdfDocumentHandler *output) const; +- bool drawPolygon(OdfDocumentHandler *output, bool is2D) const; +- +- enum Type { LINE, RECTANGLE, CIRCLE, ARC, PATH, POLYLINE, POLYGON, BAD } m_type; +- +- int m_styleId; +- double m_w,m_h, m_rw, m_rh; +- std::vector m_x,m_y; +- std::vector m_angle; +- std::string m_path; +-}; +- +-class Document +-{ +-public: +- Document() : styles(), shapes(), m_w(0.0), m_h(0.0) {} +- bool open(const char *psName, WPXPropertyList const &xPropList); +- bool close(const char *psName); +- +- void characters(WPXString const &sCharacters); +- +- void write(OdfDocumentHandler *output); +- +-protected: +- static void writeStyle(OdfDocumentHandler *output, +- WPXPropertyList const &style, int styleId); +- +- std::vector styles; +- std::vector shapes; +- +-protected: +- double m_w, m_h; +-}; +- +-} +- +-class MWAWObjectHandler : public MWAWPropertyHandler +-{ +-public: +- MWAWObjectHandler(OdfDocumentHandler *output) : MWAWPropertyHandler(), m_document(), m_output(output) { } +- ~MWAWObjectHandler() {}; +- +- void startDocument() +- { +- m_document= MWAWObjectHandlerInternal::Document(); +- }; +- void endDocument() +- { +- if (m_output) m_document.write(m_output); +- }; +- +- void startElement(const char *psName, const WPXPropertyList &xPropList) +- { +- m_document.open(psName, xPropList); +- } +- void endElement(const char *psName) +- { +- m_document.close(psName); +- } +- void characters(const WPXString &sCharacters) +- { +- m_document.characters(sCharacters); +- } +- +-private: +- MWAWObjectHandler(MWAWObjectHandler const &); +- MWAWObjectHandler operator=(MWAWObjectHandler const &); +- +- MWAWObjectHandlerInternal::Document m_document; +- OdfDocumentHandler *m_output; +-}; +- +- +-static bool handleEmbeddedMWAWObject(const WPXBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType) +-{ +- MWAWObjectHandler tmpHandler(pHandler); +- tmpHandler.startDocument(); +- if (!tmpHandler.checkData(data) || !tmpHandler.readData(data)) return false; +- tmpHandler.endDocument(); +- return true; +-} +- +-bool MWAWObjectHandlerInternal::Shape::read(const char *psName, WPXPropertyList const &xPropList, int stylId) +-{ +- m_styleId = stylId; +- m_type = BAD; +- if (strcmp(psName,"drawLine")==0) m_type = LINE; +- else if (strcmp(psName,"drawRectangle")==0) m_type = RECTANGLE; +- else if (strcmp(psName,"drawCircle")==0) m_type = CIRCLE; +- else if (strcmp(psName,"drawArc")==0) m_type = ARC; +- else if (strcmp(psName,"drawPath")==0) m_type = PATH; +- else if (strcmp(psName,"drawPolyline")==0) m_type = POLYLINE; +- else if (strcmp(psName,"drawPolygon")==0) m_type = POLYGON; +- else return false; +- +- WPXPropertyList::Iter i(xPropList); +- for (i .rewind(); i.next(); ) +- { +- if (strcmp(i.key(), "w") == 0) m_w = getSizeInPt(*i()); +- else if (strcmp(i.key(), "h") == 0) m_h = getSizeInPt(*i()); +- else if (strcmp(i.key(), "rw") == 0) m_rw = getSizeInPt(*i()); +- else if (strcmp(i.key(), "rh") == 0) m_rh = getSizeInPt(*i()); +- else if (strcmp(i.key(), "path") == 0) +- { +- if (i()->getStr().len()) +- m_path = i()->getStr().cstr(); +- } +- else +- { +- char const *key = i.key(); +- int len = (int) strlen(key); +- bool readOk = len > 1, generic = false; +- std::vector *which = 0L; +- if (readOk && strncmp(i.key(),"x",1)==0) +- { +- which = &m_x; +- key++; +- } +- else if (readOk && strncmp(i.key(),"y",1)==0) +- { +- which = &m_y; +- key++; +- } +- else if (readOk && strncmp(i.key(),"angle",5)==0) +- { +- which = &m_angle; +- key+=5; +- readOk = len>5; +- generic=true; +- } +- else readOk = false; +- +- long w(0); +- if (readOk) +- { +- char *res; +- w = strtol(key, &res, 10); +- readOk = (*res=='\0') && (w >= 0); +- } +- if (readOk) +- { +- if (int(which->size()) < w+1) which->resize(size_t(w)+1,0.0); +- double unit = generic ? 1./72.0 : 1.0; +- (*which)[size_t(w)] = getSizeInPt(*i()) * unit; +- } +- if (!readOk) +- { +- SAL_WARN("writerperfect", "MWAWObjectHandlerInternal::Shape::read: find an unknown key '" << i.key() << "'"); +- } +- } +- } +- +- return true; +-} +- +-bool MWAWObjectHandlerInternal::Shape::write(OdfDocumentHandler *output) const +-{ +- if (!output) return true; +- if (m_type == LINE) return drawLine(output); +- else if (m_type == RECTANGLE) return drawRectangle(output); +- else if (m_type == CIRCLE) return drawCircle(output); +- else if (m_type == ARC) return drawArc(output); +- else if (m_type == PATH) return drawPath(output); +- else if (m_type == POLYLINE) return drawPolygon(output, false); +- else if (m_type == POLYGON) return drawPolygon(output, true); +- +- return false; +-} +- +-bool MWAWObjectHandlerInternal::Shape::drawLine(OdfDocumentHandler *output) const +-{ +- if (m_x.size() < 2 || m_y.size() < 2) +- { +- SAL_WARN("writerperfect", "MWAWObjectHandlerInternal::Shape::drawLine: PB"); +- return false; +- } +- +- WPXPropertyList list; +- list.insert("draw:text-style-name","P1"); +- list.insert("draw:layer","layout"); +- list.insert("draw:style-name",getStyleName(m_styleId).c_str()); +- list.insert("svg:x1",getStringPt(m_x[0]).c_str()); +- list.insert("svg:y1",getStringPt(m_y[0]).c_str()); +- list.insert("svg:x2",getStringPt(m_x[1]).c_str()); +- list.insert("svg:y2",getStringPt(m_y[1]).c_str()); +- output->startElement("draw:line", list); +- output->endElement("draw:line"); +- return true; +-} +- +-bool MWAWObjectHandlerInternal::Shape::drawRectangle(OdfDocumentHandler *output) const +-{ +- if (m_x.size() < 1 || m_y.size() < 1) +- { +- SAL_WARN("writerperfect", "MWAWObjectHandlerInternal::Shape::drawRectangle: PB"); +- return false; +- } +- +- WPXPropertyList list; +- list.insert("draw:text-style-name","P1"); +- list.insert("draw:layer","layout"); +- list.insert("draw:style-name",getStyleName(m_styleId).c_str()); +- list.insert("svg:x",getStringPt(m_x[0]).c_str()); +- list.insert("svg:y",getStringPt(m_y[0]).c_str()); +- list.insert("svg:width",getStringPt(m_w).c_str()); +- list.insert("svg:height",getStringPt(m_h).c_str()); +- +- if (m_rw <= 0.0 || m_rh <= 0.0 || m_w < 2*m_rw || m_h < 2*m_rh) +- { +- if (m_rw > 0.0 || m_rh > 0.0) +- { +- SAL_WARN("writerperfect", "MWAWObjectHandlerInternal::Shape::drawRectangle:: can only create a rectangle"); +- } +- output->startElement("draw:rect", list); +- output->endElement("draw:rect"); +- return true; +- } +- +- // ok, we draw a rond rect +- std::stringstream s; +- float const unit = 1.0;//35.3; +- s.str(""); +- +- double const minPt[] = { m_x[0] *unit, m_y[0] *unit }; +- double const maxPt[] = { (m_w+m_x[0]) *unit, (m_h+m_y[0]) *unit }; +- +- s << "0 0 " << int(maxPt[0]) << " " << int(maxPt[1]); +- list.insert("svg:viewBox", s.str().c_str()); +- +- double const W[] = { m_rw *unit, m_rh *unit }; +- double const xPt[] = { minPt[0]+W[0], maxPt[0]-W[0], maxPt[0], +- maxPt[0], maxPt[0], maxPt[0], +- maxPt[0]-W[0], minPt[0]+W[0], minPt[0], +- minPt[0], minPt[0], minPt[0], +- minPt[0]+W[0] +- }; +- double const yPt[] = { minPt[1], minPt[1], minPt[1], +- minPt[1]+W[1], maxPt[1]-W[1], maxPt[1], +- maxPt[1], maxPt[1], maxPt[1], +- maxPt[1]-W[1], minPt[1]+W[1], minPt[1], +- minPt[1] +- }; +- s.str(""); +- for (int i = 0; i < 13; i++) +- { +- if (i) s << " "; +- +- if (i == 0) s << "M"; +- else if ((i%3) == 2) s << "Q"; +- else if ((i%3) == 0); +- else s << "L"; +- s << int(xPt[i]) << " " << int(yPt[i]); +- } +- s << "Z"; +- list.insert("svg:d", s.str().c_str()); +- +- output->startElement("draw:path", list); +- output->endElement("draw:path"); +- return true; +-} +- +-bool MWAWObjectHandlerInternal::Shape::drawCircle(OdfDocumentHandler *output) const +-{ +- if (m_x.size() < 1 || m_y.size() < 1) +- { +- SAL_WARN("writerperfect", "MWAWObjectHandlerInternal::Shape::drawCircle: PB"); +- return false; +- } +- +- WPXPropertyList list; +- list.insert("draw:text-style-name","P1"); +- list.insert("draw:layer","layout"); +- list.insert("draw:style-name",getStyleName(m_styleId).c_str()); +- list.insert("svg:x",getStringPt(m_x[0]).c_str()); +- list.insert("svg:y",getStringPt(m_y[0]).c_str()); +- list.insert("svg:width",getStringPt(m_w).c_str()); +- list.insert("svg:height",getStringPt(m_h).c_str()); +- if (m_w < m_h || m_w > m_h) +- { +- output->startElement("draw:ellipse", list); +- output->endElement("draw:ellipse"); +- } +- else +- { +- output->startElement("draw:circle", list); +- output->endElement("draw:circle"); +- } +- return true; +-} +- +-bool MWAWObjectHandlerInternal::Shape::drawArc(OdfDocumentHandler *output) const +-{ +- if (m_angle.size() < 2) +- { +- SAL_INFO("writerperfect", "MWAWObjectHandlerInternal::Shape::drawArc: angle are filled, call draw Circle"); +- return drawCircle(output); +- } +- if (m_x.size() < 1 || m_y.size() < 1) +- { +- SAL_WARN("writerperfect", "MWAWObjectHandlerInternal::Shape::drawArc: PB"); +- return false; +- } +- +- WPXPropertyList list; +- list.insert("draw:text-style-name","P1"); +- list.insert("draw:layer","layout"); +- list.insert("draw:style-name",getStyleName(m_styleId).c_str()); +- list.insert("svg:x",getStringPt(m_x[0]).c_str()); +- list.insert("svg:y",getStringPt(m_y[0]).c_str()); +- list.insert("svg:width",getStringPt(m_w).c_str()); +- list.insert("svg:height",getStringPt(m_h).c_str()); +- list.insert("draw:kind","arc"); +- +- std::stringstream s; +- // odg prefers angle between -360 and +360, ... +- int minAngl = int(m_angle[0]), maxAngl = int(m_angle[1]); +- if (minAngl >= 360 || maxAngl >= 360) +- { +- minAngl -= 360; +- maxAngl -= 360; +- } +- s.str(""); +- s << minAngl; +- list.insert("draw:start-angle", s.str().c_str()); +- s.str(""); +- s << maxAngl; +- list.insert("draw:end-angle", s.str().c_str()); +- +- if (m_w < m_h || m_w > m_h) +- { +- output->startElement("draw:ellipse", list); +- output->endElement("draw:ellipse"); +- } +- else +- { +- output->startElement("draw:circle", list); +- output->endElement("draw:circle"); +- } +- return true; +-} +- +-bool MWAWObjectHandlerInternal::Shape::drawPolygon(OdfDocumentHandler *output, bool is2D) const +-{ +- if (m_x.size() < 1 || m_y.size() != m_x.size()) +- { +- SAL_WARN("writerperfect", "MWAWObjectHandlerInternal::Shape::drawPolygon: PB"); +- return false; +- } +- std::stringstream s; +- WPXPropertyList list; +- list.insert("draw:text-style-name","P1"); +- list.insert("draw:layer","layout"); +- list.insert("draw:style-name","bd1"); +- list.insert("svg:x","0pt"); +- list.insert("svg:y","0pt"); +- list.insert("svg:width",getStringPt(m_w).c_str()); +- list.insert("svg:height",getStringPt(m_h).c_str()); +- +- size_t numPt = m_x.size(); +- +- float const unit = 1; //35.2777; // convert in centimeters +- s.str(""); +- s << "0 0 " << int(m_w*unit) << " " << int(m_h*unit); +- list.insert("svg:viewBox", s.str().c_str()); +- +- s.str(""); +- for (size_t i = 0; i < numPt; i++) +- { +- if (i) s << " "; +- s << int(m_x[i]*unit) << "," << int(m_y[i]*unit); +- } +- list.insert("draw:points", s.str().c_str()); +- if (!is2D) +- { +- output->startElement("draw:polyline", list); +- output->endElement("draw:polyline"); +- } +- else +- { +- output->startElement("draw:polygon", list); +- output->endElement("draw:polygon"); +- } +- return true; +-} +- +-bool MWAWObjectHandlerInternal::Shape::drawPath(OdfDocumentHandler *output) const +-{ +- if (m_path.length()==0 || m_w <= 0 || m_h <= 0) +- { +- SAL_WARN("writerperfect", "MWAWObjectHandlerInternal::Shape::drawPath: PB"); +- return false; +- } +- +- WPXPropertyList list; +- list.insert("draw:text-style-name","P1"); +- list.insert("draw:layer","layout"); +- list.insert("draw:style-name",getStyleName(m_styleId).c_str()); +- list.insert("svg:x","0pt"); +- list.insert("svg:y","0pt"); +- list.insert("svg:width",getStringPt(m_w).c_str()); +- list.insert("svg:height",getStringPt(m_h).c_str()); +- std::stringstream s; +- s << "0 0 " << int(m_w) << " " << int(m_h); +- list.insert("svg:viewBox", s.str().c_str()); +- list.insert("svg:d",m_path.c_str()); +- +- output->startElement("draw:path", list); +- output->endElement("draw:path"); +- return true; +-} +- +- +-bool MWAWObjectHandlerInternal::Document::open(const char *psName, WPXPropertyList const &xPropList) +-{ +- if (strncmp(psName,"libmwaw:", 8) == 0) +- psName += 8; +- else +- { +- SAL_WARN("writerperfect", "MWAWObjectHandlerInternal::Document::open Unknown tag '" << psName << "'.." ); +- return false; +- } +- if (strcmp(psName, "document") == 0) +- { +- m_w = m_h = 0.; +- WPXPropertyList::Iter i(xPropList); +- for (i .rewind(); i.next(); ) +- { +- if (strcmp(i.key(), "w") == 0) m_w = getSizeInPt(*i()); +- else if (strcmp(i.key(), "h") == 0) m_h = getSizeInPt(*i()); +- else +- { +- SAL_WARN("writerperfect", "MWAWObjectHandlerInternal::Document::open: find an unknown key '" << i.key() << "'"); +- } +- } +- return true; +- } +- else if (strcmp(psName, "graphicStyle") == 0) +- { +- styles.push_back(xPropList); +- return true; +- } +- else +- { +- int id = int(styles.size()); +- Shape shape; +- if (shape.read(psName, xPropList, id ? id-1 : 0)) +- { +- if (id == 0) +- { +- SAL_WARN("writerperfect", "MWAWObjectHandlerInternal::Document::open shape created without style.."); +- styles.push_back(WPXPropertyList()); +- } +- shapes.push_back(shape); +- return true; +- } +- } +- SAL_WARN("writerperfect", "MWAWObjectHandlerInternal::Document::open Unknown tag '" << psName << "'.."); +- return false; +-} +- +-bool MWAWObjectHandlerInternal::Document::close(const char *) +-{ +- return true; +-} +- +-void MWAWObjectHandlerInternal::Document::characters(WPXString const &) ++static bool handleEmbeddedMWAWObject(const WPXBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType) + { +- SAL_WARN("writerperfect", "Document::characters must NOT be called.."); ++ OdgGenerator exporter(pHandler, streamType); ++ return MWAWDocument::decodeGraphic(data, &exporter); + } + +-void MWAWObjectHandlerInternal::Document::write(OdfDocumentHandler *output) +-{ +- if (!output) return; +- WPXPropertyList list; +- std::stringstream s; +- +- list.clear(); +- list.insert("office:mimetype","application/vnd.oasis.opendocument.graphics"); +- list.insert("office:version", "1.0"); +- +- list.insert("xmlns:config", "urn:oasis:names:tc:opendocument:xmlns:config:1.0"); +- list.insert("xmlns:dc", "http://purl.org/dc/elements/1.1/"); +- list.insert("xmlns:draw", "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"); +- list.insert("xmlns:fo", "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"); +- list.insert("xmlns:office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0"); +- list.insert("xmlns:ooo", "http://openoffice.org/2004/office"); +- list.insert("xmlns:style", "urn:oasis:names:tc:opendocument:xmlns:style:1.0"); +- list.insert("xmlns:svg", "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"); +- list.insert("xmlns:text", "urn:oasis:names:tc:opendocument:xmlns:text:1.0"); +- +- output->startElement("office:document", list); +- +- // SETTINGS +- { +- list.clear(); +- output->startElement("office:settings", list); +- list.clear(); +- list.insert("config:name","ooo:view-settings"); +- output->startElement("config:config-item-set", list); +- +- // - Top +- list.clear(); +- list.insert("config:name","VisibleAreaTop"); +- list.insert("config:type","int"); +- output->startElement("config:config-item", list); +- output->characters("0"); +- +- output->endElement("config:config-item"); +- // - Left +- list.clear(); +- list.insert("config:name","VisibleAreaLeft"); +- list.insert("config:type","int"); +- output->startElement("config:config-item", list); +- output->characters("0"); +- output->endElement("config:config-item"); +- // - Width +- list.clear(); +- list.insert("config:name","VisibleAreaWidth"); +- list.insert("config:type","int"); +- s.str(""); +- s << int(m_w*35.2777); // *2540/72. why ? +- output->startElement("config:config-item", list); +- output->characters(s.str().c_str()); +- output->endElement("config:config-item"); +- // - Height +- list.clear(); +- list.insert("config:name","VisibleAreaHeight"); +- list.insert("config:type","int"); +- s.str(""); +- s << int(m_h*35.2777); // *2540/72. why ? +- output->startElement("config:config-item", list); +- output->characters(s.str().c_str()); +- output->endElement("config:config-item"); +- +- output->endElement("config:config-item-set"); +- output->endElement("office:settings"); +- } +- +- // STYLES +- { +- list.clear(); +- output->startElement("office:styles", list); +- // - a gradient +- list.clear(); +- list.insert("draw:angle","0"); +- list.insert("draw:border","0%"); +- list.insert("draw:end-color","#000000"); +- list.insert("draw:end-intensity","100%"); +- list.insert("draw:name","Gradient_1"); +- list.insert("draw:start-color","#000000"); +- list.insert("draw:start-intensity","100%"); +- list.insert("draw:style","linear"); +- output->startElement("draw:gradient", list); +- output->endElement("draw:gradient"); +- // - an arrow +- list.clear(); +- list.insert("draw:name","Arrow"); +- list.insert("svg:viewBox","0 0 20 30"); +- list.insert("svg:d","m10 0-10 30h20z"); +- output->startElement("draw:marker", list); +- output->endElement("draw:marker"); +- +- output->endElement("office:styles"); +- } +- +- // AUTOMATIC STYLES +- { +- list.clear(); +- output->startElement("office:automatic-styles", list); +- +- // - PM0 +- { +- list.clear(); +- list.insert("style:name","PM0"); +- output->startElement("style:page-layout", list); +- list.clear(); +- list.insert("fo:margin-bottom","0in"); +- list.insert("fo:margin-left","0in"); +- list.insert("fo:margin-right","0in"); +- list.insert("fo:margin-top","0in"); +- list.insert("fo:page-height",getStringPt(m_h).c_str()); +- list.insert("fo:page-width",getStringPt(m_w).c_str()); +- list.insert("style:print-orientation","portrait"); +- output->startElement("style:page-layout-properties", list); +- output->endElement("style:page-layout-properties"); +- output->endElement("style:page-layout"); +- } +- +- // - dp1 +- { +- list.clear(); +- list.insert("style:family","drawing-page"); +- list.insert("style:name","dp1"); +- output->startElement("style:style", list); +- list.clear(); +- list.insert("draw:fill","none"); +- output->startElement("style:drawing-page-properties", list); +- output->endElement("style:drawing-page-properties"); +- output->endElement("style:style"); +- } +- +- // -- the styles +- for (size_t i = 0; i < styles.size() ; i++) +- writeStyle(output, styles[i], int(i)); +- +- output->endElement("office:automatic-styles"); +- } +- +- // MASTER STYLES +- { +- list.clear(); +- output->startElement("office:master-styles", list); +- list.clear(); +- list.insert("draw:style-name","dp1"); +- list.insert("style:name","Default"); +- list.insert("style:page-layout-name","PM0"); +- output->startElement("style:master-page", list); +- output->endElement("style:master-page"); +- output->endElement("office:master-styles"); +- } +- +- // BODY +- { +- list.clear(); +- output->startElement("office:body", list); +- output->startElement("office:drawing", list); +- { +- list.clear(); +- list.insert("draw:master-page-name","Default"); +- list.insert("draw:name","page1"); +- list.insert("draw:style-name","dp1"); +- +- output->startElement("draw:page", list); +- +- for (size_t i = 0; i < shapes.size() ; i++) +- shapes[i].write(output); +- +- output->endElement("draw:page"); +- } +- output->endElement("office:drawing"); +- output->endElement("office:body"); +- } +- output->endElement("office:document"); +-} +- +-void MWAWObjectHandlerInternal::Document::writeStyle (OdfDocumentHandler *output, WPXPropertyList const &style, int styleId) +-{ +- if (!output) return; +- +- WPXPropertyList list; +- list.clear(); +- list.insert("style:family","graphic"); +- list.insert("style:name",getStyleName(styleId).c_str()); +- list.insert("style:parent-style-name","standard"); +- output->startElement("style:style", list); +- { +- list.clear(); +- +- WPXPropertyList::Iter i(style); +- for (i .rewind(); i.next(); ) +- { +- if (strcmp(i.key(), "lineColor") == 0) +- list.insert("svg:stroke-color", i()->getStr().cstr()); +- else if (strcmp(i.key(), "lineWidth") == 0) +- list.insert("svg:stroke-width", getStringSizeInPt(*i()).c_str()); +- else if (strcmp(i.key(), "lineFill") == 0) +- list.insert("draw:stroke", i()->getStr().cstr()); +- else if (strcmp(i.key(), "surfaceColor") == 0) +- list.insert("draw:fill-color", i()->getStr().cstr()); +- else if (strcmp(i.key(), "surfaceFill") == 0) +- list.insert("draw:fill", i()->getStr().cstr()); +- else if (strcmp(i.key(), "startArrow") == 0) +- { +- if (strcmp(i()->getStr().cstr(), "true") == 0) +- { +- list.insert("draw:marker-start", "Arrow"); +- list.insert("draw:marker-start-center", "false"); +- } +- } +- else if (strcmp(i.key(), "startArrowWidth") == 0) +- list.insert("draw:marker-start-width", getStringSizeInPt(*i()).c_str()); +- else if (strcmp(i.key(), "endArrow") == 0) +- { +- if (strcmp(i()->getStr().cstr(), "true") == 0) +- { +- list.insert("draw:marker-end", "Arrow"); +- list.insert("draw:marker-end-center", "false"); +- } +- } +- else if (strcmp(i.key(), "endArrowWidth") == 0) +- list.insert("draw:marker-end-width", getStringSizeInPt(*i()).c_str()); +- else +- { +- SAL_WARN("writerperfect", "MWAWObjectHandlerInternal::Document::writeStyle: find an unknown key '" << i.key() << "'"); +- } +- } +- +- output->startElement("style:graphic-properties", list); +- output->endElement("style:graphic-properties"); +- } +- output->endElement("style:style"); +-} +- +- + sal_Bool SAL_CALL MWAWImportFilter::importImpl( const Sequence< ::com::sun::star::beans::PropertyValue > &aDescriptor ) + throw (RuntimeException) + { +@@ -864,7 +91,7 @@ throw (RuntimeException) + + OdtGenerator collector(&xHandler, ODF_FLAT_XML); + collector.registerEmbeddedObjectHandler("image/mwaw-odg", &handleEmbeddedMWAWObject); +- if (MWAW_OK == MWAWDocument::parse(&input, &collector)) ++ if (MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&input, &collector)) + return sal_True; + return sal_False; + } +@@ -895,9 +122,9 @@ throw( com::sun::star::uno::RuntimeException ) + { + SAL_INFO("writerperfect", "MWAWImportFilter::detect"); + +- MWAWConfidence confidence = MWAW_CONFIDENCE_NONE; +- MWAWDocument::DocumentType docType = MWAWDocument::UNKNOWN; +- MWAWDocument::DocumentKind docKind = MWAWDocument::K_UNKNOWN; ++ MWAWDocument::Confidence confidence = MWAWDocument::MWAW_C_NONE; ++ MWAWDocument::Type docType = MWAWDocument::MWAW_T_UNKNOWN; ++ MWAWDocument::Kind docKind = MWAWDocument::MWAW_K_UNKNOWN; + OUString sTypeName; + sal_Int32 nLength = Descriptor.getLength(); + sal_Int32 location = nLength; +@@ -918,69 +145,69 @@ throw( com::sun::star::uno::RuntimeException ) + + confidence = MWAWDocument::isFileFormatSupported(&input, docType, docKind); + +- if ((confidence == MWAW_CONFIDENCE_EXCELLENT) || (confidence == MWAW_CONFIDENCE_GOOD)) ++ if (confidence == MWAWDocument::MWAW_C_EXCELLENT) + { +- if ( docKind == MWAWDocument::K_TEXT ) ++ if ( docKind == MWAWDocument::MWAW_K_TEXT ) + { + switch (docType) + { +- case MWAWDocument::ACT: // Acta (nothing done ) ++ case MWAWDocument::MWAW_T_ACTA: + break; +- case MWAWDocument::CW: // ClarisWorks/AppleWorks document (basic) ++ case MWAWDocument::MWAW_T_CLARISWORKS: + sTypeName = "writer_ClarisWorks"; + break; +- case MWAWDocument::DM: // DocMaker (v4) ++ case MWAWDocument::MWAW_T_DOCMAKER: + sTypeName = "writer_DocMaker"; + break; +- case MWAWDocument::ED: // eDOC (v2) ++ case MWAWDocument::MWAW_T_EDOC: + sTypeName = "writer_eDoc_Document"; + break; +- case MWAWDocument::FULLW: // FullWrite Professional (basic) ++ case MWAWDocument::MWAW_T_FULLWRITE: + sTypeName = "writer_FullWrite_Professional"; + break; +- case MWAWDocument::HMAC: // HanMac Word-K (basic done) ++ case MWAWDocument::MWAW_T_HANMACWORDK: + sTypeName = "writer_HanMac_Word_K"; + break; +- case MWAWDocument::HMACJ: // HanMac Word-J ( almost nothing done for J document) ++ case MWAWDocument::MWAW_T_HANMACWORDJ: + // sTypeName = "writer_HanMac_Word_J"; + break; +- case MWAWDocument::LWTEXT: // LightWayText ( only v4.5 Mac format ) ++ case MWAWDocument::MWAW_T_LIGHTWAYTEXT: + sTypeName = "writer_LightWayText"; + break; +- case MWAWDocument::MARIW: // Mariner Write ( only v1.6-v3.5 Mac Classic) ++ case MWAWDocument::MWAW_T_MARINERWRITE: + sTypeName = "writer_Mariner_Write"; + break; +- case MWAWDocument::MINDW: // MindWrite ++ case MWAWDocument::MWAW_T_MINDWRITE: + sTypeName = "writer_MindWrite"; + break; +- case MWAWDocument::MW: // MacWrite document ++ case MWAWDocument::MWAW_T_MACWRITE: + sTypeName = "writer_MacWrite"; + break; +- case MWAWDocument::MWPRO: // MacWriteII or MacWritePro document ++ case MWAWDocument::MWAW_T_MACWRITEPRO: + sTypeName = "writer_MacWritePro"; + break; +- case MWAWDocument::MSWORD: // MSWord document (v4 v5: basic done) ++ case MWAWDocument::MWAW_T_MICROSOFTWORD: + sTypeName = "writer_Mac_Word"; + break; +- case MWAWDocument::MSWORKS: // MSWorks document (v1 v2) ++ case MWAWDocument::MWAW_T_MICROSOFTWORKS: + sTypeName = "writer_Mac_Works"; + break; +- case MWAWDocument::NISUSW: // Nisus Writer document: v3.4-v6.5 ++ case MWAWDocument::MWAW_T_NISUSWRITER: + sTypeName = "writer_Nisus_Writer"; + break; +- case MWAWDocument::TEACH: // TeachText or SimpleText: v1 ++ case MWAWDocument::MWAW_T_TEACHTEXT: + sTypeName = "writer_TeachText"; + break; +- case MWAWDocument::TEDIT: // Tex-Edit v2 ++ case MWAWDocument::MWAW_T_TEXEDIT: + sTypeName = "writer_TexEdit"; + break; +- case MWAWDocument::WNOW: // WriteNow ++ case MWAWDocument::MWAW_T_WRITENOW: + sTypeName = "writer_WriteNow"; + break; +- case MWAWDocument::WPLUS: // writerplus document ++ case MWAWDocument::MWAW_T_WRITERPLUS: + sTypeName = "writer_WriterPlus"; + break; +- case MWAWDocument::ZWRT: // Z-Write : v1.3 ++ case MWAWDocument::MWAW_T_ZWRITE: + sTypeName = "writer_ZWrite"; + break; + default: +-- +1.8.3.1 + diff --git a/libreoffice.spec b/libreoffice.spec index 1a04e21..e544210 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -43,7 +43,7 @@ Summary: Free Software Productivity Suite Name: libreoffice Epoch: 1 Version: %{libo_version}.2 -Release: 3%{?libo_prerelease}%{?dist} +Release: 4%{?libo_prerelease}%{?dist} License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0 Group: Applications/Productivity URL: http://www.libreoffice.org/default/ @@ -83,7 +83,7 @@ Source27: %{external_url}/36271d3fa0d9dec1632029b6d7aac925-liblangtag-0.5. Source28: %{external_url}/f02578f5218f217a9f20e9c30e119c6a-boost_1_44_0.tar.bz2 Source29: %{external_url}/c48827713e93539dc7285f9e86ffbdc5-harfbuzz-0.9.17.tar.bz2 Source30: %{external_url}/8473296c671b6e3dd8197f4145e0854b-libodfgen-0.0.2.tar.bz2 -Source31: %{external_url}/libmwaw-0.1.11.tar.bz2 +Source31: %{external_url}/libmwaw-0.2.0.tar.bz2 %endif # build tools @@ -157,7 +157,7 @@ BuildRequires: libidn-devel BuildRequires: libjpeg-turbo-devel BuildRequires: liblangtag-devel >= 0.4.0 BuildRequires: libmspub-devel -BuildRequires: libmwaw-devel +BuildRequires: libmwaw-devel >= 0.2.0 BuildRequires: libodfgen-devel BuildRequires: liborcus-devel >= 0.5.0 BuildRequires: libvisio-devel @@ -267,6 +267,7 @@ Patch26: 0001-fdo-67725-unoidl-AggregatingCursor-must-wrap-modules.patch Patch27: 0001-Resolves-rhbz-1021915-force-menubar-menus-to-be-up-d.patch Patch28: 0001-fdo-70968-Incorrect-rendering-of-Devanagari-short-i-.patch Patch29: 0001-resolved-fdo-56209-reviving-FilterFormulaParser.patch +Patch30: 0001-update-libmwaw-to-0.2.0.patch %define instdir %{_libdir} %define baseinstdir %{instdir}/libreoffice @@ -1031,6 +1032,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc %patch27 -p1 -b .rhbz-1021915-force-menubar-menus-to-be-up-d.patch %patch28 -p1 -b .fdo-70968-Incorrect-rendering-of-Devanagari-short-i-.patch %patch29 -p1 -b .resolved-fdo-56209-reviving-FilterFormulaParser.patch +%patch30 -p1 -b .update-libmwaw-to-0.2.0.patch # TODO: check this # these are horribly incomplete--empty translations and copied english @@ -1098,8 +1100,6 @@ export PYTHON_LIBS=`python-config --libs python` %endif %endif -# TODO: do we still need this? Perhaps some old patch touches -# configure.ac? aclocal -I m4 autoconf # avoid running autogen.sh on make @@ -2122,6 +2122,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || : %endif %changelog +* Sun Nov 03 2013 David Tardon - 1:4.1.3.2-4 +- adapt for libmwaw 0.2 + * Thu Oct 31 2013 David Tardon - 1:4.1.3.2-3 - Resolves: fdo#56209 reviving FilterFormulaParser