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 | 4 +++- 5 files changed, 26 insertions(+), 2 deletions(-)
New commits: commit 282bd32aac90f81520a4dd5cbb13053f6dbf6ed7 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Nov 4 15:36:02 2014 +0100 bnc#636128 DOC export: handle FFData.cch Change-Id: Ia1a3a4ef5e61d8ed2a3bde689f3d2101525efc46 (cherry picked from commit 2ad1f195b875f2c1052c8ffab79602b9f6871ccb) 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 8a611e6..b4037ed 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -17,6 +17,7 @@ #include <com/sun/star/view/XViewSettingsSupplier.hpp> #include <com/sun/star/table/ShadowFormat.hpp> #include <com/sun/star/text/GraphicCrop.hpp> +#include <com/sun/star/text/XFormField.hpp> class Test : public SwModelTestBase { @@ -215,6 +216,15 @@ DECLARE_WW8EXPORT_TEST(testFdo59530, "fdo59530.doc") #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 7530668..ec558c9 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3663,6 +3663,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) commit 3a40e9d4b2338e8650c921ff4c8c2bb9e7cba33b Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Nov 4 12:37:45 2014 +0100 bnc#636128 DOC import: handle FFData.cch (cherry picked from commit dfa26e6d489a2c5bd79652450a9f27343008d37f) Conflicts: sw/source/filter/ww8/ww8par3.cxx Change-Id: I8020ce561a72f10b8f0f517d50407a802049bd48 diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index 696d103..a9cca62 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -625,7 +625,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; @@ -642,6 +642,8 @@ public: sal_uInt16 nChecked; sal_uInt16 nDefaultChecked; + /// 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 25da902..22e305e 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -167,6 +167,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; } @@ -2199,7 +2201,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, sal_uInt8 iRes = (bits1 & 0x7C) >> 2; sal_uInt16 cch = 0; - *pDataStream >> cch; + *pDataStream >> mnMaxLen; sal_uInt16 hps = 0; *pDataStream >> hps; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits