[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Nov 4 07:39:16 PST 2014


 sw/qa/extras/inc/swmodeltestbase.hxx      |    3 +++
 sw/qa/extras/ww8export/data/bnc636128.doc |binary
 sw/qa/extras/ww8export/ww8export.cxx      |   12 ++++++++++--
 sw/source/filter/ww8/wrtww8.cxx           |   10 ++++++++++
 sw/source/filter/ww8/ww8par.hxx           |    4 +++-
 sw/source/filter/ww8/ww8par3.cxx          |    5 +++--
 6 files changed, 29 insertions(+), 5 deletions(-)

New commits:
commit 2ad1f195b875f2c1052c8ffab79602b9f6871ccb
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 4 15:36:02 2014 +0100

    bnc#636128 DOC export: handle FFData.cch
    
    Change-Id: Ia1a3a4ef5e61d8ed2a3bde689f3d2101525efc46

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 e973029..c1e6ca6 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -16,6 +16,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
 {
@@ -378,6 +379,15 @@ DECLARE_WW8EXPORT_TEST(testCellBgColor, "cell-bg-color.odt")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xCC0000), getProperty<sal_Int32>(xTable->getCellByName("A1"), "BackColor"));
 }
 
+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 58718c2..97629ae 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3783,6 +3783,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 dfa26e6d489a2c5bd79652450a9f27343008d37f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 4 12:37:45 2014 +0100

    bnc#636128 DOC import: handle FFData.cch
    
    Change-Id: I8020ce561a72f10b8f0f517d50407a802049bd48

diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 6e0349b..953ee5e 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -662,7 +662,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;
@@ -678,6 +678,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 046e146..5e3bbe9 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -165,6 +165,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;
     }
@@ -2144,8 +2146,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 );
commit 6bd4e60930925e1738b71536cbf3363a15000a63
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 4 16:23:50 2014 +0100

    CppunitTest_sw_ww8export: allow invoking a single test only
    
    Change-Id: I601d8473fbe7f989a2380cbd773a6b09c0563ddc

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index d2e2647..53b9f07 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -93,6 +93,7 @@ using namespace css;
 #define DECLARE_RTFIMPORT_TEST(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test)
 #define DECLARE_RTFEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
 #define DECLARE_ODFIMPORT_TEST(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test)
+#define DECLARE_WW8EXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
 
 // For testing during development of a test, you want to use
 // DECLARE_OOXMLEXPORT_TEST_ONLY, and change the above to #if 0
@@ -103,6 +104,7 @@ using namespace css;
 #define DECLARE_RTFIMPORT_TEST_ONLY(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test)
 #define DECLARE_RTFEXPORT_TEST_ONLY(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
 #define DECLARE_ODFIMPORT_TEST_ONLY(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test)
+#define DECLARE_WW8EXPORT_TEST_ONLY(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
 
 #undef DECLARE_OOXMLEXPORT_TEST
 #define DECLARE_OOXMLIMPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled()
@@ -110,6 +112,7 @@ using namespace css;
 #define DECLARE_RTFIMPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled()
 #define DECLARE_RTFEXPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled()
 #define DECLARE_ODFIMPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled()
+#define DECLARE_WW8EXPORT_TEST(TestName, filename) class disabled##TestName : public Test { void disabled(); }; void disabled##TestName::disabled()
 #endif
 
 #define DECLARE_SW_IMPORT_TEST(TestName, filename, BaseClass) \
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 87da930..e973029 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -29,8 +29,6 @@ public:
     }
 };
 
-#define DECLARE_WW8EXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
-
 DECLARE_WW8EXPORT_TEST(testN325936, "n325936.doc")
 {
     /*


More information about the Libreoffice-commits mailing list