summaryrefslogtreecommitdiff
path: root/filter/source/xmlfilterdetect
diff options
context:
space:
mode:
Diffstat (limited to 'filter/source/xmlfilterdetect')
-rw-r--r--filter/source/xmlfilterdetect/fdcomp.cxx182
-rw-r--r--filter/source/xmlfilterdetect/filterdetect.cxx312
-rw-r--r--filter/source/xmlfilterdetect/filterdetect.hxx168
-rw-r--r--filter/source/xmlfilterdetect/makefile.mk60
4 files changed, 722 insertions, 0 deletions
diff --git a/filter/source/xmlfilterdetect/fdcomp.cxx b/filter/source/xmlfilterdetect/fdcomp.cxx
new file mode 100644
index 000000000000..82731faf90fb
--- /dev/null
+++ b/filter/source/xmlfilterdetect/fdcomp.cxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+
+#include <stdio.h>
+
+
+
+#include <osl/mutex.hxx>
+
+#include <osl/thread.h>
+
+#include <cppuhelper/factory.hxx>
+
+
+
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+#endif
+
+
+
+#include "filterdetect.hxx"
+
+
+
+using namespace ::rtl;
+
+using namespace ::cppu;
+
+using namespace ::com::sun::star::uno;
+
+using namespace ::com::sun::star::lang;
+
+using namespace ::com::sun::star::registry;
+
+
+
+extern "C"
+
+{
+
+//==================================================================================================
+
+void SAL_CALL component_getImplementationEnvironment(
+
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+
+{
+
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+
+}
+
+//==================================================================================================
+
+sal_Bool SAL_CALL component_writeInfo(
+
+ void * /* pServiceManager */, void * pRegistryKey )
+
+{
+
+ if (pRegistryKey)
+
+ {
+
+ try
+
+ {
+
+ Reference< XRegistryKey > xNewKey(
+
+ reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( FilterDetect_getImplementationName() ) );
+
+ xNewKey = xNewKey->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES" )) );
+
+
+
+ const Sequence< OUString > & rSNL = FilterDetect_getSupportedServiceNames();
+
+ const OUString * pArray = rSNL.getConstArray();
+
+ for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
+
+ xNewKey->createKey( pArray[nPos] );
+
+
+
+ return sal_True;
+
+ }
+
+ catch (InvalidRegistryException &)
+
+ {
+
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+
+ }
+
+ }
+
+ return sal_False;
+
+}
+
+//==================================================================================================
+
+void * SAL_CALL component_getFactory(
+
+ const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
+
+{
+
+ void * pRet = 0;
+
+
+
+ OUString implName = OUString::createFromAscii( pImplName );
+
+ if ( pServiceManager && implName.equals(FilterDetect_getImplementationName()) )
+
+ {
+
+ Reference< XSingleServiceFactory > xFactory( createSingleFactory(
+
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+
+ OUString::createFromAscii( pImplName ),
+
+ FilterDetect_createInstance, FilterDetect_getSupportedServiceNames() ) );
+
+
+
+ if (xFactory.is())
+
+ {
+
+ xFactory->acquire();
+
+ pRet = xFactory.get();
+
+ }
+
+ }
+
+ return pRet;
+
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/xmlfilterdetect/filterdetect.cxx b/filter/source/xmlfilterdetect/filterdetect.cxx
new file mode 100644
index 000000000000..02079fe52c47
--- /dev/null
+++ b/filter/source/xmlfilterdetect/filterdetect.cxx
@@ -0,0 +1,312 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_filter.hxx"
+#include <iostream>
+#include <stdlib.h>
+#include <ctype.h>
+#include <stdio.h>
+#include "filterdetect.hxx"
+#include <osl/diagnose.h>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/XImportFilter.hpp>
+#include <com/sun/star/xml/XExportFilter.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/style/XStyleLoader.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+
+#include <ucbhelper/content.hxx>
+#include <ucbhelper/contentbroker.hxx>
+#include <ucbhelper/commandenvironment.hxx>
+#include <unotools/ucbhelper.hxx>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+
+
+
+using rtl::OUString;
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::Any;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::XInterface;
+using com::sun::star::uno::Exception;
+using com::sun::star::uno::RuntimeException;
+using com::sun::star::lang::XMultiServiceFactory;
+using com::sun::star::io::XActiveDataSource;
+using com::sun::star::io::XOutputStream;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::document::XExporter;
+using com::sun::star::document::XFilter;
+using com::sun::star::document::XExtendedFilterDetection;
+
+using com::sun::star::io::XInputStream;
+using com::sun::star::document::XImporter;
+using com::sun::star::xml::sax::InputSource;
+using com::sun::star::xml::sax::XDocumentHandler;
+using com::sun::star::xml::sax::XParser;
+using com::sun::star::task::XInteractionHandler;
+
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star;
+using namespace com::sun::star::container;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+
+
+Reference< com::sun::star::frame::XModel > xModel;
+
+::rtl::OUString SAL_CALL supportedByType( const ::rtl::OUString clipBoardFormat , const ::rtl::OString resultString, const ::rtl::OUString checkType);
+
+
+::rtl::OUString SAL_CALL FilterDetect::detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& aArguments ) throw( com::sun::star::uno::RuntimeException )
+{
+ ::rtl::OUString sTypeName;
+ ::rtl::OUString sUrl;
+ ::rtl::OUString originalTypeName;
+ Sequence<PropertyValue > lProps ;
+
+ com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xInStream;
+ ::rtl::OUString temp;
+ //OSL_ENSURE( sal_False, " starting Detect" );
+ const PropertyValue * pValue = aArguments.getConstArray();
+ sal_Int32 nLength;
+ ::rtl::OString resultString;
+
+ nLength = aArguments.getLength();
+ sal_Int32 location=nLength;
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ //OSL_ENSURE( sal_False, ::rtl::OUStringToOString(pValue[i].Name,RTL_TEXTENCODING_ASCII_US).getStr() );
+ if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "TypeName" ) ) )
+ {
+ //pValue[i].Value >>= originalTypeName;
+ location=i;
+ // OSL_ENSURE( sal_False, ::rtl::OUStringToOString(sTypeName,RTL_TEXTENCODING_ASCII_US).getStr() );
+
+ }
+ else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ) )
+ {
+
+ pValue[i].Value >>= sUrl;
+ //OSL_ENSURE( sal_False, ::rtl::OUStringToOString(sUrl,RTL_TEXTENCODING_ASCII_US).getStr() );
+
+ }
+ else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) )
+ {
+ pValue[i].Value >>= xInStream ;
+ }
+
+
+ }
+ try{
+ Reference< com::sun::star::ucb::XCommandEnvironment > xEnv;
+ if (!xInStream.is())
+ {
+ ::ucbhelper::Content aContent(sUrl,xEnv);
+ xInStream = aContent.openStream();
+ if (!xInStream.is())
+ {
+ return sTypeName;
+ }
+ }
+ com::sun::star::uno::Sequence< sal_Int8 > aData;
+ /* long nBytesToRead= */ xInStream->available();
+ xInStream->skipBytes (0);
+ long bytestRead =xInStream->readBytes (aData, 4000);
+ resultString=::rtl::OString((const sal_Char *)aData.getConstArray(),bytestRead) ;
+
+
+ // test typedetect code
+ Reference <XNameAccess> xTypeCont(mxMSF->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.TypeDetection" ))),UNO_QUERY);
+ Sequence < ::rtl::OUString > myTypes= xTypeCont->getElementNames();
+ nLength = myTypes.getLength();
+
+
+ sal_Int32 new_nlength=0;
+ sal_Int32 i = 0 ;
+ while( (i < nLength) && (sTypeName.equalsAscii("")))
+ {
+
+ Any elem = xTypeCont->getByName(myTypes[i]);
+ elem >>=lProps;
+ new_nlength = lProps.getLength();
+ sal_Int32 j =0;
+ while( j < new_nlength && sTypeName.equalsAscii(""))
+ {
+ ::rtl::OUString tmpStr;
+ lProps[j].Value >>=tmpStr;
+ if((lProps[j].Name.equalsAscii("ClipboardFormat")) && (!tmpStr.equalsAscii("")) )
+ {
+ sTypeName = supportedByType(tmpStr,resultString, myTypes[i]);
+ }
+ j++;
+ }
+ i++;
+ }
+ //end test
+
+ }
+ catch(Exception &)
+ {
+ OSL_ENSURE( sal_False, "An Exception occured while opening File stream" );
+ }
+ if(sTypeName.equalsAscii(""))
+ {
+ //sTypeName=::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("writer_Flat_XML_File"));
+ }
+ else
+ {
+ if ( location == aArguments.getLength() )
+ {
+ aArguments.realloc(nLength+1);
+ aArguments[location].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TypeName" ));
+ }
+ aArguments[location].Value <<=sTypeName;
+ }
+ // OSL_ENSURE( sal_False, ::rtl::OUStringToOString(sTypeName,RTL_TEXTENCODING_ASCII_US).getStr() );
+
+
+ return sTypeName;
+}
+
+
+
+::rtl::OUString SAL_CALL supportedByType( const ::rtl::OUString clipBoardFormat , const ::rtl::OString resultString, const ::rtl::OUString checkType)
+{
+
+ ::rtl::OUString sTypeName;
+ if((clipBoardFormat.match(OUString( RTL_CONSTASCII_USTRINGPARAM( "doctype:" )))))
+ {
+ ::rtl::OString tryStr = ::rtl::OUStringToOString(clipBoardFormat.copy(8),RTL_TEXTENCODING_ASCII_US).getStr();
+ // OSL_ENSURE( sal_False, tryStr);
+ if (resultString.indexOf(tryStr) >= 0)
+ {
+ sTypeName = checkType;
+ }
+ }
+ return sTypeName;
+}
+
+// XInitialization
+
+void SAL_CALL FilterDetect::initialize( const Sequence< Any >& aArguments )
+ throw (Exception, RuntimeException)
+{
+ Sequence < PropertyValue > aAnySeq;
+ sal_Int32 nLength = aArguments.getLength();
+ if ( nLength && ( aArguments[0] >>= aAnySeq ) )
+ {
+ const PropertyValue * pValue = aAnySeq.getConstArray();
+ nLength = aAnySeq.getLength();
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+
+ if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "Type" ) ) )
+ {
+ pValue[i].Value >>= msFilterName;
+
+ }
+ else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "UserData" ) ) )
+ {
+
+ pValue[i].Value >>= msUserData;
+
+ }
+ else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "TemplateName" ) ) )
+ {
+
+ pValue[i].Value>>=msTemplateName;
+ }
+
+ }
+ }
+}
+
+
+
+OUString FilterDetect_getImplementationName ()
+ throw (RuntimeException)
+{
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.filters.XMLFilterDetect" ) );
+}
+#define SERVICE_NAME1 "com.sun.star.document.ExtendedTypeDetection"
+
+sal_Bool SAL_CALL FilterDetect_supportsService( const OUString& ServiceName )
+ throw (RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME1 ) );
+}
+Sequence< OUString > SAL_CALL FilterDetect_getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ Sequence < OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
+ return aRet;
+}
+#undef SERVICE_NAME1
+#undef SERVICE_NAME2
+
+Reference< XInterface > SAL_CALL FilterDetect_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+ throw( Exception )
+{
+ return (cppu::OWeakObject*) new FilterDetect( rSMgr );
+}
+
+// XServiceInfo
+OUString SAL_CALL FilterDetect::getImplementationName( )
+ throw (RuntimeException)
+{
+ return FilterDetect_getImplementationName();
+}
+sal_Bool SAL_CALL FilterDetect::supportsService( const OUString& rServiceName )
+ throw (RuntimeException)
+{
+ return FilterDetect_supportsService( rServiceName );
+}
+Sequence< OUString > SAL_CALL FilterDetect::getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ return FilterDetect_getSupportedServiceNames();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/xmlfilterdetect/filterdetect.hxx b/filter/source/xmlfilterdetect/filterdetect.hxx
new file mode 100644
index 000000000000..244f952a8bfb
--- /dev/null
+++ b/filter/source/xmlfilterdetect/filterdetect.hxx
@@ -0,0 +1,168 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _FILTERDETECT_HXX
+#define _FILTERDETECT_HXX
+
+
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase5.hxx>
+
+#include <cppuhelper/implbase3.hxx>
+
+
+
+enum FilterType
+{
+ FILTER_IMPORT,
+ FILTER_EXPORT
+};
+
+/* This component will be instantiated for both import or export. Whether it calls
+ * setSourceDocument or setTargetDocument determines which Impl function the filter
+ * member calls */
+
+class FilterDetect : public cppu::WeakImplHelper3
+
+<
+
+
+ com::sun::star::document::XExtendedFilterDetection,
+
+ com::sun::star::lang::XInitialization,
+
+ com::sun::star::lang::XServiceInfo
+
+>
+
+{
+
+protected:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
+
+ ::rtl::OUString msFilterName;
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > msUserData;
+
+ ::rtl::OUString msTemplateName;
+
+
+
+ sal_Bool SAL_CALL exportImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+ sal_Bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+
+
+
+public:
+
+ FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
+
+ : mxMSF( rxMSF ) {}
+
+ virtual ~FilterDetect() {}
+
+
+
+
+
+
+ //XExtendedFilterDetection
+ virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& lDescriptor )
+ throw( com::sun::star::uno::RuntimeException );
+
+
+ // XInitialization
+
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+
+
+ // XServiceInfo
+
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+
+
+::rtl::OUString FilterDetect_getImplementationName()
+
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+
+
+sal_Bool SAL_CALL FilterDetect_supportsService( const ::rtl::OUString& ServiceName )
+
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL FilterDetect_getSupportedServiceNames( )
+
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+
+SAL_CALL FilterDetect_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+
+ throw ( ::com::sun::star::uno::Exception );
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/xmlfilterdetect/makefile.mk b/filter/source/xmlfilterdetect/makefile.mk
new file mode 100644
index 000000000000..d13c4af5f576
--- /dev/null
+++ b/filter/source/xmlfilterdetect/makefile.mk
@@ -0,0 +1,60 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME= filter
+TARGET= fl_xmlfilterdetect
+
+NO_BSYMBOLIC= TRUE
+ENABLE_EXCEPTIONS= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- defines ------------------------------------------------------
+
+CDEFS+=-DCOMPMOD_NAMESPACE=framework
+
+# --- Targets ------------------------------------------------------
+
+SHL1TARGET= xmlfd$(DLLPOSTFIX)
+SHL1IMPLIB= i$(SHL1TARGET)
+
+SHL1VERSIONMAP= $(SOLARENV)/src/component.map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME= $(SHL1TARGET)
+
+SHL1OBJS= $(SLO)$/fdcomp.obj \
+ $(SLO)$/filterdetect.obj
+
+SHL1STDLIBS= $(UCBHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+.INCLUDE : target.mk