diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/writerfilter/dmapper/FormControlHelper.cxx | 37 | ||||
-rw-r--r-- | sw/source/writerfilter/dmapper/FormControlHelper.hxx | 6 |
2 files changed, 16 insertions, 27 deletions
diff --git a/sw/source/writerfilter/dmapper/FormControlHelper.cxx b/sw/source/writerfilter/dmapper/FormControlHelper.cxx index 40f5d703815e..4baf7490d2cf 100644 --- a/sw/source/writerfilter/dmapper/FormControlHelper.cxx +++ b/sw/source/writerfilter/dmapper/FormControlHelper.cxx @@ -41,6 +41,8 @@ #include <xmloff/odffields.hxx> #include <comphelper/sequence.hxx> #include <comphelper/diagnose_ex.hxx> +#include <rtl/ref.hxx> +#include <unotxdoc.hxx> namespace writerfilter::dmapper { @@ -53,11 +55,9 @@ struct FormControlHelper::FormControlHelper_Impl : public virtual SvRefBase uno::Reference<drawing::XDrawPage> rDrawPage; uno::Reference<form::XForm> rForm; uno::Reference<form::XFormComponent> rFormComponent; - uno::Reference<lang::XMultiServiceFactory> rServiceFactory; - uno::Reference<text::XTextDocument> rTextDocument; + rtl::Reference<SwXTextDocument> mxTextDocument; uno::Reference<drawing::XDrawPage> const & getDrawPage(); - uno::Reference<lang::XMultiServiceFactory> const & getServiceFactory(); uno::Reference<form::XForm> const & getForm(); uno::Reference<container::XIndexContainer> getFormComps(); }; @@ -66,23 +66,13 @@ uno::Reference<drawing::XDrawPage> const & FormControlHelper::FormControlHelper_ { if (! rDrawPage.is()) { - uno::Reference<drawing::XDrawPageSupplier> - xDrawPageSupplier(rTextDocument, uno::UNO_QUERY); - if (xDrawPageSupplier.is()) - rDrawPage = xDrawPageSupplier->getDrawPage(); + if (mxTextDocument) + rDrawPage = mxTextDocument->getDrawPage(); } return rDrawPage; } -uno::Reference<lang::XMultiServiceFactory> const & FormControlHelper::FormControlHelper_Impl::getServiceFactory() -{ - if (! rServiceFactory.is()) - rServiceFactory.set(rTextDocument, uno::UNO_QUERY); - - return rServiceFactory; -} - uno::Reference<form::XForm> const & FormControlHelper::FormControlHelper_Impl::getForm() { if (! rForm.is()) @@ -103,7 +93,7 @@ uno::Reference<form::XForm> const & FormControlHelper::FormControlHelper_Impl::g sFormName = sDOCXForm + OUString::number(nUnique); } - uno::Reference<uno::XInterface> xForm(getServiceFactory()->createInstance("com.sun.star.form.component.Form")); + uno::Reference<uno::XInterface> xForm(mxTextDocument->createInstance("com.sun.star.form.component.Form")); if (xForm.is()) { uno::Reference<beans::XPropertySet> @@ -131,12 +121,12 @@ uno::Reference<container::XIndexContainer> FormControlHelper::FormControlHelper_ } FormControlHelper::FormControlHelper(FieldId eFieldId, - uno::Reference<text::XTextDocument> const& xTextDocument, + rtl::Reference<SwXTextDocument> const& xTextDocument, FFDataHandler::Pointer_t pFFData) : m_pFFData(std::move(pFFData)), m_pImpl(new FormControlHelper_Impl) { m_pImpl->m_eFieldId = eFieldId; - m_pImpl->rTextDocument = xTextDocument; + m_pImpl->mxTextDocument = xTextDocument; } FormControlHelper::~FormControlHelper() @@ -148,13 +138,10 @@ bool FormControlHelper::createCheckbox(uno::Reference<text::XTextRange> const& x { if ( !m_pFFData ) return false; - uno::Reference<lang::XMultiServiceFactory> - xServiceFactory(m_pImpl->getServiceFactory()); - - if (! xServiceFactory.is()) + if (! m_pImpl->mxTextDocument) return false; - uno::Reference<uno::XInterface> xInterface = xServiceFactory->createInstance("com.sun.star.form.component.CheckBox"); + uno::Reference<uno::XInterface> xInterface = m_pImpl->mxTextDocument->createInstance("com.sun.star.form.component.CheckBox"); if (!xInterface.is()) return false; @@ -342,10 +329,10 @@ void FormControlHelper::insertControl(uno::Reference<text::XTextRange> const& xT uno::Any aAny(m_pImpl->rFormComponent); xFormComps->insertByIndex(xFormComps->getCount(), aAny); - if (! m_pImpl->getServiceFactory().is()) + if (! m_pImpl->mxTextDocument ) return; - uno::Reference<uno::XInterface> xInterface = m_pImpl->getServiceFactory()->createInstance("com.sun.star.drawing.ControlShape"); + uno::Reference<uno::XInterface> xInterface = m_pImpl->mxTextDocument->createInstance("com.sun.star.drawing.ControlShape"); if (! xInterface.is()) return; diff --git a/sw/source/writerfilter/dmapper/FormControlHelper.hxx b/sw/source/writerfilter/dmapper/FormControlHelper.hxx index 326637f85f78..6b0f39dd5ab1 100644 --- a/sw/source/writerfilter/dmapper/FormControlHelper.hxx +++ b/sw/source/writerfilter/dmapper/FormControlHelper.hxx @@ -23,6 +23,9 @@ #include <com/sun/star/text/XFormField.hpp> #include <com/sun/star/uno/Reference.hxx> #include "FieldTypes.hxx" +#include <rtl/ref.hxx> + +class SwXTextDocument; namespace writerfilter::dmapper { @@ -30,8 +33,7 @@ class FormControlHelper : public virtual SvRefBase { public: typedef tools::SvRef<FormControlHelper> Pointer_t; - FormControlHelper(FieldId eFieldId, - css::uno::Reference<css::text::XTextDocument> const& rTextDocument, + FormControlHelper(FieldId eFieldId, rtl::Reference<SwXTextDocument> const& rTextDocument, FFDataHandler::Pointer_t pFFData); ~FormControlHelper() override; |