[ooo-build-commit] scratch/ocrimport

Radek Doulík rodo at kemper.freedesktop.org
Thu Jul 2 11:22:16 PDT 2009


 scratch/ocrimport/Addons.xcu             |   38 +
 scratch/ocrimport/CalcListener.cxx       |   42 +
 scratch/ocrimport/CalcWindowState.xcu    |   21 
 scratch/ocrimport/Jobs.xcu               |   23 +
 scratch/ocrimport/ListenerHelper.cxx     |  147 ++++++
 scratch/ocrimport/ListenerHelper.h       |   82 +++
 scratch/ocrimport/MyJob.cxx              |  112 +++++
 scratch/ocrimport/MyJob.h                |  150 ++++++
 scratch/ocrimport/MyListener.cxx         |  170 +++++++
 scratch/ocrimport/MyListener.h           |   96 ++++
 scratch/ocrimport/MyProtocolHandler.cxx  |  665 +++++++++++++++++++++++++++++++
 scratch/ocrimport/MyProtocolHandler.h    |  141 ++++++
 scratch/ocrimport/ProtocolHandler.xcu    |   10 
 scratch/ocrimport/WriterListener.cxx     |   50 ++
 scratch/ocrimport/WriterWindowState.xcu  |   21 
 scratch/ocrimport/bitmaps/logo_big.png   |binary
 scratch/ocrimport/bitmaps/logo_small.png |binary
 scratch/ocrimport/delzip                 |    1 
 scratch/ocrimport/description.xml        |   26 +
 scratch/ocrimport/exports.cxx            |  123 +++++
 scratch/ocrimport/exports.map            |    9 
 scratch/ocrimport/help/component.txt     |    3 
 scratch/ocrimport/logo_big.png           |binary
 scratch/ocrimport/logo_small.png         |binary
 scratch/ocrimport/makefile.mk            |  209 +++++++++
 scratch/ocrimport/manifest.xml           |   17 
 26 files changed, 2156 insertions(+)

New commits:
commit 240902ea7a8f223ce4f6ba98a8031ceb1dcebbea
Author: Radek Doulik <rodo at novell.com>
Date:   Thu Jul 2 20:20:43 2009 +0200

    initial import of Jonathan Winandy's work on ocrimport extension
    
    * scratch/ocrimport/Addons.xcu:
    * scratch/ocrimport/CalcListener.cxx:
    * scratch/ocrimport/CalcWindowState.xcu:
    * scratch/ocrimport/Jobs.xcu:
    * scratch/ocrimport/ListenerHelper.cxx:
    * scratch/ocrimport/ListenerHelper.h:
    * scratch/ocrimport/MyJob.cxx:
    * scratch/ocrimport/MyJob.h:
    * scratch/ocrimport/MyListener.cxx:
    * scratch/ocrimport/MyListener.h:
    * scratch/ocrimport/MyProtocolHandler.cxx:
    * scratch/ocrimport/MyProtocolHandler.h:
    * scratch/ocrimport/ProtocolHandler.xcu:
    * scratch/ocrimport/WriterListener.cxx:
    * scratch/ocrimport/WriterWindowState.xcu:
    * scratch/ocrimport/bitmaps/logo_big.png:
    * scratch/ocrimport/bitmaps/logo_small.png:
    * scratch/ocrimport/delzip:
    * scratch/ocrimport/description.xml:
    * scratch/ocrimport/exports.cxx:
    * scratch/ocrimport/exports.map:
    * scratch/ocrimport/help/component.txt:
    * scratch/ocrimport/logo_big.png:
    * scratch/ocrimport/logo_small.png:
    * scratch/ocrimport/makefile.mk:
    * scratch/ocrimport/manifest.xml:

diff --git a/scratch/ocrimport/Addons.xcu b/scratch/ocrimport/Addons.xcu
new file mode 100644
index 0000000..ba633bc
--- /dev/null
+++ b/scratch/ocrimport/Addons.xcu
@@ -0,0 +1,38 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Addons" oor:package="org.openoffice.Office">
+  <node oor:name="AddonUI">
+      <node oor:name="OfficeMenuBar">
+      <node oor:name="com.jonathanwiandy.foo-ext:Menu" oor:op="replace">
+        <prop oor:name="Title" oor:type="xs:string">
+          <value/>
+          <value xml:lang="en">OCR</value>
+        </prop>
+        <prop oor:name="Target" oor:type="xs:string">
+          <value>_self</value>
+        </prop>
+        <prop oor:name="ImageIdentifier" oor:type="xs:string">
+          <value/>
+        </prop>
+        <node oor:name="Submenu">
+          <node oor:name="m1" oor:op="replace">
+            <prop oor:name="URL" oor:type="xs:string">
+              <value>vnd.demo.complextoolbarcontrols.demoaddon:Command1</value>
+            </prop>
+            <prop oor:name="ImageIdentifier" oor:type="xs:string">
+              <value/>
+            </prop>
+            <prop oor:name="Target" oor:type="xs:string">
+              <value>_self</value>
+            </prop>
+            <prop oor:name="Title" oor:type="xs:string">
+              <value/>
+              <value xml:lang="en">Start OCR...</value>
+            </prop>
+          </node>
+          <node oor:name="m3" oor:op="replace">
+          </node>
+        </node>
+      </node>
+    </node>
+  </node>
+</oor:component-data>
diff --git a/scratch/ocrimport/CalcListener.cxx b/scratch/ocrimport/CalcListener.cxx
new file mode 100644
index 0000000..3b09715
--- /dev/null
+++ b/scratch/ocrimport/CalcListener.cxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CalcListener.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+#include "MyListener.h"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+void SAL_CALL CalcListener::notifyEvent( const ::com::sun::star::document::EventObject& aEvent ) throw (com::sun::star::uno::RuntimeException)
+{
+}
+
+void SAL_CALL CalcListener::disposing( const com::sun::star::lang::EventObject& aSource ) throw( com::sun::star::uno::RuntimeException )
+{
+}
+
diff --git a/scratch/ocrimport/CalcWindowState.xcu b/scratch/ocrimport/CalcWindowState.xcu
new file mode 100644
index 0000000..dbb7946
--- /dev/null
+++ b/scratch/ocrimport/CalcWindowState.xcu
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="CalcWindowState" oor:package="org.openoffice.Office.UI">
+ <node oor:name="UIElements">
+  <node oor:name="States">
+   <node oor:name="private:resource/toolbar/addon_com.sun.star.comp.framework.addon.complextoolbarcontrols" oor:op="replace">
+    <prop oor:name="ContextSensitive" oor:type="xs:boolean">
+     <value>false</value>
+    </prop>
+    <prop oor:name="UIName" oor:type="xs:string">
+     <value xml:lang="en-US">Complex Toolbar Controls</value>
+    </prop>
+    <prop oor:name="Visible" oor:type="xs:boolean">
+     <value>true</value>
+    </prop>
+    <prop oor:name="Docked" oor:type="xs:boolean">
+     <value>false</value>
+    </prop>
+   </node>
+  </node>
+ </node>
+</oor:component-data>
\ No newline at end of file
diff --git a/scratch/ocrimport/Jobs.xcu b/scratch/ocrimport/Jobs.xcu
new file mode 100644
index 0000000..3641765
--- /dev/null
+++ b/scratch/ocrimport/Jobs.xcu
@@ -0,0 +1,23 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<oor:component-data oor:name="Jobs" oor:package="org.openoffice.Office" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	<node oor:name="Jobs">
+                <node oor:name="DemoAddOn" oor:op="replace">
+			<prop oor:name="Service">
+                <value>vnd.demo.NewDocListener</value>
+			</prop>
+		</node>
+	</node>
+	<node oor:name="Events">
+        <node oor:name="OnNew" oor:op="replace">
+			<node oor:name="JobList">
+                                <node oor:name="DemoAddOn" oor:op="replace"/>
+			</node>
+		</node>
+        <node oor:name="OnLoad" oor:op="replace">
+            <node oor:name="JobList">
+                <node oor:name="DemoAddOn" oor:op="replace"/>
+            </node>
+        </node>
+	</node>
+</oor:component-data>
diff --git a/scratch/ocrimport/ListenerHelper.cxx b/scratch/ocrimport/ListenerHelper.cxx
new file mode 100644
index 0000000..264e1a1
--- /dev/null
+++ b/scratch/ocrimport/ListenerHelper.cxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ListenerHelper.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+#include "ListenerHelper.h"
+
+using com::sun::star::frame::XFrame;
+using com::sun::star::frame::XDispatch;
+using com::sun::star::frame::XStatusListener;
+using com::sun::star::lang::XEventListener;
+using com::sun::star::lang::EventObject;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::RuntimeException;
+using com::sun::star::frame::FeatureStateEvent;
+
+static AllListeners aListeners;
+
+void ListenerHelper::AddListener( 
+	const Reference < XFrame >& xFrame, 
+	const Reference < XStatusListener > xControl, 
+	const ::rtl::OUString& aCommand )
+{
+	sal_uInt32 i=0;
+    sal_uInt32 nSize = aListeners.size();
+	for ( i=0; i<nSize; i++ )
+		if ( aListeners[i].xFrame == xFrame )
+			break;
+
+	OSL_ENSURE( i<nSize, "No dispatch found for this listener!" );
+	aListeners[i].aContainer[aCommand].push_back( xControl );
+}
+
+void ListenerHelper::RemoveListener(
+	const Reference < XFrame >& xFrame, 
+	const Reference < XStatusListener > xControl, 
+	const ::rtl::OUString& aCommand )
+{
+	sal_uInt32 nSize = aListeners.size();
+	for ( sal_uInt32 i=0; i<nSize; i++ )
+	{
+		if ( aListeners[i].xFrame == xFrame )
+		{
+			StatusListeners& aL = aListeners[i].aContainer[aCommand];
+			StatusListeners::iterator aIter = aL.begin();
+			while ( aIter != aL.end() )
+			{
+				if ( (*aIter) == xControl )
+				{
+					aL.erase( aIter );
+					break;
+				}		
+
+				aIter++;
+			}
+		}
+	}
+}
+
+void ListenerHelper::Notify( 
+		const Reference < XFrame >& xFrame, 
+		const ::rtl::OUString& aCommand,
+		FeatureStateEvent& rEvent )
+{
+	sal_uInt32 nSize = aListeners.size();
+	for ( sal_uInt32 i=0; i<nSize; i++ )
+	{
+		if ( aListeners[i].xFrame == xFrame )
+		{
+			rEvent.Source = aListeners[i].xDispatch;
+			StatusListeners& aL = aListeners[i].aContainer[aCommand];
+			StatusListeners::iterator aIter = aL.begin();
+			while ( aIter != aL.end() )
+			{
+				(*aIter)->statusChanged( rEvent );
+				aIter++;
+			}
+		}
+	}
+}
+
+com::sun::star::uno::Reference < XDispatch > ListenerHelper::GetDispatch( 
+		const Reference < XFrame >& xFrame, 
+		const ::rtl::OUString& aCommand )
+{
+	sal_uInt32 nSize = aListeners.size();
+	for ( sal_uInt32 i=0; i<nSize; i++ )
+	{
+		if ( aListeners[i].xFrame == xFrame )
+			return aListeners[i].xDispatch;
+	}
+
+	return Reference < XDispatch >();
+}
+
+void ListenerHelper::AddDispatch( 	
+		const Reference < XDispatch > xDispatch,
+		const Reference < XFrame >& xFrame, 
+		const ::rtl::OUString& aCommand )
+{
+	ListenerItem aItem; 
+	aItem.xFrame = xFrame;
+	aItem.xDispatch = xDispatch;
+	aListeners.push_back( aItem );			
+	xFrame->addEventListener( new ListenerItemEventListener( xFrame ) );
+}
+
+void SAL_CALL ListenerItemEventListener::disposing( const EventObject& aEvent) throw (RuntimeException)
+{
+	AllListeners::iterator aIter = aListeners.begin();
+	while ( aIter != aListeners.end() )
+	{
+		if ( (*aIter).xFrame == mxFrame )
+		{
+			aListeners.erase( aIter );
+			break;
+		}		
+
+		aIter++;
+	}
+}
diff --git a/scratch/ocrimport/ListenerHelper.h b/scratch/ocrimport/ListenerHelper.h
new file mode 100644
index 0000000..53994c5
--- /dev/null
+++ b/scratch/ocrimport/ListenerHelper.h
@@ -0,0 +1,82 @@
+#include <vector>
+#include <hash_map>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XStatusListener.hpp>
+#include <com/sun/star/frame/FeatureStateEvent.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+
+#include <rtl/ustring.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+struct hashObjectName_Impl
+{
+	size_t operator()(const ::rtl::OUString Str) const
+	{
+		return (size_t)Str.hashCode();
+	}
+};
+
+struct eqObjectName_Impl
+{
+	sal_Bool operator()(const ::rtl::OUString Str1, const ::rtl::OUString Str2) const
+	{
+		return ( Str1 == Str2 );
+	}
+};
+
+typedef std::vector < com::sun::star::uno::Reference < com::sun::star::frame::XStatusListener > > StatusListeners;
+
+typedef std::hash_map
+<
+	::rtl::OUString,
+	StatusListeners,
+	hashObjectName_Impl,
+	eqObjectName_Impl
+>
+ListenerMap;
+
+// For every frame there is *one* Dispatch object for all possible commands
+// this struct contains an array of listeners for every supported command
+// these arrays are accessed by a hash_map (with the command string as index)
+struct ListenerItem
+{
+	ListenerMap	aContainer;
+	::com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > xDispatch;
+	::com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame;
+};
+
+typedef std::vector < ListenerItem > AllListeners;
+
+class ListenerHelper
+{
+public:
+	void AddListener(
+		const com::sun::star::uno::Reference < com::sun::star::frame::XFrame >& xFrame,
+		const com::sun::star::uno::Reference < com::sun::star::frame::XStatusListener > xControl,
+		const ::rtl::OUString& aCommand );
+	void RemoveListener(
+		const com::sun::star::uno::Reference < com::sun::star::frame::XFrame >& xFrame,
+		const com::sun::star::uno::Reference < com::sun::star::frame::XStatusListener > xControl,
+		const ::rtl::OUString& aCommand );
+	void Notify(
+		const com::sun::star::uno::Reference < com::sun::star::frame::XFrame >& xFrame,
+		const ::rtl::OUString& aCommand,
+		com::sun::star::frame::FeatureStateEvent& rEvent );
+	com::sun::star::uno::Reference < com::sun::star::frame::XDispatch > GetDispatch(
+		const com::sun::star::uno::Reference < com::sun::star::frame::XFrame >& xFrame,
+		const ::rtl::OUString& aCommand );
+	void AddDispatch(
+		const com::sun::star::uno::Reference < com::sun::star::frame::XDispatch > xDispatch,
+		const com::sun::star::uno::Reference < com::sun::star::frame::XFrame >& xFrame,
+		const ::rtl::OUString& aCommand );
+};
+
+class ListenerItemEventListener : public cppu::WeakImplHelper1 < ::com::sun::star::lang::XEventListener >
+{
+	::com::sun::star::uno::Reference< com::sun::star::frame::XFrame > mxFrame;
+public:
+	ListenerItemEventListener( const com::sun::star::uno::Reference < com::sun::star::frame::XFrame >& xFrame)
+		: mxFrame(xFrame)
+	{}
+	virtual void SAL_CALL disposing( const com::sun::star::lang::EventObject& aEvent ) throw (com::sun::star::uno::RuntimeException);
+};
diff --git a/scratch/ocrimport/MyJob.cxx b/scratch/ocrimport/MyJob.cxx
new file mode 100644
index 0000000..38cd793
--- /dev/null
+++ b/scratch/ocrimport/MyJob.cxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: MyJob.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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 _MyJob_HXX
+#include "MyJob.h"
+#endif
+#include <osl/diagnose.h>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/document/XEventBroadcaster.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::IllegalArgumentException;
+using com::sun::star::lang::XMultiServiceFactory;
+using com::sun::star::beans::NamedValue;
+using com::sun::star::document::XEventBroadcaster;
+
+Any SAL_CALL MyJob::execute( const Sequence< NamedValue >& aArguments )
+	throw ( IllegalArgumentException, Exception, RuntimeException )
+{
+	Reference < XEventBroadcaster > xBrd( mxMSF->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.GlobalEventBroadcaster") ), UNO_QUERY );
+	Reference < com::sun::star::document::XEventListener > xLstner( mxMSF->createInstance(
+		::rtl::OUString::createFromAscii("com.sun.star.comp.Office.MyListener" ) ), UNO_QUERY );
+	if ( xBrd.is() )
+		xBrd->addEventListener( xLstner );
+	return Any();
+}
+
+OUString MyJob_getImplementationName ()
+	throw (RuntimeException)
+{
+	return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Office.MyJob" ) );
+}
+
+#define SERVICE_NAME "com.sun.star.task.Job"
+
+sal_Bool SAL_CALL MyJob_supportsService( const OUString& ServiceName )
+	throw (RuntimeException)
+{
+    return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
+}
+
+Sequence< OUString > SAL_CALL MyJob_getSupportedServiceNames(  )
+	throw (RuntimeException)
+{
+	Sequence < OUString > aRet(1);
+    OUString* pArray = aRet.getArray();
+    pArray[0] =  OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
+    return aRet;
+}
+
+#undef SERVICE_NAME
+
+Reference< XInterface > SAL_CALL MyJob_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+	throw( Exception )
+{
+	return (cppu::OWeakObject*) new MyJob( rSMgr );
+}
+
+// XServiceInfo
+OUString SAL_CALL MyJob::getImplementationName(  )
+	throw (RuntimeException)
+{
+	return MyJob_getImplementationName();
+}
+
+sal_Bool SAL_CALL MyJob::supportsService( const OUString& rServiceName )
+	throw (RuntimeException)
+{
+    return MyJob_supportsService( rServiceName );
+}
+
+Sequence< OUString > SAL_CALL MyJob::getSupportedServiceNames(  )
+	throw (RuntimeException)
+{
+    return MyJob_getSupportedServiceNames();
+}
diff --git a/scratch/ocrimport/MyJob.h b/scratch/ocrimport/MyJob.h
new file mode 100644
index 0000000..58916bc
--- /dev/null
+++ b/scratch/ocrimport/MyJob.h
@@ -0,0 +1,150 @@
+#ifndef _MyJob_HXX
+
+#define _MyJob_HXX
+
+
+
+#ifndef _COM_SUN_STAR_TASK_XJOB_HPP_
+
+#include <com/sun/star/task/XJob.hpp>
+
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#endif
+
+#ifndef _CPPUHELPER_IMPLBASE2_HXX_
+
+#include <cppuhelper/implbase2.hxx>
+
+#endif
+
+
+
+namespace com
+
+{
+
+	namespace sun
+
+	{
+
+		namespace star
+
+		{
+
+			namespace frame
+
+			{
+
+				class XModel;
+
+				class XFrame;
+
+			}
+
+
+
+			namespace beans
+
+			{
+
+				struct NamedValue;
+
+			}
+
+		}
+
+	}
+
+}
+
+
+
+class MyJob : public cppu::WeakImplHelper2
+
+<
+
+	com::sun::star::task::XJob,
+
+	com::sun::star::lang::XServiceInfo
+
+>
+
+{
+
+private:
+
+    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+
+
+
+public:
+
+	MyJob( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
+
+        : mxMSF( rxMSF ) {}
+
+	virtual ~MyJob() {}
+
+
+
+	// XJob
+
+	virtual ::com::sun::star::uno::Any SAL_CALL execute(
+
+		const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments )
+
+		throw (::com::sun::star::lang::IllegalArgumentException, ::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 MyJob_getImplementationName()
+
+	throw ( ::com::sun::star::uno::RuntimeException );
+
+
+
+sal_Bool SAL_CALL MyJob_supportsService( const ::rtl::OUString& ServiceName )
+
+	throw ( ::com::sun::star::uno::RuntimeException );
+
+
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL MyJob_getSupportedServiceNames(  )
+
+	throw ( ::com::sun::star::uno::RuntimeException );
+
+
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+
+SAL_CALL MyJob_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+
+	throw ( ::com::sun::star::uno::Exception );
+
+
+
+#endif
+
diff --git a/scratch/ocrimport/MyListener.cxx b/scratch/ocrimport/MyListener.cxx
new file mode 100644
index 0000000..50e6947
--- /dev/null
+++ b/scratch/ocrimport/MyListener.cxx
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: MyListener.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+#include "MyListener.h"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+
+namespace css = ::com::sun::star;
+
+/*-----------------------------------------------------
+	20.11.2003 11:31
+-----------------------------------------------------*/
+MyListener::MyListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+	: m_xSMGR(xSMGR)
+{}
+
+/*-----------------------------------------------------
+	20.11.2003 11:32
+-----------------------------------------------------*/
+MyListener::~MyListener()
+{}
+
+/*-----------------------------------------------------
+    20.11.2003 12:04
+-----------------------------------------------------*/
+css::uno::Any SAL_CALL MyListener::execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments)
+	throw (css::lang::IllegalArgumentException,
+		   css::uno::Exception,
+		   css::uno::RuntimeException)
+{
+    css::uno::Sequence< css::beans::NamedValue > lEnv;
+
+          sal_Int32               i = 0;
+          sal_Int32               c = lArguments.getLength();
+    const css::beans::NamedValue* p = lArguments.getConstArray();
+    for (i=0; i<c; ++i)
+	{
+        if (p[i].Name.equalsAscii("Environment"))
+        {
+            p[i].Value >>= lEnv;
+            break;
+        }
+	}
+
+    css::uno::Reference< css::frame::XModel > xModel;
+
+    c = lEnv.getLength();
+    p = lEnv.getConstArray();
+    for (i=0; i<c; ++i)
+    {
+        if (p[i].Name.equalsAscii("Model"))
+        {
+            p[i].Value >>= xModel;
+            break;
+        }
+        if (p[i].Name.equalsAscii("Frame"))
+        {
+			css::uno::Reference< css::frame::XController > xController;
+			css::uno::Reference< css::frame::XFrame >      xFrame;
+            p[i].Value >>= xFrame;
+			if (xFrame.is())
+				xController = xFrame->getController();
+			if (xController.is())
+				xModel = xController->getModel();
+            break;
+        }
+    }
+
+	if (!xModel.is())
+		return css::uno::Any();
+
+    css::uno::Reference< css::lang::XServiceInfo > xInfo(xModel, css::uno::UNO_QUERY);
+    sal_Bool bCalc   = xInfo->supportsService(::rtl::OUString::createFromAscii("com.sun.star.sheet.SpreadsheetDocument"));
+    sal_Bool bWriter = (
+                         xInfo->supportsService(::rtl::OUString::createFromAscii("com.sun.star.text.TextDocument"  )) &&
+                        !xInfo->supportsService(::rtl::OUString::createFromAscii("com.sun.star.text.WebDocument"   )) &&
+                        !xInfo->supportsService(::rtl::OUString::createFromAscii("com.sun.star.text.GlobalDocument"))
+                       );
+
+    // Wir interessieren uns nur für Writer und Calc. Werden hier aber für
+    // alle neu geöffneten Dokumente benachrichtigt ...
+    if (!bCalc && !bWriter)
+		return css::uno::Any();
+
+    void* pListener = 0;
+    if (bCalc)
+        pListener = (void*)(new CalcListener(m_xSMGR));
+    else
+    if (bWriter)
+        pListener = (void*)(new WriterListener(m_xSMGR));
+
+    css::uno::Reference< css::document::XEventListener >    xDocListener     (static_cast< css::document::XEventListener* >(pListener), css::uno::UNO_QUERY);
+    css::uno::Reference< css::document::XEventBroadcaster > xDocBroadcaster  (xModel   , css::uno::UNO_QUERY);
+
+    xDocBroadcaster->addEventListener(xDocListener);
+
+	return css::uno::Any();
+}
+
+/*-----------------------------------------------------
+    20.11.2003 12:13
+-----------------------------------------------------*/
+::rtl::OUString SAL_CALL MyListener::getImplementationName()
+    throw (css::uno::RuntimeException)
+{
+    return ::rtl::OUString::createFromAscii(MYLISTENER_IMPLEMENTATIONNAME);
+}
+
+/*-----------------------------------------------------
+    20.11.2003 12:13
+-----------------------------------------------------*/
+css::uno::Sequence< ::rtl::OUString > SAL_CALL MyListener::getSupportedServiceNames()
+    throw (css::uno::RuntimeException)
+{
+    css::uno::Sequence< ::rtl::OUString > lNames(1);
+    lNames[0] = ::rtl::OUString::createFromAscii(MYLISTENER_SERVICENAME);
+    return lNames;
+}
+
+/*-----------------------------------------------------
+    20.11.2003 12:14
+-----------------------------------------------------*/
+sal_Bool SAL_CALL MyListener::supportsService(const ::rtl::OUString& sServiceName)
+    throw (css::uno::RuntimeException)
+{
+    return (
+            sServiceName.equalsAscii(MYLISTENER_SERVICENAME) ||
+            sServiceName.equalsAscii("com.sun.star.task.Job"    )
+           );
+}
+
+/*-----------------------------------------------------
+	20.11.2003 11:31
+-----------------------------------------------------*/
+css::uno::Reference< css::uno::XInterface > MyListener::st_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR)
+{
+	MyListener* pListener = new MyListener(xSMGR);
+	css::uno::Reference< css::uno::XInterface > xListener(static_cast< css::task::XJob* >(pListener), css::uno::UNO_QUERY);
+	return xListener;
+}
diff --git a/scratch/ocrimport/MyListener.h b/scratch/ocrimport/MyListener.h
new file mode 100644
index 0000000..a0c49a7
--- /dev/null
+++ b/scratch/ocrimport/MyListener.h
@@ -0,0 +1,96 @@
+#ifndef _MyListener_HXX
+#define _MyListener_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/task/XJob.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+
+#define MYLISTENER_IMPLEMENTATIONNAME  "vnd.My.impl.NewDocListener"
+#define MYLISTENER_SERVICENAME         "vnd.My.NewDocListener"
+
+namespace css = ::com::sun::star;
+
+/*---------------------------------------------------
+ * Registriert sich in der Office Konfiguration als Job.
+ * Dieser wird dann für alle neu geöffneten Dokumente automatisch
+ * gerufen. Man bekommt eine Reference auf das geöffnete Dokument
+ * überreicht und kann dann prüfen, ob es ein unterstütztes Format
+ * hat. (Wir interessieren uns ja schließlich nur für Writer/Calc Dokumente.)
+ *
+ * @see CalcListener
+ * @see WriterListener
+ */
+class MyListener : public cppu::WeakImplHelper2< css::task::XJob         ,
+                                                      css::lang::XServiceInfo >
+{
+    private:
+        css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+
+    public:
+                 MyListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+        virtual ~MyListener();
+
+	// XJob
+	virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments)
+		throw (css::lang::IllegalArgumentException,
+			   css::uno::Exception,
+			   css::uno::RuntimeException);
+
+	// XServiceInfo
+    virtual ::rtl::OUString SAL_CALL getImplementationName()
+        throw (css::uno::RuntimeException);
+
+    virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& sServiceName)
+        throw (css::uno::RuntimeException);
+
+    virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+        throw (css::uno::RuntimeException);
+
+    public:
+
+    static css::uno::Reference< css::uno::XInterface > st_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR);
+};
+
+class CalcListener : public cppu::WeakImplHelper1< css::document::XEventListener >
+{
+    private:
+        ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+
+
+    public:
+        CalcListener(const css::uno::Reference< css::lang::XMultiServiceFactory > &rxMSF)
+            : mxMSF( rxMSF )
+        {}
+
+        virtual ~CalcListener()
+        {}
+
+    // document.XEventListener
+    virtual void SAL_CALL notifyEvent(const css::document::EventObject& aEvent)
+        throw (css::uno::RuntimeException);
+	virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
+        throw (css::uno::RuntimeException);
+};
+
+class WriterListener : public cppu::WeakImplHelper1< css::document::XEventListener >
+{
+    private:
+        css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF;
+
+    public:
+        WriterListener(const css::uno::Reference< css::lang::XMultiServiceFactory >& rxMSF);
+
+        virtual ~WriterListener()
+        {}
+
+        // document.XEventListener
+    virtual void SAL_CALL notifyEvent(const css::document::EventObject& aEvent)
+        throw (css::uno::RuntimeException);
+	virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
+        throw (css::uno::RuntimeException);
+};
+
+#endif // _MyListener_HXX
diff --git a/scratch/ocrimport/MyProtocolHandler.cxx b/scratch/ocrimport/MyProtocolHandler.cxx
new file mode 100644
index 0000000..570d1bf
--- /dev/null
+++ b/scratch/ocrimport/MyProtocolHandler.cxx
@@ -0,0 +1,665 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: MyProtocolHandler.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+#include "ListenerHelper.h"
+#include "MyProtocolHandler.h"
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/DispatchDescriptor.hpp>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/text/XTextViewCursor.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheetView.hpp>
+#include <com/sun/star/frame/ControlCommand.hpp>
+#include <com/sun/star/frame/ControlEvent.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XControlNotificationListener.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/awt/XMessageBox.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/system/XSystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/container/XContainerQuery.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+ #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+
+#include <osl/process.h>
+#include <osl/file.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/strbuf.hxx>
+#include <rtl/byteseq.hxx>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::frame;
+using com::sun::star::lang::XMultiServiceFactory;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::util::URL;
+using com::sun::star::text::XTextViewCursorSupplier;
+using com::sun::star::text::XTextViewCursor;
+using com::sun::star::text::XTextCursor;
+using com::sun::star::sheet::XSpreadsheetView;
+using com::sun::star::frame::XModel;
+using com::sun::star::text::XTextRange;
+using com::sun::star::text::XTextDocument;
+using com::sun::star::beans::NamedValue;
+using namespace com::sun::star::awt;
+using com::sun::star::view::XSelectionSupplier;
+using namespace com::sun::star::system;
+using namespace com::sun::star::ui::dialogs;
+
+ListenerHelper aListenerHelper;
+
+
+
+/*void ShowMessageBox( const Reference< XToolkit >& rToolkit, 
+               const Reference< XFrame >& rFrame, const ::rtl::OUString& aTitle, const ::rtl::OUString &aMsgText )
+{
+    if ( rFrame.is() && rToolkit.is() )
+    {
+        // describe window properties.
+        WindowDescriptor                aDescriptor;
+        aDescriptor.Type              = WindowClass_MODALTOP;
+        aDescriptor.WindowServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "infobox" ));
+        aDescriptor.ParentIndex       = -1;
+        aDescriptor.Parent            = Reference< XWindowPeer >
+						( rFrame->getContainerWindow(), UNO_QUERY );
+        aDescriptor.Bounds            = Rectangle(300,200,300,200);
+        aDescriptor.WindowAttributes  = WindowAttribute::BORDER | 
+                                          WindowAttribute::MOVEABLE | WindowAttribute::CLOSEABLE;
+ 
+        Reference< XWindowPeer > xPeer = rToolkit->createWindow( aDescriptor );
+        if ( xPeer.is() )
+        {
+            Reference< XMessageBox > xMsgBox( xPeer, UNO_QUERY );
+            if ( xMsgBox.is() )
+            {
+                xMsgBox->setCaptionText( aTitle );
+                xMsgBox->setMessageText( aMsgText );
+                xMsgBox->execute();
+            }
+        }
+    }
+}
+*/
+
+
+oslFileError readLine( oslFileHandle pFile, ::rtl::OStringBuffer& line )
+{
+    OSL_PRECOND( line.getLength() == 0, "line buf not empty" );
+
+    // TODO(P3): read larger chunks
+    sal_Char aChar('\n');
+    sal_uInt64 nBytesRead;
+    oslFileError nRes;
+
+    // skip garbage \r \n at start of line
+    while( osl_File_E_None == (nRes=osl_readFile(pFile, &aChar, 1, &nBytesRead)) && 
+           nBytesRead == 1 && 
+           (aChar == '\n' || aChar == '\r') ) ;
+
+    if( aChar != '\n' && aChar != '\r' )
+        line.append( aChar );
+
+    while( osl_File_E_None == (nRes=osl_readFile(pFile, &aChar, 1, &nBytesRead)) && 
+           nBytesRead == 1 && aChar != '\n' && aChar != '\r' )
+    {
+        line.append( aChar );
+    }
+    
+    return nRes;
+}
+
+void BaseDispatch::ShowMessageBox( const Reference< XFrame >& rFrame, const ::rtl::OUString& aTitle, const ::rtl::OUString& aMsgText )
+{
+	if ( !mxToolkit.is() )
+		mxToolkit = Reference< XToolkit > ( mxMSF->createInstance(
+			::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+                                            "com.sun.star.awt.Toolkit" ))), UNO_QUERY );
+    if ( rFrame.is() && mxToolkit.is() )
+    {
+        // describe window properties.
+        WindowDescriptor                aDescriptor;
+        aDescriptor.Type              = WindowClass_MODALTOP;
+        aDescriptor.WindowServiceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "infobox" ));
+        aDescriptor.ParentIndex       = -1;
+        aDescriptor.Parent            = Reference< XWindowPeer >( rFrame->getContainerWindow(), UNO_QUERY );
+        aDescriptor.Bounds            = Rectangle(0,0,300,200);
+        aDescriptor.WindowAttributes  = WindowAttribute::BORDER | WindowAttribute::MOVEABLE | WindowAttribute::CLOSEABLE;
+
+        Reference< XWindowPeer > xPeer = mxToolkit->createWindow( aDescriptor );
+        if ( xPeer.is() )
+        {
+            Reference< XMessageBox > xMsgBox( xPeer, UNO_QUERY );
+            if ( xMsgBox.is() )
+            {
+                xMsgBox->setCaptionText( aTitle );
+                xMsgBox->setMessageText( aMsgText );
+                xMsgBox->execute();
+            }
+        }
+    }
+}
+
+void BaseDispatch::SendCommand( const com::sun::star::util::URL& aURL, const ::rtl::OUString& rCommand, const Sequence< NamedValue >& rArgs, sal_Bool bEnabled )
+{
+    Reference < XDispatch > xDispatch = 
+            aListenerHelper.GetDispatch( mxFrame, aURL.Path );
+    
+    FeatureStateEvent aEvent;
+    
+    aEvent.FeatureURL = aURL;
+    aEvent.Source     = xDispatch;
+    aEvent.IsEnabled  = bEnabled;
+    aEvent.Requery    = sal_False;
+
+    ControlCommand aCtrlCmd;
+    aCtrlCmd.Command   = rCommand;
+    aCtrlCmd.Arguments = rArgs;
+    
+    aEvent.State <<= aCtrlCmd;
+    aListenerHelper.Notify( mxFrame, aEvent.FeatureURL.Path, aEvent ); 
+}
+
+void BaseDispatch::SendCommandTo( const Reference< XStatusListener >& xControl, const URL& aURL, const ::rtl::OUString& rCommand, const Sequence< NamedValue >& rArgs, sal_Bool bEnabled )
+{
+    FeatureStateEvent aEvent;
+    
+    aEvent.FeatureURL = aURL;
+    aEvent.Source     = (::com::sun::star::frame::XDispatch*) this;
+    aEvent.IsEnabled  = bEnabled;
+    aEvent.Requery    = sal_False;
+
+    ControlCommand aCtrlCmd;
+    aCtrlCmd.Command   = rCommand;
+    aCtrlCmd.Arguments = rArgs;
+    
+    aEvent.State <<= aCtrlCmd;
+    xControl->statusChanged( aEvent );
+}
+
+void SAL_CALL MyProtocolHandler::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException)
+{
+	Reference < XFrame > xFrame;
+	if ( aArguments.getLength() )
+	{
+		// das erste Argument ist immer der Frame, da ein ProtocolHandler den braucht um Zugriff
+		// auf den Context zu haben, in dem er aufgerufen wird
+		aArguments[0] >>= xFrame;
+		mxFrame = xFrame;
+	}
+}
+
+Reference< XDispatch > SAL_CALL MyProtocolHandler::queryDispatch(	const URL& aURL, const ::rtl::OUString& sTargetFrameName, sal_Int32 nSearchFlags )
+				throw( RuntimeException )
+{
+	Reference < XDispatch > xRet;
+	if ( !mxFrame.is() )
+		return 0;
+
+	Reference < XController > xCtrl = mxFrame->getController();
+	if ( xCtrl.is() && !aURL.Protocol.compareToAscii("vnd.demo.complextoolbarcontrols.demoaddon:") )
+	{
+		Reference < XTextViewCursorSupplier > xCursor( xCtrl, UNO_QUERY );
+		Reference < XSpreadsheetView > xView( xCtrl, UNO_QUERY );
+		if ( !xCursor.is() && !xView.is() )
+			// ohne ein entsprechendes Dokument funktioniert der Handler nicht
+			return xRet;
+
+		if ( aURL.Path.equalsAscii("Command1" ) ||
+			 aURL.Path.equalsAscii("Command2" ) ||
+			 aURL.Path.equalsAscii("Command3" ) ||
+			 aURL.Path.equalsAscii("Command4" ) ||
+			 aURL.Path.equalsAscii("Command5" ) ||
+			 aURL.Path.equalsAscii("Command6" ) ||
+             aURL.Path.equalsAscii("Command7" ) )
+		{
+			xRet = aListenerHelper.GetDispatch( mxFrame, aURL.Path );
+			if ( !xRet.is() )
+			{
+				xRet = xCursor.is() ? (BaseDispatch*) new WriterDispatch( mxMSF, mxFrame ) :
+					(BaseDispatch*) new CalcDispatch( mxMSF, mxFrame );
+				aListenerHelper.AddDispatch( xRet, mxFrame, aURL.Path );
+			}
+		}
+	}
+
+	return xRet;
+}
+
+Sequence < Reference< XDispatch > > SAL_CALL MyProtocolHandler::queryDispatches( const Sequence < DispatchDescriptor >& seqDescripts )
+			throw( RuntimeException )
+{
+    sal_Int32 nCount = seqDescripts.getLength();
+    Sequence < Reference < XDispatch > > lDispatcher( nCount );
+
+    for( sal_Int32 i=0; i<nCount; ++i )
+        lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL, seqDescripts[i].FrameName, seqDescripts[i].SearchFlags );
+
+    return lDispatcher;
+}
+
+::rtl::OUString MyProtocolHandler_getImplementationName ()
+	throw (RuntimeException)
+{
+    return ::rtl::OUString::createFromAscii(MYPROTOCOLHANDLER_IMPLEMENTATIONNAME);
+}
+
+sal_Bool SAL_CALL MyProtocolHandler_supportsService( const ::rtl::OUString& ServiceName )
+	throw (RuntimeException)
+{
+    return (
+            ServiceName.equalsAscii(MYPROTOCOLHANDLER_SERVICENAME  ) ||
+            ServiceName.equalsAscii("com.sun.star.frame.ProtocolHandler")
+           );
+}
+
+Sequence< ::rtl::OUString > SAL_CALL MyProtocolHandler_getSupportedServiceNames(  )
+	throw (RuntimeException)
+{
+	Sequence < ::rtl::OUString > aRet(1);
+    aRet[0] = ::rtl::OUString::createFromAscii(MYPROTOCOLHANDLER_SERVICENAME);
+    return aRet;
+}
+
+#undef SERVICE_NAME
+
+Reference< XInterface > SAL_CALL MyProtocolHandler_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+	throw( Exception )
+{
+	return (cppu::OWeakObject*) new MyProtocolHandler( rSMgr );
+}
+
+// XServiceInfo
+::rtl::OUString SAL_CALL MyProtocolHandler::getImplementationName(  )
+	throw (RuntimeException)
+{
+	return MyProtocolHandler_getImplementationName();
+}
+
+sal_Bool SAL_CALL MyProtocolHandler::supportsService( const ::rtl::OUString& rServiceName )
+	throw (RuntimeException)
+{
+    return MyProtocolHandler_supportsService( rServiceName );
+}
+
+Sequence< ::rtl::OUString > SAL_CALL MyProtocolHandler::getSupportedServiceNames(  )
+	throw (RuntimeException)
+{
+    return MyProtocolHandler_getSupportedServiceNames();
+}
+
+void SAL_CALL BaseDispatch::dispatch( const URL& aURL, const Sequence < PropertyValue >& lArgs ) throw (RuntimeException)
+{
+	/* Its neccessary to hold this object alive, till this method finish.
+	   May the outside dispatch cache (implemented by the menu/toolbar!)
+	   forget this instance during de-/activation of frames (focus!).
+
+		E.g. An open db beamer in combination with the My-Dialog
+		can force such strange situation :-(
+	 */
+	Reference< XInterface > xSelfHold(static_cast< XDispatch* >(this), UNO_QUERY);
+
+	if ( !aURL.Protocol.compareToAscii("vnd.demo.complextoolbarcontrols.demoaddon:") )
+	{
+		if ( !aURL.Path.compareToAscii("Command1" ) )
+		{
+		
+		        
+		        
+		        
+		         Reference< XFilePicker > rFilePicker = Reference< XFilePicker >
+
+( mxMSF->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.FilePicker" ))), UNO_QUERY );
+
+
+Reference< XFilterManager > rFilterManager (rFilePicker, UNO_QUERY);
+
+Reference<com::sun::star::lang::XInitialization > rInitialize (rFilePicker, UNO_QUERY);
+
+Sequence < Any > info(1);
+
+
+// Don't forget to add : #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+
+// Don't forget to add "com.sun.star.ui.dialogs.TemplateDescription \" in the makefile
+
+info[0] <<= (short) TemplateDescription::FILEOPEN_SIMPLE;
+
+rInitialize-> initialize(info);
+
+
+rFilterManager->appendFilter(::rtl::OUString::createFromAscii("Texts"),
+
+::rtl::OUString::createFromAscii("*.txt"));
+
+rFilterManager->appendFilter(::rtl::OUString::createFromAscii("Docs OpenOffice"),
+
+::rtl::OUString::createFromAscii("*.sxw;*.sxc"));
+
+rFilterManager->setCurrentFilter(::rtl::OUString::createFromAscii("Docs OpenOffice"));
+
+short result=rFilePicker->execute();
+
+
+// Don't forget to add : #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+
+// Don't forget to add "com.sun.star.ui.dialogs/ExecutableDialogResults \" in the makefile
+
+Reference< XToolkit >rToolkit = Reference< XToolkit >(mxMSF->createInstance(
+
+::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+
+"com.sun.star.awt.Toolkit" ))), UNO_QUERY );
+
+
+            Reference< XInterface > Desktop = mxMSF->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" ));
+
+Reference<com::sun::star::frame::XDesktop > rDesktop(Desktop,UNO_QUERY);
+Reference< XFrame > rFrame=rDesktop->getCurrentFrame();
+
+
+if (result == ExecutableDialogResults::OK)
+
+ShowMessageBox( rFrame,::rtl::OUString::createFromAscii("Result") ,rFilePicker->getFiles()[0] );
+
+
+
+            
+
+            Reference< XComponentLoader > rComponentLoader (Desktop, UNO_QUERY);
+            
+            
+      /****
+      
+      SOME TEST ON URLS
+        ::rtl::OUString sAbsoluteDocUrl, sWorkingDir;
+        
+             
+            osl_getProcessWorkingDir(&sWorkingDir.pData);
+            
+            ShowMessageBox( rFrame,::rtl::OUString::createFromAscii("Result") ,sWorkingDir);
+
+          
+        
+          osl::FileBase::getAbsoluteFileURL( ::rtl::OUString::createFromAscii("file:///Users/jon/"), ::rtl::OUString::createFromAscii("index.html"), sAbsoluteDocUrl);
+         */   
+            
+                Reference<com::sun::star::lang::XComponent > xHTMLComponent = rComponentLoader->loadComponentFromURL(
+       ::rtl::OUString::createFromAscii("file:///Users/jon/index.html"), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0,
+        Sequence < ::com::sun::star::beans::PropertyValue >());
+        
+        
+        
+
+            Reference <com::sun::star::lang::XComponent > xWriterComponent = rComponentLoader->loadComponentFromURL(
+               ::rtl::OUString::createFromAscii("private:factory/swriter"),
+               ::rtl::OUString::createFromAscii("_blank"),
+               0,
+               Sequence < ::com::sun::star::beans::PropertyValue >());
+            
+            Reference < XTextDocument > xTextDocument (xWriterComponent,UNO_QUERY);
+            Reference<com::sun::star::text::XText> xText = xTextDocument->getText();
+            xText->setString(::rtl::OUString::createFromAscii("Hello"));
+            
+            
+ 
+            rtl::OUString FileURL;
+            osl::FileBase::getFileURLFromSystemPath(
+              rtl::OUString::createFromAscii("/bin/cat"),
+              FileURL
+            );
+            
+            rtl::OUString AppArgs = rtl::OUString::createFromAscii("/Users/jon/out.txt");
+            
+          
+          
+            
+          
+             oslProcess    aProcess;
+    oslFileHandle pIn  = NULL;
+    oslFileHandle pOut = NULL;
+    oslFileHandle pErr = NULL;
+        rtl_uString** ppEnv = NULL;
+    sal_uInt32 nEnv = 0;
+    
+    const oslProcessError eErr = 
+        osl_executeProcess_WithRedirectedIO(FileURL.pData, 
+                                            &AppArgs.pData, 
+                                            1, 
+                                            osl_Process_SEARCHPATH|osl_Process_HIDDEN, 
+                                            osl_getCurrentSecurity(), 
+                                            0, ppEnv, nEnv, 
+                                            &aProcess, &pIn, &pOut, &pErr);
+                                            
+                                            
+
+
+
+        
+        ::rtl::OStringBuffer line;
+        ::rtl::OString content;
+        ::rtl::OString lineBreak = rtl::OUStringToOString(rtl::OUString::createFromAscii(" "), RTL_TEXTENCODING_ASCII_US );
+        
+        bool bRet=true;
+         while( osl_File_E_None == readLine(pOut, line) && line.getLength() ) {
+            if(bRet) {
+             content = line.makeStringAndClear();
+             bRet = false;
+            } else {
+             content = content.concat(lineBreak);
+             content = content.concat(line.makeStringAndClear());
+            }
+         }
+         xText->setString(rtl::OStringToOUString(content, RTL_TEXTENCODING_ASCII_US));
+            
+        }
+
+	}
+}
+
+void SAL_CALL BaseDispatch::addStatusListener( const Reference< XStatusListener >& xControl, const URL& aURL ) throw (RuntimeException)
+{
+	if ( aURL.Protocol.equalsAscii("vnd.demo.complextoolbarcontrols.demoaddon:") )
+	{
+		if ( aURL.Path.equalsAscii("Command1" ) )
+        {
+			// just enable this command
+		    ::com::sun::star::frame::FeatureStateEvent aEvent;
+			aEvent.FeatureURL = aURL;
+		    aEvent.Source = (::com::sun::star::frame::XDispatch*) this;
+			aEvent.IsEnabled = mbButtonEnabled;
+			aEvent.Requery = sal_False;
+			aEvent.State <<= Any();
+			xControl->statusChanged( aEvent );
+        }
+        else if ( aURL.Path.equalsAscii("Command2" ) )
+		{
+			// just enable this command
+		    ::com::sun::star::frame::FeatureStateEvent aEvent;
+			aEvent.FeatureURL = aURL;
+		    aEvent.Source = (::com::sun::star::frame::XDispatch*) this;
+			aEvent.IsEnabled = sal_True;
+			aEvent.Requery = sal_False;
+			aEvent.State <<= Any();
+			xControl->statusChanged( aEvent );
+		}
+		else if ( aURL.Path.equalsAscii("Command3" ) )
+		{
+            // A toggle dropdown box is normally used for a group of commands
+            // where the user can select the last issued command easily.
+            // E.g. a typical command group would be "Insert shape"
+            Sequence< NamedValue > aArgs( 1 );
+            
+            // send command to set context menu content
+            Sequence< rtl::OUString > aContextMenu( 3 );
+            aContextMenu[0] = rtl::OUString::createFromAscii( "Command 1" );
+            aContextMenu[1] = rtl::OUString::createFromAscii( "Command 2" );
+            aContextMenu[2] = rtl::OUString::createFromAscii( "Command 3" );
+            
+            aArgs[0].Name = rtl::OUString::createFromAscii( "List" );
+            aArgs[0].Value <<= aContextMenu;
+            SendCommandTo( xControl, aURL, rtl::OUString::createFromAscii( "SetList" ), aArgs, sal_True );
+            
+            // send command to check item on pos=0
+            aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Pos" ));
+            aArgs[0].Value <<= sal_Int32( 0 );            
+            SendCommandTo( xControl, aURL, ::rtl::OUString::createFromAscii( "CheckItemPos" ), aArgs, sal_True );
+        }
+        else if ( aURL.Path.equalsAscii("Command4" ) )
+        {
+            // A dropdown box is normally used for a group of dependent modes, where
+            // the user can only select one. The modes cannot be combined.
+            // E.g. a typical group would be left,right,center,block.
+            Sequence< NamedValue > aArgs( 1 );
+            
+            // send command to set context menu content
+            Sequence< rtl::OUString > aContextMenu( 2 );
+            aContextMenu[0] = rtl::OUString::createFromAscii( "Button Enabled" );
+            aContextMenu[1] = rtl::OUString::createFromAscii( "Button Disabled" );
+            
+            aArgs[0].Name = rtl::OUString::createFromAscii( "List" );
+            aArgs[0].Value <<= aContextMenu;
+            SendCommandTo( xControl, aURL, rtl::OUString::createFromAscii( "SetList" ), aArgs, sal_True );            
+
+            // set position according to enable/disable state of button
+            sal_Int32 nPos( mbButtonEnabled ? 0 : 1 );
+            
+            // send command to check item on pos=0
+            aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Pos" ));
+            aArgs[0].Value <<= nPos;
+            SendCommandTo( xControl, aURL, ::rtl::OUString::createFromAscii( "CheckItemPos" ), aArgs, sal_True );
+        }
+        else if ( aURL.Path.equalsAscii("Command5" ) )
+        {
+            // A spin button
+            Sequence< NamedValue > aArgs( 5 );
+            
+            // send command to initialize spin button
+            aArgs[0].Name = rtl::OUString::createFromAscii( "Value" );
+            aArgs[0].Value <<= double( 0.0 );
+            aArgs[1].Name = rtl::OUString::createFromAscii( "UpperLimit" );
+            aArgs[1].Value <<= double( 10.0 );
+            aArgs[2].Name = rtl::OUString::createFromAscii( "LowerLimit" );
+            aArgs[2].Value <<= double( 0.0 );
+            aArgs[3].Name = rtl::OUString::createFromAscii( "Step" );
+            aArgs[3].Value <<= double( 0.1 );
+            aArgs[4].Name = rtl::OUString::createFromAscii( "OutputFormat" );
+            aArgs[4].Value <<= rtl::OUString::createFromAscii( "%.2f cm" );
+
+            SendCommandTo( xControl, aURL, rtl::OUString::createFromAscii( "SetValues" ), aArgs, sal_True );
+        }
+        else if ( aURL.Path.equalsAscii("Command7" ) )
+        {
+            // A dropdown box is normally used for a group of commands
+            // where the user can select one of a defined set.
+            Sequence< NamedValue > aArgs( 1 );
+            
+            // send command to set context menu content
+            Sequence< rtl::OUString > aList( 10 );
+            aList[0] = rtl::OUString::createFromAscii( "White" );
+            aList[1] = rtl::OUString::createFromAscii( "Black" );
+            aList[2] = rtl::OUString::createFromAscii( "Red" );
+            aList[3] = rtl::OUString::createFromAscii( "Blue" );
+            aList[4] = rtl::OUString::createFromAscii( "Green" );
+            aList[5] = rtl::OUString::createFromAscii( "Grey" );
+            aList[6] = rtl::OUString::createFromAscii( "Yellow" );
+            aList[7] = rtl::OUString::createFromAscii( "Orange" );
+            aList[8] = rtl::OUString::createFromAscii( "Brown" );
+            aList[9] = rtl::OUString::createFromAscii( "Pink" );
+            
+            aArgs[0].Name = rtl::OUString::createFromAscii( "List" );
+            aArgs[0].Value <<= aList;
+            SendCommandTo( xControl, aURL, rtl::OUString::createFromAscii( "SetList" ), aArgs, sal_True );
+        }
+
+		aListenerHelper.AddListener( mxFrame, xControl, aURL.Path );
+	}
+}
+
+void SAL_CALL BaseDispatch::removeStatusListener( const Reference< XStatusListener >& xControl, const URL& aURL ) throw (RuntimeException)
+{
+	aListenerHelper.RemoveListener( mxFrame, xControl, aURL.Path );
+}
+
+void SAL_CALL BaseDispatch::controlEvent( const ControlEvent& Event ) throw (RuntimeException)
+{
+    if ( Event.aURL.Protocol.equalsAscii("vnd.demo.complextoolbarcontrols.demoaddon:" ))
+	{
+        if ( Event.aURL.Path.equalsAscii( "Command2" ))
+        {
+            // We get notifications whenever the text inside the combobox has been changed.
+            // We store the new text into a member.
+            if ( Event.Event.equalsAscii( "TextChanged" ))
+            {
+                rtl::OUString aNewText;
+                sal_Bool      bHasText( sal_False );
+                for ( sal_Int32 i = 0; i < Event.aInformation.getLength(); i++ )
+                {
+                    if ( Event.aInformation[i].Name.equalsAsciiL( "Text", 4 ))
+                    {
+                        bHasText = Event.aInformation[i].Value >>= aNewText;
+                        break;
+                    }
+                }
+                
+                if ( bHasText )
+                    maComboBoxText = aNewText;
+            }
+        }
+    }
+}
+ 
+BaseDispatch::BaseDispatch( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF,
+        const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, const ::rtl::OUString& rServiceName )
+        : mxMSF( rxMSF )
+		, mxFrame( xFrame )
+        , msDocService( rServiceName )
+        , mbButtonEnabled( sal_True )
+{
+}
+
+
+BaseDispatch::~BaseDispatch()
+{
+	mxFrame.clear();
+	mxMSF.clear();
+}
diff --git a/scratch/ocrimport/MyProtocolHandler.h b/scratch/ocrimport/MyProtocolHandler.h
new file mode 100644
index 0000000..de0ece1
--- /dev/null
+++ b/scratch/ocrimport/MyProtocolHandler.h
@@ -0,0 +1,141 @@
+#ifndef _MyProtocolHandler_HXX
+#define _MyProtocolHandler_HXX
+
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XControlNotificationListener.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <cppuhelper/implbase3.hxx>
+#ifndef _CPPUHELPER_IMPLBASE2_HXX
+#include <cppuhelper/implbase2.hxx>
+#endif
+#include <com/sun/star/awt/XToolkit.hpp>
+
+#define MYPROTOCOLHANDLER_IMPLEMENTATIONNAME   "vnd.demo.Impl.ProtocolHandler"
+#define MYPROTOCOLHANDLER_SERVICENAME          "vnd.demo.ProtocolHandler"
+
+namespace com
+{
+  namespace sun
+  {
+    namespace star
+    {
+      namespace frame
+      {
+        class XModel;
+        class XFrame;
+      }
+    }
+  }
+}
+
+
+class MyProtocolHandler : public cppu::WeakImplHelper3
+<
+  com::sun::star::frame::XDispatchProvider,
+  com::sun::star::lang::XInitialization,
+  com::sun::star::lang::XServiceInfo
+>
+{
+private:
+    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+  ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame;
+
+public:
+  MyProtocolHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
+        : mxMSF( rxMSF ) {}
+
+  // XDispatchProvider
+  virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >
+      SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL,
+        const ::rtl::OUString& sTargetFrameName, sal_Int32 nSearchFlags )
+        throw( ::com::sun::star::uno::RuntimeException );
+  virtual ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > >
+    SAL_CALL queryDispatches(
+      const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor )
+      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 MyProtocolHandler_getImplementationName()
+  throw ( ::com::sun::star::uno::RuntimeException );
+
+sal_Bool SAL_CALL MyProtocolHandler_supportsService( const ::rtl::OUString& ServiceName )
+  throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL MyProtocolHandler_getSupportedServiceNames(  )
+  throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL MyProtocolHandler_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+  throw ( ::com::sun::star::uno::Exception );
+
+class BaseDispatch : public cppu::WeakImplHelper2
+<
+  ::com::sun::star::frame::XDispatch,
+    ::com::sun::star::frame::XControlNotificationListener
+>
+{
+protected:
+  ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > mxFrame;
+    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+  ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > mxToolkit;
+    ::rtl::OUString msDocService;
+    ::rtl::OUString maComboBoxText;
+    sal_Bool        mbButtonEnabled;
+
+public:
+  BaseDispatch( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF,
+        const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, const ::rtl::OUString& rServiceName );
+
+  virtual ~BaseDispatch();
+
+  void ShowMessageBox( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aTitle, const ::rtl::OUString& aMsgText );
+    void SendCommand( const com::sun::star::util::URL& aURL, const ::rtl::OUString& rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rArgs, sal_Bool bEnabled );
+    void SendCommandTo( const com::sun::star::uno::Reference< com::sun::star::frame::XStatusListener >& xControl, const com::sun::star::util::URL& aURL, const ::rtl::OUString& rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rArgs, sal_Bool bEnabled );
+
+  // XDispatch
+    virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL,
+    const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs )
+    throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl,
+    const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl,
+    const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException);
+    
+    // XControlNotificationListener
+    virtual void SAL_CALL controlEvent( const ::com::sun::star::frame::ControlEvent& Event ) 
+        throw (::com::sun::star::uno::RuntimeException); 
+};
+
+class WriterDispatch : public BaseDispatch
+{
+public:
+  WriterDispatch( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF,
+    const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame )
+        : BaseDispatch( rxMSF, xFrame, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) )
+  {}
+};
+
+class CalcDispatch : public BaseDispatch
+{
+public:
+  CalcDispatch( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF,
+    const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame )
+        : BaseDispatch( rxMSF, xFrame, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadSheetDocument" ) ) )
+  {}
+};
+
+#endif
diff --git a/scratch/ocrimport/ProtocolHandler.xcu b/scratch/ocrimport/ProtocolHandler.xcu
new file mode 100644
index 0000000..8540791
--- /dev/null
+++ b/scratch/ocrimport/ProtocolHandler.xcu
@@ -0,0 +1,10 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<oor:component-data oor:name="ProtocolHandler" oor:package="org.openoffice.Office" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	<node oor:name="HandlerSet">
+        <node oor:name="vnd.demo.ProtocolHandler" oor:op="replace">
+			<prop oor:name="Protocols" oor:type="oor:string-list">
+                <value>vnd.demo.complextoolbarcontrols.demoaddon:*</value>
+			</prop>
+		</node>
+	</node>
+</oor:component-data>
diff --git a/scratch/ocrimport/WriterListener.cxx b/scratch/ocrimport/WriterListener.cxx
new file mode 100644
index 0000000..49f79f5
--- /dev/null
+++ b/scratch/ocrimport/WriterListener.cxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WriterListener.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+#include "MyListener.h"
+
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+void SAL_CALL WriterListener::notifyEvent( const ::com::sun::star::document::EventObject& aEvent ) throw (com::sun::star::uno::RuntimeException)
+{
+}
+
+void SAL_CALL WriterListener::disposing( const com::sun::star::lang::EventObject& aSource ) throw( com::sun::star::uno::RuntimeException )
+{
+}
+
+WriterListener::WriterListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
+	: mxMSF( rxMSF )
+{
+}
+
+
diff --git a/scratch/ocrimport/WriterWindowState.xcu b/scratch/ocrimport/WriterWindowState.xcu
new file mode 100644
index 0000000..fd5453e
--- /dev/null
+++ b/scratch/ocrimport/WriterWindowState.xcu
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="WriterWindowState" oor:package="org.openoffice.Office.UI">
+ <node oor:name="UIElements">
+  <node oor:name="States">
+   <node oor:name="private:resource/toolbar/addon_com.sun.star.comp.framework.addon.complextoolbarcontrols" oor:op="replace">
+    <prop oor:name="ContextSensitive" oor:type="xs:boolean">
+     <value>false</value>
+    </prop>
+    <prop oor:name="UIName" oor:type="xs:string">
+     <value xml:lang="en-US">Complex Toolbar Controls</value>
+    </prop>
+    <prop oor:name="Visible" oor:type="xs:boolean">
+     <value>true</value>
+    </prop>
+    <prop oor:name="Docked" oor:type="xs:boolean">
+     <value>false</value>
+    </prop>
+   </node>
+  </node>
+ </node>
+</oor:component-data>
\ No newline at end of file
diff --git a/scratch/ocrimport/bitmaps/logo_big.png b/scratch/ocrimport/bitmaps/logo_big.png
new file mode 100644
index 0000000..23dd241
Binary files /dev/null and b/scratch/ocrimport/bitmaps/logo_big.png differ
diff --git a/scratch/ocrimport/bitmaps/logo_small.png b/scratch/ocrimport/bitmaps/logo_small.png
new file mode 100644
index 0000000..c24b4e2
Binary files /dev/null and b/scratch/ocrimport/bitmaps/logo_small.png differ
diff --git a/scratch/ocrimport/delzip b/scratch/ocrimport/delzip
new file mode 100644
index 0000000..636fda9
--- /dev/null
+++ b/scratch/ocrimport/delzip
@@ -0,0 +1 @@
+ECHO is OFF
diff --git a/scratch/ocrimport/description.xml b/scratch/ocrimport/description.xml
new file mode 100644
index 0000000..073107e
--- /dev/null
+++ b/scratch/ocrimport/description.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<description
+
+  xmlns="http://openoffice.org/extensions/description/2006"
+  xmlns:dep="http://openoffice.org/extensions/description/2006"
+  xmlns:xlink="http://www.w3.org/1999/xlink">
+
+  <identifier value="com.sun.OCRImport-UPDATED_PLATFORM" />
+
+  <dependencies>
+    <OpenOffice.org-minimal-version value="3.1" dep:name="OpenOffice.org 3.2"/>
+  </dependencies>
+
+  <version value="0.1" />
+
+  <platform value="UPDATED_PLATFORM" />
+
+  <publisher>
+      <name xlink:href="" lang="en">noname</name>
+  </publisher>
+
+  <display-name>
+    <name lang="en">OCR Import</name>
+  </display-name>
+
+</description>
diff --git a/scratch/ocrimport/exports.cxx b/scratch/ocrimport/exports.cxx
new file mode 100644
index 0000000..4bfafc8
--- /dev/null
+++ b/scratch/ocrimport/exports.cxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: exports.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+
+#include <stdio.h>
+
+#include <osl/mutex.hxx>
+#include <osl/thread.h>
+#include <cppuhelper/factory.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <sal/types.h>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+#include "MyProtocolHandler.h"
+#include "MyListener.h"
+
+namespace css = ::com::sun::star;
+
+static void writeInfo(const css::uno::Reference< css::registry::XRegistryKey >& xRegistryKey       ,
+                      const char*                                               pImplementationName,
+                      const char*                                               pServiceName       )
+{
+    ::rtl::OUStringBuffer sKey(256);
+	sKey.append     (::rtl::OUString::createFromAscii(pImplementationName));
+    sKey.appendAscii("/UNO/SERVICES/");
+    sKey.append     (::rtl::OUString::createFromAscii(pServiceName));
+
+    xRegistryKey->createKey(sKey.makeStringAndClear());
+}
+
+extern "C"
+{
+//==================================================================================================
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char**        ppEnvTypeName,
+                                                                                 uno_Environment** ppEnv        )
+{
+	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+//==================================================================================================
+SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(void* pServiceManager,
+                                                            void* pRegistryKey   )
+{
+    if (!pRegistryKey)
+        return sal_False;
+
+    try
+    {
+        css::uno::Reference< css::registry::XRegistryKey > xKey(reinterpret_cast< css::registry::XRegistryKey* >(pRegistryKey), css::uno::UNO_QUERY);
+
+        writeInfo( xKey, MYLISTENER_IMPLEMENTATIONNAME       , MYLISTENER_SERVICENAME        );
+        writeInfo( xKey, MYPROTOCOLHANDLER_IMPLEMENTATIONNAME, MYPROTOCOLHANDLER_SERVICENAME );
+
+        return sal_True;
+    }
+    catch(const css::registry::InvalidRegistryException&)
+        { OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); }
+
+    return sal_False;
+}
+
+//==================================================================================================
+SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* pImplName      ,
+                                                                void*     pServiceManager,
+                                                                void*     pRegistryKey   )
+{
+    if ( !pServiceManager || !pImplName )
+        return 0;
+
+    css::uno::Reference< css::lang::XSingleServiceFactory > xFactory  ;
+    css::uno::Reference< css::lang::XMultiServiceFactory >  xSMGR     (reinterpret_cast< css::lang::XMultiServiceFactory* >(pServiceManager), css::uno::UNO_QUERY);
+    ::rtl::OUString                                         sImplName = ::rtl::OUString::createFromAscii(pImplName);
+
+    if (sImplName.equalsAscii(MYLISTENER_IMPLEMENTATIONNAME))
+	{
+        css::uno::Sequence< ::rtl::OUString > lNames(1);
+        lNames[0] = ::rtl::OUString::createFromAscii(MYLISTENER_IMPLEMENTATIONNAME);
+		xFactory = ::cppu::createSingleFactory(xSMGR, sImplName, MyListener::st_createInstance, lNames);
+	}
+    else
+    if (sImplName.equalsAscii(MYPROTOCOLHANDLER_IMPLEMENTATIONNAME))
+	{
+        css::uno::Sequence< ::rtl::OUString > lNames(1);
+        lNames[0] = ::rtl::OUString::createFromAscii(MYPROTOCOLHANDLER_SERVICENAME);
+        xFactory = ::cppu::createSingleFactory(xSMGR, sImplName, MyProtocolHandler_createInstance, lNames);
+	}
+
+    if (!xFactory.is())
+        return 0;
+
+    xFactory->acquire();
+    return xFactory.get();
+}
+
+} // extern C
diff --git a/scratch/ocrimport/exports.map b/scratch/ocrimport/exports.map
new file mode 100644
index 0000000..c673092
--- /dev/null
+++ b/scratch/ocrimport/exports.map
@@ -0,0 +1,9 @@
+PDFFILTER_1_0 {
+        global:
+                component_getImplementationEnvironment;
+                component_getFactory;
+                component_writeInfo;
+
+        local:
+                *;
+}; 
\ No newline at end of file
diff --git a/scratch/ocrimport/help/component.txt b/scratch/ocrimport/help/component.txt
new file mode 100755
index 0000000..3be173d
--- /dev/null
+++ b/scratch/ocrimport/help/component.txt
@@ -0,0 +1,3 @@
+The Presenter Console Extension provides more control over your slide show
+presentation, such as the ability to see the upcoming slide, the slide notes,
+and a presentation timer whereas the audience see only the current slide.
diff --git a/scratch/ocrimport/logo_big.png b/scratch/ocrimport/logo_big.png
new file mode 100644
index 0000000..23dd241
Binary files /dev/null and b/scratch/ocrimport/logo_big.png differ
diff --git a/scratch/ocrimport/logo_small.png b/scratch/ocrimport/logo_small.png
new file mode 100644
index 0000000..c24b4e2
Binary files /dev/null and b/scratch/ocrimport/logo_small.png differ
diff --git a/scratch/ocrimport/makefile.mk b/scratch/ocrimport/makefile.mk
new file mode 100644
index 0000000..92683c3
--- /dev/null
+++ b/scratch/ocrimport/makefile.mk
@@ -0,0 +1,209 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.10 $
+#
+# 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=sdext
+TARGET=OCRImport
+GEN_HID=FALSE
+EXTNAME=ocr
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings ----------------------------------
+
+.INCLUDE : rtlbootstrap.mk
+.INCLUDE : settings.mk
+.INCLUDE :  $(PRJ)$/util$/makefile.pmk
+
+.IF "$(ENABLE_OCRIMPORT)" == "NO"
+ at all:
+	@echo "OCR Import build disabled."
+.ELSE
+
+DLLPRE=
+common_build_zip=
+
+# --- Files -------------------------------------
+
+SLOFILES=										\
+	$(SLO)$/MyProtocolHandler.obj				\
+	$(SLO)$/MyJob.obj				\
+	$(SLO)$/MyListener.obj		\
+	$(SLO)$/WriterListener.obj					\
+	$(SLO)$/CalcListener.obj			\
+	$(SLO)$/ListenerHelper.obj	\
+	$(SLO)$/exports.obj
+
+# --- Library -----------------------------------
+
+SHL1TARGET=		$(TARGET).uno
+
+SHL1STDLIBS=	$(CPPUHELPERLIB)	\
+				$(CPPULIB)			\
+				$(SALLIB)
+SHL1DEPN=
+SHL1IMPLIB=		i$(SHL1TARGET)
+SHL1LIBS=		$(SLB)$/$(TARGET).lib
+SHL1DEF=		$(MISC)$/$(SHL1TARGET).def
+SHL1VERSIONMAP=	exports.map
+SHL1RPATH=      OXT
+DEF1NAME=		$(SHL1TARGET)
+
+ZIP1TARGET=		ocrimport
+ZIP1DIR=		$(MISC)$/$(TARGET)
+ZIP1EXT=		.oxt
+ZIP1FLAGS=-r
+ZIP1LIST=		*
+
+DESCRIPTION:=$(ZIP1DIR)$/description.xml
+
+COMPONENT_FILES=																			\
+    $(ZIP1DIR)$/Jobs.xcu							\
+    $(ZIP1DIR)$/ProtocolHandler.xcu   \
+    $(ZIP1DIR)$/Addons.xcu   \
+    $(ZIP1DIR)$/WriterWindowState.xcu   \
+    $(ZIP1DIR)$/CalcWindowState.xcu
+
+
+COMPONENT_BITMAPS=					\
+	$(ZIP1DIR)$/logo_big.png	\
+	$(ZIP1DIR)$/logo_small.png	
+
+COMPONENT_MANIFEST= 							\
+	$(ZIP1DIR)$/META-INF$/manifest.xml
+
+COMPONENT_LIBRARY= 								\
+	$(ZIP1DIR)$/$(TARGET).uno$(DLLPOST)
+
+COMPONENT_HELP= 								\
+	$(ZIP1DIR)$/help/component.txt
+
+ZIP1DEPS=					\
+	$(DESCRIPTION)			\
+	$(COMPONENT_MANIFEST)	\
+	$(COMPONENT_FILES)		\
+	$(COMPONENT_BITMAPS)	\
+	$(COMPONENT_LIBRARY)	\
+	$(COMPONENT_HELP)
+
+PLATFORMID:=$(RTL_OS:l)_$(RTL_ARCH:l)
+
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
+$(COMPONENT_MANIFEST) : $$(@:f)
+	@-$(MKDIRHIER) $(@:d)
+    +$(TYPE) $< | $(SED) "s/SHARED_EXTENSION/$(DLLPOST)/" > $@
+
+$(COMPONENT_HELP) : help$/$$(@:f)
+	@@-$(MKDIRHIER) $(@:d)
+    $(COPY) $< $@
+
+#$(COMPONENT_FILES) : $$(@:f)
+#	@-$(MKDIRHIER) $(@:d)
+#    +$(COPY) $< $@
+
+$(COMPONENT_BITMAPS) : bitmaps$/$$(@:f)
+	@-$(MKDIRHIER) $(@:d)
+    +$(COPY) $< $@
+
+$(COMPONENT_LIBRARY) : $(DLLDEST)$/$$(@:f)
+	@-$(MKDIRHIER) $(@:d)
+    +$(COPY) $< $@
+.IF "$(OS)$(CPU)"=="WNTI"
+ .IF "$(COM)"=="GCC"
+    $(GNUCOPY) $(SOLARBINDIR)$/mingwm10.dll $(ZIP1DIR)
+ .ELSE
+	.IF "$(PACKMS)"!=""
+		.IF "$(CCNUMVER)" <= "001399999999"
+			$(GNUCOPY) $(PACKMS)$/msvcr71.dll $(ZIP1DIR)
+			$(GNUCOPY) $(PACKMS)$/msvcp71.dll $(ZIP1DIR)
+		.ELSE
+			.IF "$(CCNUMVER)" <= "001499999999"
+				$(GNUCOPY) $(PACKMS)$/msvcr80.dll $(ZIP1DIR)
+				$(GNUCOPY) $(PACKMS)$/msvcp80.dll $(ZIP1DIR)
+		    	$(GNUCOPY) $(PACKMS)$/msvcm80.dll $(ZIP1DIR)
+				$(GNUCOPY) $(PACKMS)$/Microsoft.VC80.CRT.manifest $(ZIP1DIR)
+			.ELSE
+				$(GNUCOPY) $(PACKMS)$/msvcr90.dll $(ZIP1DIR)
+				$(GNUCOPY) $(PACKMS)$/msvcp90.dll $(ZIP1DIR)
+		    	$(GNUCOPY) $(PACKMS)$/msvcm90.dll $(ZIP1DIR)
+			    $(GNUCOPY) $(PACKMS)$/Microsoft.VC90.CRT.manifest $(ZIP1DIR)
+			.ENDIF
+	    .ENDIF
+	.ELSE        # "$(PACKMS)"!=""
+		.IF "$(CCNUMVER)" <= "001399999999"
+			$(GNUCOPY) $(SOLARBINDIR)$/msvcr71.dll $(ZIP1DIR)
+			$(GNUCOPY) $(SOLARBINDIR)$/msvcp71.dll $(ZIP1DIR)
+		.ELSE
+			.IF "$(CCNUMVER)" <= "001499999999"
+		    	$(GNUCOPY) $(SOLARBINDIR)$/msvcr80.dll $(ZIP1DIR)
+			    $(GNUCOPY) $(SOLARBINDIR)$/msvcp80.dll $(ZIP1DIR)
+				$(GNUCOPY) $(SOLARBINDIR)$/msvcm80.dll $(ZIP1DIR)
+				$(GNUCOPY) $(SOLARBINDIR)$/Microsoft.VC80.CRT.manifest $(ZIP1DIR)
+			.ELSE
+	    		$(GNUCOPY) $(SOLARBINDIR)$/msvcr90.dll $(ZIP1DIR)
+	    		$(GNUCOPY) $(SOLARBINDIR)$/msvcp90.dll $(ZIP1DIR)
+		    	$(GNUCOPY) $(SOLARBINDIR)$/msvcm90.dll $(ZIP1DIR)
+		    	$(GNUCOPY) $(SOLARBINDIR)$/Microsoft.VC90.CRT.manifest $(ZIP1DIR)
+			.ENDIF
+	    .ENDIF
+	.ENDIF         # "$(PACKMS)"!=""
+ .ENDIF	#"$(COM)"=="GCC"
+.ENDIF
+
+
+$(ZIP1DIR)/%.xcu : %.xcu
+	@@-$(MKDIRHIER) $(@:d)
+	$(GNUCOPY) $< $@
+
+$(ZIP1DIR)$/%.xcs : %.xcs
+	@@-$(MKDIRHIER) $(@:d)
+	$(GNUCOPY) $< $@
+
+# Temporary file that is used to replace some placeholders in description.xml.
+DESCRIPTION_TMP:=$(ZIP1DIR)$/description.xml.tmp
+
+.INCLUDE .IGNORE : $(ZIP1DIR)_lang_track.mk
+.IF "$(LAST_WITH_LANG)"!="$(WITH_LANG)"
+PHONYDESC=.PHONY
+.ENDIF			# "$(LAST_WITH_LANG)"!="$(WITH_LANG)"
+$(DESCRIPTION) $(PHONYDESC) : $$(@:f)
+	@@-$(MKDIRHIER) $(@:d)
+	$(PERL) $(SOLARENV)$/bin$/licinserter.pl description.xml registry/LICENSE_xxx $(DESCRIPTION_TMP)
+	@echo LAST_WITH_LANG=$(WITH_LANG) > $(ZIP1DIR)_lang_track.mk
+	$(TYPE) $(DESCRIPTION_TMP) | sed s/UPDATED_PLATFORM/$(PLATFORMID)/ > $@
+	@@-$(RM) $(DESCRIPTION_TMP)
+
+
+.ENDIF # "$(ENABLE_OCRIMPORT)" != "NO"
diff --git a/scratch/ocrimport/manifest.xml b/scratch/ocrimport/manifest.xml
new file mode 100644
index 0000000..0e1cd3a
--- /dev/null
+++ b/scratch/ocrimport/manifest.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
+<manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest">
+  <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=native"
+    manifest:full-path="OCRImport.unoSHARED_EXTENSION"/>
+  <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+    manifest:full-path="Addons.xcu"/>
+  <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+    manifest:full-path="WriterWindowState.xcu"/>
+    <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+    manifest:full-path="CalcWindowState.xcu"/>
+  <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+    manifest:full-path="Jobs.xcu"/>
+  <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+    manifest:full-path="ProtocolHandler.xcu"/>
+  
+</manifest:manifest>


More information about the ooo-build-commit mailing list