diff options
author | David Tardon <dtardon@redhat.com> | 2012-09-20 10:28:56 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2012-10-25 14:48:23 +0200 |
commit | ca0ea73a4ab104031a16b5bac7a9bb6e57c77ba0 (patch) | |
tree | 2db5bf3254573d5f64ff4197a1d57382249f947c /filter | |
parent | 25113cd050d931b0e195fda6d6da9864a575070e (diff) |
rework selection of transformer for an XSLT filter
Change-Id: I765762f11813c6b612416a8db2707bf94114c876
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/xsltdialog/typedetectionexport.cxx | 2 | ||||
-rw-r--r-- | filter/source/xsltdialog/typedetectionimport.cxx | 2 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltercommon.hxx | 2 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfilterhelpids.hrc | 3 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 11 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertabpagexslt.cxx | 20 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertabpagexslt.hrc | 5 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertabpagexslt.hxx | 5 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertabpagexslt.src | 23 | ||||
-rw-r--r-- | filter/source/xsltfilter/LibXSLTTransformer.cxx | 4 | ||||
-rw-r--r-- | filter/source/xsltfilter/LibXSLTTransformer.hxx | 18 | ||||
-rw-r--r-- | filter/source/xsltfilter/XSLTFilter.cxx | 69 | ||||
-rw-r--r-- | filter/source/xsltfilter/com/sun/star/comp/xsltfilter/XSLTransformer.java | 13 | ||||
-rw-r--r-- | filter/source/xsltfilter/components.rdb | 4 | ||||
-rw-r--r-- | filter/source/xsltfilter/xsltfilter.component | 2 |
15 files changed, 96 insertions, 87 deletions
diff --git a/filter/source/xsltdialog/typedetectionexport.cxx b/filter/source/xsltdialog/typedetectionexport.cxx index ae0da2375628..f48a62c4fb69 100644 --- a/filter/source/xsltdialog/typedetectionexport.cxx +++ b/filter/source/xsltdialog/typedetectionexport.cxx @@ -183,7 +183,7 @@ void TypeDetectionExporter::doExport( Reference< XOutputStream > xOS, const XML sValue += sComma; sValue += sXSLTFilterService; sValue += sDelim; - sValue += pFilter->maXSLTTransformerImpl; + sValue += OUString::valueOf( pFilter->mbNeedsXSLT2 ); sValue += sDelim; const application_info_impl* pAppInfo = getApplicationInfo( pFilter->maExportService ); diff --git a/filter/source/xsltdialog/typedetectionimport.cxx b/filter/source/xsltdialog/typedetectionimport.cxx index daf6f32d2bba..1740b6d6964f 100644 --- a/filter/source/xsltdialog/typedetectionimport.cxx +++ b/filter/source/xsltdialog/typedetectionimport.cxx @@ -170,7 +170,7 @@ filter_info_impl* TypeDetectionImporter::createFilterForNode( Node * pNode ) OUString aAdapterService( getSubdata( 0, aDelim, aFilterUserData ) ); //Import/ExportService - pFilter->maXSLTTransformerImpl = getSubdata( 1, aDelim, aFilterUserData ); + pFilter->mbNeedsXSLT2 = getSubdata( 1, aDelim, aFilterUserData ).toBoolean(); pFilter->maImportService = getSubdata( 2, aDelim, aFilterUserData ); pFilter->maExportService = getSubdata( 3, aDelim, aFilterUserData ); pFilter->maImportXSLT = getSubdata( 4, aDelim, aFilterUserData ); diff --git a/filter/source/xsltdialog/xmlfiltercommon.hxx b/filter/source/xsltdialog/xmlfiltercommon.hxx index 85d0ff1e52e0..f00cbcf38ebc 100644 --- a/filter/source/xsltdialog/xmlfiltercommon.hxx +++ b/filter/source/xsltdialog/xmlfiltercommon.hxx @@ -68,7 +68,7 @@ public: sal_Bool mbReadonly; - rtl::OUString maXSLTTransformerImpl; + sal_Bool mbNeedsXSLT2; filter_info_impl(); filter_info_impl( const filter_info_impl& rInfo ); diff --git a/filter/source/xsltdialog/xmlfilterhelpids.hrc b/filter/source/xsltdialog/xmlfilterhelpids.hrc index f2d48e315517..d4ea134087b6 100644 --- a/filter/source/xsltdialog/xmlfilterhelpids.hrc +++ b/filter/source/xsltdialog/xmlfilterhelpids.hrc @@ -41,8 +41,7 @@ #define HID_XML_FILTER_DOCTYPE "FILTER_HID_XML_FILTER_DOCTYPE" #define HID_XML_FILTER_DTD "FILTER_HID_XML_FILTER_DTD" #define HID_XML_FILTER_DTD_BROWSE "FILTER_HID_XML_FILTER_DTD_BROWSE" -#define HID_XML_FILTER_TRANSFORM_SERVICE_SAXON_J "FILTER_HID_XML_FILTER_TRANSFORM_SERVICE_SAXON_J" -#define HID_XML_FILTER_TRANSFORM_SERVICE_LIBXSLT "FILTER_HID_XML_FILTER_TRANSFORM_SERVICE_LIBXSLT" +#define HID_XML_FILTER_NEEDS_XSLT2 "FILTER_HID_XML_FILTER_NEEDS_XSLT2" #define HID_XML_FILTER_EXPORT_XSLT "FILTER_HID_XML_FILTER_EXPORT_XSLT" #define HID_XML_FILTER_EXPORT_XSLT_BROWSE "FILTER_HID_XML_FILTER_EXPORT_XSLT_BROWSE" #define HID_XML_FILTER_IMPORT_XSLT "FILTER_HID_XML_FILTER_IMPORT_XSLT" diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index 31814cf2534b..5337a2a89124 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -1152,7 +1152,7 @@ void XMLFilterSettingsDialog::initFilterList() continue; // get filter information from userdata - pTempFilter->maXSLTTransformerImpl = aUserData[1]; + pTempFilter->mbNeedsXSLT2 = aUserData[1].toBoolean(); pTempFilter->maImportService = aUserData[2]; pTempFilter->maExportService = aUserData[3]; pTempFilter->maImportXSLT = aUserData[4]; @@ -1572,7 +1572,8 @@ filter_info_impl::filter_info_impl() : maFlags(0x00080040), maFileFormatVersion(0), mnDocumentIconID(0), - mbReadonly(sal_False) + mbReadonly(sal_False), + mbNeedsXSLT2(sal_False) { } @@ -1597,7 +1598,7 @@ filter_info_impl::filter_info_impl( const filter_info_impl& rInfo ) : maFileFormatVersion( rInfo.maFileFormatVersion ), mnDocumentIconID( rInfo.mnDocumentIconID ), mbReadonly( rInfo.mbReadonly ), - maXSLTTransformerImpl( rInfo.maXSLTTransformerImpl ) + mbNeedsXSLT2( rInfo.mbNeedsXSLT2 ) { } @@ -1621,7 +1622,7 @@ int filter_info_impl::operator==( const filter_info_impl& r ) const maImportTemplate != r.maImportTemplate || maFlags != r.maFlags || maFileFormatVersion != r.maFileFormatVersion || - maXSLTTransformerImpl != r.maXSLTTransformerImpl + mbNeedsXSLT2 != r.mbNeedsXSLT2 ) return false; @@ -1635,7 +1636,7 @@ Sequence< OUString > filter_info_impl::getFilterUserData() const Sequence< OUString > aUserData(8); aUserData[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.documentconversion.XSLTFilter" ) ); - aUserData[1] = maXSLTTransformerImpl; + aUserData[1] = OUString::valueOf( mbNeedsXSLT2 ); aUserData[2] = maImportService; aUserData[3] = maExportService; aUserData[4] = maImportXSLT; diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx index 37be99048f71..31dce8848a20 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx +++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx @@ -59,9 +59,8 @@ XMLFilterTabPageXSLT::XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr, co maEDImportTemplate( this, ResId( ED_XML_IMPORT_TEMPLATE, rResMgr ), INET_PROT_FILE ), maPBImportTemplate( this, ResId( PB_XML_IMPORT_TEMPLATE_BROWSE, rResMgr ) ), - maFTTransformationService( this, ResId (FT_XML_TRANSFORM_SERVICE, rResMgr ) ), - maRBTransformationServiceLibXSLT( this, ResId (RB_XML_TRANSFORM_SERVICE_LIBXSLT, rResMgr ) ), - maRBTransformationServiceSaxonJ( this, ResId (RB_XML_TRANSFORM_SERVICE_SAXON_J, rResMgr ) ), + maFTNeedsXSLT2( this, ResId (FT_XML_NEEDS_XSLT2, rResMgr ) ), + maCBNeedsXSLT2( this, ResId (CB_XML_NEEDS_XSLT2, rResMgr ) ), sHTTPSchema( RTL_CONSTASCII_USTRINGPARAM( "http://" ) ), sSHTTPSchema( RTL_CONSTASCII_USTRINGPARAM( "shttp://" ) ), @@ -91,8 +90,7 @@ XMLFilterTabPageXSLT::XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr, co maEDExportXSLT.SetHelpId( HID_XML_FILTER_EXPORT_XSLT ); maEDImportXSLT.SetHelpId( HID_XML_FILTER_IMPORT_XSLT ); maEDImportTemplate.SetHelpId( HID_XML_FILTER_IMPORT_TEMPLATE ); - maRBTransformationServiceLibXSLT.SetHelpId( HID_XML_FILTER_TRANSFORM_SERVICE_LIBXSLT ); - maRBTransformationServiceSaxonJ.SetHelpId( HID_XML_FILTER_TRANSFORM_SERVICE_SAXON_J ); + maCBNeedsXSLT2.SetHelpId( HID_XML_FILTER_NEEDS_XSLT2 ); } XMLFilterTabPageXSLT::~XMLFilterTabPageXSLT() @@ -108,10 +106,7 @@ bool XMLFilterTabPageXSLT::FillInfo( filter_info_impl* pInfo ) pInfo->maExportXSLT = GetURL( maEDExportXSLT ); pInfo->maImportXSLT = GetURL( maEDImportXSLT ); pInfo->maImportTemplate = GetURL( maEDImportTemplate ); - pInfo->maXSLTTransformerImpl - = maRBTransformationServiceSaxonJ.IsChecked() ? OUString( - RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.JAXTHelper" )) - : OUString(RTL_CONSTASCII_USTRINGPARAM( "" )); + pInfo->mbNeedsXSLT2 = maCBNeedsXSLT2.IsChecked(); } return true; @@ -127,12 +122,7 @@ void XMLFilterTabPageXSLT::SetInfo(const filter_info_impl* pInfo) SetURL( maEDExportXSLT, pInfo->maExportXSLT ); SetURL( maEDImportXSLT, pInfo->maImportXSLT ); SetURL( maEDImportTemplate, pInfo->maImportTemplate ); - if (pInfo->maXSLTTransformerImpl.equals(OUString( - RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.JAXTHelper" )))) { - maRBTransformationServiceSaxonJ.Check(); - } else { - maRBTransformationServiceLibXSLT.Check(); - } + maCBNeedsXSLT2.Check( pInfo->mbNeedsXSLT2 ); } } diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.hrc b/filter/source/xsltdialog/xmlfiltertabpagexslt.hrc index c86830758062..93c6ed15adf0 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagexslt.hrc +++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.hrc @@ -35,8 +35,7 @@ #define FT_XML_IMPORT_TEMPLATE 12 #define ED_XML_IMPORT_TEMPLATE 13 #define PB_XML_IMPORT_TEMPLATE_BROWSE 14 -#define FT_XML_TRANSFORM_SERVICE 15 -#define RB_XML_TRANSFORM_SERVICE_LIBXSLT 16 -#define RB_XML_TRANSFORM_SERVICE_SAXON_J 17 +#define FT_XML_NEEDS_XSLT2 15 +#define CB_XML_NEEDS_XSLT2 16 #endif diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx index a37d017aa71c..cccd97e95e0e 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx +++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx @@ -60,9 +60,8 @@ public: SvtURLBox maEDImportTemplate; PushButton maPBImportTemplate; - FixedText maFTTransformationService; - RadioButton maRBTransformationServiceLibXSLT; - RadioButton maRBTransformationServiceSaxonJ; + FixedText maFTNeedsXSLT2; + CheckBox maCBNeedsXSLT2; private: void SetURL( SvtURLBox& rURLBox, const rtl::OUString& rURL ); diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.src b/filter/source/xsltdialog/xmlfiltertabpagexslt.src index f719dd5a1fc4..f8feb42265b6 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagexslt.src +++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.src @@ -166,27 +166,18 @@ TabPage RID_XML_FILTER_TABPAGE_XSLT // XSLT transformation service -------------------------------------------------------- - FixedText FT_XML_TRANSFORM_SERVICE + CheckBox CB_XML_NEEDS_XSLT2 { + HelpID = HID_XML_FILTER_NEEDS_XSLT2; Pos = MAP_APPFONT ( FIRST_ROW_X , FIRST_ROW_Y + 5 * ROW_HEIGHT + 5 * SPACING + FIXED_TEXT_OFFSET + EDIT_OFFSET ) ; - Size = MAP_APPFONT ( FIRST_ROW_WIDTH , 8 ) ; - Text [ en-US ] = "XSLT Transformation Service"; - }; - - RadioButton RB_XML_TRANSFORM_SERVICE_LIBXSLT - { - HelpID = HID_XML_FILTER_TRANSFORM_SERVICE_LIBXSLT; - Pos = MAP_APPFONT ( SECOND_ROW_X , SECOND_ROW_Y + 5 * ROW_HEIGHT + 5 * SPACING + EDIT_OFFSET ) ; - Size = MAP_APPFONT ( SECOND_ROW_WIDTH - SPACING - BROWSE_WIDTH, 12 ) ; - Text[ en-US ] = "~Builtin (LibXSLT)"; + Size = MAP_APPFONT ( 12, 12 ) ; }; - RadioButton RB_XML_TRANSFORM_SERVICE_SAXON_J + FixedText FT_XML_NEEDS_XSLT2 { - HelpID = HID_XML_FILTER_TRANSFORM_SERVICE_SAXON_J; - Pos = MAP_APPFONT ( SECOND_ROW_X , SECOND_ROW_Y + 6 * ROW_HEIGHT + 6 * SPACING + EDIT_OFFSET ) ; - Size = MAP_APPFONT ( SECOND_ROW_WIDTH - SPACING - BROWSE_WIDTH, 12 ) ; - Text[ en-US ] = "~Saxon/J"; + Pos = MAP_APPFONT ( FIRST_ROW_X + 3 * SPACING , SECOND_ROW_Y + 5 * ROW_HEIGHT + 5 * SPACING + FIXED_TEXT_OFFSET + EDIT_OFFSET ) ; + Size = MAP_APPFONT ( 2 * FIRST_ROW_WIDTH , 8 ) ; // guess width + Text [ en-US ] = "The filter needs XSLT 2.0 processor"; }; }; diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx index aa1411f7b946..5c5b0e0c4296 100644 --- a/filter/source/xsltfilter/LibXSLTTransformer.cxx +++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx @@ -494,9 +494,11 @@ namespace XSLT } void - LibXSLTTransformer::initialize(const Sequence<Any>& params) + LibXSLTTransformer::initialize(const Sequence<Any>& args) throw (RuntimeException) { + Sequence<Any> params; + args[0] >>= params; xmlSubstituteEntitiesDefault(0); m_parameters.clear(); for (int i = 0; i < params.getLength(); i++) diff --git a/filter/source/xsltfilter/LibXSLTTransformer.hxx b/filter/source/xsltfilter/LibXSLTTransformer.hxx index 444cb2f6b9ce..a7c71a611fd5 100644 --- a/filter/source/xsltfilter/LibXSLTTransformer.hxx +++ b/filter/source/xsltfilter/LibXSLTTransformer.hxx @@ -42,7 +42,7 @@ #include <cppuhelper/factory.hxx> #include <cppuhelper/servicefactory.hxx> -#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase.hxx> #include <rtl/ref.hxx> @@ -51,14 +51,12 @@ #include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XOutputStream.hpp> -#include <com/sun/star/io/XActiveDataSource.hpp> -#include <com/sun/star/io/XActiveDataSink.hpp> -#include <com/sun/star/io/XActiveDataControl.hpp> #include <com/sun/star/io/XStreamListener.hpp> -#include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/xml/xslt/XXSLTTransformer.hpp> using namespace ::rtl; using namespace ::cppu; @@ -66,7 +64,6 @@ using namespace ::osl; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::io; using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; using ::std::list; using ::std::map; @@ -90,8 +87,7 @@ namespace XSLT * * See Reader below. */ - class LibXSLTTransformer : public WeakImplHelper4<XActiveDataSink, - XActiveDataSource, XActiveDataControl, XInitialization> + class LibXSLTTransformer : public WeakImplHelper1<com::sun::star::xml::xslt::XXSLTTransformer> { private: static const char* const PARAM_SOURCE_URL; @@ -102,7 +98,7 @@ namespace XSLT static const char* const PARAM_DOCTYPE_PUBLIC; // the UNO ServiceFactory - com::sun::star::uno::Reference<XMultiServiceFactory> m_rServiceFactory; + com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> m_rServiceFactory; com::sun::star::uno::Reference<XInputStream> m_rInputStream; @@ -129,7 +125,7 @@ namespace XSLT public: // ctor... - LibXSLTTransformer(const com::sun::star::uno::Reference<XMultiServiceFactory> &r); + LibXSLTTransformer(const com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> &r); // XActiveDataSink virtual void SAL_CALL @@ -169,7 +165,7 @@ namespace XSLT ::std::map<const char*, OString> SAL_CALL getParameters(); - virtual com::sun::star::uno::Reference<XMultiServiceFactory> SAL_CALL + virtual com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> SAL_CALL getServiceFactory() { return m_rServiceFactory; } diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx index 7f90eedb695a..2ce6aba88f36 100644 --- a/filter/source/xsltfilter/XSLTFilter.cxx +++ b/filter/source/xsltfilter/XSLTFilter.cxx @@ -66,6 +66,8 @@ #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/task/XInteractionRequest.hpp> #include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp> +#include <com/sun/star/xml/xslt/XSLT2Transformer.hpp> +#include <com/sun/star/xml/xslt/XSLTTransformer.hpp> #include <xmloff/attrlist.hxx> @@ -96,14 +98,10 @@ namespace XSLT * them to an XSLT transformation service. XSLT transformation errors are * reported to XSLTFilter. * - * Currently, two implementations for the XSLT transformation service exist: - * a java based service (see XSLTransformer.java) and a libxslt based - * service (LibXSLTTransformer.cxx). - * - * The libxslt implementation will be used by default. - * - * If the value of the 2nd "UserData" parameter of the filter configuration is - * not empty, the service name given there will be used. + * Currently, our transformation service is libxslt based, so it + * only supports XSLT 1.0. There is a possibility to use XSLT 2.0 + * supporting service from an extension for a specific filter; the + * service must support com.sun.star.xml.xslt.XSLT2Transformer. */ class XSLTFilter : public WeakImplHelper4<XImportFilter, XExportFilter, XStreamListener, ExtendedDocumentHandlerAdapter> @@ -116,7 +114,7 @@ namespace XSLT // DocumentHandler interface of the css::xml::sax::Writer service css::uno::Reference<XOutputStream> m_rOutputStream; - css::uno::Reference<XActiveDataControl> m_tcontrol; + css::uno::Reference<xslt::XXSLTTransformer> m_tcontrol; oslCondition m_cTransformed; sal_Bool m_bTerminated; @@ -129,6 +127,8 @@ namespace XSLT OUString expandUrl(const OUString&); + css::uno::Reference<xslt::XXSLTTransformer> impl_createTransformer(const rtl::OUString& rTransformer, const Sequence<Any>& rArgs); + public: // ctor... @@ -200,6 +200,43 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False) return sExpandedUrl; } + css::uno::Reference<xslt::XXSLTTransformer> + XSLTFilter::impl_createTransformer(const rtl::OUString& rTransformer, const Sequence<Any>& rArgs) + { + css::uno::Reference<xslt::XXSLTTransformer> xTransformer; + + // check if the filter needs XSLT-2.0-capable transformer + // COMPATIBILITY: libreoffice 3.5/3.6 used to save the impl. + // name of the XSLT 2.0 transformation service there, so check + // for that too (it is sufficient to check that there is _a_ + // service name there) + if (rTransformer.toBoolean() || rTransformer.startsWith("com.sun.")) + { + try + { + xTransformer = xslt::XSLT2Transformer::create( + comphelper::getComponentContext(m_rServiceFactory), rArgs); + } + catch (const Exception&) + { + // TODO: put a dialog telling about the need to install + // xslt2-transformer extension here + SAL_WARN("filter.xslt", "could not create XSLT 2.0 transformer"); + throw; + } + } + + // instantiation of XSLT 2.0 transformer service failed, or the + // filter does not need it + if (!xTransformer.is()) + { + xTransformer = xslt::XSLTTransformer::create( + comphelper::getComponentContext(m_rServiceFactory), rArgs); + } + + return xTransformer; + } + void XSLTFilter::started() throw (RuntimeException) { @@ -300,11 +337,7 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False) nv.Value <<= OUString(INetURLObject(aURL).getBase()); args[2] <<= nv; - OUString serviceName("com.sun.star.comp.documentconversion.LibXSLTTransformer"); - if (!msUserData[1].isEmpty()) - serviceName = msUserData[1]; - - m_tcontrol = css::uno::Reference<XActiveDataControl> (m_rServiceFactory->createInstanceWithArguments(serviceName, args), UNO_QUERY); + m_tcontrol = impl_createTransformer(msUserData[1], args); OSL_ASSERT(xHandler.is()); OSL_ASSERT(xInputStream.is()); @@ -459,11 +492,7 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False) nv.Value <<= m_aExportBaseUrl; args[3] <<= nv; - OUString serviceName("com.sun.star.comp.documentconversion.LibXSLTTransformer"); - if (!msUserData[1].isEmpty()) - serviceName = msUserData[1]; - - m_tcontrol = css::uno::Reference<XActiveDataControl> (m_rServiceFactory->createInstanceWithArguments(serviceName, args), UNO_QUERY); + m_tcontrol = impl_createTransformer(msUserData[1], args); OSL_ASSERT(m_rOutputStream.is()); OSL_ASSERT(m_tcontrol.is()); @@ -536,7 +565,7 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False) // -------------------------------------- #define FILTER_SERVICE_NAME "com.sun.star.documentconversion.XSLTFilter" #define FILTER_IMPL_NAME "com.sun.star.comp.documentconversion.XSLTFilter" -#define TRANSFORMER_SERVICE_NAME "com.sun.star.documentconversion.LibXSLTTransformer" +#define TRANSFORMER_SERVICE_NAME "com.sun.star.xml.xslt.XSLTTransformer" #define TRANSFORMER_IMPL_NAME "com.sun.star.comp.documentconversion.LibXSLTTransformer" static css::uno::Reference<XInterface> SAL_CALL diff --git a/filter/source/xsltfilter/com/sun/star/comp/xsltfilter/XSLTransformer.java b/filter/source/xsltfilter/com/sun/star/comp/xsltfilter/XSLTransformer.java index 17ef2047353d..3ce044e882ef 100644 --- a/filter/source/xsltfilter/com/sun/star/comp/xsltfilter/XSLTransformer.java +++ b/filter/source/xsltfilter/com/sun/star/comp/xsltfilter/XSLTransformer.java @@ -68,6 +68,7 @@ import com.sun.star.registry.XRegistryKey; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; +import com.sun.star.xml.xslt.XXSLTTransformer; //Uno to java Adaptor import com.sun.star.lib.uno.adapter.XInputStreamToInputStreamAdapter; @@ -81,8 +82,8 @@ import net.sf.saxon.FeatureKeys; * component on demand (__getServiceFactory()). */ public class XSLTransformer - implements XTypeProvider, XServiceName, XServiceInfo, XActiveDataSink, - XActiveDataSource, XActiveDataControl, XInitialization, URIResolver, EntityResolver { + implements XTypeProvider, XServiceName, XServiceInfo, XXSLTTransformer, + URIResolver, EntityResolver { /** * This component provides java based XSL transformations @@ -125,7 +126,7 @@ public class XSLTransformer svcfactory = msf; } - public void initialize(Object[] values) throws com.sun.star.uno.Exception { + public void initialize(Object[] args) throws com.sun.star.uno.Exception { // some configurable debugging String statsfilepath = null; if ((statsfilepath = System.getProperty(STATSPROP)) != null) { @@ -139,6 +140,8 @@ public class XSLTransformer } } + Object[] values = (Object[]) args[0]; + // reading the values NamedValue nv = null; debug("The transformation's parameters as 'name = value' pairs:\n"); @@ -437,7 +440,7 @@ public class XSLTransformer } } } // --- component management interfaces... --- - private final static String _serviceName = "com.sun.star.comp.JAXTHelper"; + private final static String _serviceName = "com.sun.star.xml.xslt.XSLT2Transformer"; // Implement methods from interface XTypeProvider public byte[] getImplementationId() { @@ -487,7 +490,7 @@ public class XSLTransformer public static XSingleServiceFactory __getServiceFactory( String implName, XMultiServiceFactory multiFactory, XRegistryKey regKey) { XSingleServiceFactory xSingleServiceFactory = null; - if (implName.indexOf("XSLTransformer") != -1) { + if (implName.equals(XSLTransformer.class.getName())) { xSingleServiceFactory = FactoryHelper.getServiceFactory(XSLTransformer.class, _serviceName, multiFactory, regKey); } diff --git a/filter/source/xsltfilter/components.rdb b/filter/source/xsltfilter/components.rdb index 080cb7adb871..6014b82cad91 100644 --- a/filter/source/xsltfilter/components.rdb +++ b/filter/source/xsltfilter/components.rdb @@ -1,8 +1,8 @@ <?xml version="1.0"?> <components xmlns="http://openoffice.org/2010/uno-components"> <component loader="com.sun.star.loader.Java2" uri="./XSLTFilter.jar"> - <implementation name="XSLTransformer"> - <service name="com.sun.star.comp.JAXTHelper"/> + <implementation name="com.sun.star.comp.xsltfilter.XSLTransformer"> + <service name="com.sun.star.xml.xslt.XSLT2Transformer"/> </implementation> </component> </components> diff --git a/filter/source/xsltfilter/xsltfilter.component b/filter/source/xsltfilter/xsltfilter.component index b96a13fe8432..0495ad95ed2b 100644 --- a/filter/source/xsltfilter/xsltfilter.component +++ b/filter/source/xsltfilter/xsltfilter.component @@ -23,6 +23,6 @@ <service name="com.sun.star.documentconversion.XSLTFilter"/> </implementation> <implementation name="com.sun.star.comp.documentconversion.LibXSLTTransformer"> - <service name="com.sun.star.documentconversion.LibXSLTTransformer"/> + <service name="com.sun.star.xml.xslt.XSLTTransformer"/> </implementation> </component> |