ooo-build r11997 - in trunk: . patches/src680
- From: tml svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r11997 - in trunk: . patches/src680
- Date: Tue, 25 Mar 2008 14:30:28 +0000 (GMT)
Author: tml
Date: Tue Mar 25 14:30:27 2008
New Revision: 11997
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11997&view=rev
Log:
2008-03-25 Tor Lillqvist <tml novell com>
* patches/src680/odf-converter-ignore-writerfilter.diff: Add code
to check if an extentsion called odf-converter-* is deployed. In
that case don't use the built-in OOXML filters. Unlike in the
sled-10-sp1-ooo-build-2-4 branch, here this code is used
cross-platform, not just #ifdef WNT.
Modified:
trunk/ChangeLog
trunk/patches/src680/odf-converter-ignore-writerfilter.diff
Modified: trunk/patches/src680/odf-converter-ignore-writerfilter.diff
==============================================================================
--- trunk/patches/src680/odf-converter-ignore-writerfilter.diff (original)
+++ trunk/patches/src680/odf-converter-ignore-writerfilter.diff Tue Mar 25 14:30:27 2008
@@ -2,17 +2,40 @@
index e090c61..b5c97ce 100644
--- oox/source/core/filterdetect.cxx
+++ oox/source/core/filterdetect.cxx
-@@ -48,6 +48,9 @@
+@@ -41,7 +41,10 @@
+ #include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
+ #include <com/sun/star/xml/sax/XFastContextHandler.hpp>
+ #include <com/sun/star/xml/sax/XFastParser.hpp>
++#include <com/sun/star/deployment/thePackageManagerFactory.hpp>
+
++#include <ucbhelper/commandenvironment.hxx>
++
+ #include <comphelper/processfactory.hxx>
+ #include <comphelper/mediadescriptor.hxx>
+ #include <comphelper/storagehelper.hxx>
+@@ -48,6 +48,11 @@
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
+#include <unotools/bootstrap.hxx>
+#include <osl/file.hxx>
+
++#include <rtl/ustring.hxx>
++
#include "oox/helper/attributelist.hxx"
#include "oox/helper/helper.hxx"
#include "oox/core/fasttokenhandler.hxx"
-@@ -325,6 +328,19 @@ FilterDetect::~FilterDetect()
+@@ -291,6 +295,9 @@
+
+ private:
+ Reference< XMultiServiceFactory > mxFactory;
++#ifdef WNT
++ sal_Bool checkAgainstOdfConverterPackage( void );
++#endif
+ };
+
+ // ----------------------------------------------------------------------------
+@@ -325,6 +328,22 @@ FilterDetect::~FilterDetect()
OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& lDescriptor ) throw( RuntimeException )
{
@@ -29,18 +52,70 @@
+ return rtl::OUString();
+ }
+
++ if ( checkAgainstOdfConverterPackage() )
++ return rtl::OUString();
++
OUString aFilter;
Reference< XFastDocumentHandler > xHandler( new FilterDetectDocHandler(aFilter) );
+@@ -414,6 +426,47 @@
+ return FilterDetect_getSupportedServiceNames();
+ }
+
++sal_Bool FilterDetect::checkAgainstOdfConverterPackage( void)
++{
++ Reference< XPropertySet > xProps(mxFactory, UNO_QUERY);
++ Reference< XComponentContext > xContext(xProps->getPropertyValue(rtl::OUString::createFromAscii("DefaultContext")), UNO_QUERY);
++
++ Reference< ::com::sun::star::deployment::XPackageManager > xUserContext(
++ ::com::sun::star::deployment::thePackageManagerFactory::get (xContext)->getPackageManager( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("user") ) ) );
++ Reference< ::com::sun::star::deployment::XPackageManager > xSharedContext(
++ ::com::sun::star::deployment::thePackageManagerFactory::get (xContext)->getPackageManager( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("shared") ) ) );
++
++ Reference< ::com::sun::star::task::XInteractionHandler > xInteractionHandler = Reference< ::com::sun::star::task::XInteractionHandler > (
++ mxFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uui.InteractionHandler") ) ), UNO_QUERY );
++ ::ucbhelper::CommandEnvironment* pCommandEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< ::com::sun::star::ucb::XProgressHandler >() );
++
++ Reference< ::com::sun::star::ucb::XCommandEnvironment > xCmdEnv( static_cast< ::com::sun::star::ucb::XCommandEnvironment* >( pCommandEnv ), UNO_QUERY );
++
++ const Sequence< Reference< ::com::sun::star::deployment::XPackage > > userPackages(
++ xUserContext->getDeployedPackages( NULL, xCmdEnv ) );
++ const Sequence< Reference< ::com::sun::star::deployment::XPackage > > sharedPackages(
++ xSharedContext->getDeployedPackages( NULL, xCmdEnv ) );
++
++ const Sequence< Reference< ::com::sun::star::deployment::XPackage > > pkgsArray[2] = {
++ userPackages,
++ sharedPackages
++ };
++
++ for ( int i = 0; i < 2; i++ ) {
++ const Sequence< Reference< ::com::sun::star::deployment::XPackage > > pkgs = pkgsArray[i];
++
++ for ( int j = 0; j < pkgs.getLength(); j++ ) {
++ OUString fname = pkgs[j]->getName();
++ if ( fname.matchIgnoreAsciiCase( rtl::OUString::createFromAscii( "odf-converter-" ) ) ) {
++ printf( "Found match for odf-converter!\n");
++ fflush( stdout );
++ return sal_True;
++ }
++ }
++ }
++ return sal_False;
++}
++
+ // ============================================================================
+
+ } // namespace core
diff --git oox/util/makefile.mk oox/util/makefile.mk
index 69713a6..3c69e95 100644
--- oox/util/makefile.mk
+++ oox/util/makefile.mk
-@@ -74,6 +74,7 @@ SHL1STDLIBS= \
+@@ -74,6 +74,8 @@ SHL1STDLIBS= \
$(RTLLIB) \
$(SALLIB) \
$(BASEGFXLIB) \
+ $(UNOTOOLSLIB) \
++ $(UCBHELPERLIB) \
$(SAXLIB)
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
@@ -48,18 +123,29 @@
index e9030ac..9f910ae 100644
--- writerfilter/source/filter/WriterFilterDetection.cxx
+++ writerfilter/source/filter/WriterFilterDetection.cxx
-@@ -58,6 +58,10 @@
+@@ -58,6 +58,21 @@
#ifndef _UNOTOOLS_STREAMHELPER_HXX_
#include <unotools/ucbstreamhelper.hxx>
#endif
+
++#include <com/sun/star/beans/XPropertySet.hpp>
++#include <com/sun/star/lang/XMultiServiceFactory.hpp>
++#include <com/sun/star/deployment/thePackageManagerFactory.hpp>
++
++#include <com/sun/star/uno/Sequence.hxx>
++
++#include <ucbhelper/commandenvironment.hxx>
++
++#include <comphelper/processfactory.hxx>
++
+#include <unotools/bootstrap.hxx>
++
+#include <osl/file.hxx>
+
using namespace ::rtl;
using namespace ::cppu;
using namespace ::com::sun::star;
-@@ -91,6 +95,19 @@ OUString WriterFilterDetection_getImplementationName () throw (uno::RuntimeExcep
+@@ -91,6 +95,57 @@ OUString WriterFilterDetection_getImplementationName () throw (uno::RuntimeExcep
OUString WriterFilterDetection::detect( uno::Sequence< beans::PropertyValue >& rDescriptor )
throw( uno::RuntimeException )
{
@@ -76,6 +162,44 @@
+ return rtl::OUString();
+ }
+
++ uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> xMS(::comphelper::getProcessServiceFactory(), uno::UNO_QUERY);
++ uno::Reference< beans::XPropertySet > xProps(xMS, uno::UNO_QUERY);
++ uno::Reference< uno::XComponentContext > xContext(xProps->getPropertyValue(rtl::OUString::createFromAscii("DefaultContext")), uno::UNO_QUERY);
++
++ uno::Reference< deployment::XPackageManager > xUserContext(
++ deployment::thePackageManagerFactory::get (xContext)->getPackageManager( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("user") ) ) );
++ uno::Reference< ::com::sun::star::deployment::XPackageManager > xSharedContext(
++ deployment::thePackageManagerFactory::get (xContext)->getPackageManager( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("shared") ) ) );
++
++ uno::Reference< ::com::sun::star::task::XInteractionHandler > xInteractionHandler = uno::Reference< task::XInteractionHandler > (
++ xMS->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uui.InteractionHandler") ) ), uno::UNO_QUERY );
++ ::ucbhelper::CommandEnvironment* pCommandEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, uno::Reference< ucb::XProgressHandler >() );
++
++ uno::Reference< ucb::XCommandEnvironment > xCmdEnv( static_cast< ::com::sun::star::ucb::XCommandEnvironment* >( pCommandEnv ), uno::UNO_QUERY );
++
++ const uno::Sequence< uno::Reference< deployment::XPackage > > userPackages(
++ xUserContext->getDeployedPackages( NULL, xCmdEnv ) );
++ const uno::Sequence< uno::Reference< deployment::XPackage > > sharedPackages(
++ xSharedContext->getDeployedPackages( NULL, xCmdEnv ) );
++
++ const uno::Sequence< uno::Reference< deployment::XPackage > > pkgsArray[2] = {
++ userPackages,
++ sharedPackages
++ };
++
++ for ( int i = 0; i < 2; i++ ) {
++ const uno::Sequence< uno::Reference< deployment::XPackage > > pkgs = pkgsArray[i];
++
++ for ( int j = 0; j < pkgs.getLength(); j++ ) {
++ OUString fname = pkgs[j]->getName();
++ if ( fname.matchIgnoreAsciiCase( rtl::OUString::createFromAscii( "odf-converter-" ) ) ) {
++ printf( "Found match for odf-converter!\n");
++ fflush( stdout );
++ return rtl::OUString();
++ }
++ }
++ }
++
OUString sTypeName;
bool bWord = false;
sal_Int32 nPropertyCount = rDescriptor.getLength();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]