Hi,
i've found out how Drop-Caps are encoded in .pub format.
Attached is a patch that adds first support for that to
libmspub.
Greetings,
Franz Schmid
From 9d6264a47a60750ecbec1b5ba7c66bb038ea9745 Mon Sep 17 00:00:00 2001
From: Franz Schmid <franz@linux-hp-i7.site>
Date: Thu, 25 Apr 2013 23:09:47 +0200
Subject: [PATCH] Added Drop Caps to the Paragraph Styles.
---
src/lib/MSPUBBlockID.h | 1 +
src/lib/MSPUBCollector.cpp | 6 ++++++
src/lib/MSPUBParser.cpp | 3 +++
src/lib/MSPUBTypes.h | 3 ++-
4 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/src/lib/MSPUBBlockID.h b/src/lib/MSPUBBlockID.h
index 5a42d72..a44c5a8 100644
--- a/src/lib/MSPUBBlockID.h
+++ b/src/lib/MSPUBBlockID.h
@@ -68,6 +68,7 @@ enum MSPUBBlockID // Don't be alarmed by multiple elements with the same value;
PARAGRAPH_FIRST_LINE_INDENT = 0xC,
PARAGRAPH_LEFT_INDENT = 0xD,
PARAGRAPH_RIGHT_INDENT = 0xE,
+ PARAGRAPH_DROP_CAP_LINES = 0x8,
THIS_MASTER_NAME = 0xE,
APPLIED_MASTER_NAME = 0xD,
BA_ARRAY = 0x02,
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index a8d55ca..f16ae79 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -1193,6 +1193,12 @@ WPXPropertyList libmspub::MSPUBCollector::getParaStyleProps(const
ParagraphStyle
{
ret.insert("fo:margin-right", (double)rightIndentEmu / EMUS_IN_INCH);
}
+ unsigned dropCapLines = style.m_dropCapLines.get_value_or(
+ defaultStyle.m_dropCapLines.get_value_or(0));
+ if (dropCapLines != 0)
+ {
+ ret.insert("style:drop-cap", (int)dropCapLines);
+ }
return ret;
}
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 9851ec6..418ea1b 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -1260,6 +1260,9 @@ libmspub::ParagraphStyle
libmspub::MSPUBParser::getParagraphStyle(WPXInputStream
case PARAGRAPH_LIST_NUMBER_RESTART:
numberIfRestarted = info.data;
break;
+ case PARAGRAPH_DROP_CAP_LINES:
+ ret.m_dropCapLines = info.data;
+ break;
default:
break;
}
diff --git a/src/lib/MSPUBTypes.h b/src/lib/MSPUBTypes.h
index 7884725..946f9c4 100644
--- a/src/lib/MSPUBTypes.h
+++ b/src/lib/MSPUBTypes.h
@@ -158,10 +158,11 @@ struct ParagraphStyle
boost::optional<unsigned> m_rightIndentEmu;
boost::optional<ListInfo> m_listInfo;
std::vector<unsigned> m_tabStopsInEmu;
+ boost::optional<unsigned> m_dropCapLines;
ParagraphStyle() :
m_align(), m_defaultCharStyleIndex(), m_lineSpacing(), m_spaceBeforeEmu(),
m_spaceAfterEmu(), m_firstLineIndentEmu(), m_leftIndentEmu(),
- m_rightIndentEmu(), m_listInfo(), m_tabStopsInEmu()
+ m_rightIndentEmu(), m_listInfo(), m_tabStopsInEmu(), m_dropCapLines()
{
}
};
--
1.7.1
Context
- Patch for libmspub · Franz Schmid
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.