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

Tamás Zolnai tamas.zolnai at collabora.com
Sat Aug 26 16:35:03 UTC 2017


 include/oox/ole/axcontrol.hxx                                  |    1 
 oox/source/ole/axcontrol.cxx                                   |   11 +++++-
 oox/source/token/properties.txt                                |    1 
 sw/qa/extras/ooxmlexport/data/activex_option_button_group.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx                      |   17 ++++++++++
 5 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit e463c96092e108a8fad3b9a91b693457f3c26545
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Sat Aug 26 16:10:51 2017 +0200

    tdf#111980: DOCX: Handle ActiveX radio button group
    
    Change-Id: I3372b3b69623bda5c6e8587215e8fb7056fdf0a7
    Reviewed-on: https://gerrit.libreoffice.org/41586
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/include/oox/ole/axcontrol.hxx b/include/oox/ole/axcontrol.hxx
index 6da2e8039ffc..a932a7bcfcd2 100644
--- a/include/oox/ole/axcontrol.hxx
+++ b/include/oox/ole/axcontrol.hxx
@@ -616,6 +616,7 @@ public:
     virtual bool        importBinaryModel( BinaryInputStream& rInStrm ) override;
     virtual void        exportBinaryModel( BinaryOutputStream& rOutStrm ) override;
     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
+    virtual void        convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv ) override;
 
 public: // direct access needed for legacy VML drawing controls
     StreamDataSequence  maPictureData;      ///< Binary picture stream.
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index a59beb631475..8e2b87634ce4 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -1540,7 +1540,7 @@ void AxMorphDataModelBase::exportBinaryModel( BinaryOutputStream& rOutStrm )
     aWriter.skipProperty(); // accelerator
     aWriter.skipProperty(); // undefined
     aWriter.writeBoolProperty(true); // must be 1 for morph
-    if ( ( mnDisplayStyle == AX_DISPLAYSTYLE_CHECKBOX ) || ( mnDisplayStyle == AX_DISPLAYSTYLE_OPTBUTTON ) )
+    if ( mnDisplayStyle == AX_DISPLAYSTYLE_OPTBUTTON )
         aWriter.writeStringProperty( maGroupName );
     else
         aWriter.skipProperty(); //maGroupName
@@ -1552,9 +1552,18 @@ void AxMorphDataModelBase::convertProperties( PropertyMap& rPropMap, const Contr
 {
     rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
     rConv.convertColor( rPropMap, PROP_TextColor, mnTextColor );
+    if ( mnDisplayStyle == AX_DISPLAYSTYLE_OPTBUTTON )
+        rPropMap.setProperty( PROP_GroupName, maGroupName );
     AxFontDataModel::convertProperties( rPropMap, rConv );
 }
 
+void AxMorphDataModelBase::convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv )
+{
+    if ( mnDisplayStyle == AX_DISPLAYSTYLE_OPTBUTTON )
+        rPropSet.getProperty( maGroupName, PROP_GroupName );
+    AxFontDataModel::convertFromProperties( rPropSet, rConv );
+}
+
 AxToggleButtonModel::AxToggleButtonModel()
 {
     mnDisplayStyle = AX_DISPLAYSTYLE_TOGGLE;
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index b32924c2be9b..e6bc79ff3d08 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -208,6 +208,7 @@ GraphicSize
 GraphicURL
 GridColor
 GroupInfo
+GroupName
 HScroll
 Handles
 HasAutoShowInfo
diff --git a/sw/qa/extras/ooxmlexport/data/activex_option_button_group.docx b/sw/qa/extras/ooxmlexport/data/activex_option_button_group.docx
new file mode 100755
index 000000000000..9da266a9278d
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/activex_option_button_group.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 515f40e4803b..f381de9c9032 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -1007,6 +1007,23 @@ DECLARE_OOXMLEXPORT_TEST(testWatermarkLayer, "watermark-layer.docx")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(1), pObject->GetLayer().get());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testActiveXOptionButtonGroup, "activex_option_button_group.docx")
+{
+    // Optionbutton groups were not handled
+    // The two optionbutton should have the same group name
+    const OUString sGroupName = "GroupX";
+
+    uno::Reference<drawing::XControlShape> xControlShape(getShape(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xControlShape.is());
+    uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sGroupName, getProperty<OUString>(xPropertySet, "GroupName"));
+
+    xControlShape.set(getShape(2), uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xControlShape.is());
+    xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sGroupName, getProperty<OUString>(xPropertySet, "GroupName"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list