diff options
-rw-r--r-- | sw/CppunitTest_sw_ww8export2.mk | 2 | ||||
-rwxr-xr-x | sw/qa/extras/ww8export/data/checkbox_control.odt | bin | 0 -> 9601 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export2.cxx | 39 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 69 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 1 |
6 files changed, 42 insertions, 71 deletions
diff --git a/sw/CppunitTest_sw_ww8export2.mk b/sw/CppunitTest_sw_ww8export2.mk index 20f7df957a61..99551b36750e 100644 --- a/sw/CppunitTest_sw_ww8export2.mk +++ b/sw/CppunitTest_sw_ww8export2.mk @@ -52,6 +52,8 @@ $(eval $(call gb_CppunitTest_use_components,sw_ww8export2,\ comphelper/util/comphelp \ configmgr/source/configmgr \ dbaccess/util/dba \ + embeddedobj/util/embobj \ + emfio/emfio \ filter/source/config/cache/filterconfig1 \ filter/source/storagefilterdetect/storagefd \ forms/util/frm \ diff --git a/sw/qa/extras/ww8export/data/checkbox_control.odt b/sw/qa/extras/ww8export/data/checkbox_control.odt Binary files differnew file mode 100755 index 000000000000..b5281b30eecd --- /dev/null +++ b/sw/qa/extras/ww8export/data/checkbox_control.odt diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index cb6155cf444a..066b680d01dd 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -16,6 +16,8 @@ #include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/text/XTextTablesSupplier.hpp> #include <com/sun/star/text/XFootnote.hpp> +#include <com/sun/star/drawing/XControlShape.hpp> +#include <com/sun/star/text/VertOrientation.hpp> #include <ftninfo.hxx> #include <pagedesc.hxx> @@ -229,6 +231,43 @@ DECLARE_WW8EXPORT_TEST(testTdf111480, "tdf111480.doc") CPPUNIT_ASSERT(xText->getSize().Width > 11000); } +DECLARE_WW8EXPORT_TEST( testActiveXCheckbox, "checkbox_control.odt" ) +{ + // First check box anchored as a floating object + uno::Reference<drawing::XControlShape> xControlShape; + if(!mbExported) + xControlShape.set(getShape(1), uno::UNO_QUERY); + else + xControlShape.set(getShape(2), uno::UNO_QUERY); + CPPUNIT_ASSERT(xControlShape.is()); + + // Check whether we have the right control + 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.CheckBox"))); + CPPUNIT_ASSERT_EQUAL(OUString("Floating Checkbox"), getProperty<OUString>(xPropertySet, "Label")); + + // Check anchor type + uno::Reference<beans::XPropertySet> xPropertySet2(xControlShape, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER,getProperty<text::TextContentAnchorType>(xPropertySet2,"AnchorType")); + + // Second check box anchored inline / as character + if(!mbExported) + xControlShape.set(getShape(2), uno::UNO_QUERY); + else + xControlShape.set(getShape(1), uno::UNO_QUERY); + + // Check whether we have the right control + xPropertySet.set(xControlShape->getControl(), uno::UNO_QUERY); + xServiceInfo.set(xPropertySet, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(true, bool(xServiceInfo->supportsService("com.sun.star.form.component.CheckBox"))); + CPPUNIT_ASSERT_EQUAL(OUString("Inline Checkbox"), getProperty<OUString>(xPropertySet, "Label")); + + // Check anchor type + xPropertySet2.set(xControlShape, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER,getProperty<text::TextContentAnchorType>(xPropertySet2,"AnchorType")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index e0020a473856..5a1cd9252921 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1967,7 +1967,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi m_aRun->append(OUStringToOString(FieldString(ww::eFORMCHECKBOX), m_rExport.m_eCurrentEncoding)); m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD "{"); m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFTYPE "1"); // 1 = checkbox - // checkbox size in half points, this seems to be always 20, see WW8Export::DoCheckBox() + // checkbox size in half points, this seems to be always 20 m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFHPS "20"); OUString aStr; diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index f29a568a27a5..f5450722ce38 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -384,12 +384,6 @@ bool WW8Export::MiserableFormFieldExportHack(const SwFrameFormat& rFrameFormat) return true; } - if (xInfo->supportsService("com.sun.star.form.component.CheckBox")) - { - DoCheckBox(xPropSet); - return true; - } - return false; } @@ -488,69 +482,6 @@ void WW8Export::DoComboBox(const OUString &rName, aFFData.Write(pDataStrm); } -void WW8Export::DoCheckBox(uno::Reference<beans::XPropertySet> const & xPropSet) -{ - uno::Reference<beans::XPropertySetInfo> xPropSetInfo = - xPropSet->getPropertySetInfo(); - - OutputField(nullptr, ww::eFORMCHECKBOX, FieldString(ww::eFORMCHECKBOX), - FieldFlags::Start | FieldFlags::CmdStart); - // write the reference to the "picture" structure - sal_uLong nDataStt = pDataStrm->Tell(); - m_pChpPlc->AppendFkpEntry( Strm().Tell() ); - - WriteChar( 0x01 ); - static sal_uInt8 aArr1[] = { - 0x03, 0x6a, 0,0,0,0, // sprmCPicLocation - - 0x06, 0x08, 0x01, // sprmCFData - 0x55, 0x08, 0x01, // sprmCFSpec - 0x02, 0x08, 0x01 // sprmCFFieldVanish - }; - sal_uInt8* pDataAdr = aArr1 + 2; - Set_UInt32( pDataAdr, nDataStt ); - - m_pChpPlc->AppendFkpEntry(Strm().Tell(), - sizeof( aArr1 ), aArr1 ); - - ::sw::WW8FFData aFFData; - - aFFData.setType(1); - aFFData.setCheckboxHeight(0x14); - - sal_Int16 nTemp = 0; - xPropSet->getPropertyValue("DefaultState") >>= nTemp; - aFFData.setDefaultResult(nTemp); - - xPropSet->getPropertyValue("State") >>= nTemp; - aFFData.setResult(nTemp); - - OUString aStr; - static const char sName[] = "Name"; - if (xPropSetInfo->hasPropertyByName(sName)) - { - xPropSet->getPropertyValue(sName) >>= aStr; - aFFData.setName(aStr); - } - - static const char sHelpText[] = "HelpText"; - if (xPropSetInfo->hasPropertyByName(sHelpText)) - { - xPropSet->getPropertyValue(sHelpText) >>= aStr; - aFFData.setHelp(aStr); - } - static const char sHelpF1Text[] = "HelpF1Text"; - if (xPropSetInfo->hasPropertyByName(sHelpF1Text)) - { - xPropSet->getPropertyValue(sHelpF1Text) >>= aStr; - aFFData.setStatus(aStr); - } - - aFFData.Write(pDataStrm); - - OutputField(nullptr, ww::eFORMCHECKBOX, OUString(), FieldFlags::Close); -} - void WW8Export::DoFormText(const SwInputField * pField) { OutputField(nullptr, ww::eFORMTEXT, FieldString(ww::eFORMTEXT), diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index ffa7221bdb90..e726231442fa 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -998,7 +998,6 @@ private: void RestoreMacroCmds(); void DoComboBox(css::uno::Reference<css::beans::XPropertySet> const & xPropSet); - void DoCheckBox(css::uno::Reference<css::beans::XPropertySet> const & xPropSet); public: |