sw/qa/extras/ww8export/data/bnc636128.doc |binary sw/qa/extras/ww8export/ww8export.cxx | 10 ++++++++++ sw/source/filter/ww8/wrtww8.cxx | 10 ++++++++++ sw/source/filter/ww8/ww8par.hxx | 4 +++- sw/source/filter/ww8/ww8par3.cxx | 5 +++-- 5 files changed, 26 insertions(+), 3 deletions(-)
New commits: commit 82c01116a7df315b78bfd3af6ccd936572b45d78 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Nov 4 12:37:45 2014 +0100 bnc#636128 DOC filter: fix handling of FFData.cch (cherry picked from commit dfa26e6d489a2c5bd79652450a9f27343008d37f) (cherry picked from commit 2ad1f195b875f2c1052c8ffab79602b9f6871ccb) Change-Id: Ia1a3a4ef5e61d8ed2a3bde689f3d2101525efc46 Reviewed-on: https://gerrit.libreoffice.org/12257 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/qa/extras/ww8export/data/bnc636128.doc b/sw/qa/extras/ww8export/data/bnc636128.doc new file mode 100644 index 0000000..5f92c3e Binary files /dev/null and b/sw/qa/extras/ww8export/data/bnc636128.doc differ diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 5857559..3a9cf7c 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -18,6 +18,7 @@ #include <com/sun/star/table/ShadowFormat.hpp> #include <com/sun/star/table/TableBorder2.hpp> #include <com/sun/star/text/GraphicCrop.hpp> +#include <com/sun/star/text/XFormField.hpp> class Test : public SwModelTestBase { @@ -347,6 +348,15 @@ DECLARE_WW8EXPORT_TEST(testBorderColoursExport, "bordercolours.odt") } #endif +DECLARE_WW8EXPORT_TEST(testBnc636128, "bnc636128.doc") +{ + // Import / export of FFData.cch was missing. + uno::Reference<text::XFormField> xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(1), 2), "Bookmark"); + uno::Reference<container::XNameContainer> xParameters = xFormField->getParameters(); + // This resulted in a container.NoSuchElementException. + CPPUNIT_ASSERT_EQUAL(OUString("5"), xParameters->getByName("MaxLength").get<OUString>()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index f52a273..5917aa6 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3782,6 +3782,16 @@ void WW8Export::WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ) ffres = 0; } aFldHeader.bits |= ( (ffres<<2) & 0x7C ); + if (type == 0) // iTypeText + { + sw::mark::IFieldmark::parameter_map_t::const_iterator pParameter = rFieldmark.GetParameters()->find("MaxLength"); + if (pParameter != rFieldmark.GetParameters()->end()) + { + OUString aLength; + pParameter->second >>= aLength; + aFldHeader.cch = aLength.toUInt32(); + } + } std::vector< OUString > aListItems; if (type==2) diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index cbacc1f..a50724d0 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -617,7 +617,7 @@ public: WW8FormulaControl(const OUString& rN, SwWW8ImplReader &rR) : rRdr(rR), fUnknown(0), fDropdownIndex(0), fToolTip(0), fNoMark(0), fUseSize(0), fNumbersOnly(0), fDateOnly(0), - fUnused(0), nSize(0), hpsCheckBox(20), nChecked(0), sName( rN ) + fUnused(0), nSize(0), hpsCheckBox(20), nChecked(0), mnMaxLen(0), sName( rN ) { } sal_uInt8 fUnknown:2; @@ -633,6 +633,8 @@ public: sal_uInt16 hpsCheckBox; sal_uInt16 nChecked; + /// FFData.cch in the spec: maximum length, in characters, of the value of the textbox. + sal_uInt16 mnMaxLen; OUString sTitle; OUString sDefault; OUString sFormatting; diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index b547cd0..5e10c8d0 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -164,6 +164,8 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* pF, OUString& rStr ) maFieldStack.back().SetBookmarkType(ODF_FORMTEXT); maFieldStack.back().getParameters()["Description"] = uno::makeAny(OUString(aFormula.sToolTip)); maFieldStack.back().getParameters()["Name"] = uno::makeAny(OUString(aFormula.sTitle)); + if (aFormula.mnMaxLen) + maFieldStack.back().getParameters()["MaxLength"] = uno::makeAny(OUString::number(aFormula.mnMaxLen)); } return FLD_TEXT; } @@ -2173,8 +2175,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, sal_uInt8 iRes = (bits1 & 0x7C) >> 2; - sal_uInt16 cch = 0; - pDataStream->ReadUInt16( cch ); + pDataStream->ReadUInt16( mnMaxLen ); sal_uInt16 hps = 0; pDataStream->ReadUInt16( hps );
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits