diff options
-rw-r--r-- | sw/qa/extras/ww8export/data/bnc636128.doc | bin | 0 -> 26112 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.hxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 5 |
5 files changed, 26 insertions, 3 deletions
diff --git a/sw/qa/extras/ww8export/data/bnc636128.doc b/sw/qa/extras/ww8export/data/bnc636128.doc Binary files differnew file mode 100644 index 000000000000..5f92c3e2ecd1 --- /dev/null +++ b/sw/qa/extras/ww8export/data/bnc636128.doc diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 585755969bf4..3a9cf7cac62f 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 f52a273aacb3..5917aa601a1d 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 cbacc1f0d02a..a50724d084e9 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 b547cd080366..5e10c8d029b6 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 ); |