src/conv/raw/cdr2raw.cpp | 10 +++++++--- src/conv/raw/cmx2raw.cpp | 10 +++++++--- src/conv/svg/cdr2xhtml.cpp | 8 ++++++-- src/conv/svg/cmx2xhtml.cpp | 8 ++++++-- src/conv/text/cdr2text.cpp | 8 ++++++-- src/conv/text/cmx2text.cpp | 8 ++++++-- src/lib/CDRContentCollector.cpp | 24 ++++++++++++------------ 7 files changed, 50 insertions(+), 26 deletions(-)
New commits: commit 5acb80e5e2a930fa6ccb50da39aafc57b429e6e6 Author: David Tardon <dtar...@redhat.com> Date: Fri Dec 25 17:57:19 2015 +0100 make help output more help2man-friendly Change-Id: Icf52fbf7222f155e5f0cb25c3da3053f5962dc2e diff --git a/src/conv/raw/cdr2raw.cpp b/src/conv/raw/cdr2raw.cpp index fa5d1b2..1b68a29 100644 --- a/src/conv/raw/cdr2raw.cpp +++ b/src/conv/raw/cdr2raw.cpp @@ -19,11 +19,15 @@ namespace int printUsage() { - printf("Usage: cdr2raw [OPTION] <Corel Draw Document>\n"); + printf("`cdr2raw' is used to test import of CorelDRAW documents in libcdr.\n"); + printf("\n"); + printf("Usage: cdr2raw [OPTION] FILE\n"); printf("\n"); printf("Options:\n"); - printf("--callgraph Display the call graph nesting level\n"); - printf("--help Shows this help message\n"); + printf("\t--callgraph display the call graph nesting level\n"); + printf("\t--help show this help message\n"); + printf("\n"); + printf("Report bugs to <https://bugs.documentfoundation.org/>.\n"); return -1; } diff --git a/src/conv/raw/cmx2raw.cpp b/src/conv/raw/cmx2raw.cpp index 5f88117..63d2f7a 100644 --- a/src/conv/raw/cmx2raw.cpp +++ b/src/conv/raw/cmx2raw.cpp @@ -19,11 +19,15 @@ namespace int printUsage() { - printf("Usage: cmx2raw [OPTION] <Corel Binary Metafile>\n"); + printf("`cmx2raw' is used to test import of Corel Binary Metafiles in libcdr.\n"); + printf("\n"); + printf("Usage: cmx2raw [OPTION] FILE\n"); printf("\n"); printf("Options:\n"); - printf("--callgraph Display the call graph nesting level\n"); - printf("--help Shows this help message\n"); + printf("\t--callgraph display the call graph nesting level\n"); + printf("\t--help show this help message\n"); + printf("\n"); + printf("Report bugs to <https://bugs.documentfoundation.org/>.\n"); return -1; } diff --git a/src/conv/svg/cdr2xhtml.cpp b/src/conv/svg/cdr2xhtml.cpp index 1146522..ef68dde 100644 --- a/src/conv/svg/cdr2xhtml.cpp +++ b/src/conv/svg/cdr2xhtml.cpp @@ -21,10 +21,14 @@ namespace int printUsage() { - printf("Usage: cdr2xhtml [OPTION] <Corel Draw Document>\n"); + printf("`cdr2xhtml' converts CorelDRAW documents to SVG.\n"); + printf("\n"); + printf("Usage: cdr2xhtml [OPTION] FILE\n"); printf("\n"); printf("Options:\n"); - printf("--help Shows this help message\n"); + printf("\t--help show this help message\n"); + printf("\n"); + printf("Report bugs to <https://bugs.documentfoundation.org/>.\n"); return -1; } diff --git a/src/conv/svg/cmx2xhtml.cpp b/src/conv/svg/cmx2xhtml.cpp index e5dfdd3..2c926ec 100644 --- a/src/conv/svg/cmx2xhtml.cpp +++ b/src/conv/svg/cmx2xhtml.cpp @@ -21,10 +21,14 @@ namespace int printUsage() { - printf("Usage: cmx2xhtml [OPTION] <Corel Binary Metafile>\n"); + printf("`cmx2xhtml' converts Corel Binary Metafiles to SVG.\n"); + printf("\n"); + printf("Usage: cmx2xhtml [OPTION] FILE\n"); printf("\n"); printf("Options:\n"); - printf("--help Shows this help message\n"); + printf("\t--help show this help message\n"); + printf("\n"); + printf("Report bugs to <https://bugs.documentfoundation.org/>.\n"); return -1; } diff --git a/src/conv/text/cdr2text.cpp b/src/conv/text/cdr2text.cpp index be37be6..dfc2645 100644 --- a/src/conv/text/cdr2text.cpp +++ b/src/conv/text/cdr2text.cpp @@ -20,10 +20,14 @@ namespace int printUsage() { - printf("Usage: cdr2text [OPTION] <Corel Draw Document>\n"); + printf("`cdr2text' converts CorelDRAW documents to plain text.\n"); + printf("\n"); + printf("Usage: cdr2text [OPTION] FILE\n"); printf("\n"); printf("Options:\n"); - printf("--help Shows this help message\n"); + printf("\t--help show this help message\n"); + printf("\n"); + printf("Report bugs to <https://bugs.documentfoundation.org/>.\n"); return -1; } diff --git a/src/conv/text/cmx2text.cpp b/src/conv/text/cmx2text.cpp index fc7f45a..b734855 100644 --- a/src/conv/text/cmx2text.cpp +++ b/src/conv/text/cmx2text.cpp @@ -19,10 +19,14 @@ namespace int printUsage() { - printf("Usage: cmx2text [OPTION] <Corel Binary Metafile>\n"); + printf("`cmx2text' converts Corel Binary Metafiles to plain text.\n"); + printf("\n"); + printf("Usage: cmx2text [OPTION] FILE\n"); printf("\n"); printf("Options:\n"); - printf("--help Shows this help message\n"); + printf("\t--help show this help message\n"); + printf("\n"); + printf("Report bugs to <https://bugs.documentfoundation.org/>.\n"); return -1; } commit f56526a10105b06a03379ba28249cd1192e194c6 Author: David Tardon <dtar...@redhat.com> Date: Fri Dec 25 17:00:17 2015 +0100 avoid out-of-bounds access Change-Id: Idbf93398707eac0ed5b861366f3713c5af2957f9 diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp index 8a3894c..f841b5e 100644 --- a/src/lib/CDRContentCollector.cpp +++ b/src/lib/CDRContentCollector.cpp @@ -459,6 +459,8 @@ void libcdr::CDRContentCollector::_flushCurrentPath() for (unsigned i = 0; i < m_currentText->size(); ++i) { const std::vector<CDRText> ¤tLine = (*m_currentText)[i].m_line; + if (currentLine.empty()) + continue; librevenge::RVNGPropertyList paraProps; bool rtl = false; switch (currentLine[0].m_charStyle.m_align) commit ab3ca672deeb0308d09faba93d1af2bdf66a3ae8 Author: David Tardon <dtar...@redhat.com> Date: Fri Dec 25 16:59:31 2015 +0100 shorten the expressions a bit Change-Id: I2da1425b07333a58be1b5dd75d1cae295a943911 diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp index 3af5c0a..8a3894c 100644 --- a/src/lib/CDRContentCollector.cpp +++ b/src/lib/CDRContentCollector.cpp @@ -458,9 +458,10 @@ void libcdr::CDRContentCollector::_flushCurrentPath() outputElement.addStartTextObject(textFrameProps); for (unsigned i = 0; i < m_currentText->size(); ++i) { + const std::vector<CDRText> ¤tLine = (*m_currentText)[i].m_line; librevenge::RVNGPropertyList paraProps; bool rtl = false; - switch ((*m_currentText)[i].m_line[0].m_charStyle.m_align) + switch (currentLine[0].m_charStyle.m_align) { case 1: // Left if (!rtl) @@ -488,19 +489,19 @@ void libcdr::CDRContentCollector::_flushCurrentPath() break; } outputElement.addOpenParagraph(paraProps); - for (unsigned j = 0; j < (*m_currentText)[i].m_line.size(); ++j) + for (unsigned j = 0; j < currentLine.size(); ++j) { - if (!(*m_currentText)[i].m_line[j].m_text.empty()) + if (!currentLine[j].m_text.empty()) { librevenge::RVNGPropertyList spanProps; - double fontSize = (double)cdr_round(144.0*(*m_currentText)[i].m_line[j].m_charStyle.m_fontSize) / 2.0; + double fontSize = (double)cdr_round(144.0*currentLine[j].m_charStyle.m_fontSize) / 2.0; spanProps.insert("fo:font-size", fontSize, librevenge::RVNG_POINT); - if ((*m_currentText)[i].m_line[j].m_charStyle.m_fontName.len()) - spanProps.insert("style:font-name", (*m_currentText)[i].m_line[j].m_charStyle.m_fontName); - if ((*m_currentText)[i].m_line[j].m_charStyle.m_fillStyle.fillType != (unsigned short)-1) - spanProps.insert("fo:color", m_ps.getRGBColorString((*m_currentText)[i].m_line[j].m_charStyle.m_fillStyle.color1)); + if (currentLine[j].m_charStyle.m_fontName.len()) + spanProps.insert("style:font-name", currentLine[j].m_charStyle.m_fontName); + if (currentLine[j].m_charStyle.m_fillStyle.fillType != (unsigned short)-1) + spanProps.insert("fo:color", m_ps.getRGBColorString(currentLine[j].m_charStyle.m_fillStyle.color1)); outputElement.addOpenSpan(spanProps); - outputElement.addInsertText((*m_currentText)[i].m_line[j].m_text); + outputElement.addInsertText(currentLine[j].m_text); outputElement.addCloseSpan(); } } commit bb36ded402e8de6770042ba1dfe18da1d8430530 Author: David Tardon <dtar...@redhat.com> Date: Fri Dec 25 16:57:46 2015 +0100 drop obsolete code Change-Id: I16d4a9b63fbc9bcef4a60b8ab880e5c72ff1127a diff --git a/src/lib/CDRContentCollector.cpp b/src/lib/CDRContentCollector.cpp index 15abc1f..3af5c0a 100644 --- a/src/lib/CDRContentCollector.cpp +++ b/src/lib/CDRContentCollector.cpp @@ -487,9 +487,6 @@ void libcdr::CDRContentCollector::_flushCurrentPath() default: break; } -// paraProps.insert("fo:text-indent", (*m_currentText)[i].m_charStyle.m_firstIndent); -// paraProps.insert("fo:margin-left", (*m_currentText)[i].m_charStyle.m_leftIndent); -// paraProps.insert("fo:margin-right", (*m_currentText)[i].m_charStyle.m_rightIndent); outputElement.addOpenParagraph(paraProps); for (unsigned j = 0; j < (*m_currentText)[i].m_line.size(); ++j) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits