[Libreoffice-commits] core.git: 3 commits - include/oox oox/source sw/qa
Miklos Vajna
vmiklos at collabora.co.uk
Fri Sep 6 09:39:44 PDT 2013
include/oox/vml/vmltextbox.hxx | 1 +
oox/source/vml/vmlshape.cxx | 9 +++++++++
oox/source/vml/vmltextbox.cxx | 10 ++++++++++
oox/source/vml/vmltextboxcontext.cxx | 15 +++++++++++++++
sw/qa/extras/ooxmlimport/data/groupshape-sdt.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 16 ++++++++++++++++
6 files changed, 51 insertions(+)
New commits:
commit 4cbc41bc4eaa822829e68c1ee11eafe834bb7da7
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Sep 6 15:57:03 2013 +0200
bnc#779642 VML import: handle drawinglayer rectangle char spacing
Change-Id: I79fa72c9235682030d23a03fdb0c7c40370c4a8a
diff --git a/include/oox/vml/vmltextbox.hxx b/include/oox/vml/vmltextbox.hxx
index fc97dc7..d31bb3b 100644
--- a/include/oox/vml/vmltextbox.hxx
+++ b/include/oox/vml/vmltextbox.hxx
@@ -54,6 +54,7 @@ struct OOX_DLLPUBLIC TextFontModel
OptValue< bool > mobBold;
OptValue< bool > mobItalic;
OptValue< bool > mobStrikeout;
+ OptValue<sal_Int32> monSpacing;
explicit TextFontModel();
};
diff --git a/oox/source/vml/vmltextbox.cxx b/oox/source/vml/vmltextbox.cxx
index 553b6f0..fbd8217 100644
--- a/oox/source/vml/vmltextbox.cxx
+++ b/oox/source/vml/vmltextbox.cxx
@@ -20,6 +20,7 @@
#include "oox/vml/vmltextbox.hxx"
#include <rtl/ustrbuf.hxx>
+#include <svx/unopage.hxx>
#include <com/sun/star/awt/FontWeight.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
@@ -92,6 +93,15 @@ void TextBox::convert(uno::Reference<drawing::XShape> xShape) const
aPropertyValue.Value = uno::makeAny(double(rFont.monSize.get()) / 2.);
aPropVec.push_back(aPropertyValue);
}
+ if (rFont.monSpacing.has())
+ {
+ aPropertyValue.Name = "CharKerning";
+ // Value is not converted to mm100: SvxKerningItem::PutValue() gets
+ // called with nMemberId = 0, so no mm100 -> twips conversion will
+ // be done there.
+ aPropertyValue.Value = uno::makeAny(sal_Int16(rFont.monSpacing.get()));
+ aPropVec.push_back(aPropertyValue);
+ }
if (rParagraph.moParaAdjust.has())
{
style::ParagraphAdjust eAdjust = style::ParagraphAdjust_LEFT;
diff --git a/oox/source/vml/vmltextboxcontext.cxx b/oox/source/vml/vmltextboxcontext.cxx
index 2720450..5c7e2f7 100644
--- a/oox/source/vml/vmltextboxcontext.cxx
+++ b/oox/source/vml/vmltextboxcontext.cxx
@@ -132,6 +132,16 @@ void TextPortionContext::onStartElement(const AttributeList& rAttribs)
case OOX_TOKEN(doc, color):
maFont.moColor = rAttribs.getString( OOX_TOKEN(doc, val) );
break;
+ case OOX_TOKEN(doc, spacing):
+ maFont.monSpacing = rAttribs.getInteger(OOX_TOKEN(doc, val));
+ break;
+ case OOX_TOKEN(doc, r):
+ case OOX_TOKEN(doc, rPr):
+ case OOX_TOKEN(doc, t):
+ break;
+ default:
+ SAL_INFO("oox", "unhandled: 0x" << std::hex<< getCurrentElement());
+ break;
}
}
diff --git a/sw/qa/extras/ooxmlimport/data/groupshape-sdt.docx b/sw/qa/extras/ooxmlimport/data/groupshape-sdt.docx
new file mode 100755
index 0000000..0729847
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/groupshape-sdt.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 08b2bfc..b933e85 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -132,6 +132,7 @@ public:
void testTablePagebreak();
void testFdo68607();
void testVmlTextVerticalAdjust();
+ void testGroupshapeSdt();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -230,6 +231,7 @@ void Test::run()
{"table-pagebreak.docx", &Test::testTablePagebreak},
{"fdo68607.docx", &Test::testFdo68607},
{"vml-text-vertical-adjust.docx", &Test::testVmlTextVerticalAdjust},
+ {"groupshape-sdt.docx", &Test::testGroupshapeSdt},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1551,6 +1553,20 @@ void Test::testVmlTextVerticalAdjust()
CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_TOP, getProperty<drawing::TextVerticalAdjust>(xShape, "TextVerticalAdjust"));
}
+void Test::testGroupshapeSdt()
+{
+ // All problems here are due to the groupshape: we have a drawinglayer rectangle, not a writer textframe.
+ uno::Reference<drawing::XShapes> xOuterGroupShape(getShape(1), uno::UNO_QUERY);
+ uno::Reference<drawing::XShapes> xInnerGroupShape(xOuterGroupShape->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xShape(xInnerGroupShape->getByIndex(0), uno::UNO_QUERY);
+ // Border distances were not implemented, this was 0.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1905), getProperty<sal_Int32>(xShape, "TextUpperDistance"));
+ // Sdt field result wasn't imported, this was "".
+ CPPUNIT_ASSERT_EQUAL(OUString("placeholder text"), xShape->getString());
+ // w:spacing was ignored in oox, this was 0.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(20), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xShape->getText()), 1), "CharKerning"));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
commit 870a2394a87c77740daf41e1aa81b130113f8e00
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Sep 6 12:29:46 2013 +0200
bnc#779642 VML import: handle drawinglayer rectangle inset
Change-Id: If8b064ca9a52bb02ff41f07e00142702a29df818
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 186bd50..26cc704 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -594,7 +594,16 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes
PropertySet(xShape).setAnyProperty(PROP_TextVerticalAdjust, makeAny(eTextVerticalAdjust));
if (getTextBox())
+ {
getTextBox()->convert(xShape);
+ if (getTextBox()->borderDistanceSet)
+ {
+ PropertySet(xShape).setAnyProperty(PROP_TextLeftDistance, makeAny(sal_Int32(getTextBox()->borderDistanceLeft)));
+ PropertySet(xShape).setAnyProperty(PROP_TextUpperDistance, makeAny(sal_Int32(getTextBox()->borderDistanceTop)));
+ PropertySet(xShape).setAnyProperty(PROP_TextRightDistance, makeAny(sal_Int32(getTextBox()->borderDistanceRight)));
+ PropertySet(xShape).setAnyProperty(PROP_TextLowerDistance, makeAny(sal_Int32(getTextBox()->borderDistanceBottom)));
+ }
+ }
}
// Import Legacy Fragments (if any)
commit 3847de4b724f4f435bb68bceef9a5e187c3f363c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Sep 6 12:09:45 2013 +0200
bnc#779642 VML import: import result of sdt fields
We can't have e.g. placeholder fields on drawinglayer rectangles, but at
least the result of the field is now imported.
Change-Id: I135f205c4231645f11f824495993c4dbea4135ed
diff --git a/oox/source/vml/vmltextboxcontext.cxx b/oox/source/vml/vmltextboxcontext.cxx
index fbb701f..2720450 100644
--- a/oox/source/vml/vmltextboxcontext.cxx
+++ b/oox/source/vml/vmltextboxcontext.cxx
@@ -226,14 +226,19 @@ ContextHandlerRef TextBoxContext::onCreateContext( sal_Int32 nElement, const Att
if (nElement == OOX_TOKEN(doc, p)) return this;
break;
case OOX_TOKEN(doc, p):
+ case OOX_TOKEN(doc, sdtContent):
if (nElement == OOX_TOKEN(doc, r))
return new TextPortionContext( *this, mrTextBox, maParagraph, TextFontModel(), nElement, rAttribs );
else
return this;
break;
case OOX_TOKEN(doc, pPr):
+ case OOX_TOKEN(doc, sdt):
return this;
break;
+ default:
+ SAL_INFO("oox", "unhandled 0x" << std::hex << getCurrentElement());
+ break;
}
return 0;
}
More information about the Libreoffice-commits
mailing list