summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorALONSO Laurent <laurent.alonso@inria.fr>2021-09-02 10:46:32 +0200
committerALONSO Laurent <laurent.alonso@inria.fr>2021-09-02 10:46:32 +0200
commitfdfdd05c8f5995bbabaf19bfece820f04fab14d5 (patch)
tree6d074418b18f5f3428845d8fdc67542321b755b6
parentcbdcb8143f350592c8a8bde888ad9430082e42e7 (diff)
iwa[numbers]: use also workspace name to define the final sheet's name...
Change-Id: I8c7b55a26546bef68ff728fd9f5e8229dbb7ad76
-rw-r--r--src/lib/IWAParser.cpp26
-rw-r--r--src/lib/IWORKCollector.h5
-rw-r--r--src/lib/NUMCollector.h18
3 files changed, 37 insertions, 12 deletions
diff --git a/src/lib/IWAParser.cpp b/src/lib/IWAParser.cpp
index c3e5632..f657c44 100644
--- a/src/lib/IWAParser.cpp
+++ b/src/lib/IWAParser.cpp
@@ -2541,8 +2541,15 @@ void IWAParser::parseTabularModel(const unsigned id)
}
if (get(msg).string(8))
{
- auto finalName=get(get(msg).string(8));
- // also update the table name map?
+ std::string finalName;
+ if (bool(m_collector.getWorkSpaceName()))
+ {
+ std::stringstream s;
+ s << get(m_collector.getWorkSpaceName()) << "_" << get(get(msg).string(8));
+ finalName=s.str();
+ }
+ else
+ finalName=get(get(msg).string(8));
if (m_tableNameMap->find(finalName)!=m_tableNameMap->end())
{
ETONYEK_DEBUG_MSG(("IWAParser::parseTabularModel: a table with name %s already exists\n", finalName.c_str()));
@@ -2811,15 +2818,24 @@ void IWAParser::parseTileDefinition(unsigned row, unsigned column, RVNGInputStre
const unsigned flags = readU32(input);
if (flags & 1)
{
- double mantissa=double(readU64(input));
- mantissa+=double(65536)*double(65536)*double(65536)*double(65536)*double(readU32(input));
- input->seek(2, librevenge::RVNG_SEEK_CUR); // checkme: maybe nan
+ long double mantissa=0;
+ long double decal=1;
+ for (int i=0; i<7; ++i)
+ {
+ mantissa+=decal*double(readU16(input));
+ decal*=65536;
+ }
auto exponent=readU16(input);
if (exponent&0x8000)
{
mantissa*=-1;
exponent&=0x7fff;
}
+ if (exponent&1)
+ {
+ mantissa+=decal;
+ exponent&=0x7ffe; // need if exponent<12352
+ }
std::stringstream s;
s << std::setprecision(12) << mantissa *std::pow(10, (exponent-12352)/2); // 3040 mean 0
text=s.str();
diff --git a/src/lib/IWORKCollector.h b/src/lib/IWORKCollector.h
index da8b01c..f62ddf5 100644
--- a/src/lib/IWORKCollector.h
+++ b/src/lib/IWORKCollector.h
@@ -128,6 +128,11 @@ public:
return m_stylesheetStack.top();
}
+ // use to create the final table name in numbers document
+ virtual boost::optional<std::string> getWorkSpaceName() const
+ {
+ return boost::none;
+ }
IWORKOutputManager &getOutputManager();
public:
diff --git a/src/lib/NUMCollector.h b/src/lib/NUMCollector.h
index 8649247..b6583e0 100644
--- a/src/lib/NUMCollector.h
+++ b/src/lib/NUMCollector.h
@@ -17,7 +17,7 @@ namespace libetonyek
class IWORKDocumentInterface;
-class NUMCollector : public IWORKCollector
+class NUMCollector final : public IWORKCollector
{
public:
explicit NUMCollector(IWORKDocumentInterface *document);
@@ -30,17 +30,21 @@ public:
void startWorkSpace(boost::optional<std::string> const &name);
void endWorkSpace(IWORKTableNameMapPtr_t tableNameMap);
+ boost::optional<std::string> getWorkSpaceName() const final
+ {
+ return m_workSpaceName;
+ }
- void collectStickyNote() override;
+ void collectStickyNote() final;
private:
- void drawTable() override;
- void drawMedia(double x, double y, const librevenge::RVNGPropertyList &data) override;
- void fillShapeProperties(librevenge::RVNGPropertyList &props) override;
- bool createFrameStylesForTextBox() const override
+ void drawTable() final;
+ void drawMedia(double x, double y, const librevenge::RVNGPropertyList &data) final;
+ void fillShapeProperties(librevenge::RVNGPropertyList &props) final;
+ bool createFrameStylesForTextBox() const final
{
return true;
}
- void drawTextBox(const IWORKTextPtr_t &text, const glm::dmat3 &trafo, const IWORKGeometryPtr_t &boundingBox, const librevenge::RVNGPropertyList &style) override;
+ void drawTextBox(const IWORKTextPtr_t &text, const glm::dmat3 &trafo, const IWORKGeometryPtr_t &boundingBox, const librevenge::RVNGPropertyList &style) final;
bool m_workSpaceOpened;
boost::optional<std::string> m_workSpaceName;