ooo-build r11968 - in branches/sled-10-sp1-ooo-build-2-4: . patches/src680



Author: tml
Date: Thu Mar 20 22:35:34 2008
New Revision: 11968
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11968&view=rev

Log:
2008-03-21  Tor Lillqvist  <tml novell com>

	Novell Edition Windows build OOo-2.4.0-13 at this point.

2008-03-20  Tor Lillqvist  <tml novell com>

	* patches/src680/odf-converter-ignore-writerfilter.diff: Add code
	to check if an odf-converter-* extension is deployed, and in that
	case don't use the built-in OOXML filters. It is inside #ifdef WNT
	as the old code in this patch that checks for program/OdfConverter
	being present should be enough for the Linux case, at least when
	the odf-converter executable is called OdfConverter and it is
	installed through Linux package management directly into the
	OOo program directory.



Modified:
   branches/sled-10-sp1-ooo-build-2-4/ChangeLog
   branches/sled-10-sp1-ooo-build-2-4/patches/src680/odf-converter-ignore-writerfilter.diff

Modified: branches/sled-10-sp1-ooo-build-2-4/patches/src680/odf-converter-ignore-writerfilter.diff
==============================================================================
--- branches/sled-10-sp1-ooo-build-2-4/patches/src680/odf-converter-ignore-writerfilter.diff	(original)
+++ branches/sled-10-sp1-ooo-build-2-4/patches/src680/odf-converter-ignore-writerfilter.diff	Thu Mar 20 22:35:34 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,24 @@ FilterDetect::~FilterDetect()
  
  OUString SAL_CALL FilterDetect::detect( Sequence< PropertyValue >& lDescriptor ) throw( RuntimeException )
  {
@@ -29,18 +52,74 @@
 +            return rtl::OUString();
 +    }
 +
++#ifdef WNT
++	if ( checkAgainstOdfConverterPackage() )
++		return rtl::OUString();
++#endif
++
      OUString aFilter;
  
      Reference< XFastDocumentHandler > xHandler( new FilterDetectDocHandler(aFilter) );
+@@ -414,6 +426,49 @@
+     return FilterDetect_getSupportedServiceNames();
+ }
+ 
++#ifdef WNT
++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;
++}
++#endif
++
+ // ============================================================================
+ 
+ } // 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 +127,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,59 @@ OUString WriterFilterDetection_getImplementationName () throw (uno::RuntimeExcep
  OUString WriterFilterDetection::detect( uno::Sequence< beans::PropertyValue >& rDescriptor )
     throw( uno::RuntimeException )
  {
@@ -76,6 +166,46 @@
 +            return rtl::OUString();
 +    }
 +
++#ifdef WNT
++	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();
++			}
++		}
++	}
++#endif
++
      OUString sTypeName;
      bool bWord = false;
      sal_Int32 nPropertyCount = rDescriptor.getLength();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]