diff options
author | osnola <alonso@loria.fr> | 2017-05-11 10:07:54 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2017-07-19 15:17:15 +0200 |
commit | c419a9c2d9b216c500e961445ad785955b6eeae9 (patch) | |
tree | fd0ab33cda4ef95d395e3a0e3d957f62cfeefd3a | |
parent | fd69377a60eba6865e751ffbfaddc0666a1cb602 (diff) |
Read BlendObject zone + try to retrieve the paragraph attributes...
Change-Id: I4e9fad2a51ef568d607414d5edfb36d1d2d7a3dc
-rw-r--r-- | src/lib/FHCollector.cpp | 225 | ||||
-rw-r--r-- | src/lib/FHCollector.h | 6 | ||||
-rw-r--r-- | src/lib/FHConstants.h | 13 | ||||
-rw-r--r-- | src/lib/FHParser.cpp | 86 | ||||
-rw-r--r-- | src/lib/FHParser.h | 1 | ||||
-rw-r--r-- | src/lib/FHTypes.h | 22 | ||||
-rw-r--r-- | src/lib/tokens.txt | 1 |
7 files changed, 317 insertions, 37 deletions
diff --git a/src/lib/FHCollector.cpp b/src/lib/FHCollector.cpp index 408e40a..bb1432f 100644 --- a/src/lib/FHCollector.cpp +++ b/src/lib/FHCollector.cpp @@ -238,8 +238,8 @@ private: libfreehand::FHCollector::FHCollector() : m_pageInfo(), m_fhTail(), m_block(), m_transforms(), m_paths(), m_strings(), m_names(), m_lists(), m_layers(), m_groups(), m_clipGroups(), m_currentTransforms(), m_fakeTransforms(), m_compositePaths(), - m_pathTexts(), m_tStrings(), m_fonts(), m_paragraphs(), m_textBloks(), m_textObjects(), m_charProperties(), - m_rgbColors(), m_basicFills(), m_propertyLists(), m_basicLines(), m_displayTexts(), m_graphicStyles(), + m_pathTexts(), m_tStrings(), m_fonts(), m_paragraphs(), m_tabs(), m_textBloks(), m_textObjects(), m_charProperties(), + m_paragraphProperties(), m_rgbColors(), m_basicFills(), m_propertyLists(), m_basicLines(), m_displayTexts(), m_graphicStyles(), m_attributeHolders(), m_data(), m_dataLists(), m_images(), m_multiColorLists(), m_linearFills(), m_tints(), m_lensFills(), m_radialFills(), m_newBlends(), m_filterAttributeHolders(), m_opacityFilters(), m_shadowFilters(), m_glowFilters(), m_tileFills(), m_symbolClasses(), m_symbolInstances(), m_patternFills(), @@ -343,6 +343,12 @@ void libfreehand::FHCollector::collectParagraph(unsigned recordId, const FHParag m_paragraphs[recordId] = paragraph; } +void libfreehand::FHCollector::collectTabTable(unsigned recordId, const std::vector<FHTab> &tabs) +{ + if (tabs.empty()) return; + m_tabs[recordId] = tabs; +} + void libfreehand::FHCollector::collectTextBlok(unsigned recordId, const std::vector<unsigned short> &characters) { m_textBloks[recordId] = characters; @@ -358,6 +364,11 @@ void libfreehand::FHCollector::collectCharProps(unsigned recordId, const FHCharP m_charProperties[recordId] = charProps; } +void libfreehand::FHCollector::collectParagraphProps(unsigned recordId, const FHParagraphProperties ¶graphProps) +{ + m_paragraphProperties[recordId] = paragraphProps; +} + void libfreehand::FHCollector::collectColor(unsigned recordId, const FHRGBColor &color) { m_rgbColors[recordId] = color; @@ -1468,7 +1479,31 @@ void libfreehand::FHCollector::_appendCharacterProperties(librevenge::RVNGProper propList.insert("fo:color", color); } } - propList.insert("style:text-scale", charProps.m_horizontalScale, librevenge::RVNG_PERCENT); + for (std::map<unsigned,double>::const_iterator it=charProps.m_idToDoubleMap.begin(); it!=charProps.m_idToDoubleMap.end(); ++it) + { + switch (it->first) + { + case FH_BASELN_SHIFT: + { + if (it->second<=0 && it->second>=0) break; + librevenge::RVNGString value; + double fontSize=(charProps.m_fontSize>0) ? charProps.m_fontSize : 24.; + value.sprintf("%g%%",100.*it->second/fontSize); + propList.insert("style:text-position", value); + break; + } + case FH_HOR_SCALE: + if (it->second<=1 && it->second>=1) break; + propList.insert("style:text-scale", it->second, librevenge::RVNG_PERCENT); + break; + case FH_RNG_KERN: + if (it->second<=0 && it->second>=0) break; + propList.insert("fo:letter-spacing", it->second*charProps.m_fontSize, librevenge::RVNG_POINT); + break; + default: + break; + } + } } void libfreehand::FHCollector::_appendCharacterProperties(librevenge::RVNGPropertyList &propList, const FH3CharProperties &charProps) @@ -1497,18 +1532,145 @@ void libfreehand::FHCollector::_appendCharacterProperties(librevenge::RVNGProper if (charProps.m_baselineShift<0 || charProps.m_baselineShift>0) { librevenge::RVNGString value; - double fontSize=(charProps.m_fontSize>0) ? charProps.m_fontSize : 12.; + double fontSize=(charProps.m_fontSize>0) ? charProps.m_fontSize : 24.; value.sprintf("%g%%",100.*charProps.m_baselineShift/fontSize); propList.insert("style:text-position", value); } } +void libfreehand::FHCollector::_appendTabProperties(librevenge::RVNGPropertyList &propList, const libfreehand::FHTab &tab) +{ + switch (tab.m_type) + { + case 0: + case 4: // unsure, look like a left tab + default: + break; + case 1: + propList.insert("style:type", "right"); + break; + case 2: + propList.insert("style:type", "center"); + break; + case 3: + propList.insert("style:type", "char"); + propList.insert("style:char", "."); // checkme + break; + } + propList.insert("style:position", tab.m_position, librevenge::RVNG_POINT); +} + void libfreehand::FHCollector::_appendParagraphProperties(librevenge::RVNGPropertyList & /* propList */, const FH3ParaProperties & /* paraProps */) { } -void libfreehand::FHCollector::_appendParagraphProperties(librevenge::RVNGPropertyList & /* propList */, unsigned /* paraPropsId */) +void libfreehand::FHCollector::_appendParagraphProperties(librevenge::RVNGPropertyList &propList, unsigned paragraphPropsId) { + std::map<unsigned, FHParagraphProperties>::const_iterator iter = m_paragraphProperties.find(paragraphPropsId); + if (iter == m_paragraphProperties.end()) + return; + FHParagraphProperties const ¶=iter->second; + for (std::map<unsigned,unsigned>::const_iterator it=para.m_idToZoneIdMap.begin(); it!=para.m_idToZoneIdMap.end(); ++it) + { + switch (it->first) + { + case FH_PARA_TAB_TABLE_ID: + if (m_tabs.find(it->second)!=m_tabs.end()) + { + std::vector<FHTab> const &tabs=m_tabs.find(it->second)->second; + if (tabs.empty()) + break; + librevenge::RVNGPropertyListVector tabVect; + for (size_t i=0; i<tabs.size(); i++) + { + librevenge::RVNGPropertyList tabList; + _appendTabProperties(tabList, tabs[i]); + tabVect.append(tabList); + } + propList.insert("style:tab-stops", tabVect); + } + break; + default: + break; + } + } + for (std::map<unsigned,double>::const_iterator it=para.m_idToDoubleMap.begin(); it!=para.m_idToDoubleMap.end(); ++it) + { + switch (it->first) + { + case FH_PARA_LEFT_INDENT: + propList.insert("fo:margin-left", it->second, librevenge::RVNG_POINT); + break; + case FH_PARA_RIGHT_INDENT: + propList.insert("fo:margin-right", it->second, librevenge::RVNG_POINT); + break; + case FH_PARA_TEXT_INDENT: + propList.insert("fo:text-indent", it->second, librevenge::RVNG_POINT); + break; + case FH_PARA_SPC_ABOVE: + propList.insert("fo:margin-top", it->second, librevenge::RVNG_POINT); + break; + case FH_PARA_SPC_BELLOW: + propList.insert("fo:margin-bottom", it->second, librevenge::RVNG_POINT); + break; + case FH_PARA_LEADING: + if (it->second<=0 && it->second>=0) break; + if (para.m_idToIntMap.find(FH_PARA_LEADING_TYPE)==para.m_idToIntMap.end()) + { + FH_DEBUG_MSG(("libfreehand::FHCollector::_appendParagraphProperties: can not find the leading type\n")); + break; + } + switch (para.m_idToIntMap.find(FH_PARA_LEADING_TYPE)->second) + { + case 0: // delta in point + propList.insert("fo:line-height",1.+it->second/(it->second>0 ? 12 : 24), librevenge::RVNG_PERCENT); + break; + case 1: + propList.insert("fo:line-height",it->second, librevenge::RVNG_POINT); + break; + case 2: + propList.insert("fo:line-height",it->second, librevenge::RVNG_PERCENT); + break; + default: + break; + } + break; + default: + break; + } + } + for (std::map<unsigned,unsigned>::const_iterator it=para.m_idToIntMap.begin(); it!=para.m_idToIntMap.end(); ++it) + { + switch (it->first) + { + case FH_PARA_TEXT_ALIGN: + switch (it->second) + { + case 0: + propList.insert("fo:text-align", "left"); + break; + case 1: + propList.insert("fo:text-align", "end"); + break; + case 2: + propList.insert("fo:text-align", "center"); + break; + case 3: + propList.insert("fo:text-align", "justify"); + break; + default: + break; + } + break; + case FH_PARA_KEEP_SAME_LINE: + if (it->second==1) + propList.insert("fo:keep-together", "always"); + break; + case FH_PARA_LEADING_TYPE: // done with FH_PARA_LEADING + default: + break; + } + } } void libfreehand::FHCollector::_outputDisplayText(const libfreehand::FHDisplayText *displayText, librevenge::RVNGDrawingInterface *painter) @@ -1780,8 +1942,45 @@ void libfreehand::FHCollector::_outputTextRun(const std::vector<unsigned short> _appendCharacterProperties(propList, charStyleId); painter->openSpan(propList); std::vector<unsigned short> tmpChars; + bool lastIsSpace=false; for (unsigned i = offset; i < length+offset && i < characters->size(); ++i) - tmpChars.push_back((*characters)[i]); + { + unsigned c=(*characters)[i]; + if (c=='\t' || (c==' ' && lastIsSpace)) + { + if (!tmpChars.empty()) + { + librevenge::RVNGString text; + _appendUTF16(text, tmpChars); + painter->insertText(text); + tmpChars.clear(); + } + if (c=='\t') + painter->insertTab(); + else + painter->insertSpace(); + continue; + } + else + { + if (c<=0x1f) + { + switch (c) + { + case 0xb: // end of column + break; + case 0x1f: // optional hyphen + break; + default: + FH_DEBUG_MSG(("libfreehand::FHCollector::_outputTextRun: find character %x\n", c)); + break; + } + } + else + tmpChars.push_back(c); + } + lastIsSpace=c==' '; + } if (!tmpChars.empty()) { librevenge::RVNGString text; @@ -2352,6 +2551,16 @@ const libfreehand::FHParagraph *libfreehand::FHCollector::_findParagraph(unsigne return 0; } +const std::vector<libfreehand::FHTab> *libfreehand::FHCollector::_findTabTable(unsigned id) +{ + if (!id) + return 0; + std::map<unsigned, std::vector<libfreehand::FHTab> >::const_iterator iter = m_tabs.find(id); + if (iter != m_tabs.end()) + return &(iter->second); + return 0; +} + const std::vector<unsigned> *libfreehand::FHCollector::_findTStringElements(unsigned id) { if (!id) @@ -2665,7 +2874,7 @@ unsigned libfreehand::FHCollector::_findValueFromAttribute(unsigned id) return value; } -::librevenge::RVNGBinaryData libfreehand::FHCollector::getImageData(unsigned id) +librevenge::RVNGBinaryData libfreehand::FHCollector::getImageData(unsigned id) { std::map<unsigned, FHDataList>::const_iterator iter = m_dataLists.find(id); librevenge::RVNGBinaryData data; @@ -2680,7 +2889,7 @@ unsigned libfreehand::FHCollector::_findValueFromAttribute(unsigned id) return data; } -::librevenge::RVNGString libfreehand::FHCollector::getColorString(unsigned id) +librevenge::RVNGString libfreehand::FHCollector::getColorString(unsigned id) { const FHRGBColor *color = _findRGBColor(id); if (color) diff --git a/src/lib/FHCollector.h b/src/lib/FHCollector.h index 3150426..846e423 100644 --- a/src/lib/FHCollector.h +++ b/src/lib/FHCollector.h @@ -45,9 +45,11 @@ public: void collectTString(unsigned recordId, const std::vector<unsigned> &elements); void collectAGDFont(unsigned recordId, const FHAGDFont &font); void collectParagraph(unsigned recordId, const FHParagraph ¶graph); + void collectTabTable(unsigned recordId, const std::vector<FHTab> &tabs); void collectTextBlok(unsigned recordId, const std::vector<unsigned short> &characters); void collectTextObject(unsigned recordId, const FHTextObject &textObject); void collectCharProps(unsigned recordId, const FHCharProperties &charProps); + void collectParagraphProps(unsigned recordId, const FHParagraphProperties ¶graphProps); void collectPropList(unsigned recordId, const FHPropList &propertyList); void collectDisplayText(unsigned recordId, const FHDisplayText &displayText); void collectGraphicStyle(unsigned recordId, const FHGraphicStyle &graphicStyle); @@ -123,6 +125,7 @@ private: void _appendCharacterProperties(librevenge::RVNGPropertyList &propList, unsigned charPropsId); void _appendCharacterProperties(librevenge::RVNGPropertyList &propList, const FH3CharProperties &charProps); void _appendFontProperties(librevenge::RVNGPropertyList &propList, unsigned agdFontId); + void _appendTabProperties(librevenge::RVNGPropertyList &propList, const FHTab &tab); void _appendFillProperties(librevenge::RVNGPropertyList &propList, unsigned graphicStyleId); void _appendStrokeProperties(librevenge::RVNGPropertyList &propList, unsigned graphicStyleId); void _appendBasicFill(librevenge::RVNGPropertyList &propList, const FHBasicFill *basicFill); @@ -148,6 +151,7 @@ private: const FHTextObject *_findTextObject(unsigned id); const FHTransform *_findTransform(unsigned id); const FHParagraph *_findParagraph(unsigned id); + const std::vector<FHTab> *_findTabTable(unsigned id); const FHPropList *_findPropList(unsigned id); const FHGraphicStyle *_findGraphicStyle(unsigned id); const std::vector<unsigned short> *_findTextBlok(unsigned id); @@ -201,9 +205,11 @@ private: std::map<unsigned, std::vector<unsigned> > m_tStrings; std::map<unsigned, FHAGDFont> m_fonts; std::map<unsigned, FHParagraph> m_paragraphs; + std::map<unsigned, std::vector<FHTab> > m_tabs; std::map<unsigned, std::vector<unsigned short> > m_textBloks; std::map<unsigned, FHTextObject> m_textObjects; std::map<unsigned, FHCharProperties> m_charProperties; + std::map<unsigned, FHParagraphProperties> m_paragraphProperties; std::map<unsigned, FHRGBColor> m_rgbColors; std::map<unsigned, FHBasicFill> m_basicFills; std::map<unsigned, FHPropList> m_propertyLists; diff --git a/src/lib/FHConstants.h b/src/lib/FHConstants.h index 2591019..126e56a 100644 --- a/src/lib/FHConstants.h +++ b/src/lib/FHConstants.h @@ -14,23 +14,28 @@ #define FH_NAME 0x0321 #define FH_UID 0x065b -#define FH_TEXT_ALIGN 0x15e3 +#define FH_PARA_TEXT_ALIGN 0x15e3 +#define FH_PARA_TEXT_INDENT 0x1604 +#define FH_PARA_LINE_TOGETHER 0x160b +#define FH_PARA_LEFT_INDENT 0x1614 #define FH_SPC_LETTER_MAX 0x161c #define FH_SPC_WORD_MAX 0x1624 #define FH_SPC_LETTER_MIN 0x1634 #define FH_SPC_WORD_MIN 0x163c #define FH_SPC_LETTER_OPT 0x164c #define FH_SPC_WORD_OPT 0x1654 +#define FH_PARA_RIGHT_INDENT 0x1664 #define FH_PARA_SPC_BELLOW 0x1684 #define FH_PARA_SPC_ABOVE 0x168c -#define FH_TAB_TABLE_ID 0x1691 +#define FH_PARA_TAB_TABLE_ID 0x1691 #define FH_BASELN_SHIFT 0x169c +#define FH_PARA_KEEP_SAME_LINE 0x16a2 #define FH_TEFFECT_ID 0x16b1 #define FH_TXT_COLOR_ID 0x16b9 #define FH_FONT_ID 0x16c1 #define FH_HOR_SCALE 0x16d4 -#define FH_LEADING 0x16dc -#define FH_LEADING_TYPE 0x16e3 +#define FH_PARA_LEADING 0x16dc +#define FH_PARA_LEADING_TYPE 0x16e3 #define FH_RNG_KERN 0x16ec #define FH_FONT_SIZE 0x1734 #define FH_FONT_NAME 0x1739 diff --git a/src/lib/FHParser.cpp b/src/lib/FHParser.cpp index 7cd4d54..e483a06 100644 --- a/src/lib/FHParser.cpp +++ b/src/lib/FHParser.cpp @@ -7,6 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <algorithm> #include <memory> #include <sstream> #include <string> @@ -172,6 +173,9 @@ void libfreehand::FHParser::parseRecord(librevenge::RVNGInputStream *input, libf case FH_BENDFILTER: readBendFilter(input, collector); break; + case FH_BLENDOBJECT: + readBlendObject(input, collector); + break; case FH_BLOCK: readBlock(input, collector); break; @@ -679,6 +683,15 @@ void libfreehand::FHParser::readBendFilter(librevenge::RVNGInputStream *input, l input->seek(10, librevenge::RVNG_SEEK_CUR); } +void libfreehand::FHParser::readBlendObject(librevenge::RVNGInputStream *input, libfreehand::FHCollector */*collector*/) +{ + // osnola useme + for (int i=0; i<2; ++i) _readRecordId(input); + input->seek(8, librevenge::RVNG_SEEK_CUR); + _readRecordId(input); + input->seek(16, librevenge::RVNG_SEEK_CUR); +} + void libfreehand::FHParser::readBlock(librevenge::RVNGInputStream *input, libfreehand::FHCollector *collector) { unsigned layerListId = 0; @@ -1159,6 +1172,7 @@ void libfreehand::FHParser::readGuides(librevenge::RVNGInputStream *input, libfr unsigned short size = readU16(input); _readRecordId(input); _readRecordId(input); + /* osnola: todo, useme, there is one guide by "page", ... */ if (m_version > 3) input->seek(4, librevenge::RVNG_SEEK_CUR); input->seek(12+size*8, librevenge::RVNG_SEEK_CUR); @@ -1791,6 +1805,8 @@ void libfreehand::FHParser::readPropLst(librevenge::RVNGInputStream *input, libf input->seek(4, librevenge::RVNG_SEEK_CUR); FHPropList propertyList; _readPropLstElements(input, propertyList.m_elements, size); + /* osnola: TODO + - if version>3, look if pages is defined, if yes, the zone defines the list of pages, */ if (m_version < 9) input->seek((size2 - size)*4, librevenge::RVNG_SEEK_CUR); if (collector) @@ -2047,13 +2063,27 @@ void libfreehand::FHParser::readSymbolLibrary(librevenge::RVNGInputStream *input _readRecordId(input); } -void libfreehand::FHParser::readTabTable(librevenge::RVNGInputStream *input, libfreehand::FHCollector * /* collector */) +void libfreehand::FHParser::readTabTable(librevenge::RVNGInputStream *input, libfreehand::FHCollector *collector) { unsigned short size = readU16(input); - if (m_version < 10) - input->seek(2+size*2, librevenge::RVNG_SEEK_CUR); - else - input->seek(2+size*6, librevenge::RVNG_SEEK_CUR); + unsigned short n = readU16(input); + long endPos=input->tell()+6*size; + if (n>size) + { + FH_DEBUG_MSG(("libfreehand::FHParser::readTabTable: the number of tabs seems bad\n")); + input->seek(endPos, librevenge::RVNG_SEEK_SET); + return; + } + std::vector<FHTab> tabs; + tabs.resize(size_t(n)); + for (size_t i=0; i<size_t(n); ++i) + { + tabs[i].m_type=readU16(input); + tabs[i].m_position=_readCoordinate(input); + } + if (collector) + collector->collectTabTable(m_currentRecord+1, tabs); + input->seek(endPos, librevenge::RVNG_SEEK_SET); } void libfreehand::FHParser::readTaperedFill(librevenge::RVNGInputStream *input, libfreehand::FHCollector *collector) @@ -2295,6 +2325,7 @@ void libfreehand::FHParser::readVMpObj(librevenge::RVNGInputStream *input, libfr double minY = 0.0; double maxX = 0.0; double maxY = 0.0; + FHParagraphProperties paraProps; std::unique_ptr<libfreehand::FHCharProperties> charProps; for (unsigned short i = 0; i < num; ++i) { @@ -2307,10 +2338,7 @@ void libfreehand::FHParser::readVMpObj(librevenge::RVNGInputStream *input, libfr { minX = _readCoordinate(input) / 72.0; if (m_pageInfo.m_minX > 0.0) - { - if (m_pageInfo.m_minX > minX) - m_pageInfo.m_minX = minX; - } + m_pageInfo.m_minX=std::min(minX,m_pageInfo.m_minX); else m_pageInfo.m_minX = minX; break; @@ -2320,10 +2348,7 @@ void libfreehand::FHParser::readVMpObj(librevenge::RVNGInputStream *input, libfr { minY = _readCoordinate(input) / 72.0; if (m_pageInfo.m_minY > 0.0) - { - if (m_pageInfo.m_minY > minY) - m_pageInfo.m_minY = minY; - } + m_pageInfo.m_minY=std::min(minY,m_pageInfo.m_minY); else m_pageInfo.m_minY = minY; break; @@ -2331,17 +2356,32 @@ void libfreehand::FHParser::readVMpObj(librevenge::RVNGInputStream *input, libfr case FH_PAGE_WIDTH: { maxX = minX + _readCoordinate(input) / 72.0; - if (m_pageInfo.m_maxX < maxX) - m_pageInfo.m_maxX = maxX; + m_pageInfo.m_maxX = std::max(maxX,m_pageInfo.m_maxX); break; } case FH_PAGE_HEIGHT: { maxY = minY + _readCoordinate(input) / 72.0; - if (m_pageInfo.m_maxY < maxY) - m_pageInfo.m_maxY = maxY; + m_pageInfo.m_maxY = std::max(maxY,m_pageInfo.m_maxY); break; } + case FH_PARA_LEFT_INDENT: + case FH_PARA_RIGHT_INDENT: + case FH_PARA_TEXT_INDENT: + case FH_PARA_SPC_ABOVE: + case FH_PARA_SPC_BELLOW: + case FH_PARA_LEADING: + paraProps.m_idToDoubleMap[rec]=_readCoordinate(input); + break; + case FH_PARA_LINE_TOGETHER: + case FH_PARA_TEXT_ALIGN: + case FH_PARA_LEADING_TYPE: + case FH_PARA_KEEP_SAME_LINE: + paraProps.m_idToIntMap[rec]=readU32(input); + break; + case FH_PARA_TAB_TABLE_ID: + paraProps.m_idToZoneIdMap[rec]=_readRecordId(input); + break; case FH_TEFFECT_ID: { if (!charProps) @@ -2377,13 +2417,13 @@ void libfreehand::FHParser::readVMpObj(librevenge::RVNGInputStream *input, libfr charProps->m_fontNameId = _readRecordId(input); break; } + case FH_BASELN_SHIFT: case FH_HOR_SCALE: - { + case FH_RNG_KERN: if (!charProps) charProps.reset(new libfreehand::FHCharProperties()); - charProps->m_horizontalScale = _readCoordinate(input); + charProps->m_idToDoubleMap[rec]=_readCoordinate(input); break; - } default: if (key == 2) _readRecordId(input); @@ -2391,10 +2431,12 @@ void libfreehand::FHParser::readVMpObj(librevenge::RVNGInputStream *input, libfr input->seek(4, librevenge::RVNG_SEEK_CUR); } } - if (charProps) + if (collector) { - if (collector) + if (charProps) collector->collectCharProps(m_currentRecord+1, *charProps); + if (!paraProps.empty()) + collector->collectParagraphProps(m_currentRecord+1, paraProps); } } diff --git a/src/lib/FHParser.h b/src/lib/FHParser.h index a79ddfd..8f322cb 100644 --- a/src/lib/FHParser.h +++ b/src/lib/FHParser.h @@ -44,6 +44,7 @@ private: void readBasicFill(librevenge::RVNGInputStream *input, FHCollector *collector); void readBasicLine(librevenge::RVNGInputStream *input, FHCollector *collector); void readBendFilter(librevenge::RVNGInputStream *input, FHCollector *collector); + void readBlendObject(librevenge::RVNGInputStream *input, FHCollector *collector); void readBlock(librevenge::RVNGInputStream *input, FHCollector *collector); void readBrush(librevenge::RVNGInputStream *input, FHCollector *collector); void readBrushStroke(librevenge::RVNGInputStream *input, FHCollector *collector); diff --git a/src/lib/FHTypes.h b/src/lib/FHTypes.h index 7b3db81..595ae22 100644 --- a/src/lib/FHTypes.h +++ b/src/lib/FHTypes.h @@ -35,6 +35,13 @@ struct FHBlock FHBlock(unsigned layerListId) : m_layerListId(layerListId) {} }; +struct FHTab +{ + unsigned m_type; + double m_position; + FHTab() : m_type(0), m_position(0) {} +}; + struct FHTail { unsigned m_blockId; @@ -116,8 +123,17 @@ struct FHTextObject m_startX(0.0), m_startY(0.0), m_width(0.0), m_height(0.0) {} }; -struct FHParaProperties +struct FHParagraphProperties { + std::map<unsigned,unsigned> m_idToIntMap; // id to enum, int map + std::map<unsigned,double> m_idToDoubleMap; + std::map<unsigned,unsigned> m_idToZoneIdMap; + FHParagraphProperties() : m_idToIntMap(), m_idToDoubleMap(), m_idToZoneIdMap() + {} + bool empty() const + { + return m_idToIntMap.empty() && m_idToDoubleMap.empty() && m_idToZoneIdMap.empty(); + } }; struct FHCharProperties @@ -126,9 +142,9 @@ struct FHCharProperties double m_fontSize; unsigned m_fontNameId; unsigned m_fontId; - double m_horizontalScale; + std::map<unsigned,double> m_idToDoubleMap; FHCharProperties() - : m_textColorId(0), m_fontSize(12.0), m_fontNameId(0), m_fontId(0), m_horizontalScale(1.0) {} + : m_textColorId(0), m_fontSize(12.0), m_fontNameId(0), m_fontId(0), m_idToDoubleMap() {} }; struct FHRGBColor diff --git a/src/lib/tokens.txt b/src/lib/tokens.txt index 97d1cb3..10de9b5 100644 --- a/src/lib/tokens.txt +++ b/src/lib/tokens.txt @@ -5,6 +5,7 @@ AttributeHolder BasicFill BasicLine BendFilter +BlendObject Block Brush BrushList |