[Libreoffice-commits] core.git: 3 commits - solenv/bin solenv/gdb solenv/Package_gdb.mk sw/qa writerfilter/source
Cédric Bosdonnat
cedric.bosdonnat at free.fr
Tue May 28 05:53:59 PDT 2013
solenv/Package_gdb.mk | 2
solenv/bin/install-gdb-printers | 4
solenv/gdb/boost/smart_ptr.py | 9 +
solenv/gdb/libreoffice/writerfilter.py | 88 +++++++++++++++
sw/qa/extras/ooxmlimport/data/table_width.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 4
writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 20 ++-
7 files changed, 121 insertions(+), 6 deletions(-)
New commits:
commit daa2ac6e76a4c30a4e2b9a9d0f9d7e351fcb5b5f
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date: Mon May 27 20:01:37 2013 +0200
Added pretty printers for writerfilter OOXML tokenizer
Change-Id: I0fa2cb8d24cd6862ab1d88ad8ccc033c70bbfa44
diff --git a/solenv/Package_gdb.mk b/solenv/Package_gdb.mk
index b38233d..aced144 100644
--- a/solenv/Package_gdb.mk
+++ b/solenv/Package_gdb.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_Package_add_files,solenv_gdb,lib,\
$(call gb_Library_get_runtime_filename,cppu).3-gdb.py \
$(call gb_Library_get_runtime_filename,sal).3-gdb.py \
$(call gb_Library_get_runtime_filename,sw)-gdb.py \
+ $(call gb_Library_get_runtime_filename,writerfilter)-gdb.py \
) \
$(call gb_Library_get_runtime_filename,merged)-gdb.py, \
$(call gb_Library_get_runtime_filename,cppu).3-gdb.py \
@@ -23,6 +24,7 @@ $(eval $(call gb_Package_add_files,solenv_gdb,lib,\
$(call gb_Library_get_runtime_filename,svl)-gdb.py \
$(call gb_Library_get_runtime_filename,sw)-gdb.py \
$(call gb_Library_get_runtime_filename,tl)-gdb.py) \
+ $(call gb_Library_get_runtime_filename,writerfilter)-gdb.py \
))
$(eval $(call gb_Package_use_custom_target,solenv_gdb,solenv/gdb))
diff --git a/solenv/bin/install-gdb-printers b/solenv/bin/install-gdb-printers
index 6201e0c..4125fe5 100755
--- a/solenv/bin/install-gdb-printers
+++ b/solenv/bin/install-gdb-printers
@@ -157,7 +157,7 @@ if [[ ${DESTDIR}${pythondir} != ${GDBDIR} ]]; then
fi
if [[ -n "${MERGELIBS}" ]]; then
- make_autoload merged program libmergedlo."$DYLIB" merge svl tl basegfx `[[ ${MERGELIBS} == "ALL" ]] && echo sw`
+ make_autoload merged program libmergedlo."$DYLIB" merge svl tl basegfx writerfilter `[[ ${MERGELIBS} == "ALL" ]] && echo sw`
if [[ ${MERGELIBS} == "ALL" ]]; then
make_autoload urelibs ure-link/lib liburelibs."$DYLIB" merge cppu sal
else
@@ -165,6 +165,7 @@ if [[ -n "${MERGELIBS}" ]]; then
make_autoload sal ure-link/lib libuno_sal."$DYLIB".3
make_autoload sw program libswlo."$DYLIB"
make_autoload basegfx program libbasegfxlo."$DYLIB"
+ make_autoload writerfilter program libwriterfilterlo."$DYLIB"
fi
else
make_autoload cppu ure-link/lib libuno_cppu."$DYLIB".3
@@ -173,6 +174,7 @@ else
make_autoload tl program libtllo."$DYLIB"
make_autoload sw program libswlo."$DYLIB"
make_autoload basegfx program libbasegfxlo."$DYLIB"
+ make_autoload writerfilter program libwriterfilterlo."$DYLIB"
fi
# vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/solenv/gdb/libreoffice/writerfilter.py b/solenv/gdb/libreoffice/writerfilter.py
new file mode 100644
index 0000000..5b65321
--- /dev/null
+++ b/solenv/gdb/libreoffice/writerfilter.py
@@ -0,0 +1,88 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+from libreoffice.util import printing
+
+class OOXMLPropertySetPrinter(object):
+ '''Prints writerfilter::ooxml::OOXMLPropertySetImpl'''
+
+ def __init__(self, typename, value):
+ self.typename = typename
+ self.value = value
+
+ def to_string(self):
+ return "%s" % (self.typename)
+
+ def children(self):
+ children = [ ( 'properties', self.value['mProperties'] ) ]
+ return children.__iter__()
+
+class OOXMLPropertyPrinter(object):
+ '''Prints writerfilter::ooxml::OOXMLPropertyImpl'''
+
+ def __init__(self, typename, value):
+ self.typename = typename
+ self.value = value
+
+ def to_string(self):
+ return "%s" % (self.typename)
+
+ def children(self):
+ children = [ ( 'id', self.value['mId'] ),
+ ( 'type', self.value['meType'] ),
+ ( 'value', self.value['mpValue'] ) ]
+ return children.__iter__()
+
+class OOXMLPropertySetValuePrinter(object):
+ '''Prints writerfilter::ooxml::OOXMLPropertySetValue'''
+
+ def __init__(self, typename, value):
+ self.typename = typename
+ self.value = value
+
+ def to_string(self):
+ return "%s" % (self.typename)
+
+class OOXMLStringValuePrinter(object):
+ '''Prints writerfilter::ooxml::OOXMLStringValue'''
+
+ def __init__(self, typename, value):
+ self.value = value
+
+ def to_string(self):
+ return "%s" % (self.value['mStr'])
+
+class OOXMLIntegerValuePrinter(object):
+ '''Prints writerfilter::ooxml::OOXMLIntegerValue'''
+
+ def __init__(self, typename, value):
+ self.value = value
+
+ def to_string(self):
+ return "%d" % (self.value['mnValue'])
+
+printer = None
+
+def build_pretty_printers():
+ global printer
+
+ printer = printing.Printer("libreoffice/writerfilter")
+ printer.add('writerfilter::ooxml::OOXMLPropertyImpl', OOXMLPropertyPrinter)
+ printer.add('writerfilter::ooxml::OOXMLPropertySetImpl', OOXMLPropertySetPrinter)
+ printer.add('writerfilter::ooxml::OOXMLPropertySetValue', OOXMLPropertySetValuePrinter)
+ printer.add('writerfilter::ooxml::OOXMLStringValue', OOXMLStringValuePrinter)
+ printer.add('writerfilter::ooxml::OOXMLIntegerValue', OOXMLIntegerValuePrinter)
+ printer.add('writerfilter::ooxml::OOXMLHexValue', OOXMLIntegerValuePrinter)
+
+def register_pretty_printers(obj):
+ printing.register_pretty_printer(printer, obj)
+
+build_pretty_printers()
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab:
commit 1848540022f2f50436ec505eb82efa99bb14a5b3
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date: Mon May 27 19:53:01 2013 +0200
SmartPtr pretty printer now behaves according to set print object value
Change-Id: Ie8a092b7d91e0f379c7102c3aa12da8eb7666840
diff --git a/solenv/gdb/boost/smart_ptr.py b/solenv/gdb/boost/smart_ptr.py
index fdf5818..6646e12 100644
--- a/solenv/gdb/boost/smart_ptr.py
+++ b/solenv/gdb/boost/smart_ptr.py
@@ -32,9 +32,14 @@ class SmartPtrPrinter:
def to_string(self):
if self.value['px']:
- return "%s %s" % (self.typename, self.value['px'].dereference())
+ print_object = gdb.parameter('print object')
+ value = self.value['px'].dereference()
+ if print_object:
+ dynamic_type = self.value['px'].dynamic_type
+ value = self.value['px'].cast(dynamic_type).dereference()
+ return "%s %s" % (self.typename, value)
else:
- return "empty %s" % (self.typename,)
+ return "empty %s" % (self.typename)
printer = None
commit 9f4c8a8bca06b4c2a916a51909367b453fc41a8b
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date: Wed May 22 11:34:01 2013 +0200
n#816593: Floating table width import fix: adjust the frame width
Change-Id: I8212bc5981418f6cbd514bf5002e6a5dbdf53152
diff --git a/sw/qa/extras/ooxmlimport/data/table_width.docx b/sw/qa/extras/ooxmlimport/data/table_width.docx
index 26deb6d..02b77c9 100644
Binary files a/sw/qa/extras/ooxmlimport/data/table_width.docx and b/sw/qa/extras/ooxmlimport/data/table_width.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index adbe872..3a765b7 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1311,6 +1311,10 @@ void Test::testTableWidth()
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
// Relative width wasn't recognized during import.
CPPUNIT_ASSERT_EQUAL(true, bool(getProperty<sal_Bool>(xTables->getByIndex(0), "IsWidthRelative")));
+
+ uno::Reference<text::XTextFramesSupplier> xFramesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xFrames(xFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(xFrames->getByIndex(0), "FrameWidthPercent"));
}
void Test::testConditionalstylesTbllook()
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 495165b..7586396 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -828,9 +828,23 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel)
if (xTable.is() && xStart.is() && xEnd.is())
{
uno::Reference<beans::XPropertySet> xTableProperties(xTable, uno::UNO_QUERY);
- aFrameProperties.realloc(aFrameProperties.getLength() + 1);
- aFrameProperties[aFrameProperties.getLength() - 1].Name = "Width";
- aFrameProperties[aFrameProperties.getLength() - 1].Value = xTableProperties->getPropertyValue("Width");
+ sal_Bool bIsRelative = sal_False;
+ xTableProperties->getPropertyValue("IsWidthRelative") >>= bIsRelative;
+ if (!bIsRelative)
+ {
+ aFrameProperties.realloc(aFrameProperties.getLength() + 1);
+ aFrameProperties[aFrameProperties.getLength() - 1].Name = "Width";
+ aFrameProperties[aFrameProperties.getLength() - 1].Value = xTableProperties->getPropertyValue("Width");
+ }
+ else
+ {
+ aFrameProperties.realloc(aFrameProperties.getLength() + 1);
+ aFrameProperties[aFrameProperties.getLength() - 1].Name = "FrameWidthPercent";
+ aFrameProperties[aFrameProperties.getLength() - 1].Value = xTableProperties->getPropertyValue("RelativeWidth");
+
+ // Applying the relative width to the frame, needs to have the table width to be 100% of the frame width
+ xTableProperties->setPropertyValue("RelativeWidth", uno::makeAny(sal_Int16(100)));
+ }
// A non-zero left margin would move the table out of the frame, move the frame itself instead.
xTableProperties->setPropertyValue("LeftMargin", uno::makeAny(sal_Int32(0)));
More information about the Libreoffice-commits
mailing list