diff options
author | osnola <alonso@loria.fr> | 2019-03-31 09:25:43 +0200 |
---|---|---|
committer | Laurent Alonso(fr) <alonso.laurent@gmail.com> | 2019-03-31 09:27:26 +0200 |
commit | de6ab45c601cb43a87a9773343d63833ce5e02a8 (patch) | |
tree | 172fe2414e41fee42fec1c9cd02939a04053d7b8 /src/lib | |
parent | 46523ce012db705a411ff402b1198c9481f9fba0 (diff) |
iwa[numbers]: retrieve some sticky notes, to be improved...
Change-Id: Ifb29ce590021e5b8f8695dc6a300cc89e2c20100
Reviewed-on: https://gerrit.libreoffice.org/69992
Reviewed-by: Laurent Alonso(fr) <alonso.laurent@gmail.com>
Tested-by: Laurent Alonso(fr) <alonso.laurent@gmail.com>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/IWAParser.cpp | 25 | ||||
-rw-r--r-- | src/lib/IWAParser.h | 3 | ||||
-rw-r--r-- | src/lib/IWORKCollector.cpp | 5 | ||||
-rw-r--r-- | src/lib/IWORKCollector.h | 1 | ||||
-rw-r--r-- | src/lib/KEY6Parser.cpp | 16 | ||||
-rw-r--r-- | src/lib/KEY6Parser.h | 4 | ||||
-rw-r--r-- | src/lib/KEYCollector.h | 2 | ||||
-rw-r--r-- | src/lib/NUM3Parser.cpp | 17 | ||||
-rw-r--r-- | src/lib/NUM3Parser.h | 1 | ||||
-rw-r--r-- | src/lib/NUMCollector.cpp | 2 | ||||
-rw-r--r-- | src/lib/NUMCollector.h | 2 |
11 files changed, 49 insertions, 29 deletions
diff --git a/src/lib/IWAParser.cpp b/src/lib/IWAParser.cpp index 2fef11d..a7edce2 100644 --- a/src/lib/IWAParser.cpp +++ b/src/lib/IWAParser.cpp @@ -530,24 +530,31 @@ bool IWAParser::dispatchShape(const unsigned id) const ObjectMessage msg(*this, id); if (!msg) return false; - switch (msg.getType()) + return dispatchShapeWithMessage(get(msg), msg.getType()); +} + +bool IWAParser::dispatchShapeWithMessage(const IWAMessage &msg, unsigned type) +{ + switch (type) { case IWAObjectType::ConnectionLine : case IWAObjectType::DrawableShape : - return parseDrawableShape(get(msg), msg.getType()==IWAObjectType::ConnectionLine); + return parseDrawableShape(msg, type==IWAObjectType::ConnectionLine); case IWAObjectType::Group : - return parseGroup(get(msg)); + return parseGroup(msg); case IWAObjectType::Image : - return parseImage(get(msg)); + return parseImage(msg); + case IWAObjectType::StickyNote: + return parseStickyNote(msg); case IWAObjectType::TabularInfo : - return parseTabularInfo(get(msg)); + return parseTabularInfo(msg); default: { static bool first=true; if (first) { first=false; - ETONYEK_DEBUG_MSG(("IWAParser::dispatchShape: find some unknown shapes, type=%d\n", int(msg.getType()))); + ETONYEK_DEBUG_MSG(("IWAParser::dispatchShape: find some unknown shapes, type=%d\n", int(type))); } } } @@ -1124,6 +1131,12 @@ bool IWAParser::parsePath(const IWAMessage &msg, IWORKPathPtr_t &path) return true; } +bool IWAParser::parseStickyNote(const IWAMessage &/*msg*/) +{ + ETONYEK_DEBUG_MSG(("IWAParser::parseStickyNote: not implemented\n")); + return false; +} + bool IWAParser::parseDrawableShape(const IWAMessage &msg, bool isConnectionLine) { m_collector.startLevel(); diff --git a/src/lib/IWAParser.h b/src/lib/IWAParser.h index a4bce1c..e28ed3c 100644 --- a/src/lib/IWAParser.h +++ b/src/lib/IWAParser.h @@ -102,6 +102,7 @@ protected: static void readPadding(const IWAMessage &msg, IWORKPadding &padding); bool dispatchShape(unsigned id); + bool dispatchShapeWithMessage(const IWAMessage &msg, unsigned type); bool parseText(unsigned id, const std::function<void(unsigned, IWORKStylePtr_t)> &openPageSpan=nullptr); void parseComment(unsigned id); void parseAuthorInComment(unsigned id); @@ -205,7 +206,6 @@ private: void parseLink(unsigned id, std::string &url); bool parseAttachment(unsigned id); - bool parseDrawableShape(const IWAMessage &msg, bool isConnectionLine=false); bool parseGroup(const IWAMessage &msg); bool parseShapePlacement(const IWAMessage &msg); @@ -214,6 +214,7 @@ private: bool parsePath(const IWAMessage &msg, IWORKPathPtr_t &path); bool parseFormula(const IWAMessage &msg, IWORKFormulaPtr_t &formula); bool parseFormat(const IWAMessage &msg, Format &format); + virtual bool parseStickyNote(const IWAMessage &msg); bool parseArrowProperties(const IWAMessage &msg, IWORKPropertyMap &props, bool headArrow); void parseCharacterProperties(const IWAMessage &msg, IWORKPropertyMap &props); diff --git a/src/lib/IWORKCollector.cpp b/src/lib/IWORKCollector.cpp index 3a8d53c..41a9c79 100644 --- a/src/lib/IWORKCollector.cpp +++ b/src/lib/IWORKCollector.cpp @@ -512,6 +512,11 @@ void IWORKCollector::collectText(const std::shared_ptr<IWORKText> &text) m_currentText = text; } +void IWORKCollector::collectStickyNote() +{ + ETONYEK_DEBUG_MSG(("IWORKCollector::collectStickyNote: not implemented\n")); +} + void IWORKCollector::startDocument(const librevenge::RVNGPropertyList &props) { m_document->startDocument(props); diff --git a/src/lib/IWORKCollector.h b/src/lib/IWORKCollector.h index f01f691..e6cd135 100644 --- a/src/lib/IWORKCollector.h +++ b/src/lib/IWORKCollector.h @@ -91,6 +91,7 @@ public: void collectTable(const std::shared_ptr<IWORKTable> &table); void collectText(const std::shared_ptr<IWORKText> &text); + virtual void collectStickyNote(); void startDocument(const librevenge::RVNGPropertyList &props); void endDocument(); diff --git a/src/lib/KEY6Parser.cpp b/src/lib/KEY6Parser.cpp index d1fedbd..eca8a79 100644 --- a/src/lib/KEY6Parser.cpp +++ b/src/lib/KEY6Parser.cpp @@ -229,22 +229,6 @@ void KEY6Parser::parseNotes(const unsigned id) } } -bool KEY6Parser::dispatchShape(const unsigned id) -{ - { - const ObjectMessage msg(*this, id); - if (!msg) - return false; - - if (msg.getType() == IWAObjectType::StickyNote) - return parseStickyNote(get(msg)); - } - m_collector.startLevel(); - bool ok=IWAParser::dispatchShape(id); - m_collector.endLevel(); - return ok; -} - bool KEY6Parser::parseStickyNote(const IWAMessage &msg) { m_collector.startLevel(); diff --git a/src/lib/KEY6Parser.h b/src/lib/KEY6Parser.h index 54550e7..984d811 100644 --- a/src/lib/KEY6Parser.h +++ b/src/lib/KEY6Parser.h @@ -27,15 +27,13 @@ public: private: bool parseDocument() override; - bool dispatchShape(unsigned id); - bool parsePresentation(unsigned id); bool parseSlideList(unsigned id); KEYSlidePtr_t parseSlide(unsigned id, bool master); bool parsePlaceholder(unsigned id); void parseNotes(unsigned id); - bool parseStickyNote(const IWAMessage &msg); + bool parseStickyNote(const IWAMessage &msg) override; const IWORKStylePtr_t querySlideStyle(unsigned id) const; diff --git a/src/lib/KEYCollector.h b/src/lib/KEYCollector.h index d22e74d..b941a04 100644 --- a/src/lib/KEYCollector.h +++ b/src/lib/KEYCollector.h @@ -40,7 +40,7 @@ public: void collectNote(); - void collectStickyNote(); + void collectStickyNote() override; void setSlideStyle(const IWORKStylePtr_t &style); diff --git a/src/lib/NUM3Parser.cpp b/src/lib/NUM3Parser.cpp index 80f6ce6..0126152 100644 --- a/src/lib/NUM3Parser.cpp +++ b/src/lib/NUM3Parser.cpp @@ -64,6 +64,23 @@ bool NUM3Parser::parseShapePlacement(const IWAMessage &msg, IWORKGeometryPtr_t & return true; } +bool NUM3Parser::parseStickyNote(const IWAMessage &msg) +{ + assert(!m_currentText); + + m_collector.startLevel(); + // 1: a text box, 2: a comment ref + + // FIXME: actually, this creates a textbox but the background and + // padding are bad and we do not retrieve the author, ... + auto const &shape=msg.message(1); + if (shape) + dispatchShapeWithMessage(get(shape),IWAObjectType::DrawableShape); + m_collector.endLevel(); + + return true; +} + bool NUM3Parser::parseDocument() { const ObjectMessage msg(*this, 1, NUM3ObjectType::Document); diff --git a/src/lib/NUM3Parser.h b/src/lib/NUM3Parser.h index a47c331..65266c5 100644 --- a/src/lib/NUM3Parser.h +++ b/src/lib/NUM3Parser.h @@ -25,6 +25,7 @@ public: private: bool parseDocument() override; bool parseShapePlacement(const IWAMessage &msg, IWORKGeometryPtr_t &geometry) override; + bool parseStickyNote(const IWAMessage &msg) override; bool parseSheet(unsigned id); diff --git a/src/lib/NUMCollector.cpp b/src/lib/NUMCollector.cpp index 16dc5bf..6c5d8f6 100644 --- a/src/lib/NUMCollector.cpp +++ b/src/lib/NUMCollector.cpp @@ -135,7 +135,7 @@ void NUMCollector::drawTable() { // check if the table can be the main sheet glm::dvec3 vec = m_levelStack.top().m_trafo * glm::dvec3(0, 0, 1); - m_workSpaceCreateGraphic = vec[0]>0 || vec[1]>0; + m_workSpaceCreateGraphic = vec[0]>5 || vec[1]>5; } m_tableElementLists.push_back(IWORKOutputElements()); diff --git a/src/lib/NUMCollector.h b/src/lib/NUMCollector.h index 086d87d..8649247 100644 --- a/src/lib/NUMCollector.h +++ b/src/lib/NUMCollector.h @@ -31,7 +31,7 @@ public: void startWorkSpace(boost::optional<std::string> const &name); void endWorkSpace(IWORKTableNameMapPtr_t tableNameMap); - void collectStickyNote(); + void collectStickyNote() override; private: void drawTable() override; void drawMedia(double x, double y, const librevenge::RVNGPropertyList &data) override; |