[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - oox/source sd/qa sw/qa
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Aug 10 08:20:16 UTC 2018
oox/source/ole/axcontrol.cxx | 9 +++++--
sd/qa/unit/activex-controls-tests.cxx | 3 +-
sw/qa/extras/ooxmlexport/data/activex_textbox.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 25 +++++++++++++++++++++
4 files changed, 34 insertions(+), 3 deletions(-)
New commits:
commit 3ffca217ac7f66eddf3f88444d33241a635e60f3
Author: Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Tue Jul 17 10:06:27 2018 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Fri Aug 10 01:20:43 2018 -0700
tdf#118651 OOXML ActiveX textbox: fix multiline support
of textfield component in DOCX/PPTX by handling properties
AX_FLAGS_MULTILINE and AX_FLAGS_WORDWRAP during the import
and export. Both of them need to be enabled to get multiline
textfield in MSO, but LibreOffice has got only one multiline
property. With this fix, LibreOffice imports only really
multiline textfields as multiline, and it doesn't export
multiline textfields as single line anymore.
Change-Id: I9b567c3fcdc5d01a5838a3ec2517579f8d788954
Reviewed-on: https://gerrit.libreoffice.org/57552
Reviewed-by: László Németh <nemeth at numbertext.org>
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-on: https://gerrit.libreoffice.org/57619
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
(cherry picked from commit 076cb54472d5bba8916df9ee50074ac74433d694)
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index a697fddfe33c..1e1b249e1bc7 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -1768,7 +1768,10 @@ ApiControlType AxTextBoxModel::getControlType() const
void AxTextBoxModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
- rPropMap.setProperty( PROP_MultiLine, getFlag( mnFlags, AX_FLAGS_MULTILINE ) );
+ if (getFlag( mnFlags, AX_FLAGS_MULTILINE ) && getFlag( mnFlags, AX_FLAGS_WORDWRAP ))
+ rPropMap.setProperty( PROP_MultiLine, true );
+ else
+ rPropMap.setProperty( PROP_MultiLine, false );
rPropMap.setProperty( PROP_HideInactiveSelection, getFlag( mnFlags, AX_FLAGS_HIDESELECTION ) );
rPropMap.setProperty( mbAwtModel ? PROP_Text : PROP_DefaultText, maValue );
rPropMap.setProperty( PROP_MaxTextLen, getLimitedValue< sal_Int16, sal_Int32 >( mnMaxLength, 0, SAL_MAX_INT16 ) );
@@ -1784,8 +1787,10 @@ void AxTextBoxModel::convertProperties( PropertyMap& rPropMap, const ControlConv
void AxTextBoxModel::convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv )
{
bool bRes = false;
- if ( rPropSet.getProperty( bRes, PROP_MultiLine ) )
+ if ( rPropSet.getProperty( bRes, PROP_MultiLine ) ) {
setFlag( mnFlags, AX_FLAGS_WORDWRAP, bRes );
+ setFlag( mnFlags, AX_FLAGS_MULTILINE, bRes );
+ }
if ( rPropSet.getProperty( bRes, PROP_HideInactiveSelection ) )
setFlag( mnFlags, AX_FLAGS_HIDESELECTION, bRes );
rPropSet.getProperty( maValue, ( mbAwtModel ? PROP_Text : PROP_DefaultText ) );
diff --git a/sd/qa/unit/activex-controls-tests.cxx b/sd/qa/unit/activex-controls-tests.cxx
index ce6533bf95dc..ca9072d6ff34 100644
--- a/sd/qa/unit/activex-controls-tests.cxx
+++ b/sd/qa/unit/activex-controls-tests.cxx
@@ -266,8 +266,9 @@ void SdActiveXControlsTest::testTextBoxProperties()
xPropertySet->getPropertyValue("Enabled") >>= bEnabled;
CPPUNIT_ASSERT_EQUAL(false, bEnabled);
+ // These textfields are not multilines in the pptx testfile
xPropertySet->getPropertyValue("MultiLine") >>= bMultiLine;
- CPPUNIT_ASSERT_EQUAL(true, bMultiLine);
+ CPPUNIT_ASSERT_EQUAL(false, bMultiLine);
xPropertySet->getPropertyValue("TextColor") >>= nColor;
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x404040), nColor);
diff --git a/sw/qa/extras/ooxmlexport/data/activex_textbox.docx b/sw/qa/extras/ooxmlexport/data/activex_textbox.docx
new file mode 100644
index 000000000000..6f137008ce78
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/activex_textbox.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index f71241a025d3..3b569c9f40ba 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -905,6 +905,31 @@ DECLARE_OOXMLEXPORT_TEST(testTdf105095, "tdf105095.docx")
CPPUNIT_ASSERT(xTextRange->getString().endsWith("\tfootnote"));
}
+DECLARE_OOXMLEXPORT_TEST( testActiveXTextfield, "activex_textbox.docx" )
+{
+ uno::Reference<drawing::XControlShape> xControlShape( getShape(1), uno::UNO_QUERY );
+ CPPUNIT_ASSERT( xControlShape.is() );
+
+ // Check control type
+ uno::Reference<beans::XPropertySet> xPropertySet( xControlShape->getControl(), uno::UNO_QUERY );
+ uno::Reference<lang::XServiceInfo> xServiceInfo( xPropertySet, uno::UNO_QUERY );
+ CPPUNIT_ASSERT_EQUAL( true, bool( xServiceInfo->supportsService ( "com.sun.star.form.component.TextField" ) ) );
+
+ // Check textfield is multi-line
+ CPPUNIT_ASSERT_EQUAL( true, getProperty<bool>(xPropertySet, "MultiLine") );
+
+ uno::Reference<drawing::XControlShape> xControlShape2( getShape(2), uno::UNO_QUERY );
+ CPPUNIT_ASSERT( xControlShape2.is() );
+
+ // Check control type
+ uno::Reference<beans::XPropertySet> xPropertySet2( xControlShape2->getControl(), uno::UNO_QUERY );
+ uno::Reference<lang::XServiceInfo> xServiceInfo2( xPropertySet2, uno::UNO_QUERY );
+ CPPUNIT_ASSERT_EQUAL( true, bool( xServiceInfo2->supportsService ( "com.sun.star.form.component.TextField" ) ) );
+
+ // Check textfield is single-line
+ CPPUNIT_ASSERT_EQUAL( false, getProperty<bool>(xPropertySet2, "MultiLine") );
+}
+
DECLARE_OOXMLEXPORT_TEST( testActiveXCheckbox, "activex_checkbox.docx" )
{
uno::Reference<drawing::XControlShape> xControlShape( getShape(1), uno::UNO_QUERY );
More information about the Libreoffice-commits
mailing list