[ooo-build-commit] patches/dev300

Jan Holesovsky kendy at kemper.freedesktop.org
Wed Jun 17 05:23:17 PDT 2009


 patches/dev300/apply                      |    2 
 patches/dev300/kde4-fpicker-source.diff   |  901 +++++++-----
 patches/dev300/kde4-plugin-detection.diff |  100 +
 patches/dev300/kde4-shell-prj.diff        |    2 
 patches/dev300/kde4-shell-source.diff     |  237 +--
 patches/dev300/kde4-vcl-prj.diff          |   12 
 patches/dev300/kde4-vcl-source.diff       | 2191 ++++++++++++++++++++++++++++++
 patches/dev300/kde4-vcl.diff              | 1933 --------------------------
 8 files changed, 2925 insertions(+), 2453 deletions(-)

New commits:
commit 4e8e761ee91c414c22c1b0e8ba5361fafd364a5a
Author: Roman Shtylman <shtylman at gmail.com>
Date:   Tue Jun 16 19:21:44 2009 -0400

    updated the kde4 file structure and includes
    
    * patches/dev300/apply:
    * patches/dev300/kde4-fpicker-source.diff:
    * patches/dev300/kde4-plugin-detection.diff:
    * patches/dev300/kde4-shell-prj.diff:
    * patches/dev300/kde4-shell-source.diff:
    * patches/dev300/kde4-vcl-prj.diff:
    * patches/dev300/kde4-vcl-source.diff:
    * patches/dev300/kde4-vcl.diff:

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 2d2db22..679d6fc 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -2777,7 +2777,7 @@ kde4-scp2.diff
 
 kde4-plugin-detection.diff
 kde4-vcl-prj.diff
-kde4-vcl.diff
+kde4-vcl-source.diff
 
 [ KDE4Experimental ]
 # Not yet ported to co-exist with the KDE3 stuff
diff --git a/patches/dev300/kde4-fpicker-source.diff b/patches/dev300/kde4-fpicker-source.diff
index b46c327..b5cb28a 100644
--- a/patches/dev300/kde4-fpicker-source.diff
+++ b/patches/dev300/kde4-fpicker-source.diff
@@ -1,9 +1,38 @@
+diff --git fpicker/source/generic/fpicker.cxx fpicker/source/generic/fpicker.cxx
+index 1129369..b4a96d6 100644
+--- fpicker/source/generic/fpicker.cxx
++++ fpicker/source/generic/fpicker.cxx
+@@ -68,6 +68,8 @@ static OUString FilePicker_getSystemPickerServiceName()
+ 		return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.GtkFilePicker"));
+ 	else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("kde"))
+ 		return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.KDEFilePicker"));
++	else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("kde4"))
++		return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.KDE4FilePicker"));
+     else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("macosx"))
+         return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.AquaFilePicker"));
+ #endif
+diff --git fpicker/source/unx/kde/makefile.mk fpicker/source/unx/kde/makefile.mk
+index 680e0f6..f4a113a 100644
+--- fpicker/source/unx/kde/makefile.mk
++++ fpicker/source/unx/kde/makefile.mk
+@@ -96,9 +96,10 @@ SLOFILES =\
+ APP1TARGET=$(TARGET)
+ APP1OBJS=$(SLOFILES)
+ APP1RPATH=BRAND
++APP1LINKFLAGS+=$(KDE_LIBS)
+ APP1STDLIBS=\
+ 			$(SALLIB) \
+-			$(KDE_LIBS) -lkio
++			-lkio
+ 
+ 
+ .ENDIF # "$(GUIBASE)" != "unx" || "$(ENABLE_KDE)" != "TRUE"
 diff --git fpicker/source/unx/kde4/FPServiceInfo.hxx fpicker/source/unx/kde4/FPServiceInfo.hxx
 new file mode 100644
-index 0000000..85214a1
+index 0000000..59804ea
 --- /dev/null
 +++ fpicker/source/unx/kde4/FPServiceInfo.hxx
-@@ -0,0 +1,77 @@
+@@ -0,0 +1,74 @@
 +/*************************************************************************
 + *
 + *
@@ -65,28 +94,25 @@ index 0000000..85214a1
 + *
 + ************************************************************************/
 +
-+#ifndef _FPSERVICEINFO_HXX_
-+#define _FPSERVICEINFO_HXX_
++#pragma once
 +
 +// the service names
 +#define FILE_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.KDE4FilePicker"
 +
 +// the implementation names		
-+#define FILE_PICKER_IMPL_NAME    "com.sun.star.ui.dialogs.KDE4FilePickerImpl"
++#define FILE_PICKER_IMPL_NAME    "com.sun.star.ui.dialogs.KDE4FilePicker"
 +
 +// the registry key names
 +// a key under which this service will be registered,
 +// Format: -> "/ImplName/UNO/SERVICES/ServiceName"
 +//  <Implementation-Name></UNO/SERVICES/><Service-Name> 
 +#define FILE_PICKER_REGKEY_NAME  "/com.sun.star.ui.dialogs.KDE4FilePickerImpl/UNO/SERVICES/com.sun.star.ui.dialogs.KDE4FilePicker"
-+
-+#endif
 diff --git fpicker/source/unx/kde4/KDE4FPEntry.cxx fpicker/source/unx/kde4/KDE4FPEntry.cxx
 new file mode 100644
-index 0000000..4d95264
+index 0000000..9a75688
 --- /dev/null
 +++ fpicker/source/unx/kde4/KDE4FPEntry.cxx
-@@ -0,0 +1,169 @@
+@@ -0,0 +1,136 @@
 +/*************************************************************************
 + *
 + *
@@ -148,25 +174,14 @@ index 0000000..4d95264
 + *
 + ************************************************************************/
 +
-+#ifndef _CPPUHELPER_FACTORY_HXX_
 +#include <cppuhelper/factory.hxx>
-+#endif
 +
-+#ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
 +#include <com/sun/star/container/XSet.hpp>
-+#endif
 +
-+#ifndef _OSL_DIAGNOSE_H_
 +#include <osl/diagnose.h>
-+#endif
 +
-+#ifndef _UNXFILEPICKER_HXX_
 +#include "KDE4FilePicker.hxx"
-+#endif
-+
-+#ifndef _FPSERVICEINFO_HXX_
 +#include "FPServiceInfo.hxx"
-+#endif
 +
 +using namespace ::rtl;
 +using namespace ::com::sun::star::uno;
@@ -176,92 +191,70 @@ index 0000000..4d95264
 +using namespace ::cppu;
 +using ::com::sun::star::ui::dialogs::XFilePicker;
 +
-+//////////////////////////////////////////////////////////////////////////
-+// 
-+//////////////////////////////////////////////////////////////////////////
-+
-+static Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager )
++static Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& serviceManager )
 +{
-+    return Reference< XInterface >( 
-+            static_cast< XFilePicker* >( new KDE4FilePicker( rServiceManager ) ) );
++    return Reference< XInterface >(static_cast< XFilePicker* >( new KDE4FilePicker( serviceManager ) ) );
 +}
 +
-+//////////////////////////////////////////////////////////////////////////
 +// the three uno functions that will be exported
-+//////////////////////////////////////////////////////////////////////////
-+
 +extern "C" 
 +{
++	void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
++	{
++		*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
++	}
 +
-+//////////////////////////////////////////////////////////////////////////
-+// component_getImplementationEnvironment
-+//////////////////////////////////////////////////////////////////////////
-+
-+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 )
-+{
-+    sal_Bool bRetVal = sal_True;
-+
-+    if ( pRegistryKey )
-+    {
-+        try
-+        {
-+            Reference< XRegistryKey > pXNewKey( static_cast< XRegistryKey* >( pRegistryKey ) );				
-+            pXNewKey->createKey( OUString::createFromAscii( FILE_PICKER_REGKEY_NAME ) );
-+        }
-+        catch( InvalidRegistryException& )
-+        {			
-+            OSL_ENSURE( sal_False, "InvalidRegistryException caught" );			
-+            bRetVal = sal_False;
-+        }
-+    }
++	sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey )
++	{
++		sal_Bool bRetVal = sal_True;
 +
-+    return bRetVal;
-+}
++		if ( pRegistryKey )
++		{
++			try
++			{
++				Reference< XRegistryKey > pXNewKey( static_cast< XRegistryKey* >( pRegistryKey ) );				
++				pXNewKey->createKey( OUString::createFromAscii( FILE_PICKER_REGKEY_NAME ) );
++			}
++			catch( InvalidRegistryException& )
++			{			
++				OSL_ENSURE( sal_False, "InvalidRegistryException caught" );			
++				bRetVal = sal_False;
++			}
++		}
 +
-+//////////////////////////////////////////////////////////////////////////
-+//
-+//////////////////////////////////////////////////////////////////////////
++		return bRetVal;
++	}
 +
-+void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* pRegistryKey )
-+{
-+    void* pRet = 0;
++	void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* pRegistryKey )
++	{
++		void* pRet = 0;
 +
-+    if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FILE_PICKER_IMPL_NAME ) ) )
-+    {
-+        Sequence< OUString > aSNS( 1 );
-+        aSNS.getArray( )[0] = OUString::createFromAscii( FILE_PICKER_SERVICE_NAME );		
-+
-+        Reference< XSingleServiceFactory > xFactory ( createSingleFactory(
-+                    reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
-+                    OUString::createFromAscii( pImplName ),
-+                    createInstance,
-+                    aSNS ) );
-+        if ( xFactory.is() )
-+        {
-+            xFactory->acquire();
-+            pRet = xFactory.get();
-+        }			
-+    }
++		if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, FILE_PICKER_IMPL_NAME ) ) )
++		{
++			Sequence< OUString > aSNS( 1 );
++			aSNS.getArray( )[0] = OUString::createFromAscii( FILE_PICKER_SERVICE_NAME );		
++
++			Reference< XSingleServiceFactory > xFactory ( createSingleFactory(
++						reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
++						OUString::createFromAscii( pImplName ),
++						createInstance,
++						aSNS ) );
++			if ( xFactory.is() )
++			{
++				xFactory->acquire();
++				pRet = xFactory.get();
++			}			
++		}
 +
-+    return pRet;
++		return pRet;
++	}
 +}
-+
-+} // extern "C"
 diff --git fpicker/source/unx/kde4/KDE4FilePicker.cxx fpicker/source/unx/kde4/KDE4FilePicker.cxx
 new file mode 100644
-index 0000000..ce3a01f
+index 0000000..6c382c8
 --- /dev/null
 +++ fpicker/source/unx/kde4/KDE4FilePicker.cxx
-@@ -0,0 +1,489 @@
+@@ -0,0 +1,717 @@
 +/*************************************************************************
 + *
 + *
@@ -327,80 +320,40 @@ index 0000000..ce3a01f
 +// includes
 +//////////////////////////////////////////////////////////////////////////
 +
-+#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
 +#include <com/sun/star/lang/DisposedException.hpp>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
 +#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-+#endif
-+
-+#ifndef _CPPUHELPER_INTERFACECONTAINER_H_
 +#include <cppuhelper/interfacecontainer.h>
-+#endif
-+
-+#ifndef _OSL_DIAGNOSE_H_
-+#include <osl/diagnose.h>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_UI_DIALOGS_TEMPLATEDESCRIPTION_HPP_
 +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_UI_DIALOGS_COMMONFILEPICKERELEMENTIDS_HPP_
 +#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_UI_DIALOGS_EXTENDEDFILEPICKERELEMENTIDS_HPP_
 +#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_UI_DIALOGS_CONTROLACTIONS_HPP_
 +#include <com/sun/star/ui/dialogs/ControlActions.hpp>
-+#endif
-+
-+#ifndef _RTL_USTRING_H_
-+#include <rtl/ustring.hxx>
-+#endif
-+
-+#ifndef _RTL_USTRBUF_HXX_
-+#include <rtl/ustrbuf.hxx>
-+#endif
-+
-+#ifndef _FPSERVICEINFO_HXX_
-+#include "FPServiceInfo.hxx"
-+#endif
++#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
 +
-+#ifndef _TOOLS_RESMGR_HXX
-+#include <tools/resmgr.hxx>
-+#endif
-+
-+#ifndef _SVTOOLS_HRC
 +#include <svtools/svtools.hrc>
-+#endif
-+
-+#ifndef _UNXFILEOPENIMPL_HXX_
-+#include "KDE4FilePicker.hxx"
-+#endif
 +
 +#include <vos/mutex.hxx>
 +
 +#include <vcl/svapp.hxx>
 +#include <vcl/sysdata.hxx>
 +#include <vcl/syswin.hxx>
-+#include <vcl/window.hxx>
 +
-+#include <sys/wait.h>
-+#include <unistd.h>
-+#include <fcntl.h>
-+#include <stdio.h>
++#include "KDE4FilePicker.hxx"
++#include "FPServiceInfo.hxx"
 +
 +/* ********* Hack, but needed because of conflicting types... */
 +#define Region QtXRegion
 +
++//kde has an enum that uses this...OO does too
++#undef SETTINGS_MOUSE
++
 +#include <kfiledialog.h>
 +#include <kwindowsystem.h>
 +#include <kapplication.h>
++#include <kfilefiltercombo.h>
++
++#include <QWidget>
++#include <QCheckBox>
++#include <QGridLayout>
 +
 +#undef Region
 +
@@ -438,6 +391,16 @@ index 0000000..ce3a01f
 +    }
 +}
 +
++rtl::OUString toOUString(const QString& s)
++{
++	return rtl::OUString(s.toUtf8().data(), s.length(), RTL_TEXTENCODING_UTF8);
++}
++
++QString toQString(const rtl::OUString& s)
++{
++	return QString::fromUtf16(s.getStr(), s.getLength());
++}
++
 +//////////////////////////////////////////////////////////////////////////
 +// KDE4FilePicker
 +//////////////////////////////////////////////////////////////////////////
@@ -452,14 +415,24 @@ index 0000000..ce3a01f
 +          lang::XInitialization,
 +          util::XCancellable,
 +          lang::XEventListener, 
-+          lang::XServiceInfo>( m_rbHelperMtx ),
-+          m_xServiceMgr( xServiceMgr )
++          lang::XServiceInfo>( _helperMutex ),
++          m_xServiceMgr( xServiceMgr ),
++		  _resMgr( CREATEVERSIONRESMGR( fps_office ) )
 +{
-+	_dialog = new KFileDialog(KUrl("/home/shtylman/Desktop"), QString(""), 0);
++	_extraControls = new QWidget();
++	
++	_layout = new QGridLayout(_extraControls);
++	
++	_dialog = new KFileDialog(KUrl(""), QString(""), 0, _extraControls);
++	_dialog->setMode(KFile::File | KFile::LocalOnly);
++	
++	//default mode
++	_dialog->setOperationMode(KFileDialog::Opening);
 +}
 +
 +KDE4FilePicker::~KDE4FilePicker()
 +{
++	delete _resMgr;
 +	delete _dialog;
 +}
 +
@@ -477,17 +450,15 @@ index 0000000..ce3a01f
 +    m_xListener.clear();
 +}
 +
-+void SAL_CALL KDE4FilePicker::setTitle( const rtl::OUString &rTitle )
++void SAL_CALL KDE4FilePicker::setTitle( const rtl::OUString &title )
 +    throw( uno::RuntimeException )
 +{
-+	fprintf(stderr, "set title fp\n");
++	_dialog->setCaption(toQString(title));
 +}
 +
 +sal_Int16 SAL_CALL KDE4FilePicker::execute()
 +    throw( uno::RuntimeException )
 +{
-+	fprintf(stderr, "execute fp\n");
-+	
 +	//get the window id of the main OO window to set it for the dialog as a parent
 +	Window *pParentWin = Application::GetDefDialogParent();
 +	if ( pParentWin )
@@ -499,9 +470,7 @@ index 0000000..ce3a01f
 +		}
 +	}
 +	
-+	_dialog->setMode( KFile::File | KFile::LocalOnly | KFile::ExistingOnly );
-+	_dialog->setOperationMode(KFileDialog::Opening);
-+	
++	_dialog->setFilter(_filter);
 +	_dialog->exec();
 +	
 +	//nasty hack to get a local qt event loop going to process the dialog
@@ -511,42 +480,47 @@ index 0000000..ce3a01f
 +		kapp->processEvents(QEventLoop::WaitForMoreEvents);
 +	}
 +	
-+	fprintf(stderr, "exec ret\n");
-+	
 +	//block and wait for user input
 +	if (_dialog->result() == KFileDialog::Accepted)
 +	{
-+		return true;
++		return ExecutableDialogResults::OK;
 +	}
 +	
-+	return false;
++	return ExecutableDialogResults::CANCEL;
 +}
 +
-+void SAL_CALL KDE4FilePicker::setMultiSelectionMode( sal_Bool bMode )
++void SAL_CALL KDE4FilePicker::setMultiSelectionMode( sal_Bool multiSelect )
 +    throw( uno::RuntimeException )
 +{
-+	fprintf(stderr, "set multi sel mode fp\n");
++	if (multiSelect)
++	{
++		_dialog->setMode(KFile::Files | KFile::LocalOnly);
++	}
++	else
++	{
++		_dialog->setMode(KFile::File | KFile::LocalOnly);
++	}
 +}
 +
-+void SAL_CALL KDE4FilePicker::setDefaultName( const ::rtl::OUString &rName )
++void SAL_CALL KDE4FilePicker::setDefaultName( const ::rtl::OUString &name )
 +    throw( uno::RuntimeException )
 +{
-+	fprintf(stderr, "set def name fp\n");
++	const QString url = toQString(name);
++	_dialog->setSelection(url);
 +}
 +
-+void SAL_CALL KDE4FilePicker::setDisplayDirectory( const rtl::OUString &rDirectory )
++void SAL_CALL KDE4FilePicker::setDisplayDirectory( const rtl::OUString &dir )
 +    throw( uno::RuntimeException )
 +{
-+	fprintf(stderr, "set disp dir fp\n");
++	const QString url = toQString(dir);
++	_dialog->setStartDir(KUrl(url));
 +}
 +
 +rtl::OUString SAL_CALL KDE4FilePicker::getDisplayDirectory()
 +    throw( uno::RuntimeException )
 +{
-+	fprintf(stderr, "get disp dir fp\n");
-+	
-+	const char* s = "/home/shtylman/Desktop";
-+	return rtl::OUString(s, strlen(s), RTL_TEXTENCODING_UTF8);
++	QString dir = _dialog->baseUrl().url();
++	return toOUString(dir);
 +}
 +
 +uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles()
@@ -554,156 +528,412 @@ index 0000000..ce3a01f
 +{
 +	QStringList files = _dialog->selectedFiles();
 +	
-+	fprintf(stderr, "get files %d\n", files.size());
++	uno::Sequence< ::rtl::OUString > seq(files.size());
 +	
-+	//uno::Sequence< ::rtl::OUString > seq(files.size());
-+	uno::Sequence< ::rtl::OUString > seq(1);
-+	
-+	////seq[0] = rtl::OUString("file:/home/shtylman/Desktop/test.cpp", strlen("file:/home/shtylman/Desktop/test.cpp"), RTL_TEXTENCODING_UTF8);
 +	for (int i=0 ; i<files.size() ; ++i)
 +	{
 +		const QString fileName = "file:" + files[i];
-+		fprintf(stderr, "%s\n", fileName.toUtf8().data());
-+		seq[i] = rtl::OUString(fileName.toUtf8().data(), fileName.size(), RTL_TEXTENCODING_UTF8);
++		seq[i] = toOUString(fileName);
 +	}
 +	
 +	return seq;
 +}
 +
-+void SAL_CALL KDE4FilePicker::appendFilter( const ::rtl::OUString &rTitle, const ::rtl::OUString &rFilter )
++void SAL_CALL KDE4FilePicker::appendFilter( const ::rtl::OUString &title, const ::rtl::OUString &filter )
 +    throw( lang::IllegalArgumentException, uno::RuntimeException )
 +{
-+	fprintf(stderr, "append filter fp\n");
++	QString t = toQString(title);
++	QString f = toQString(filter);
++	
++	if (!_filter.isNull())
++	{
++		_filter.append("\n");
++	}
++	
++	//add to hash map for reverse lookup in getCurrentFilter
++	_filters.insert(f, t);
++	
++	// '/' meed to be escaped to else they are assumed to be mime types by kfiledialog
++	//see the docs
++	t.replace("/", "\\/");
++	
++	_filter.append(QString("%1|%2").arg(f).arg(t));
 +}
 +
-+void SAL_CALL KDE4FilePicker::setCurrentFilter( const rtl::OUString &rTitle )
++void SAL_CALL KDE4FilePicker::setCurrentFilter( const rtl::OUString &title )
 +    throw( lang::IllegalArgumentException, uno::RuntimeException )
 +{
-+	fprintf(stderr, "set current filter fp\n");
++	QString filter = toQString(title);
++	filter.replace("/", "\\/");
++	_dialog->filterWidget()->setCurrentFilter(filter);
 +}
 +
 +rtl::OUString SAL_CALL KDE4FilePicker::getCurrentFilter()
 +    throw( uno::RuntimeException )
 +{
-+	fprintf(stderr, "get current filter fp\n");
-+	const char* s = "";
-+	return rtl::OUString(s, strlen(s), RTL_TEXTENCODING_UTF8);
++	QString filter = _filters[_dialog->currentFilter()];
++	
++	//default if not found
++	if (filter.isNull())
++	{
++		filter = "ODF Text Document (.odt)";
++	}
++	
++	return toOUString(filter);
 +}
 +
-+void SAL_CALL KDE4FilePicker::appendFilterGroup( const rtl::OUString &rGroupTitle, const uno::Sequence<beans::StringPair> &rFilters )
++void SAL_CALL KDE4FilePicker::appendFilterGroup( const rtl::OUString&, const uno::Sequence<beans::StringPair>& )
 +    throw( lang::IllegalArgumentException, uno::RuntimeException )
 +{
-+	fprintf(stderr, "append filter group fp\n");
++	//TODO
 +}
 +
-+void SAL_CALL KDE4FilePicker::setValue( sal_Int16 nControlId, sal_Int16 nControlAction, const uno::Any &rValue )
++void SAL_CALL KDE4FilePicker::setValue( sal_Int16 controlId, sal_Int16, const uno::Any &value )
 +    throw( uno::RuntimeException )
 +{
-+	fprintf(stderr, "set value fp\n");
++	QWidget* widget = _customWidgets[controlId];
++	
++	if (widget)
++	{
++		switch (controlId)
++		{
++			case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION:
++			case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
++			case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
++			case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
++			case ExtendedFilePickerElementIds::CHECKBOX_LINK:
++			case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
++			case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
++			{
++				QCheckBox* cb = dynamic_cast<QCheckBox*>(widget);
++				cb->setChecked(value.getValue());
++				break;
++			}
++			case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
++			case ExtendedFilePickerElementIds::LISTBOX_VERSION:
++			case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
++			case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
++			case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
++			case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
++			case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
++			case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
++				break;
++		}
++	}
 +}
 +
-+uno::Any SAL_CALL KDE4FilePicker::getValue( sal_Int16 nControlId, sal_Int16 nControlAction )
++uno::Any SAL_CALL KDE4FilePicker::getValue( sal_Int16 controlId, sal_Int16 )
 +    throw( uno::RuntimeException )
 +{
-+	fprintf(stderr, "get value fp\n");
++	uno::Any res(false);
++	
++	QWidget* widget = _customWidgets[controlId];
++	
++	if (widget)
++	{
++		switch (controlId)
++		{
++			case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION:
++			case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
++			case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
++			case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
++			case ExtendedFilePickerElementIds::CHECKBOX_LINK:
++			case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
++			case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
++			{
++				QCheckBox* cb = dynamic_cast<QCheckBox*>(widget);
++				res = uno::Any(cb->isChecked());
++				break;
++			}
++			case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
++			case ExtendedFilePickerElementIds::LISTBOX_VERSION:
++			case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
++			case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
++			case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
++			case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
++			case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
++			case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
++				break;
++		}
++	}
++	
++	return res;
 +}
 +
-+void SAL_CALL KDE4FilePicker::enableControl( sal_Int16 nControlId, sal_Bool bEnable )
++void SAL_CALL KDE4FilePicker::enableControl( sal_Int16 controlId, sal_Bool enable )
 +    throw( uno::RuntimeException )
 +{
++	QWidget* widget = _customWidgets[controlId];
++	
++	if (widget)
++	{
++		widget->setEnabled(enable);
++	}
 +}
 +
-+void SAL_CALL KDE4FilePicker::setLabel( sal_Int16 nControlId, const ::rtl::OUString &rLabel )
++void SAL_CALL KDE4FilePicker::setLabel( sal_Int16 controlId, const ::rtl::OUString &label )
 +    throw( uno::RuntimeException )
 +{
-+	fprintf(stderr, "set label fp\n");
++	QWidget* widget = _customWidgets[controlId];
++	
++	if (widget)
++	{
++		switch (controlId)
++		{
++			case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION:
++			case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
++			case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
++			case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
++			case ExtendedFilePickerElementIds::CHECKBOX_LINK:
++			case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
++			case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
++			{
++				QCheckBox* cb = dynamic_cast<QCheckBox*>(widget);
++				cb->setText(toQString(label));
++				break;
++			}
++			case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
++			case ExtendedFilePickerElementIds::LISTBOX_VERSION:
++			case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
++			case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
++			case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
++			case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
++			case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
++			case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
++				break;
++		}
++	}
 +}
 +
-+rtl::OUString SAL_CALL KDE4FilePicker::getLabel(sal_Int16 /*nControlId*/) 
++rtl::OUString SAL_CALL KDE4FilePicker::getLabel(sal_Int16 controlId) 
 +    throw ( uno::RuntimeException )
 +{
-+	fprintf(stderr, "get label fp\n");
-+	const char* s = "";
-+	return rtl::OUString(s, strlen(s), RTL_TEXTENCODING_UTF8);
-+}
-+
-+/* TODO
-+uno::Sequence<sal_Int16> SAL_CALL KDE4FilePicker::getSupportedImageFormats()
-+    throw( uno::RuntimeException )
-+{
-+    checkFilePicker();
-+    ::osl::MutexGuard aGuard( m_aMutex );
-+
-+    return m_pImpl->getSupportedImageFormats();
-+}
-+
-+sal_Int32 SAL_CALL KDE4FilePicker::getTargetColorDepth()
-+    throw( uno::RuntimeException )
-+{
-+    checkFilePicker();
-+    ::osl::MutexGuard aGuard( m_aMutex );
-+
-+    return m_pImpl->getTargetColorDepth();
-+}
-+
-+sal_Int32 SAL_CALL KDE4FilePicker::getAvailableWidth()
-+    throw( uno::RuntimeException )
-+{
-+    checkFilePicker();
-+    ::osl::MutexGuard aGuard( m_aMutex );
-+
-+    return m_pImpl->getAvailableWidth();
-+}
-+
-+sal_Int32 SAL_CALL KDE4FilePicker::getAvailableHeight()
-+    throw( uno::RuntimeException )
-+{
-+    checkFilePicker();
-+    ::osl::MutexGuard aGuard( m_aMutex );
-+
-+    return m_pImpl->getAvailableHeight();
++	QWidget* widget = _customWidgets[controlId];
++	QString label;
++	
++	if (widget)
++	{
++		switch (controlId)
++		{
++			case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION:
++			case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
++			case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
++			case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
++			case ExtendedFilePickerElementIds::CHECKBOX_LINK:
++			case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
++			case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
++			{
++				QCheckBox* cb = dynamic_cast<QCheckBox*>(widget);
++				label = cb->text();
++				break;
++			}
++			case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
++			case ExtendedFilePickerElementIds::LISTBOX_VERSION:
++			case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
++			case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
++			case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
++			case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
++			case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
++			case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
++				break;
++		}
++	}
++	return toOUString(label);
 +}
 +
-+void SAL_CALL KDE4FilePicker::setImage( sal_Int16 aImageFormat, const uno::Any &rImage ) 
-+    throw( lang::IllegalArgumentException, uno::RuntimeException )
++void KDE4FilePicker::addCustomControl(sal_Int16 controlId)
 +{
-+    checkFilePicker();
-+    ::osl::MutexGuard aGuard( m_aMutex );
-+
-+    m_pImpl->setImage( aImageFormat, aImage );
++	QWidget* widget = 0;
++	sal_Int32 resId = -1;
++	
++	switch (controlId)
++	{
++		case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION:
++			resId = STR_SVT_FILEPICKER_AUTO_EXTENSION;
++			break;
++		case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
++			resId = STR_SVT_FILEPICKER_PASSWORD;
++			break;
++		case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
++			resId = STR_SVT_FILEPICKER_FILTER_OPTIONS;
++			break;
++		case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
++			resId = STR_SVT_FILEPICKER_READONLY;
++			break;
++		case ExtendedFilePickerElementIds::CHECKBOX_LINK:
++			resId = STR_SVT_FILEPICKER_INSERT_AS_LINK;
++			break;
++		case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
++			resId = STR_SVT_FILEPICKER_SHOW_PREVIEW;
++			break;
++		case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
++			resId = STR_SVT_FILEPICKER_SELECTION;
++			break;
++		case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
++			resId = STR_SVT_FILEPICKER_PLAY;
++			break;
++		case ExtendedFilePickerElementIds::LISTBOX_VERSION:
++			resId = STR_SVT_FILEPICKER_VERSION;
++			break;
++		case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
++			resId = STR_SVT_FILEPICKER_TEMPLATES;
++			break;
++		case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
++			resId = STR_SVT_FILEPICKER_IMAGE_TEMPLATE;
++			break;
++		case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
++		case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
++		case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
++		case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
++			break;
++	}
++	
++	switch (controlId)
++	{
++		case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION:
++		case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD:
++		case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS:
++		case ExtendedFilePickerElementIds::CHECKBOX_READONLY:
++		case ExtendedFilePickerElementIds::CHECKBOX_LINK:
++		case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW:
++		case ExtendedFilePickerElementIds::CHECKBOX_SELECTION:
++		{
++			QString label;
++			
++			if (_resMgr && resId != -1)
++			{
++				rtl::OUString s = String(ResId( resId, *_resMgr ));
++				label = toQString(s);
++				label.replace("~", "&");
++			}
++			
++			widget = new QCheckBox(label, _extraControls);
++			
++			break;
++		}
++		case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY:
++		case ExtendedFilePickerElementIds::LISTBOX_VERSION:
++		case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE:
++		case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE:
++		case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL:
++		case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL:
++		case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL:
++		case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR:
++			break;
++	}
++	
++	if (widget)
++	{
++		_layout->addWidget(widget);
++		_customWidgets.insert(controlId, widget);
++	}
 +}
 +
-+sal_Bool SAL_CALL KDE4FilePicker::setShowState( sal_Bool bShowState )
-+    throw( uno::RuntimeException )
-+{
-+    checkFilePicker();
-+    ::osl::MutexGuard aGuard( m_aMutex );   
-+
-+    return m_pImpl->setShowState( bShowState );
-+}
++void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args ) 
++    throw( uno::Exception, uno::RuntimeException )
++{	
++	_filter.clear();
++	_filters.clear();
++	
++    // parameter checking	    
++    uno::Any arg;
++    if (args.getLength() == 0)
++	{
++        throw lang::IllegalArgumentException(
++                rtl::OUString::createFromAscii( "no arguments" ),
++                static_cast< XFilePicker* >( this ), 1 );
++	}
 +
-+sal_Bool SAL_CALL KDE4FilePicker::getShowState()
-+    throw( uno::RuntimeException )
-+{
-+    checkFilePicker();
-+    ::osl::MutexGuard aGuard( m_aMutex );
++    arg = args[0];
 +
-+    return m_pImpl->getShowState();
-+}
-+*/
++    if (( arg.getValueType() != ::getCppuType((sal_Int16*)0)) && 
++		( arg.getValueType() != ::getCppuType((sal_Int8*)0)))
++	{
++        throw lang::IllegalArgumentException(
++                rtl::OUString::createFromAscii( "invalid argument type" ),
++                static_cast< XFilePicker* >( this ), 1 );
++	}
 +
-+void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &rArguments ) 
-+    throw( uno::Exception, uno::RuntimeException )
-+{
-+	fprintf(stderr, "initialize fp\n");
-+    initFilePicker();
-+	fprintf(stderr, "initialize end fp\n");
++    sal_Int16 templateId = -1;
++    arg >>= templateId;
++	
++	//default is opening
++	KFileDialog::OperationMode operationMode = KFileDialog::Opening;
++	
++    switch ( templateId )
++    {
++        case FILEOPEN_SIMPLE:
++            break;
++			
++        case FILESAVE_SIMPLE:
++            operationMode = KFileDialog::Saving;
++            break;
++			
++        case FILESAVE_AUTOEXTENSION:
++            operationMode = KFileDialog::Saving;
++			addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
++            break;
++
++        case FILESAVE_AUTOEXTENSION_PASSWORD:
++		{
++            operationMode = KFileDialog::Saving;
++			addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
++            addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD );
++            break;
++		}
++        case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS:
++		{
++			operationMode = KFileDialog::Saving;
++			addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
++            addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD );
++            addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS );
++            break;
++		}
++        case FILESAVE_AUTOEXTENSION_SELECTION:
++            operationMode = KFileDialog::Saving;
++            addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
++            addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_SELECTION );
++            break;
++
++        case FILESAVE_AUTOEXTENSION_TEMPLATE:
++            operationMode = KFileDialog::Saving;
++            addCustomControl( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE );
++            break;
++
++        case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE:
++            addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_LINK );
++            addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW );
++            addCustomControl( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE );
++            break;
++
++        case FILEOPEN_PLAY:        
++            addCustomControl( ExtendedFilePickerElementIds::PUSHBUTTON_PLAY );
++            break;
++
++        case FILEOPEN_READONLY_VERSION:
++            addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_READONLY );
++            addCustomControl( ExtendedFilePickerElementIds::LISTBOX_VERSION );
++            break;
++
++        case FILEOPEN_LINK_PREVIEW:
++            addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_LINK );
++            addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW );
++            break;
++
++        default:
++            throw lang::IllegalArgumentException(
++                    rtl::OUString::createFromAscii( "Unknown template" ),
++                    static_cast< XFilePicker* >( this ),
++                    1 );
++    }
++	
++	_dialog->setOperationMode(operationMode);
 +}
 +
 +void SAL_CALL KDE4FilePicker::cancel()
 +    throw ( uno::RuntimeException )
 +{
-+	fprintf(stderr, "calcel fp\n");
++	
 +}
 +
 +void SAL_CALL KDE4FilePicker::disposing( const lang::EventObject &rEvent )
@@ -712,9 +942,9 @@ index 0000000..ce3a01f
 +    uno::Reference<XFilePickerListener> xFilePickerListener( rEvent.Source, uno::UNO_QUERY );
 +
 +    if ( xFilePickerListener.is() )
++	{
 +        removeFilePickerListener( xFilePickerListener );
-+	
-+	fprintf(stderr, "disposed fp\n");
++	}
 +}
 +
 +rtl::OUString SAL_CALL KDE4FilePicker::getImplementationName() 
@@ -742,21 +972,12 @@ index 0000000..ce3a01f
 +{
 +    return FilePicker_getSupportedServiceNames();
 +}
-+
-+void KDE4FilePicker::initFilePicker()
-+{
-+}
-+
-+void KDE4FilePicker::checkFilePicker() throw( ::com::sun::star::uno::RuntimeException )
-+{
-+	fprintf(stderr, "check fp\n");
-+}
 diff --git fpicker/source/unx/kde4/KDE4FilePicker.hxx fpicker/source/unx/kde4/KDE4FilePicker.hxx
 new file mode 100644
-index 0000000..8505ff8
+index 0000000..4d5ca77
 --- /dev/null
 +++ fpicker/source/unx/kde4/KDE4FilePicker.hxx
-@@ -0,0 +1,223 @@
+@@ -0,0 +1,205 @@
 +/*************************************************************************
 + *
 + *
@@ -818,63 +1039,31 @@ index 0000000..8505ff8
 + *
 + ************************************************************************/
 +
-+#ifndef _UNXFILEPICKER_HXX_
-+#define _UNXFILEPICKER_HXX_
++#pragma once
 +
-+#ifndef _CPPUHELPER_COMPBASE8_HXX_
 +#include <cppuhelper/compbase8.hxx>
-+#endif
-+
-+#ifndef _OSL_CONDITN_HXX_
-+#include <osl/conditn.hxx>
-+#endif
-+
-+#ifndef _OSL_MUTEX_HXX_
-+#include <osl/mutex.hxx>
-+#endif
 +
-+#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
 +#include <com/sun/star/lang/XInitialization.hpp>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
 +#include <com/sun/star/lang/XServiceInfo.hpp>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERNOTIFIER_HPP_
 +#include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILTERMANAGER_HPP_
 +#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILTERGROUPMANAGER_HPP_
 +#include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPICKERCONTROLACCESS_HPP_
 +#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_UI_DIALOGS_XFILEPREVIEW_HPP_
-+#include <com/sun/star/ui/dialogs/XFilePreview.hpp>
-+#endif
-+
-+#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_
++//#include <com/sun/star/ui/dialogs/XFilePreview.hpp>
 +#include <com/sun/star/util/XCancellable.hpp>
-+#endif
 +
-+#ifndef _RTL_USTRBUF_HXX_
++#include <osl/conditn.hxx>
++#include <osl/mutex.hxx>
++
 +#include <rtl/ustrbuf.hxx>
-+#endif
 +
-+#include <list>
++#include <QString>
++#include <QHash>
 +
 +class KFileDialog;
++class QWidget;
++class QLayout;
 +
-+class UnxFilePickerCommandThread;
-+class UnxFilePickerNotifyThread;
 +class ResMgr;
 +
 +class KDE4FilePicker : 
@@ -893,11 +1082,28 @@ index 0000000..8505ff8
 +    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceMgr;   // to instanciate own services		
 +
 +	::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener > m_xListener;
-+    //ResMgr                     *m_pResMgr;
 +	
++    ResMgr *_resMgr;
++	
++	//the dialog to display
 +	KFileDialog* _dialog;
 +	
-+	osl::Mutex                  m_rbHelperMtx;
++	osl::Mutex _helperMutex;
++	
++	//running filter string to add to dialog
++	QString _filter;
++	
++	//filter for reverse lookup of filter text
++	QHash<QString, QString> _filters;
++	
++	//mapping of SAL control ID's to created custom controls
++	QHash<sal_Int16, QWidget*> _customWidgets;
++	
++	//widget to contain extra custom controls
++	QWidget* _extraControls;
++	
++	//layout for extra custom controls
++	QLayout* _layout;
 +
 +public:
 +    KDE4FilePicker( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceMgr );
@@ -905,38 +1111,38 @@ index 0000000..8505ff8
 +
 +    // XFilePickerNotifier
 +
-+    virtual void SAL_CALL       addFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) throw( ::com::sun::star::uno::RuntimeException );
-+    virtual void SAL_CALL       removeFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) throw( ::com::sun::star::uno::RuntimeException );
++    virtual void SAL_CALL addFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) throw( ::com::sun::star::uno::RuntimeException );
++    virtual void SAL_CALL removeFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener ) throw( ::com::sun::star::uno::RuntimeException );
 +
 +    // XExecutableDialog functions
 +
-+    virtual void SAL_CALL       setTitle( const ::rtl::OUString &rTitle ) throw( ::com::sun::star::uno::RuntimeException );
-+    virtual sal_Int16 SAL_CALL  execute() throw( ::com::sun::star::uno::RuntimeException );
++    virtual void SAL_CALL setTitle( const ::rtl::OUString &rTitle ) throw( ::com::sun::star::uno::RuntimeException );
++    virtual sal_Int16 SAL_CALL execute() throw( ::com::sun::star::uno::RuntimeException );
 +
 +    // XFilePicker functions
 +
-+    virtual void SAL_CALL       setMultiSelectionMode( sal_Bool bMode ) throw( ::com::sun::star::uno::RuntimeException );
-+    virtual void SAL_CALL       setDefaultName( const ::rtl::OUString &rName ) throw( ::com::sun::star::uno::RuntimeException );
-+    virtual void SAL_CALL       setDisplayDirectory( const ::rtl::OUString &rDirectory ) throw( ::com::sun::star::uno::RuntimeException );
++    virtual void SAL_CALL setMultiSelectionMode( sal_Bool bMode ) throw( ::com::sun::star::uno::RuntimeException );
++    virtual void SAL_CALL setDefaultName( const ::rtl::OUString &rName ) throw( ::com::sun::star::uno::RuntimeException );
++    virtual void SAL_CALL setDisplayDirectory( const ::rtl::OUString &rDirectory ) throw( ::com::sun::star::uno::RuntimeException );
 +    virtual ::rtl::OUString SAL_CALL getDisplayDirectory() throw( ::com::sun::star::uno::RuntimeException );
 +    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles() throw( ::com::sun::star::uno::RuntimeException );
 +
 +    // XFilterManager functions
 +
-+    virtual void SAL_CALL       appendFilter( const ::rtl::OUString &rTitle, const ::rtl::OUString &rFilter ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
-+    virtual void SAL_CALL       setCurrentFilter( const ::rtl::OUString &rTitle ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
++    virtual void SAL_CALL appendFilter( const ::rtl::OUString &rTitle, const ::rtl::OUString &rFilter ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
++    virtual void SAL_CALL setCurrentFilter( const ::rtl::OUString &rTitle ) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
 +    virtual ::rtl::OUString SAL_CALL getCurrentFilter() throw( ::com::sun::star::uno::RuntimeException );
 +
 +    // XFilterGroupManager functions
 +
-+    virtual void SAL_CALL       appendFilterGroup( const ::rtl::OUString &rGroupTitle, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > &rFilters ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
++    virtual void SAL_CALL appendFilterGroup( const ::rtl::OUString &rGroupTitle, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > &rFilters ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
 +
 +    // XFilePickerControlAccess functions
 +
-+    virtual void SAL_CALL       setValue( sal_Int16 nControlId, sal_Int16 nControlAction, const ::com::sun::star::uno::Any &rValue ) throw (::com::sun::star::uno::RuntimeException);
++    virtual void SAL_CALL setValue( sal_Int16 nControlId, sal_Int16 nControlAction, const ::com::sun::star::uno::Any &rValue ) throw (::com::sun::star::uno::RuntimeException);
 +    virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 nControlId, sal_Int16 nControlAction ) throw (::com::sun::star::uno::RuntimeException);
-+    virtual void SAL_CALL       enableControl( sal_Int16 nControlId, sal_Bool bEnable ) throw( ::com::sun::star::uno::RuntimeException );
-+    virtual void SAL_CALL       setLabel( sal_Int16 nControlId, const ::rtl::OUString &rLabel ) throw (::com::sun::star::uno::RuntimeException);
++    virtual void SAL_CALL enableControl( sal_Int16 nControlId, sal_Bool bEnable ) throw( ::com::sun::star::uno::RuntimeException );
++    virtual void SAL_CALL setLabel( sal_Int16 nControlId, const ::rtl::OUString &rLabel ) throw (::com::sun::star::uno::RuntimeException);
 +    virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 nControlId ) throw (::com::sun::star::uno::RuntimeException);
 +
 +    /* TODO XFilePreview
@@ -952,49 +1158,46 @@ index 0000000..8505ff8
 +
 +    // XInitialization
 +
-+    virtual void SAL_CALL       initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > &rArguments ) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException );
++    virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > &rArguments ) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException );
 +
 +    // XCancellable
 +
-+    virtual void SAL_CALL       cancel( ) throw( ::com::sun::star::uno::RuntimeException );
++    virtual void SAL_CALL cancel( ) throw( ::com::sun::star::uno::RuntimeException );
 +
 +    // XEventListener
 +
-+    virtual void SAL_CALL       disposing( const ::com::sun::star::lang::EventObject &rEvent ) throw( ::com::sun::star::uno::RuntimeException );
++    virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject &rEvent ) throw( ::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 &rServiceName ) throw( ::com::sun::star::uno::RuntimeException );
++    virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString &rServiceName ) throw( ::com::sun::star::uno::RuntimeException );
 +    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
 +
 +private:
 +    // prevent copy and assignment
 +    KDE4FilePicker( const KDE4FilePicker& );           
 +    KDE4FilePicker& operator=( const KDE4FilePicker& );
-+
-+protected:
-+    void                        initFilePicker();
-+    void                        checkFilePicker() throw( ::com::sun::star::uno::RuntimeException );
++	
++	//add a custom control widget to the file dialog
++	void addCustomControl(sal_Int16 controlId);
 +	
 +}; 
-+
-+#endif // _UNXFILEPICKER_HXX_
 diff --git fpicker/source/unx/kde4/fps-kde4-ucd.txt fpicker/source/unx/kde4/fps-kde4-ucd.txt
 new file mode 100644
-index 0000000..28aa49d
+index 0000000..8ecc4e0
 --- /dev/null
 +++ fpicker/source/unx/kde4/fps-kde4-ucd.txt
 @@ -0,0 +1,6 @@
 +[ComponentDescriptor]
-+ImplementationName=com.sun.star.ui.dialogs.KDE4UnxFilePicker
++ImplementationName=com.sun.star.ui.dialogs.KDE4FilePicker
 +ComponentName=fps_kde4.uno.so
 +LoaderName=com.sun.star.loader.SharedLibrary
 +[SupportedServices]
 +com.sun.star.ui.dialogs.KDE4FilePicker
 diff --git fpicker/source/unx/kde4/fps_kde4.xml fpicker/source/unx/kde4/fps_kde4.xml
 new file mode 100644
-index 0000000..fb967fd
+index 0000000..b250c05
 --- /dev/null
 +++ fpicker/source/unx/kde4/fps_kde4.xml
 @@ -0,0 +1,51 @@
@@ -1051,7 +1254,7 @@ index 0000000..fb967fd
 +</module-description>
 diff --git fpicker/source/unx/kde4/makefile.mk fpicker/source/unx/kde4/makefile.mk
 new file mode 100644
-index 0000000..e148d81
+index 0000000..f485e33
 --- /dev/null
 +++ fpicker/source/unx/kde4/makefile.mk
 @@ -0,0 +1,117 @@
@@ -1155,7 +1358,7 @@ index 0000000..e148d81
 +		$(SALLIB)\
 +		$(VCLLIB)\
 +		$(TOOLSLIB) \
-+		$(KDE4_LIBS) -lkio
++		$(KDE4_LIBS) -lkio -lkfile
 +
 +
 +SHL1OBJS=$(SLOFILES)
@@ -1172,19 +1375,3 @@ index 0000000..e148d81
 +
 +$(MISC)$/KDE4FilePicker.moc.cxx : KDE4FilePicker.hxx
 +	$(MOC4) $< -o $@
-diff --git fpicker/source/unx/kde/makefile.mk fpicker/source/unx/kde/makefile.mk
-index 680e0f6..f4a113a 100644
---- fpicker/source/unx/kde/makefile.mk
-+++ fpicker/source/unx/kde/makefile.mk
-@@ -96,9 +96,10 @@ SLOFILES =\
- APP1TARGET=$(TARGET)
- APP1OBJS=$(SLOFILES)
- APP1RPATH=BRAND
-+APP1LINKFLAGS+=$(KDE_LIBS)
- APP1STDLIBS=\
- 			$(SALLIB) \
--			$(KDE_LIBS) -lkio
-+			-lkio
- 
- 
- .ENDIF # "$(GUIBASE)" != "unx" || "$(ENABLE_KDE)" != "TRUE"
diff --git a/patches/dev300/kde4-plugin-detection.diff b/patches/dev300/kde4-plugin-detection.diff
index bf3f9c5..137e544 100644
--- a/patches/dev300/kde4-plugin-detection.diff
+++ b/patches/dev300/kde4-plugin-detection.diff
@@ -1,5 +1,5 @@
 diff --git vcl/unx/source/plugadapt/salplug.cxx vcl/unx/source/plugadapt/salplug.cxx
-index 335bb8f..da10725 100644
+index a104ce3..3c71b47 100644
 --- vcl/unx/source/plugadapt/salplug.cxx
 +++ vcl/unx/source/plugadapt/salplug.cxx
 @@ -55,13 +55,16 @@ typedef SalInstance*(*salFactoryProc)( oslModule pModule);
@@ -25,28 +25,37 @@ index 335bb8f..da10725 100644
  
  static SalInstance* tryInstance( const OUString& rModuleBase )
  {
-@@ -331,7 +334,15 @@ static OUString getNetWMName( Display* pDisplay )
- static bool is_kde_desktop( Display* pDisplay )
+@@ -302,15 +305,36 @@ static OUString getNetWMName( Display* pDisplay )
+     return aRet;
+ }
+ 
+-static bool is_kde_desktop( Display* pDisplay )
++static bool is_kde_desktop(Display*)
  {
      if ( NULL != getenv( "KDE_FULL_SESSION" ) )
 -        return true;
 +    {
 +        const char *pVer = getenv( "KDE_SESSION_VERSION" );
 +        if ( !pVer || pVer[0] == '0' )
++		{
 +            return true; // does not exist => KDE3
++		}
 +
 +        rtl::OUString aVer( RTL_CONSTASCII_USTRINGPARAM( "3" ) );
 +        if ( aVer.equalsIgnoreAsciiCaseAscii( pVer ) )
++		{
 +            return true;
++		}
 +    }
      
-     // check for kwin
-     rtl::OUString aWM = getNetWMName( pDisplay );
-@@ -341,6 +352,22 @@ static bool is_kde_desktop( Display* pDisplay )
-     return false;
- }
- 
-+static bool is_kde4_desktop( Display* /*pDisplay*/ )
+-    // check for kwin
+-    rtl::OUString aWM = getNetWMName( pDisplay );
+-    if( aWM.equalsIgnoreAsciiCaseAscii( "KWin" ) )
+-        return true;
++    return false;
++}
++
++static bool is_kde4_desktop(Display*)
 +{
 +    if ( NULL != getenv( "KDE_FULL_SESSION" ) )
 +    {
@@ -56,16 +65,10 @@ index 335bb8f..da10725 100644
 +        if ( pVer && aVer.equalsIgnoreAsciiCaseAscii( pVer ) )
 +            return true;
 +    }
-+
-+    // TODO here we could check for KDE_SESSION_VERSION atom (must exist & equal 4)
-+    
-+    return false;
-+}
-+
- static bool is_cde_desktop( Display* pDisplay )
- {
-     void* pLibrary = NULL;
-@@ -370,6 +397,8 @@ static const char * get_desktop_environment()
+     
+     return false;
+ }
+@@ -344,6 +368,8 @@ static const char * get_desktop_environment()
              pRet = desktop_strings[DESKTOP_CDE];
          if ( aOver.equalsIgnoreAsciiCase( "kde" ) )
              pRet = desktop_strings[DESKTOP_KDE];
@@ -74,7 +77,7 @@ index 335bb8f..da10725 100644
          if ( aOver.equalsIgnoreAsciiCase( "gnome" ) )
              pRet = desktop_strings[DESKTOP_GNOME];
          if ( aOver.equalsIgnoreAsciiCase( "none" ) )
-@@ -412,7 +441,9 @@ static const char * get_desktop_environment()
+@@ -384,7 +410,9 @@ static const char * get_desktop_environment()
              {
                  XErrorHandler pOldHdl = XSetErrorHandler( autodect_error_handler );
              
@@ -85,12 +88,61 @@ index 335bb8f..da10725 100644
                      pRet = desktop_strings[DESKTOP_KDE];
                  else if ( is_gnome_desktop( pDisplay ) )
                      pRet = desktop_strings[DESKTOP_GNOME];
-@@ -443,6 +474,8 @@ static const char* autodetect_plugin()
+@@ -417,6 +445,8 @@ static const char* autodetect_plugin()
          pRet = "gtk";
      else if( desktop == desktop_strings[DESKTOP_KDE] )
          pRet = "kde";
 +    else if( desktop == desktop_strings[DESKTOP_KDE4] )
 +        pRet = "kde4";
      else
-         pRet = "gen";
-         
+     {
+         // #i95296# use the much nicer looking gtk plugin
+diff --git vcl/util/makefile.mk vcl/util/makefile.mk
+index 317ffba..217ce3e 100644
+--- vcl/util/makefile.mk
++++ vcl/util/makefile.mk
+@@ -387,7 +387,7 @@ SHL5IMPLIB=ikde_plug_
+ SHL5LIBS=$(LIB5TARGET)
+ SHL5DEPN=$(SHL2TARGETN)
+ # libs for KDE plugin
+-SHL5STDLIBS=$(KDE_LIBS)
++SHL5LINKFLAGS+=$(KDE_LIBS)
+ SHL5STDLIBS+=-l$(SHL2TARGET)
+ SHL5STDLIBS+=\
+         $(VCLLIB)       \
+@@ -404,6 +404,35 @@ SHL5STDLIBS+= $(XRANDR_LIBS)
+ 
+ .ENDIF # "$(ENABLE_KDE)" != ""
+ 
++# KDE4 plugin
++.IF "$(ENABLE_KDE4)" != ""
++.IF "$(KDE4_ROOT)"!=""
++EXTRALIBPATHS+=-L$(KDE4_ROOT)$/lib
++.ENDIF
++LIB6TARGET=$(SLB)$/ikde4_plug_
++LIB6FILES=$(SLB)$/kde4plug.lib
++SHL6TARGET=vclplug_kde4$(DLLPOSTFIX)
++SHL6IMPLIB=ikde4_plug_
++SHL6LIBS=$(LIB6TARGET)
++SHL6DEPN=$(SHL2TARGETN)
++# libs for KDE4 plugin
++SHL6LINKFLAGS+=$(KDE4_LIBS)
++SHL6STDLIBS+=-l$(SHL2TARGET)
++SHL6STDLIBS+=\
++        $(VCLLIB)       \
++        $(PSPLIB)	\
++        $(TOOLSLIB)     \
++        $(VOSLIB)       \
++        $(SALLIB)
++
++.IF "$(ENABLE_RANDR)" != ""
++.IF "$(XRANDR_DLOPEN)" == "FALSE"
++SHL6STDLIBS+= $(XRANDR_LIBS)
++.ENDIF
++.ENDIF
++
++.ENDIF # "$(ENABLE_KDE4)" != ""
++
+ .ENDIF # UNX
+ 
+ # --- Allgemein ----------------------------------------------------------
diff --git a/patches/dev300/kde4-shell-prj.diff b/patches/dev300/kde4-shell-prj.diff
index f537458..8299510 100644
--- a/patches/dev300/kde4-shell-prj.diff
+++ b/patches/dev300/kde4-shell-prj.diff
@@ -9,4 +9,4 @@ index 510071c..e9c8a29 100644
 +sl    shell\source\backends\kde4be                 nmake   -   u   sl_backends_kde4be sl_inc NULL
  sl    shell\source\backends\desktopbe              nmake   -   u   sl_backends_desktopbe sl_inc NULL
  sl    shell\source\win32\shlxthandler\ooofilt      nmake   -   w   sl_win32_shlxthandler_ooofilt sl_all_zipfile.w sl_all_ooofilereader.w sl_win32_shlxthandler_util.w sl_all sl_inc NULL
- sl    shell\source\win32\shlxthandler\ooofilt\proxy nmake   -   w   sl_win32_ooofiltproxy sl_inc NULL 
+ sl    shell\source\win32\shlxthandler\ooofilt\proxy nmake   -   w   sl_win32_ooofiltproxy sl_inc NULL 
\ No newline at end of file
diff --git a/patches/dev300/kde4-shell-source.diff b/patches/dev300/kde4-shell-source.diff
index f485bdf..8dfe458 100644
--- a/patches/dev300/kde4-shell-source.diff
+++ b/patches/dev300/kde4-shell-source.diff
@@ -14,62 +14,9 @@ index 0000000..cc40b40
 +	local:
 +		*;
 +};
-diff --git shell/source/backends/kde4be/kde4be.xml shell/source/backends/kde4be/kde4be.xml
-new file mode 100644
-index 0000000..16b8cc0
---- /dev/null
-+++ shell/source/backends/kde4be/kde4be.xml
-@@ -0,0 +1,35 @@
-+<?xml version="1.0" encoding="UTF-8"?>
-+<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
-+<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
-+    <module-name>kde4be</module-name>
-+    <component-description>
-+        <author> Éric Bischoff </author>
-+        <name>com.sun.star.comp.configuration.backend.KDE4Backend</name>
-+        <description> The KDE4 configuration backend </description>
-+        <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
-+        <language>c++</language>
-+        <status value="beta"/>        
-+        <supported-service>com.sun.star.comp.configuration.backend.KDE4Backend</supported-service>		
-+        <service-dependency>...</service-dependency>
-+        <type>com.sun.star.configuration.backend.XBackendChangesListener</type>
-+        <type>com.sun.star.configuration.backend.XBackendChangesNotifier</type>
-+        <type>com.sun.star.configuration.backend.XLayerHandler</type>
-+        <type>com.sun.star.configuration.backend.XSingleLayerStratum</type>
-+        <type>com.sun.star.lang.XMultiComponentFactory</type>
-+        <type>com.sun.star.lang.XServiceInfo</type>
-+        <type>com.sun.star.lang.XSingleComponentFactory</type>
-+        <type>com.sun.star.lang.XTypeProvider</type>
-+        <type>com.sun.star.uno.TypeClass</type>
-+        <type>com.sun.star.uno.XAggregation</type>
-+        <type>com.sun.star.uno.XComponentContext</type>
-+        <type>com.sun.star.uno.XCurrentContext</type>
-+        <type>com.sun.star.uno.XWeak</type>
-+        <type>com.sun.star.registry.XRegistryKey</type>
-+    </component-description>
-+    <project-build-dependency>cppuhelper</project-build-dependency>
-+    <project-build-dependency>cppu</project-build-dependency>
-+    <project-build-dependency>sal</project-build-dependency>
-+    <runtime-module-dependency>cppuhelper3$(COM)</runtime-module-dependency>
-+    <runtime-module-dependency>cppu3</runtime-module-dependency>
-+    <runtime-module-dependency>sal3</runtime-module-dependency>
-+</module-description>
-diff --git shell/source/backends/kde4be/kde4be1-ucd.txt shell/source/backends/kde4be/kde4be1-ucd.txt
-new file mode 100644
-index 0000000..adf7e17
---- /dev/null
-+++ shell/source/backends/kde4be/kde4be1-ucd.txt
-@@ -0,0 +1,6 @@
-+[ComponentDescriptor]
-+ImplementationName=com.sun.star.comp.configuration.backend.KDE4Backend
-+ComponentName=kde4be1.uno.so
-+LoaderName=com.sun.star.loader.SharedLibrary
-+[SupportedServices]
-+com.sun.star.configuration.backend.KDE4Backend
 diff --git shell/source/backends/kde4be/kde4backend.cxx shell/source/backends/kde4be/kde4backend.cxx
 new file mode 100644
-index 0000000..904db3e
+index 0000000..a90cb3b
 --- /dev/null
 +++ shell/source/backends/kde4be/kde4backend.cxx
 @@ -0,0 +1,158 @@
@@ -233,10 +180,10 @@ index 0000000..904db3e
 +// ---------------------------------------------------------------------------------------
 diff --git shell/source/backends/kde4be/kde4backend.hxx shell/source/backends/kde4be/kde4backend.hxx
 new file mode 100644
-index 0000000..cf44b3d
+index 0000000..f2c258d
 --- /dev/null
 +++ shell/source/backends/kde4be/kde4backend.hxx
-@@ -0,0 +1,128 @@
+@@ -0,0 +1,123 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -267,12 +214,9 @@ index 0000000..cf44b3d
 + *
 + ************************************************************************/
 +
-+#ifndef KDEBACKEND_HXX_
-+#define KDEBACKEND_HXX_
++#pragma once
 +
-+#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XSCHEMASUPPLIER_HPP_
 +#include <com/sun/star/configuration/backend/XSingleLayerStratum.hpp>
-+#endif
 +#include <com/sun/star/lang/XInitialization.hpp>
 +#include <com/sun/star/uno/XComponentContext.hpp>
 +#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -363,11 +307,62 @@ index 0000000..cf44b3d
 +
 +        static KDEBackend* mInstance;
 +};
-+
-+#endif // CONFIGMGR_LOCALBE_LOCALSINGLESTRATUM_HXX_
+diff --git shell/source/backends/kde4be/kde4be.xml shell/source/backends/kde4be/kde4be.xml
+new file mode 100644
+index 0000000..9396167
+--- /dev/null
++++ shell/source/backends/kde4be/kde4be.xml
+@@ -0,0 +1,35 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd">
++<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
++    <module-name>kde4be</module-name>
++    <component-description>
++        <author> Éric Bischoff </author>
++        <name>com.sun.star.comp.configuration.backend.KDE4Backend</name>
++        <description> The KDE4 configuration backend </description>
++        <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
++        <language>c++</language>
++        <status value="beta"/>        
++        <supported-service>com.sun.star.comp.configuration.backend.KDE4Backend</supported-service>		
++        <service-dependency>...</service-dependency>
++        <type>com.sun.star.configuration.backend.XBackendChangesListener</type>
++        <type>com.sun.star.configuration.backend.XBackendChangesNotifier</type>
++        <type>com.sun.star.configuration.backend.XLayerHandler</type>
++        <type>com.sun.star.configuration.backend.XSingleLayerStratum</type>
++        <type>com.sun.star.lang.XMultiComponentFactory</type>
++        <type>com.sun.star.lang.XServiceInfo</type>
++        <type>com.sun.star.lang.XSingleComponentFactory</type>
++        <type>com.sun.star.lang.XTypeProvider</type>
++        <type>com.sun.star.uno.TypeClass</type>
++        <type>com.sun.star.uno.XAggregation</type>
++        <type>com.sun.star.uno.XComponentContext</type>
++        <type>com.sun.star.uno.XCurrentContext</type>
++        <type>com.sun.star.uno.XWeak</type>
++        <type>com.sun.star.registry.XRegistryKey</type>
++    </component-description>
++    <project-build-dependency>cppuhelper</project-build-dependency>
++    <project-build-dependency>cppu</project-build-dependency>
++    <project-build-dependency>sal</project-build-dependency>
++    <runtime-module-dependency>cppuhelper3$(COM)</runtime-module-dependency>
++    <runtime-module-dependency>cppu3</runtime-module-dependency>
++    <runtime-module-dependency>sal3</runtime-module-dependency>
++</module-description>
+diff --git shell/source/backends/kde4be/kde4be1-ucd.txt shell/source/backends/kde4be/kde4be1-ucd.txt
+new file mode 100644
+index 0000000..9671199
+--- /dev/null
++++ shell/source/backends/kde4be/kde4be1-ucd.txt
+@@ -0,0 +1,6 @@
++[ComponentDescriptor]
++ImplementationName=com.sun.star.comp.configuration.backend.KDE4Backend
++ComponentName=kde4be1.uno.so
++LoaderName=com.sun.star.loader.SharedLibrary
++[SupportedServices]
++com.sun.star.configuration.backend.KDE4Backend
 diff --git shell/source/backends/kde4be/kde4becdef.cxx shell/source/backends/kde4be/kde4becdef.cxx
 new file mode 100644
-index 0000000..7bd481f
+index 0000000..2dba0ec
 --- /dev/null
 +++ shell/source/backends/kde4be/kde4becdef.cxx
 @@ -0,0 +1,143 @@
@@ -404,13 +399,13 @@ index 0000000..7bd481f
 +// MARKER(update_precomp.py): autogen include statement, do not remove
 +#include "precompiled_shell.hxx"
 +#include "kde4backend.hxx"
-+#include <com/sun/star/registry/XRegistryKey.hpp>
 +
-+#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
++#include <kapplication.h>
++
 +#include <cppuhelper/implementationentry.hxx>
-+#endif
++
++#include <com/sun/star/registry/XRegistryKey.hpp>
 +#include <com/sun/star/uno/XComponentContext.hpp>
-+#include <vcl/kde4_headers.h>
 +
 +#include "uno/current_context.hxx"
 +
@@ -516,10 +511,10 @@ index 0000000..7bd481f
 +//------------------------------------------------------------------------------
 diff --git shell/source/backends/kde4be/kde4commonlayer.cxx shell/source/backends/kde4be/kde4commonlayer.cxx
 new file mode 100644
-index 0000000..f598211
+index 0000000..6e718cb
 --- /dev/null
 +++ shell/source/backends/kde4be/kde4commonlayer.cxx
-@@ -0,0 +1,153 @@
+@@ -0,0 +1,157 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -552,12 +547,16 @@ index 0000000..f598211
 +
 +// MARKER(update_precomp.py): autogen include statement, do not remove
 +#include "precompiled_shell.hxx"
++
 +#include "kde4commonlayer.hxx"
-+#include <vcl/kde4_headers.h>
++
++#include <kemailsettings.h>
++#include <kglobalsettings.h>
++
++#include <QFont>
++
 +#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
-+#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_
 +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
-+#endif
 +#include <com/sun/star/uno/Sequence.hxx>
 +
 +#define SPACE      ' '
@@ -675,20 +674,17 @@ index 0000000..f598211
 +}
 diff --git shell/source/backends/kde4be/kde4commonlayer.hxx shell/source/backends/kde4be/kde4commonlayer.hxx
 new file mode 100644
-index 0000000..84bcf35
+index 0000000..d37bab8
 --- /dev/null
 +++ shell/source/backends/kde4be/kde4commonlayer.hxx
-@@ -0,0 +1,56 @@
-+#ifndef KDECOMMONLAYER_HXX_
-+#define KDECOMMONLAYER_HXX_
+@@ -0,0 +1,51 @@
++#pragma once
 +
 +#include "kde4backend.hxx"
 +#include <com/sun/star/uno/XComponentContext.hpp>
 +#include <com/sun/star/configuration/backend/XLayer.hpp>
 +#include <com/sun/star/configuration/backend/BackendAccessException.hpp>
-+#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_
 +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
-+#endif
 +#include <com/sun/star/util/XTimeStamped.hpp>
 +#include <cppuhelper/implbase2.hxx>
 +
@@ -732,15 +728,13 @@ index 0000000..84bcf35
 +              
 +    private :
 +        uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ;
-+  } ;
-+
-+#endif // KDECOMMONLAYER
++};
 diff --git shell/source/backends/kde4be/kde4inetlayer.cxx shell/source/backends/kde4be/kde4inetlayer.cxx
 new file mode 100644
-index 0000000..15e9e58
+index 0000000..01749d9
 --- /dev/null
 +++ shell/source/backends/kde4be/kde4inetlayer.cxx
-@@ -0,0 +1,254 @@
+@@ -0,0 +1,255 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -773,11 +767,12 @@ index 0000000..15e9e58
 +
 +// MARKER(update_precomp.py): autogen include statement, do not remove
 +#include "precompiled_shell.hxx"
++
++#include <kprotocolmanager.h>
++
 +#include "kde4inetlayer.hxx"
 +#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
-+#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_
 +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
-+#endif
 +#include <com/sun/star/uno/Sequence.hxx>
 +
 +#define COMMA      ','
@@ -997,23 +992,22 @@ index 0000000..15e9e58
 +
 diff --git shell/source/backends/kde4be/kde4inetlayer.hxx shell/source/backends/kde4be/kde4inetlayer.hxx
 new file mode 100644
-index 0000000..333117b
+index 0000000..1724628
 --- /dev/null
 +++ shell/source/backends/kde4be/kde4inetlayer.hxx
-@@ -0,0 +1,62 @@
-+#ifndef KDEINETLAYER_HXX_
-+#define KDEINETLAYER_HXX_
+@@ -0,0 +1,59 @@
++#pragma once
++
++#include <QString>
 +
 +#include "kde4backend.hxx"
++
 +#include <com/sun/star/uno/XComponentContext.hpp>
 +#include <com/sun/star/configuration/backend/XLayer.hpp>
 +#include <com/sun/star/configuration/backend/BackendAccessException.hpp>
-+#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_
 +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
-+#endif
 +#include <com/sun/star/util/XTimeStamped.hpp>
 +#include <cppuhelper/implbase2.hxx>
-+#include <vcl/kde4_headers.h>
 +
 +namespace css = com::sun::star ;
 +namespace uno = css::uno ;
@@ -1060,15 +1054,13 @@ index 0000000..333117b
 +        (uno::Sequence<backend::PropertyInfo> &aPropInfoList, sal_Int32 &nProperties,
 +         int nProxyType, const QString &aNoProxyfor = QString(),
 +         const QString &aHTTPProxy = QString(), const QString &aFTPProxy = QString(), const QString &aHTTPSProxy = QString()) const;
-+  } ;
-+
-+#endif // KDEINETLAYER
++};
 diff --git shell/source/backends/kde4be/kde4pathslayer.cxx shell/source/backends/kde4be/kde4pathslayer.cxx
 new file mode 100644
-index 0000000..858decf
+index 0000000..0791790
 --- /dev/null
 +++ shell/source/backends/kde4be/kde4pathslayer.cxx
-@@ -0,0 +1,121 @@
+@@ -0,0 +1,124 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1101,12 +1093,15 @@ index 0000000..858decf
 +
 +// MARKER(update_precomp.py): autogen include statement, do not remove
 +#include "precompiled_shell.hxx"
++
 +#include "kde4pathslayer.hxx"
-+#include <vcl/kde4_headers.h>
++
++#include <QString>
++#include <kglobalsettings.h>
++
 +#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
-+#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_
 +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
-+#endif
++
 +#include <osl/security.hxx>
 +#include <osl/file.hxx>
 +#include <com/sun/star/uno/Sequence.hxx>
@@ -1192,10 +1187,10 @@ index 0000000..858decf
 +}
 diff --git shell/source/backends/kde4be/kde4pathslayer.hxx shell/source/backends/kde4be/kde4pathslayer.hxx
 new file mode 100644
-index 0000000..fe88206
+index 0000000..e3fc4dc
 --- /dev/null
 +++ shell/source/backends/kde4be/kde4pathslayer.hxx
-@@ -0,0 +1,86 @@
+@@ -0,0 +1,82 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1226,17 +1221,15 @@ index 0000000..fe88206
 + *
 + ************************************************************************/
 +
-+#ifndef KDEPATHSLAYER_HXX_
-+#define KDEPATHSLAYER_HXX_
++#pragma once
 +
 +#include "kde4backend.hxx"
 +#include <com/sun/star/uno/XComponentContext.hpp>
 +#include <com/sun/star/configuration/backend/XLayer.hpp>
 +#include <com/sun/star/configuration/backend/BackendAccessException.hpp>
-+#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_
 +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
-+#endif
 +#include <com/sun/star/util/XTimeStamped.hpp>
++
 +#include <cppuhelper/implbase2.hxx>
 +
 +namespace css = com::sun::star ;
@@ -1279,15 +1272,13 @@ index 0000000..fe88206
 +              
 +    private :
 +        uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ;
-+  } ;
-+
-+#endif // KDEPATHSLAYER
++};
 diff --git shell/source/backends/kde4be/kde4vcllayer.cxx shell/source/backends/kde4be/kde4vcllayer.cxx
 new file mode 100644
-index 0000000..ce36a23
+index 0000000..2705cb6
 --- /dev/null
 +++ shell/source/backends/kde4be/kde4vcllayer.cxx
-@@ -0,0 +1,116 @@
+@@ -0,0 +1,115 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -1320,13 +1311,12 @@ index 0000000..ce36a23
 +
 +// MARKER(update_precomp.py): autogen include statement, do not remove
 +#include "precompiled_shell.hxx"
++
 +#include "kde4vcllayer.hxx"
++
 +#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
-+#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_
 +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
-+#endif
 +#include <com/sun/star/uno/Sequence.hxx>
-+#include <vcl/kde4_headers.h>
 +
 +//==============================================================================
 +
@@ -1406,21 +1396,20 @@ index 0000000..ce36a23
 +}
 diff --git shell/source/backends/kde4be/kde4vcllayer.hxx shell/source/backends/kde4be/kde4vcllayer.hxx
 new file mode 100644
-index 0000000..32b541a
+index 0000000..aeed4e6
 --- /dev/null
 +++ shell/source/backends/kde4be/kde4vcllayer.hxx
-@@ -0,0 +1,56 @@
-+#ifndef KDEVCLLAYER_HXX_
-+#define KDEVCLLAYER_HXX_
+@@ -0,0 +1,53 @@
++#pragma once
 +
 +#include "kde4backend.hxx"
++
 +#include <com/sun/star/uno/XComponentContext.hpp>
 +#include <com/sun/star/configuration/backend/XLayer.hpp>
 +#include <com/sun/star/configuration/backend/BackendAccessException.hpp>
-+#ifndef _COM_SUN_STAR_CONFIGURATION_BACKEND_XLAYERCONTENTDESCIBER_HPP_
 +#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
-+#endif
 +#include <com/sun/star/util/XTimeStamped.hpp>
++
 +#include <cppuhelper/implbase2.hxx>
 +
 +namespace css = com::sun::star ;
@@ -1463,12 +1452,10 @@ index 0000000..32b541a
 +              
 +    private :
 +        uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ;
-+  } ;
-+
-+#endif // KDEVCLLAYER
++};
 diff --git shell/source/backends/kde4be/makefile.mk shell/source/backends/kde4be/makefile.mk
 new file mode 100644
-index 0000000..48d5c8d
+index 0000000..3a41296
 --- /dev/null
 +++ shell/source/backends/kde4be/makefile.mk
 @@ -0,0 +1,94 @@
@@ -1567,7 +1554,7 @@ index 0000000..48d5c8d
 +
 +.INCLUDE : target.mk
 diff --git shell/source/backends/kdebe/makefile.mk shell/source/backends/kdebe/makefile.mk
-index 8bc0b47..b630f41 100644
+index 73ebf92..01037e7 100644
 --- shell/source/backends/kdebe/makefile.mk
 +++ shell/source/backends/kdebe/makefile.mk
 @@ -77,11 +77,12 @@ SHL1OBJS=$(SLOFILES)
diff --git a/patches/dev300/kde4-vcl-prj.diff b/patches/dev300/kde4-vcl-prj.diff
index 3cc467e..f195744 100644
--- a/patches/dev300/kde4-vcl-prj.diff
+++ b/patches/dev300/kde4-vcl-prj.diff
@@ -20,15 +20,3 @@ index eeda7e6..e60416f 100644
 -vc	vcl\util								nmake	-	all	vc_util vc__plug.u vc__aquy.u vc__appa.u vc__appm.m vc__appu.u vc__appw.w vc__appp.p vc__gdia.u vc__gdim.m vc__gdiu.u vc__gdiw.w vc__gdip.p vc__srcm.m vc__srcw.w vc__srcp.p vc__wina.u vc__winm.m vc__winu.u vc__winw.w vc__winp.p vc__gtka.u vc__gtky.u vc__gtkw.u vc__gtkg.u vc__kde.u vc__hl.u vc_app vc_ctrl vc_gdi vc_hlp vc_src vc_win vc_glyphs vc_components NULL
 +vc	vcl\util								nmake	-	all	vc_util vc__plug.u vc__aquy.u vc__appa.u vc__appm.m vc__appu.u vc__appw.w vc__appp.p vc__gdia.u vc__gdim.m vc__gdiu.u vc__gdiw.w vc__gdip.p vc__srcm.m vc__srcw.w vc__srcp.p vc__wina.u vc__winm.m vc__winu.u vc__winw.w vc__winp.p vc__gtka.u vc__gtky.u vc__gtkw.u vc__gtkg.u vc__kde.u vc__kde4.u vc__hl.u vc_app vc_ctrl vc_gdi vc_hlp vc_src vc_win vc_glyphs vc_components NULL
  vc  vcl\util\linksvp                        nmake   -   u   vc_lsvp vc_util NULL
-diff --git vcl/prj/d.lst vcl/prj/d.lst
-index c7a5f71..d476228 100644
---- vcl/prj/d.lst
-+++ vcl/prj/d.lst
-@@ -64,6 +64,7 @@ mkdir: %_DEST%\inc%_EXT%\vcl\plug\vcl
- ..\inc\vcl\javachild.hxx %_DEST%\inc%_EXT%\vcl\javachild.hxx
- ..\inc\vcl\jobset.hxx %_DEST%\inc%_EXT%\vcl\jobset.hxx
- ..\unx\inc\kde_headers.h %_DEST%\inc%_EXT%\vcl\kde_headers.h
-+..\unx\inc\kde4_headers.h %_DEST%\inc%_EXT%\vcl\kde4_headers.h
- ..\inc\vcl\keycod.hxx %_DEST%\inc%_EXT%\vcl\keycod.hxx
- ..\inc\vcl\keycodes.hxx %_DEST%\inc%_EXT%\vcl\keycodes.hxx
- ..\inc\vcl\lineinfo.hxx %_DEST%\inc%_EXT%\vcl\lineinfo.hxx
diff --git a/patches/dev300/kde4-vcl-source.diff b/patches/dev300/kde4-vcl-source.diff
new file mode 100644
index 0000000..8ff0feb
--- /dev/null
+++ b/patches/dev300/kde4-vcl-source.diff
@@ -0,0 +1,2191 @@
+diff --git vcl/unx/kde4/KDEData.cxx vcl/unx/kde4/KDEData.cxx
+new file mode 100644
+index 0000000..2b1f5bc
+--- /dev/null
++++ vcl/unx/kde4/KDEData.cxx
+@@ -0,0 +1,52 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2009 by Sun Microsystems, Inc.
++ *
++ * 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.
++ *
++ ************************************************************************/
++
++#include "KDEData.hxx"
++
++#include "KDEXLib.hxx"
++
++KDEData::~KDEData()
++{
++}
++
++void KDEData::Init()
++{
++    pXLib_ = new KDEXLib();
++    pXLib_->Init();
++}
++
++void KDEData::initNWF()
++{
++    ImplSVData *pSVData = ImplGetSVData();
++	
++    // draw toolbars on separate lines
++    pSVData->maNWFData.mbDockingAreaSeparateTB = true;
++}
++
++void KDEData::deInitNWF()
++{
++}
+\ No newline at end of file
+diff --git vcl/unx/kde4/KDEData.hxx vcl/unx/kde4/KDEData.hxx
+new file mode 100644
+index 0000000..71dedbc
+--- /dev/null
++++ vcl/unx/kde4/KDEData.hxx
+@@ -0,0 +1,42 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2009 by Sun Microsystems, Inc.
++ *
++ * 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.
++ *
++ ************************************************************************/
++
++#pragma once
++
++#include <saldisp.hxx>
++#include <saldata.hxx>
++
++class KDEData : public X11SalData
++{
++	public:
++		KDEData() {}
++		virtual ~KDEData();
++		
++		virtual void Init();
++		virtual void initNWF();
++		virtual void deInitNWF();
++};
+\ No newline at end of file
+diff --git vcl/unx/kde4/KDESalDisplay.cxx vcl/unx/kde4/KDESalDisplay.cxx
+new file mode 100644
+index 0000000..16f128b
+--- /dev/null
++++ vcl/unx/kde4/KDESalDisplay.cxx
+@@ -0,0 +1,45 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2009 by Sun Microsystems, Inc.
++ *
++ * 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.
++ *
++ ************************************************************************/
++
++#include "KDESalDisplay.hxx"
++
++#include "KDEXLib.hxx"
++
++SalKDEDisplay::SalKDEDisplay( Display* pDisp )
++    : SalX11Display( pDisp )
++{
++}
++
++SalKDEDisplay::~SalKDEDisplay()
++{
++    // in case never a frame opened
++    static_cast<KDEXLib*>(GetXLib())->doStartup();
++    // clean up own members
++    doDestruct();
++    // prevent SalDisplay from closing KApplication's display
++    pDisp_ = NULL;
++}
+\ No newline at end of file
+diff --git vcl/unx/kde4/KDESalDisplay.hxx vcl/unx/kde4/KDESalDisplay.hxx
+new file mode 100644
+index 0000000..aa81804
+--- /dev/null
++++ vcl/unx/kde4/KDESalDisplay.hxx
+@@ -0,0 +1,37 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2009 by Sun Microsystems, Inc.
++ *
++ * 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.
++ *
++ ************************************************************************/
++
++#pragma once
++
++#include <saldisp.hxx>
++
++class SalKDEDisplay : public SalX11Display
++{
++	public:
++		SalKDEDisplay( Display* pDisp );
++			virtual ~SalKDEDisplay();
++};
+diff --git vcl/unx/kde4/KDESalFrame.cxx vcl/unx/kde4/KDESalFrame.cxx
+new file mode 100644
+index 0000000..c8bccc8
+--- /dev/null
++++ vcl/unx/kde4/KDESalFrame.cxx
+@@ -0,0 +1,409 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2009 by Sun Microsystems, Inc.
++ *
++ * 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.
++ *
++ ************************************************************************/
++
++#define Region QtXRegion
++
++#include <QColor>
++#include <QStyle>
++
++#include <kconfig.h>
++#include <kglobal.h>
++#include <kmenubar.h>
++#include <kconfiggroup.h>
++#include <kmainwindow.h>
++#include <kapplication.h>
++#include <ktoolbar.h>
++
++#undef Region
++
++#include "KDESalFrame.hxx"
++#include "KDEXLib.hxx"
++#include "KDESalGraphics.hxx"
++
++#include <vcl/settings.hxx>
++#include <vcl/font.hxx>
++#include <tools/color.hxx>
++
++#include <vcl/svdata.hxx>
++
++#include <pspgraphics.h>
++
++#if OSL_DEBUG_LEVEL > 1
++#include <stdio.h>
++#endif
++
++KDESalFrame::KDESalFrame( SalFrame* pParent, ULONG nState ) :
++    X11SalFrame( pParent, nState )
++{
++}
++
++void KDESalFrame::Show( BOOL bVisible, BOOL bNoActivate )
++{
++    if ( !GetParent() && ! (GetStyle() & SAL_FRAME_STYLE_INTRO) )
++    {
++        KDEXLib* pXLib = static_cast<KDEXLib*>(GetDisplay()->GetXLib());
++        pXLib->doStartup();
++    }
++	
++    X11SalFrame::Show( bVisible, bNoActivate );
++}
++
++/** Helper function to convert colors.
++*/
++static Color toColor( const QColor &rColor )
++{
++    return Color( rColor.red(), rColor.green(), rColor.blue() );
++}
++
++/** Helper function to read untranslated text entry from KConfig configuration repository.
++*/
++static OUString readEntryUntranslated( KConfigGroup *pGroup, const char *pKey )
++{
++    return OUString::createFromAscii( (const char *) pGroup->readEntryUntranslated( pKey ).toAscii() );
++}
++
++/** Helper function to read color from KConfig configuration repository.
++*/
++static Color readColor( KConfigGroup *pGroup, const char *pKey )
++{
++    return toColor( pGroup->readEntry( pKey, QColor(Qt::white) ) );
++}
++
++/** Helper function to add information to Font from QFont.
++
++    Mostly grabbed from the Gtk+ vclplug (salnativewidgets-gtk.cxx).
++*/
++static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& rLocale )
++{
++    psp::FastPrintFontInfo aInfo;
++    QFontInfo qFontInfo( rQFont );
++    
++    // set family name
++    aInfo.m_aFamilyName = String( (const char *) rQFont.family().toUtf8(), RTL_TEXTENCODING_UTF8 );
++
++    // set italic
++    aInfo.m_eItalic = ( qFontInfo.italic()? psp::italic::Italic: psp::italic::Upright );
++    
++    // set weight
++    int nWeight = qFontInfo.weight();
++    if ( nWeight <= QFont::Light )
++        aInfo.m_eWeight = psp::weight::Light;
++    else if ( nWeight <= QFont::Normal )
++        aInfo.m_eWeight = psp::weight::Normal;
++    else if ( nWeight <= QFont::DemiBold )
++        aInfo.m_eWeight = psp::weight::SemiBold;
++    else if ( nWeight <= QFont::Bold )
++        aInfo.m_eWeight = psp::weight::Bold;
++    else
++        aInfo.m_eWeight = psp::weight::UltraBold;
++    
++    // set width
++    int nStretch = rQFont.stretch();
++    if ( nStretch <= QFont::UltraCondensed )
++        aInfo.m_eWidth = psp::width::UltraCondensed;
++    else if ( nStretch <= QFont::ExtraCondensed )
++        aInfo.m_eWidth = psp::width::ExtraCondensed;
++    else if ( nStretch <= QFont::Condensed )
++        aInfo.m_eWidth = psp::width::Condensed;
++    else if ( nStretch <= QFont::SemiCondensed )
++        aInfo.m_eWidth = psp::width::SemiCondensed;
++    else if ( nStretch <= QFont::Unstretched )
++        aInfo.m_eWidth = psp::width::Normal;
++    else if ( nStretch <= QFont::SemiExpanded )
++        aInfo.m_eWidth = psp::width::SemiExpanded;
++    else if ( nStretch <= QFont::Expanded )
++        aInfo.m_eWidth = psp::width::Expanded;
++    else if ( nStretch <= QFont::ExtraExpanded )
++        aInfo.m_eWidth = psp::width::ExtraExpanded;
++    else
++        aInfo.m_eWidth = psp::width::UltraExpanded;
++    
++#if OSL_DEBUG_LEVEL > 1
++    fprintf( stderr, "font name BEFORE system match: \"%s\"\n", OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
++#endif
++
++    // match font to e.g. resolve "Sans"
++    psp::PrintFontManager::get().matchFont( aInfo, rLocale );
++
++#if OSL_DEBUG_LEVEL > 1
++    fprintf( stderr, "font match %s, name AFTER: \"%s\"\n",
++             aInfo.m_nID != 0 ? "succeeded" : "failed",
++             OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
++#endif
++
++    // font height
++    int nPointHeight = qFontInfo.pointSize();
++    if ( nPointHeight <= 0 )
++        nPointHeight = rQFont.pointSize();
++    
++    // Create the font
++    Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) );
++    if( aInfo.m_eWeight != psp::weight::Unknown )
++        aFont.SetWeight( PspGraphics::ToFontWeight( aInfo.m_eWeight ) );
++    if( aInfo.m_eWidth != psp::width::Unknown )
++        aFont.SetWidthType( PspGraphics::ToFontWidth( aInfo.m_eWidth ) );
++    if( aInfo.m_eItalic != psp::italic::Unknown )
++        aFont.SetItalic( PspGraphics::ToFontItalic( aInfo.m_eItalic ) );
++    if( aInfo.m_ePitch != psp::pitch::Unknown )
++        aFont.SetPitch( PspGraphics::ToFontPitch( aInfo.m_ePitch ) );
++
++    return aFont;
++}
++
++/** Implementation of KDE integration's main method.
++*/
++void KDESalFrame::UpdateSettings( AllSettings& rSettings )
++{
++    StyleSettings style( rSettings.GetStyleSettings() );
++	BOOL bSetTitleFont = false;
++
++	
++	// General settings
++    QPalette pal = kapp->palette();
++	
++	style.SetActiveColor(toColor(pal.color(QPalette::Active, QPalette::Window)));
++	style.SetDeactiveColor(toColor(pal.color(QPalette::Inactive, QPalette::Window)));
++	
++	style.SetActiveColor2(toColor(pal.color(QPalette::Active, QPalette::Window)));
++	style.SetDeactiveColor2(toColor(pal.color(QPalette::Inactive, QPalette::Window)));
++	
++	style.SetActiveTextColor(toColor(pal.color(QPalette::Active, QPalette::WindowText)));
++	style.SetDeactiveTextColor(toColor(pal.color(QPalette::Inactive, QPalette::WindowText)));
++	
++    // WM settings
++    KConfig *pConfig = KGlobal::config().data();
++    if ( pConfig )
++    {
++        KConfigGroup aGroup = pConfig->group( "WM" );
++        const char *pKey;
++		
++        pKey = "titleFont";
++        if ( aGroup.hasKey( pKey ) )
++        {
++            Font aFont = toFont( aGroup.readEntry( pKey, QFont() ), rSettings.GetUILocale() );
++            style.SetTitleFont( aFont );
++			bSetTitleFont = true;
++        }
++		
++        aGroup = pConfig->group( "Icons" );
++
++        pKey = "Theme";
++        if ( aGroup.hasKey( pKey ) )
++            style.SetPreferredSymbolsStyleName( readEntryUntranslated( &aGroup, pKey ) );
++    }
++	
++    Color aFore = toColor( pal.color( QPalette::Active, QPalette::WindowText ) );
++    Color aBack = toColor( pal.color( QPalette::Active, QPalette::Window ) );
++    Color aText = toColor( pal.color( QPalette::Active, QPalette::Text ) );
++    Color aBase = toColor( pal.color( QPalette::Active, QPalette::Base ) );
++    Color aButn = toColor( pal.color( QPalette::Active, QPalette::ButtonText ) );
++    Color aMid = toColor( pal.color( QPalette::Active, QPalette::Mid ) );
++    Color aHigh = toColor( pal.color( QPalette::Active, QPalette::Highlight ) );
++
++    // Foreground
++    style.SetRadioCheckTextColor( aFore );
++    style.SetLabelTextColor( aFore );
++    style.SetInfoTextColor( aFore );
++    style.SetDialogTextColor( aFore );
++    style.SetGroupTextColor( aFore );
++
++    // Text
++    style.SetFieldTextColor( aText );
++    style.SetFieldRolloverTextColor( aText );
++    style.SetWindowTextColor( aText );
++    style.SetHelpTextColor( aText );
++
++    // Base
++    style.SetFieldColor( aBase );
++    style.SetHelpColor( aBase );
++    style.SetWindowColor( aBase );
++    style.SetActiveTabColor( aBase );
++    
++    // Buttons
++    style.SetButtonTextColor( aButn );
++    style.SetButtonRolloverTextColor( aButn );
++
++    // Disable color
++    style.SetDisableColor( aMid );
++
++    // Workspace
++    style.SetWorkspaceColor( aMid );
++
++    // Background
++    style.Set3DColors( aBack );
++    style.SetFaceColor( aBack );
++    style.SetInactiveTabColor( aBack );
++    style.SetDialogColor( aBack );
++	
++    if( aBack == COL_LIGHTGRAY )
++        style.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) );
++    else
++    {
++        Color aColor2 = style.GetLightColor();
++        style.
++            SetCheckedColor( Color( (BYTE)(((USHORT)aBack.GetRed()+(USHORT)aColor2.GetRed())/2),
++                        (BYTE)(((USHORT)aBack.GetGreen()+(USHORT)aColor2.GetGreen())/2),
++                        (BYTE)(((USHORT)aBack.GetBlue()+(USHORT)aColor2.GetBlue())/2)
++                        ) );
++    }
++
++    // Selection
++    style.SetHighlightColor( aHigh );
++    style.SetHighlightTextColor( toColor(pal.color( QPalette::HighlightedText))  );
++
++    // Font
++    Font aFont = toFont( kapp->font(), rSettings.GetUILocale() );
++	
++    style.SetAppFont( aFont );
++    style.SetHelpFont( aFont );
++	
++	if( !bSetTitleFont )
++	{
++		style.SetTitleFont( aFont );
++	}
++	
++	style.SetFloatTitleFont( aFont );
++    style.SetMenuFont( aFont ); // will be changed according to pMenuBar
++    style.SetToolFont( aFont ); // will be changed according to pToolBar
++    style.SetLabelFont( aFont );
++    style.SetInfoFont( aFont );
++    style.SetRadioCheckFont( aFont );
++    style.SetPushButtonFont( aFont );
++    style.SetFieldFont( aFont );
++    style.SetIconFont( aFont );
++    style.SetGroupFont( aFont );
++	
++    int flash_time = QApplication::cursorFlashTime();
++    style.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME );
++
++    KMainWindow qMainWindow;
++
++    // Menu
++    style.SetSkipDisabledInMenus( TRUE );
++    KMenuBar *pMenuBar = qMainWindow.menuBar();
++    if ( pMenuBar )
++    {
++        // Color
++        QPalette qMenuCG = pMenuBar->palette();
++        
++        // Menu text and background color, theme specific
++        Color aMenuFore = toColor( qMenuCG.color( QPalette::WindowText ) );
++        Color aMenuBack = toColor( qMenuCG.color( QPalette::Window ) );
++		
++        aMenuFore = toColor( qMenuCG.color( QPalette::ButtonText ) );
++        aMenuBack = toColor( qMenuCG.color( QPalette::Button ) );
++        
++        style.SetMenuTextColor( aMenuFore );
++        style.SetMenuColor( aMenuBack );
++        style.SetMenuBarColor( aMenuBack );
++
++        style.SetMenuHighlightColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) );
++
++        style.SetMenuHighlightTextColor( aMenuFore );
++        
++        // set special menubar higlight text color
++        if ( kapp->style()->inherits( "HighContrastStyle" ) )
++            ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = toColor( qMenuCG.color( QPalette::HighlightedText ) );
++        else
++            ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore;
++
++        // Font
++        aFont = toFont( pMenuBar->font(), rSettings.GetUILocale() );
++        style.SetMenuFont( aFont );
++    }
++
++    // Tool bar
++    KToolBar *pToolBar = qMainWindow.toolBar();
++    if ( pToolBar )
++    {
++        aFont = toFont( pToolBar->font(), rSettings.GetUILocale() );
++        style.SetToolFont( aFont );
++    }
++
++    // Scroll bar size
++    style.SetScrollBarSize( kapp->style()->pixelMetric( QStyle::PM_ScrollBarExtent ) );
++    
++    // #i59364# high contrast mode
++    BOOL bHC = ( style.GetFaceColor().IsDark() ||
++                 style.GetWindowColor().IsDark() );
++    style.SetHighContrastMode( bHC );
++
++    rSettings.SetStyleSettings( style );
++}
++
++
++void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics )
++{
++    for( int i = 0; i < nMaxGraphics; i++ )
++    {
++        if( m_aGraphics[i].pGraphics == pGraphics )
++        {
++            m_aGraphics[i].bInUse = false;
++            break;
++        }
++    }
++}
++
++void KDESalFrame::updateGraphics()
++{
++    for( int i = 0; i < nMaxGraphics; i++ )
++    {
++        if( m_aGraphics[i].bInUse )
++            m_aGraphics[i].pGraphics->SetDrawable( GetWindow(), GetScreenNumber() );
++    }
++}
++
++KDESalFrame::~KDESalFrame()
++{
++}
++
++KDESalFrame::GraphicsHolder::~GraphicsHolder()
++{
++	delete pGraphics;
++}
++
++SalGraphics* KDESalFrame::GetGraphics()
++{
++    if( GetWindow() )
++    {
++        for( int i = 0; i < nMaxGraphics; i++ )
++        {
++            if( ! m_aGraphics[i].bInUse )
++            {
++                m_aGraphics[i].bInUse = true;
++                if( ! m_aGraphics[i].pGraphics )
++                {
++                    m_aGraphics[i].pGraphics = new KDESalGraphics();
++                    m_aGraphics[i].pGraphics->Init( this, GetWindow(), GetScreenNumber() );
++                }
++                return m_aGraphics[i].pGraphics;
++            }
++        }
++    }
++    
++    return NULL;
++}
+\ No newline at end of file
+diff --git vcl/unx/kde4/KDESalFrame.hxx vcl/unx/kde4/KDESalFrame.hxx
+new file mode 100644
+index 0000000..da41fd3
+--- /dev/null
++++ vcl/unx/kde4/KDESalFrame.hxx
+@@ -0,0 +1,58 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2009 by Sun Microsystems, Inc.
++ *
++ * 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.
++ *
++ ************************************************************************/
++
++#pragma once
++
++#include <saldisp.hxx>
++#include <salframe.h>
++
++class KDESalFrame : public X11SalFrame
++{
++	private:
++		static const int nMaxGraphics = 2;
++
++		struct GraphicsHolder
++		{
++			X11SalGraphics* pGraphics;
++			bool bInUse;
++			
++			GraphicsHolder() : pGraphics(0),bInUse( false ) {}
++			~GraphicsHolder();
++		};
++		
++		GraphicsHolder m_aGraphics[ nMaxGraphics ];
++
++	public:
++		KDESalFrame( SalFrame* pParent, ULONG nStyle );
++		virtual ~KDESalFrame();
++
++		virtual SalGraphics* GetGraphics();
++		virtual void ReleaseGraphics( SalGraphics *pGraphics );
++		virtual void updateGraphics();
++		virtual void UpdateSettings( AllSettings& rSettings );
++		virtual void Show( BOOL bVisible, BOOL bNoActivate );
++};
+\ No newline at end of file
+diff --git vcl/unx/kde4/KDESalGraphics.cxx vcl/unx/kde4/KDESalGraphics.cxx
+new file mode 100644
+index 0000000..35b9330
+--- /dev/null
++++ vcl/unx/kde4/KDESalGraphics.cxx
+@@ -0,0 +1,752 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2009 by Sun Microsystems, Inc.
++ *
++ * 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_vcl.hxx"
++
++#define _SV_SALNATIVEWIDGETS_KDE_CXX
++
++#define Region QtXRegion
++
++#include <QStyle>
++#include <QStyleOption>
++#include <QPainter>
++
++#include <kapplication.h>
++
++#undef Region
++
++#include "KDESalGraphics.hxx"
++
++#include <vcl/settings.hxx>
++#include <rtl/ustrbuf.hxx>
++
++#include <stdio.h>
++
++using namespace ::rtl;
++
++/** 
++  Conversion function between VCL ControlState together with
++  ImplControlValue and Qt state flags.
++  @param nControlState State of the widget (default, focused, ...) in Native Widget Framework.
++  @param aValue Value held by the widget (on, off, ...)
++*/
++QStyle::State vclStateValue2StateFlag( ControlState nControlState,
++	const ImplControlValue& aValue )
++{
++    QStyle::State nState =
++		( (nControlState & CTRL_STATE_DEFAULT)?  QStyle::State_None:      QStyle::State_None ) |
++		( (nControlState & CTRL_STATE_ENABLED)?  QStyle::State_Enabled:   QStyle::State_None ) |
++		( (nControlState & CTRL_STATE_FOCUSED)?  QStyle::State_HasFocus:  QStyle::State_None ) |
++		( (nControlState & CTRL_STATE_PRESSED)?  QStyle::State_Sunken:    QStyle::State_None ) |
++		( (nControlState & CTRL_STATE_SELECTED)? QStyle::State_Selected : QStyle::State_None ) |
++		( (nControlState & CTRL_STATE_ROLLOVER)? QStyle::State_MouseOver: QStyle::State_None );
++		//TODO ( (nControlState & CTRL_STATE_HIDDEN)?   QStyle::State_:   QStyle::State_None ) |
++
++    switch ( aValue.getTristateVal() )
++    {
++		case BUTTONVALUE_ON:    nState |= QStyle::State_On;       break;
++		case BUTTONVALUE_OFF:   nState |= QStyle::State_Off;      break;
++		case BUTTONVALUE_MIXED: nState |= QStyle::State_NoChange; break;
++		default: break;
++    }
++
++    return nState;
++}
++
++/** 
++ Convert VCL Region to QRect.
++ @param rControlRegion The region to convert.
++ @return The bounding box of the region.
++*/
++QRect region2QRect( const Region& rControlRegion )
++{
++    Rectangle aRect = rControlRegion.GetBoundRect();
++
++    return QRect( QPoint( aRect.Left(), aRect.Top() ),
++		  QPoint( aRect.Right(), aRect.Bottom() ) );
++}
++
++BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart part )
++{
++	if (type == CTRL_PUSHBUTTON) return true;
++	
++	if (type == CTRL_MENUBAR) return true;
++	
++	if (type == CTRL_MENU_POPUP) return true;
++	
++	if (type == CTRL_EDITBOX) return true;
++	
++	if (type == CTRL_COMBOBOX) return true;
++	
++	if (type == CTRL_TOOLBAR) return true;
++	
++	if (type == CTRL_CHECKBOX) return true;
++	
++	if (type == CTRL_LISTBOX) return true;
++	
++	if (type == CTRL_LISTNODE) return true;
++	
++	if (type == CTRL_FRAME) return true;
++	
++	if (type == CTRL_SCROLLBAR) return true;
++	
++	if (type == CTRL_WINDOW_BACKGROUND) return true;
++	
++	if (type == CTRL_SPINBOX) return true;
++	
++	if (type == CTRL_SPINBUTTONS) return true;
++	
++	if (type == CTRL_GROUPBOX) return true;
++	
++	if (type == CTRL_FIXEDLINE) return true;
++	
++	if (type == CTRL_FIXEDBORDER) return true;
++	
++	if (type == CTRL_TOOLTIP) return true;
++	
++	if (type == CTRL_RADIOBUTTON) return true;
++	
++	return false;
++	
++	if ( (type == CTRL_TAB_ITEM) && (part == PART_ENTIRE_CONTROL) ) return true;
++	if ( (type == CTRL_TAB_PANE) && (part == PART_ENTIRE_CONTROL) ) return true;
++	// no CTRL_TAB_BODY for KDE
++	if ( (type == CTRL_PROGRESS)    && (part == PART_ENTIRE_CONTROL) ) return true;
++		
++	return false;
++}
++
++
++BOOL KDESalGraphics::hitTestNativeControl( ControlType type, ControlPart part,
++										   const Region& rControlRegion, const Point& rPos,
++										   SalControlHandle&, BOOL& rIsInside )
++{
++    return FALSE;
++}
++
++BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
++										const Region& rControlRegion, ControlState nControlState,
++										const ImplControlValue& value, SalControlHandle&,
++										const OUString& )
++{
++    BOOL returnVal = true;
++
++    Display* dpy = GetXDisplay();
++    XLIB_Window drawable = GetDrawable();
++    GC gc = SelectPen();
++	
++	QRect widgetRect = region2QRect(rControlRegion);
++	
++	//draw right onto the window
++	QPixmap pixmap(widgetRect.width(), widgetRect.height());
++	
++	if (pixmap.isNull())
++	{
++		return false;
++	}
++	
++	QPainter painter(&pixmap);
++	painter.setBackgroundMode(Qt::OpaqueMode);
++	
++	//copy previous screen contents for proper blending
++	QPixmap screen = QPixmap::fromX11Pixmap(drawable);
++	painter.drawPixmap(0,0, screen, widgetRect.left(), widgetRect.top(), widgetRect.width(), widgetRect.height());
++	
++    if (type == CTRL_PUSHBUTTON)
++    {
++		QStyleOptionButton styleOption;
++		
++		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++		styleOption.state =vclStateValue2StateFlag( nControlState, value );
++		
++		kapp->style()->drawControl( QStyle::CE_PushButton, &styleOption, &painter);
++    }
++	else if ( (type == CTRL_MENUBAR))
++	{
++		if (part == PART_MENU_ITEM) 
++		{
++			QStyleOptionMenuItem styleOption;
++			
++			styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++			styleOption.state = vclStateValue2StateFlag( nControlState, value );
++			
++			kapp->style()->drawControl( QStyle::CE_MenuBarItem, &styleOption, &painter);
++		}
++		else
++		{
++			pixmap.fill(KApplication::palette().color(QPalette::Window));
++		}
++	}
++	else if (type == CTRL_MENU_POPUP)
++	{		
++		if (part == PART_MENU_ITEM)
++		{
++			QStyleOptionMenuItem styleOption;
++			
++			styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++			styleOption.state = vclStateValue2StateFlag( nControlState, value );
++			
++			kapp->style()->drawControl( QStyle::CE_MenuItem, &styleOption, &painter);
++		}
++		else if (part == PART_MENU_ITEM_CHECK_MARK)
++		{
++			QStyleOptionButton styleOption;
++			
++			styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++			styleOption.state = vclStateValue2StateFlag( nControlState, value );
++			
++			if (nControlState & CTRL_STATE_PRESSED)
++			{
++				kapp->style()->drawPrimitive( QStyle::PE_IndicatorMenuCheckMark, &styleOption, &painter);
++			}
++		}
++		else if (part == PART_MENU_ITEM_RADIO_MARK)
++		{
++			QStyleOptionButton styleOption;
++			
++			styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++			styleOption.state = vclStateValue2StateFlag( nControlState, value );
++			
++			if (nControlState & CTRL_STATE_PRESSED)
++			{
++				kapp->style()->drawPrimitive( QStyle::PE_IndicatorRadioButton, &styleOption, &painter);
++			}
++		}
++		else
++		{
++			pixmap.fill(KApplication::palette().color(QPalette::Window));
++			
++			QStyleOptionFrameV3 styleOption;
++		
++			styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++			styleOption.state = vclStateValue2StateFlag( nControlState, value );
++			styleOption.frameShape = QFrame::StyledPanel;
++			
++			kapp->style()->drawPrimitive( QStyle::PE_FrameMenu, &styleOption, &painter);
++		}
++	}
++	else if ( (type == CTRL_TOOLBAR) && (part == PART_BUTTON) )
++    {
++		QStyleOptionToolButton styleOption;
++		
++		styleOption.arrowType = Qt::NoArrow;
++		styleOption.subControls = QStyle::SC_ToolButton;
++		
++		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++		styleOption.state = vclStateValue2StateFlag( nControlState, value );
++		styleOption.state |= QStyle::State_Raised | QStyle::State_Enabled | QStyle::State_AutoRaise;
++		
++		kapp->style()->drawComplexControl( QStyle::CC_ToolButton, &styleOption, &painter);
++    }
++	else if ( (type == CTRL_TOOLBAR) && (part == PART_ENTIRE_CONTROL) )
++    {
++		QStyleOptionToolBar styleOption;
++		
++		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++		styleOption.state = vclStateValue2StateFlag( nControlState, value );
++		
++		kapp->style()->drawControl( QStyle::CE_ToolBar, &styleOption, &painter);
++    }
++	else if ( (type == CTRL_TOOLBAR) && (part == PART_THUMB_VERT) )
++    {
++        QStyleOption styleOption;
++		
++		int width = kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent);
++		
++		styleOption.rect = QRect(0, 0, width, widgetRect.height());
++		styleOption.state = QStyle::State_Horizontal;
++		
++		kapp->style()->drawPrimitive( QStyle::PE_IndicatorToolBarHandle, &styleOption, &painter);
++    }
++	else if (type == CTRL_EDITBOX)
++	{
++		pixmap.fill(KApplication::palette().color(QPalette::Window));
++		
++		//TODO hover?? OO does not seem to do this for line edits
++		
++		QStyleOptionFrameV3 styleOption;
++		
++		styleOption.state = vclStateValue2StateFlag( nControlState, value );
++		
++		//TODO...how does the line edit draw itself internally??
++		styleOption.rect = QRect(2, 2, widgetRect.width()-4, widgetRect.height()-4);
++		kapp->style()->drawPrimitive( QStyle::PE_PanelLineEdit, &styleOption, &painter);
++		
++		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++		kapp->style()->drawPrimitive( QStyle::PE_FrameLineEdit, &styleOption, &painter);
++	}
++	else if (type == CTRL_COMBOBOX)
++	{
++		pixmap.fill(KApplication::palette().color(QPalette::Window));
++		
++		QStyleOptionComboBox styleOption;
++		
++		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++		styleOption.state = vclStateValue2StateFlag( nControlState, value );
++		
++		styleOption.editable = true;
++		
++		kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter);
++	}
++	else if (type == CTRL_LISTBOX)
++	{
++		QStyleOptionComboBox styleOption;
++		
++		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++		styleOption.state = vclStateValue2StateFlag( nControlState, value );
++		
++		if (part == PART_SUB_EDIT)
++		{
++			kapp->style()->drawControl(QStyle::CE_ComboBoxLabel, &styleOption, &painter);
++		}
++		else
++		{
++			kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter);
++		}
++	}
++	else if (type == CTRL_LISTNODE)
++	{
++		QStyleOption styleOption;
++		
++		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++		styleOption.state = vclStateValue2StateFlag( nControlState, value );
++		
++		styleOption.state |= QStyle::State_Item;
++		styleOption.state |= QStyle::State_Children;
++		
++		if (nControlState & CTRL_STATE_PRESSED)
++		{
++			styleOption.state |= QStyle::State_Open;
++		}
++		
++		kapp->style()->drawPrimitive(QStyle::PE_IndicatorBranch, &styleOption, &painter);
++	}
++	else if (type == CTRL_CHECKBOX)
++	{	
++		QStyleOptionButton styleOption;
++		
++		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++		styleOption.state = vclStateValue2StateFlag( nControlState, value );
++		
++		kapp->style()->drawControl(QStyle::CE_CheckBox, &styleOption, &painter);
++	}
++	else if (type == CTRL_SCROLLBAR)
++	{
++		pixmap.fill(KApplication::palette().color(QPalette::Window));
++		
++		if ((part == PART_DRAW_BACKGROUND_VERT) || (part == PART_DRAW_BACKGROUND_HORZ))
++		{
++			ScrollbarValue* sbVal = static_cast<ScrollbarValue *> ( value.getOptionalVal() );
++			
++			QStyleOptionSlider styleOption;
++			styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++			
++			//if the scroll bar is active (aka not degenrate...allow for hover events
++			if (sbVal->mnVisibleSize < sbVal->mnMax)
++			{
++				styleOption.state = vclStateValue2StateFlag( nControlState, value );
++				styleOption.state |= QStyle::State_MouseOver;
++			}
++			
++			//horizontal or vertical
++			if (part == PART_DRAW_BACKGROUND_VERT)
++			{
++				styleOption.orientation = Qt::Vertical;
++			}
++			else
++			{
++				styleOption.state |= QStyle::State_Horizontal;
++			}
++			
++			//setup parameters from the OO values
++			styleOption.minimum = sbVal->mnMin;
++			styleOption.maximum = sbVal->mnMax - sbVal->mnVisibleSize;
++			styleOption.sliderValue = sbVal->mnCur;
++			styleOption.sliderPosition = sbVal->mnCur;
++			styleOption.pageStep = sbVal->mnVisibleSize;
++			
++			//setup the active control...always the slider
++			if (sbVal->mnThumbState & CTRL_STATE_ROLLOVER)
++			{
++				styleOption.activeSubControls = QStyle::SC_ScrollBarSlider;
++			}
++			
++			kapp->style()->drawComplexControl(QStyle::CC_ScrollBar, &styleOption, &painter);
++		}
++	}
++	else if (type == CTRL_SPINBOX)
++	{
++		pixmap.fill(KApplication::palette().color(QPalette::Window));
++		//SpinbuttonValue* sbVal = static_cast<SpinbuttonValue *> ( value.getOptionalVal() );
++		
++		QStyleOptionSpinBox styleOption;
++		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++		styleOption.state = vclStateValue2StateFlag( nControlState, value );
++		
++		kapp->style()->drawComplexControl(QStyle::CC_SpinBox, &styleOption, &painter);
++	}
++	else if (type == CTRL_SPINBUTTONS)
++	{
++		pixmap.fill(KApplication::palette().color(QPalette::Window));
++		
++		QStyleOptionSpinBox styleOption;
++		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++		styleOption.state = vclStateValue2StateFlag( nControlState, value );
++		
++		styleOption.subControls = QStyle::SC_SpinBoxUp | QStyle::SC_SpinBoxDown;
++		
++		kapp->style()->drawComplexControl(QStyle::CC_SpinBox, &styleOption, &painter);
++	}
++	else if (type == CTRL_GROUPBOX)
++	{
++		QStyleOptionGroupBox styleOption;
++		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++		styleOption.state = vclStateValue2StateFlag( nControlState, value );
++		
++		kapp->style()->drawComplexControl(QStyle::CC_GroupBox, &styleOption, &painter);
++	}
++	else if (type == CTRL_RADIOBUTTON)
++	{
++		QStyleOptionButton styleOption;
++		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++		styleOption.state = vclStateValue2StateFlag( nControlState, value );
++		
++		kapp->style()->drawControl(QStyle::CE_RadioButton, &styleOption, &painter);
++	}
++	else if (type == CTRL_TOOLTIP)
++	{
++		QStyleOption styleOption;
++		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++		styleOption.state = vclStateValue2StateFlag( nControlState, value );
++		
++		kapp->style()->drawPrimitive(QStyle::PE_PanelTipLabel, &styleOption, &painter);
++	}
++	else if (type == CTRL_FRAME)
++	{
++		QStyleOptionFrameV3 styleOption;
++		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++		styleOption.state = vclStateValue2StateFlag( nControlState, value );
++		styleOption.frameShape = QFrame::StyledPanel;
++		
++		kapp->style()->drawPrimitive(QStyle::PE_FrameWindow, &styleOption, &painter);
++	}
++	else if (type == CTRL_FIXEDBORDER)
++	{
++		QStyleOptionFrameV3 styleOption;
++		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++		styleOption.state = vclStateValue2StateFlag( nControlState, value );
++		styleOption.frameShape = QFrame::StyledPanel;
++		
++		kapp->style()->drawPrimitive(QStyle::PE_FrameWindow, &styleOption, &painter);
++	}
++	else if (type == CTRL_WINDOW_BACKGROUND)
++	{
++		pixmap.fill(KApplication::palette().color(QPalette::Window));	
++	}
++	else if (type == CTRL_FIXEDLINE)
++	{
++		QStyleOptionMenuItem styleOption;
++			
++		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
++		styleOption.state = vclStateValue2StateFlag( nControlState, value );
++		styleOption.menuItemType = QStyleOptionMenuItem::Separator;
++		styleOption.state |= QStyle::State_Item;
++		
++		kapp->style()->drawControl( QStyle::CE_MenuItem, &styleOption, &painter);
++	}
++	else
++	{
++		returnVal = false;
++	}
++	
++	if (returnVal)
++	{
++		X11SalGraphics::CopyScreenArea( dpy,
++			pixmap.handle(), pixmap.x11Info().screen(), pixmap.x11Info().depth(),
++			drawable, GetScreenNumber(), GetVisual().GetDepth(), gc,
++			0, 0, widgetRect.width(), widgetRect.height(), widgetRect.left(), widgetRect.top() );
++	}
++
++    return returnVal;
++}
++
++BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
++											 const Region& controlRegion, ControlState controlState,
++											 const ImplControlValue& val, SalControlHandle&,
++											 const OUString&,
++											 Region &nativeBoundingRegion, Region &nativeContentRegion )
++{
++    bool retVal = false;
++	
++    QRect boundingRect = region2QRect( controlRegion );
++    QRect contentRect = boundingRect;
++    QStyleOptionComplex styleOption;
++	
++    switch ( type )
++    {
++		// Metrics of the push button
++		case CTRL_PUSHBUTTON:
++			if (part == PART_ENTIRE_CONTROL)
++			{
++				styleOption.state = vclStateValue2StateFlag(controlState, val);
++
++				if ( controlState & CTRL_STATE_DEFAULT )
++				{
++					int size = kapp->style()->pixelMetric(
++						QStyle::PM_ButtonDefaultIndicator, &styleOption );
++					
++					boundingRect.adjust( -size, -size, size, size );
++					
++					retVal = true;
++				}
++			}
++			break;
++		case CTRL_EDITBOX:
++		{
++			styleOption.rect = QRect(0, 0, contentRect.width(), contentRect.height());
++			styleOption.state = vclStateValue2StateFlag(controlState, val);
++
++			int size = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) - 1;
++			
++			contentRect.adjust( -size, -size, size, size);
++			boundingRect = contentRect;
++			
++			retVal = true;
++			
++			break;
++		}
++		case CTRL_CHECKBOX:
++			if (part == PART_ENTIRE_CONTROL)
++			{
++				styleOption.state = vclStateValue2StateFlag(controlState, val);
++						
++				contentRect.setWidth(kapp->style()->pixelMetric(
++					QStyle::PM_IndicatorWidth, &styleOption));
++				contentRect.setHeight(kapp->style()->pixelMetric(
++					QStyle::PM_IndicatorHeight, &styleOption));
++				
++				contentRect.adjust(0, 10, 0, 5);
++				
++				boundingRect = contentRect;
++					
++				retVal = true;
++				
++				break;
++			}
++		case CTRL_COMBOBOX:
++		case CTRL_LISTBOX:
++		{
++			QStyleOptionComboBox cbo;
++			
++			cbo.rect = QRect(0, 0, contentRect.width(), contentRect.height());
++			cbo.state = vclStateValue2StateFlag(controlState, val);
++			
++			switch ( part )
++			{
++				case PART_ENTIRE_CONTROL:
++				{
++					int size = kapp->style()->pixelMetric(QStyle::PM_ComboBoxFrameWidth) - 2;
++					contentRect.adjust(-size,-size,size,size);
++					retVal = true;
++					break;
++				}
++				case PART_BUTTON_DOWN:
++					//the entire control can be used as the "down" button
++					retVal = true;
++					break;
++				case PART_SUB_EDIT:
++					contentRect = kapp->style()->subControlRect(
++						QStyle::CC_ComboBox, &cbo, QStyle::SC_ComboBoxEditField );
++						
++					contentRect.translate( boundingRect.left(), boundingRect.top() );
++					
++					retVal = true;
++					break;
++			}
++			break;
++		}
++		case CTRL_SPINBOX:
++		{
++			QStyleOptionSpinBox sbo;
++
++			sbo.rect = QRect(0, 0, contentRect.width(), contentRect.height());
++			sbo.state = vclStateValue2StateFlag(controlState, val);
++			
++			switch ( part )
++			{
++				case PART_BUTTON_UP:
++					contentRect = kapp->style()->subControlRect(
++						QStyle::CC_SpinBox, &sbo, QStyle::SC_SpinBoxUp );
++					contentRect.translate( boundingRect.left(), boundingRect.top() );
++					retVal = true;
++					boundingRect = QRect();
++					break;
++				
++				case PART_BUTTON_DOWN:
++					contentRect = kapp->style()->subControlRect(
++						QStyle::CC_SpinBox, &sbo, QStyle::SC_SpinBoxDown );
++					retVal = true;
++					contentRect.translate( boundingRect.left(), boundingRect.top() );
++					boundingRect = QRect();
++					break;
++
++				case PART_SUB_EDIT:
++					contentRect = kapp->style()->subControlRect(
++						QStyle::CC_SpinBox, &sbo, QStyle::SC_SpinBoxEditField );
++					retVal = true;
++					contentRect.translate( boundingRect.left(), boundingRect.top() );
++					break;
++				default:
++					retVal = true;
++			}
++			break;
++		}
++		case CTRL_MENU_POPUP:
++			//just limit the widget of the menu items
++			//OO isn't very flexible in all reguards with the menu
++			//so we do the best we can
++			if (part == PART_MENU_ITEM_CHECK_MARK)
++			{
++				contentRect.setWidth(contentRect.height());
++				retVal = true;
++			}
++			else if (part == PART_MENU_ITEM_RADIO_MARK)
++			{
++				contentRect.setWidth(contentRect.height());
++				retVal = true;
++			}
++			break;
++		case CTRL_FRAME:
++		{
++			if (part == PART_BORDER)
++			{
++				int size = kapp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
++				//contentRect.adjust(size, size, size, size);
++				boundingRect.adjust(-size, -size, size, size);
++				retVal = true;
++			}
++			
++			break;
++		}
++		case CTRL_RADIOBUTTON:
++		{
++			const int h = kapp->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorHeight);
++			const int w = kapp->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth);
++			
++			contentRect = QRect(boundingRect.left(), boundingRect.top(), w, h);
++			
++			retVal = true;
++		}
++		default:
++			break;
++	}
++#if 0
++	
++
++		// Metrics of the scroll bar
++		case CTRL_SCROLLBAR:
++			//pWidget = pWidgetPainter->scrollBar( rControlRegion,
++				//( part == PART_BUTTON_LEFT || part == PART_BUTTON_RIGHT ),
++				//ImplControlValue() );
++			//aStyleOption.initFrom( pWidget );
++
++			switch ( part )
++			{
++			case PART_BUTTON_LEFT:
++			case PART_BUTTON_UP:
++				qRect = kapp->style()->subControlRect(
++					QStyle::CC_ScrollBar, &aStyleOption, QStyle::SC_ScrollBarSubLine );
++
++				// Workaround for Platinum style scroll bars. It makes the
++				// left/up button invisible.
++				if ( part == PART_BUTTON_LEFT )
++				{
++					if ( qRect.left() > kapp->style()->subControlRect(
++						QStyle::CC_ScrollBar, &aStyleOption,
++						QStyle::SC_ScrollBarSubPage ).left() )
++					{
++						qRect.setLeft( 0 );
++						qRect.setRight( 0 );
++					}
++				}
++				else
++				{
++					if ( qRect.top() > kapp->style()->subControlRect(
++						QStyle::CC_ScrollBar, &aStyleOption,
++						QStyle::SC_ScrollBarSubPage ).top() )
++					{
++						qRect.setTop( 0 );
++						qRect.setBottom( 0 );
++					}
++				}
++	
++				qRect.translate( qBoundingRect.left(), qBoundingRect.top() );
++
++				bReturn = TRUE;
++				break;
++
++			case PART_BUTTON_RIGHT:
++			case PART_BUTTON_DOWN:
++				qRect = kapp->style()->subControlRect(
++					QStyle::CC_ScrollBar, &aStyleOption, QStyle::SC_ScrollBarAddLine );
++
++				// Workaround for Platinum and 3 button style scroll bars.
++				// It makes the right/down button bigger.
++				if ( part == PART_BUTTON_RIGHT )
++					qRect.setLeft( kapp->style()->subControlRect(
++						QStyle::CC_ScrollBar, &aStyleOption,
++						QStyle::SC_ScrollBarAddPage ).right() + 1 );
++				else
++					qRect.setTop( kapp->style()->subControlRect(
++						QStyle::CC_ScrollBar, &aStyleOption,
++						QStyle::SC_ScrollBarAddPage ).bottom() + 1 );
++
++				qRect.translate( qBoundingRect.left(), qBoundingRect.top() );
++
++				bReturn = TRUE;
++				break;
++			}
++			break;
++    }
++#endif
++    
++    if (retVal)
++    {
++		// Bounding region
++		Point aBPoint( boundingRect.x(), boundingRect.y() );
++		Size aBSize( boundingRect.width(), boundingRect.height() );
++		nativeBoundingRegion = Region( Rectangle( aBPoint, aBSize ) );
++
++		// Region of the content
++		Point aPoint( contentRect.x(), contentRect.y() );
++		Size  aSize( contentRect.width(), contentRect.height() );
++		nativeContentRegion = Region( Rectangle( aPoint, aSize ) );
++    }
++	
++    return retVal;
++}
+diff --git vcl/unx/kde4/KDESalGraphics.hxx vcl/unx/kde4/KDESalGraphics.hxx
+new file mode 100644
+index 0000000..f6e77d7
+--- /dev/null
++++ vcl/unx/kde4/KDESalGraphics.hxx
+@@ -0,0 +1,114 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2009 by Sun Microsystems, Inc.
++ *
++ * 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.
++ *
++ ************************************************************************/
++
++#pragma once
++
++#include <rtl/string.hxx>
++#include <saldisp.hxx>
++#include <salgdi.h>
++
++/** handles graphics drawings requests and performs the needed drawing operations */
++class KDESalGraphics : public X11SalGraphics
++{
++	public:
++		KDESalGraphics() {}
++		virtual ~KDESalGraphics() {}
++		
++		/**
++			What widgets can be drawn the native way.
++			@param type Type of the widget.
++			@param part Specification of the widget's part if it consists of more than one.
++			@return true if the platform supports native drawing of the widget type defined by part.
++		*/
++		virtual BOOL IsNativeControlSupported( ControlType type, ControlPart part );
++		
++		/** Test whether the position is in the native widget.
++			If the return value is TRUE, bIsInside contains information whether
++			aPos was or was not inside the native widget specified by the
++			type/part combination.
++		*/
++		virtual BOOL hitTestNativeControl( ControlType type, ControlPart part,
++										const Region& rControlRegion, const Point& aPos,
++										SalControlHandle& rControlHandle, BOOL& rIsInside );
++		/** Draw the requested control described by part/nControlState.
++		
++			@param rControlRegion
++			The bounding region of the complete control in VCL frame coordinates.
++			
++			@param aValue
++			An optional value (tristate/numerical/string).
++			
++			@param rControlHandle
++			Carries platform dependent data and is maintained by the SalFrame implementation.
++			
++			@param aCaption
++			A caption or title string (like button text etc.)
++		*/
++		virtual BOOL drawNativeControl( ControlType type, ControlPart part,
++										const Region& rControlRegion, ControlState nControlState,
++										const ImplControlValue& aValue, SalControlHandle& rControlHandle,
++										const rtl::OUString& aCaption );
++										
++		/** Draw text on the widget.
++			OPTIONAL. Draws the requested text for the control described by part/nControlState.
++			Used if text is not drawn by DrawNativeControl().
++		
++			@param rControlRegion The bounding region of the complete control in VCL frame coordinates.
++			@param aValue An optional value (tristate/numerical/string)
++			@param rControlHandle Carries platform dependent data and is maintained by the SalFrame implementation.
++			@param aCaption	A caption or title string (like button text etc.)
++		*/
++		virtual BOOL drawNativeControlText( ControlType type, ControlPart part,
++											const Region& rControlRegion, ControlState nControlState,
++											const ImplControlValue& aValue, SalControlHandle& rControlHandle,
++											const rtl::OUString& aCaption ) { return false; }
++		/** Check if the bounding regions match.
++			
++			If the return value is TRUE, rNativeBoundingRegion
++			contains the true bounding region covered by the control
++			including any adornment, while rNativeContentRegion contains the area
++			within the control that can be safely drawn into without drawing over
++			the borders of the control.
++
++			@param rControlRegion
++			The bounding region of the control in VCL frame coordinates.
++			
++			@param aValue
++			An optional value (tristate/numerical/string)
++			
++			@param rControlHandle
++			Carries platform dependent data and is maintained by the SalFrame implementation.
++			
++			@param aCaption
++			A caption or title string (like button text etc.)
++		*/
++		virtual BOOL getNativeControlRegion( ControlType type, ControlPart part,
++											const Region& rControlRegion, ControlState nControlState,
++											const ImplControlValue& aValue, SalControlHandle& rControlHandle,
++											const rtl::OUString& aCaption,
++											Region &rNativeBoundingRegion, Region &rNativeContentRegion );
++};
+\ No newline at end of file
+diff --git vcl/unx/kde4/KDESalInstance.cxx vcl/unx/kde4/KDESalInstance.cxx
+new file mode 100644
+index 0000000..c65f08e
+--- /dev/null
++++ vcl/unx/kde4/KDESalInstance.cxx
+@@ -0,0 +1,35 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2009 by Sun Microsystems, Inc.
++ *
++ * 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.
++ *
++ ************************************************************************/
++
++#include "KDESalInstance.hxx"
++
++#include "KDESalFrame.hxx"
++
++SalFrame* KDESalInstance::CreateFrame( SalFrame *pParent, ULONG nState )
++{
++	return new KDESalFrame( pParent, nState );
++}
+\ No newline at end of file
+diff --git vcl/unx/kde4/KDESalInstance.hxx vcl/unx/kde4/KDESalInstance.hxx
+new file mode 100644
+index 0000000..8ca2272
+--- /dev/null
++++ vcl/unx/kde4/KDESalInstance.hxx
+@@ -0,0 +1,41 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2009 by Sun Microsystems, Inc.
++ *
++ * 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.
++ *
++ ************************************************************************/
++
++#pragma once
++
++#include <salinst.h>
++
++class SalYieldMutex;
++class SalFrame;
++
++class KDESalInstance : public X11SalInstance
++{
++	public:
++		KDESalInstance( SalYieldMutex* pMutex ) : X11SalInstance( pMutex ) {}
++		virtual ~KDESalInstance() {}
++		virtual SalFrame* CreateFrame( SalFrame* pParent, ULONG nStyle );
++};
+\ No newline at end of file
+diff --git vcl/unx/kde4/KDEXLib.cxx vcl/unx/kde4/KDEXLib.cxx
+new file mode 100644
+index 0000000..1e4e367
+--- /dev/null
++++ vcl/unx/kde4/KDEXLib.cxx
+@@ -0,0 +1,171 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2009 by Sun Microsystems, Inc.
++ *
++ * 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.
++ *
++ ************************************************************************/
++
++#include "VCLKDEApplication.hxx"
++
++#define Region QtXRegion
++
++#include <kapplication.h>
++#include <klocale.h>
++#include <kaboutdata.h>
++#include <kcmdlineargs.h>
++#include <kstartupinfo.h>
++
++#undef Region
++
++#include "KDEXLib.hxx"
++
++#include <i18n_im.hxx>
++#include <i18n_xkb.hxx>
++
++#include <saldata.hxx>
++#include <vos/process.hxx>
++
++#include "KDESalDisplay.hxx"
++
++#if OSL_DEBUG_LEVEL > 1
++#include <stdio.h>
++#endif
++
++KDEXLib::KDEXLib() : 
++	SalXLib(),	m_bStartupDone(false), m_pApplication(0),
++	m_pFreeCmdLineArgs(0), m_pAppCmdLineArgs(0), m_nFakeCmdLineArgs( 0 )
++{
++}
++
++KDEXLib::~KDEXLib()
++{
++	delete (VCLKDEApplication*)m_pApplication;
++	
++    // free the faked cmdline arguments no longer needed by KApplication
++    for( int i = 0; i < m_nFakeCmdLineArgs; i++ )
++	{
++        free( m_pFreeCmdLineArgs[i] );
++	}
++	
++    delete [] m_pFreeCmdLineArgs;
++    delete [] m_pAppCmdLineArgs;
++}
++
++void KDEXLib::Init()
++{
++	SalI18N_InputMethod* pInputMethod = new SalI18N_InputMethod;
++	pInputMethod->SetLocale();
++	XrmInitialize();
++
++	KAboutData *kAboutData = new KAboutData( "OpenOffice.org",
++			"OpenOffice.org",
++			ki18n( "OpenOffice.org" ),
++			"3.0.0",
++			ki18n( "OpenOffice.org with KDE Native Widget Support." ),
++			KAboutData::License_LGPL,
++			ki18n( "Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008 Novell, Inc"),
++			ki18n( "OpenOffice.org is an office suite.\n" ),
++			"http://kde.openoffice.org/index.html",
++			"dev at kde.openoffice.org" );
++	kAboutData->addAuthor( ki18n( "Jan Holesovsky" ),
++			ki18n( "Original author and maintainer of the KDE NWF." ),
++			"kendy at artax.karlin.mff.cuni.cz",
++			"http://artax.karlin.mff.cuni.cz/~kendy" );
++	kAboutData->addAuthor( ki18n("Eric Bischoff"),
++			ki18n( "Accessibility fixes, porting to KDE 4." ),
++			"bischoff at kde.org" );
++
++    m_nFakeCmdLineArgs = 1;
++	USHORT nIdx;
++	vos::OExtCommandLine aCommandLine;
++	int nParams = aCommandLine.getCommandArgCount();
++	rtl::OString aDisplay;
++	rtl::OUString aParam, aBin;
++
++	for ( nIdx = 0; nIdx < nParams; ++nIdx ) 
++	{
++		aCommandLine.getCommandArg( nIdx, aParam );
++		if ( !m_pFreeCmdLineArgs && aParam.equalsAscii( "-display" ) && nIdx + 1 < nParams )
++		{
++			aCommandLine.getCommandArg( nIdx + 1, aParam );
++			aDisplay = rtl::OUStringToOString( aParam, osl_getThreadTextEncoding() );
++
++			m_nFakeCmdLineArgs = 3;
++			m_pFreeCmdLineArgs = new char*[ m_nFakeCmdLineArgs ];
++			m_pFreeCmdLineArgs[ 1 ] = strdup( "-display" );
++			m_pFreeCmdLineArgs[ 2 ] = strdup( aDisplay.getStr() );
++		}
++	}
++	if ( !m_pFreeCmdLineArgs )
++		m_pFreeCmdLineArgs = new char*[ m_nFakeCmdLineArgs ];
++
++    osl_getExecutableFile( &aParam.pData );
++    osl_getSystemPathFromFileURL( aParam.pData, &aBin.pData );
++    rtl::OString aExec = rtl::OUStringToOString( aBin, osl_getThreadTextEncoding() );
++	m_pFreeCmdLineArgs[0] = strdup( aExec.getStr() );
++
++    // make a copy of the string list for freeing it since
++    // KApplication manipulates the pointers inside the argument vector
++    // note: KApplication bad !
++    m_pAppCmdLineArgs = new char*[ m_nFakeCmdLineArgs ];
++    for( int i = 0; i < m_nFakeCmdLineArgs; i++ )
++        m_pAppCmdLineArgs[i] = m_pFreeCmdLineArgs[i];
++
++	KCmdLineArgs::init( m_nFakeCmdLineArgs, m_pAppCmdLineArgs, kAboutData );
++	
++	m_pApplication = new VCLKDEApplication();
++	kapp->disableSessionManagement();
++	
++	Display* pDisp = QX11Info::display();
++	SalKDEDisplay *pSalDisplay = new SalKDEDisplay(pDisp);
++	
++	((VCLKDEApplication*)m_pApplication)->disp = pSalDisplay;
++
++	XSetIOErrorHandler	  ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
++	XSetErrorHandler	  ( (XErrorHandler)X11SalData::XErrorHdl );
++	
++	pInputMethod->CreateMethod( pDisp );
++	pInputMethod->AddConnectionWatch( pDisp, (void*)this );
++	pSalDisplay->SetInputMethod( pInputMethod );
++
++    PushXErrorLevel( true );
++	SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp );
++	XSync( pDisp, False );
++
++	pKbdExtension->UseExtension( ! HasXErrorOccured() );
++	PopXErrorLevel();
++
++	pSalDisplay->SetKbdExtension( pKbdExtension );
++}
++
++void KDEXLib::doStartup()
++{
++    if( ! m_bStartupDone )
++    {
++        KStartupInfo::appStarted();
++        m_bStartupDone = true;
++        #if OSL_DEBUG_LEVEL > 1
++        fprintf( stderr, "called KStartupInfo::appStarted()\n" );
++        #endif
++    }
++}
+\ No newline at end of file
+diff --git vcl/unx/kde4/KDEXLib.hxx vcl/unx/kde4/KDEXLib.hxx
+new file mode 100644
+index 0000000..09a6197
+--- /dev/null
++++ vcl/unx/kde4/KDEXLib.hxx
+@@ -0,0 +1,48 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2009 by Sun Microsystems, Inc.
++ *
++ * 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.
++ *
++ ************************************************************************/
++
++#pragma once
++
++#include <saldisp.hxx>
++
++class KDEXLib : public SalXLib
++{
++	private:
++		bool m_bStartupDone;
++		void* m_pApplication;
++		char** m_pFreeCmdLineArgs;
++		char** m_pAppCmdLineArgs;
++		int m_nFakeCmdLineArgs;
++		
++	public:
++		KDEXLib();
++				
++		virtual ~KDEXLib();
++		virtual void Init();
++			
++		void doStartup();
++};
+diff --git vcl/unx/kde4/VCLKDEApplication.cxx vcl/unx/kde4/VCLKDEApplication.cxx
+new file mode 100644
+index 0000000..ff44d1b
+--- /dev/null
++++ vcl/unx/kde4/VCLKDEApplication.cxx
+@@ -0,0 +1,52 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2009 by Sun Microsystems, Inc.
++ *
++ * 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.
++ *
++ ************************************************************************/
++
++#include "VCLKDEApplication.hxx"
++
++#define Region QtXRegion
++#include <QEvent>
++#undef Region
++
++#include "KDESalDisplay.hxx"
++
++VCLKDEApplication::VCLKDEApplication() : 
++	KApplication()
++{
++	disp = 0;
++}
++
++bool VCLKDEApplication::x11EventFilter(XEvent* event)
++{
++	//if we have a display and the display consumes the event
++	//do not process the event in qt
++	if (disp && disp->Dispatch(event) > 0)
++	{
++		return true;
++	}
++	
++	return false;
++}
+\ No newline at end of file
+diff --git vcl/unx/kde4/VCLKDEApplication.hxx vcl/unx/kde4/VCLKDEApplication.hxx
+new file mode 100644
+index 0000000..e47ecef
+--- /dev/null
++++ vcl/unx/kde4/VCLKDEApplication.hxx
+@@ -0,0 +1,53 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2009 by Sun Microsystems, Inc.
++ *
++ * 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.
++ *
++ ************************************************************************/
++
++#pragma once
++
++#define Region QtXRegion
++
++#include <QSessionManager>
++
++#include <kapplication.h>
++
++#undef Region
++
++class SalKDEDisplay;
++
++/* #i59042# override KApplications method for session management
++ * since it will interfere badly with our own.
++ */
++class VCLKDEApplication : public KApplication
++{
++    public:
++		VCLKDEApplication();
++		
++		virtual void commitData(QSessionManager&) {};
++		
++		virtual bool x11EventFilter(XEvent* event);
++		
++		SalKDEDisplay* disp;
++};
+\ No newline at end of file
+diff --git vcl/unx/kde4/main.cxx vcl/unx/kde4/main.cxx
+new file mode 100644
+index 0000000..848cd09
+--- /dev/null
++++ vcl/unx/kde4/main.cxx
+@@ -0,0 +1,83 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2009 by Sun Microsystems, Inc.
++ *
++ * 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_vcl.hxx"
++
++#define Region QtXRegion
++#include <QApplication>
++#undef Region
++
++#include "KDEData.hxx"
++#include "KDESalInstance.hxx"
++
++#if OSL_DEBUG_LEVEL > 1
++#include <stdio.h>
++#endif
++
++#include <rtl/string.hxx>
++
++/// entry point for the KDE4 VCL plugin
++extern "C" {
++	VCL_DLLPUBLIC SalInstance* create_SalInstance( oslModule )
++	{
++#if QT_VERSION < 0x040000
++		// Qt 3.x support needs >= 3.2.2 - any 4.x should be ok
++		rtl::OString aVersion( qVersion() );
++#if OSL_DEBUG_LEVEL > 1
++		fprintf( stderr, "qt version string is \"%s\"\n", aVersion.getStr() );
++#endif
++		sal_Int32 nIndex = 0, nMajor = 0, nMinor = 0, nMicro = 0;
++		nMajor = aVersion.getToken( 0, '.', nIndex ).toInt32();
++		if( nIndex > 0 )
++			nMinor = aVersion.getToken( 0, '.', nIndex ).toInt32();
++		if( nIndex > 0 )
++			nMicro = aVersion.getToken( 0, '.', nIndex ).toInt32();
++		if( nMajor != 3 || nMinor < 2 || (nMinor == 2 && nMicro < 2) )
++		{
++#if OSL_DEBUG_LEVEL > 1
++			fprintf( stderr, "unsuitable qt version %d.%d.%d\n", nMajor, nMinor, nMicro );
++#endif
++			return NULL;
++		}
++#endif
++		
++		KDESalInstance* pInstance = new KDESalInstance( new SalYieldMutex() );
++#if OSL_DEBUG_LEVEL > 1
++		fprintf( stderr, "created KDESalInstance 0x%p\n", pInstance );
++#endif
++		
++		// initialize SalData
++		KDEData *salData = new KDEData();
++		SetSalData(salData);
++		salData->m_pInstance = pInstance;
++		salData->Init();
++		salData->initNWF();
++
++		return pInstance;
++	}
++}
+diff --git vcl/unx/kde4/makefile.mk vcl/unx/kde4/makefile.mk
+new file mode 100644
+index 0000000..102e268
+--- /dev/null
++++ vcl/unx/kde4/makefile.mk
+@@ -0,0 +1,92 @@
++#*************************************************************************
++#
++# 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=vcl
++TARGET=kde4plug
++.INCLUDE :  $(PRJ)$/util$/makefile.pmk
++
++# workaround for makedepend hang
++MKDEPENDSOLVER=
++
++# --- Settings -----------------------------------------------------
++
++.INCLUDE :  settings.mk
++.INCLUDE :  $(PRJ)$/util$/makefile2.pmk
++
++# For some of the included external KDE headers, GCC complains about shadowed
++# symbols in instantiated template code only at the end of a compilation unit,
++# so the only solution is to disable that warning here:
++.IF "$(COM)" == "GCC"
++CFLAGSCXX+=-Wno-shadow
++.ENDIF
++
++# --- Files --------------------------------------------------------
++
++.IF "$(GUIBASE)"!="unx"
++
++dummy:
++	@echo "Nothing to build for GUIBASE $(GUIBASE)"
++
++.ELSE		# "$(GUIBASE)"!="unx"
++
++.IF "$(ENABLE_KDE4)" != ""
++
++CFLAGS+=$(KDE4_CFLAGS)
++
++.IF "$(ENABLE_RANDR)" != ""
++CDEFS+=-DUSE_RANDR
++.ENDIF
++
++SLOFILES=\
++	$(SLO)$/main.obj \
++	$(SLO)$/VCLKDEApplication.obj \
++	$(SLO)$/KDEXLib.obj \
++	$(SLO)$/KDESalDisplay.obj \
++	$(SLO)$/KDESalFrame.obj \
++	$(SLO)$/KDESalGraphics.obj \
++	$(SLO)$/KDESalInstance.obj \
++	$(SLO)$/KDEData.obj
++	
++
++.ELSE # "$(ENABLE_KDE4)" != ""
++
++dummy:
++	@echo KDE disabled - nothing to build
++.ENDIF
++.ENDIF		# "$(GUIBASE)"!="unx"
++
++# --- Targets ------------------------------------------------------
++
++.INCLUDE :  target.mk
++
++.INCLUDE :  $(PRJ)$/util$/target.pmk
diff --git a/patches/dev300/kde4-vcl.diff b/patches/dev300/kde4-vcl.diff
deleted file mode 100644
index 4a1bf03..0000000
--- a/patches/dev300/kde4-vcl.diff
+++ /dev/null
@@ -1,1933 +0,0 @@
-diff --git vcl/unx/kde4/kde4data.cxx vcl/unx/kde4/kde4data.cxx
-new file mode 100644
-index 0000000..bfc0d2c
---- /dev/null
-+++ vcl/unx/kde4/kde4data.cxx
-@@ -0,0 +1,291 @@
-+/*************************************************************************
-+ *
-+ * 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: kde4data.cxx,v $
-+ * $Revision: 1.21 $
-+ *
-+ * 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_vcl.hxx"
-+
-+#define _SV_SALDATA_CXX
-+#include "kde4_headers.h"
-+
-+#include <unistd.h>
-+#include <fcntl.h>
-+
-+#include <stdio.h>
-+#include <string.h>
-+#include <stdlib.h>
-+#include <limits.h>
-+#include <errno.h>
-+#include <poll.h>
-+#ifdef FREEBSD
-+#include <sys/types.h>
-+#include <sys/time.h>
-+#include <unistd.h>
-+#endif
-+#include <plugins/kde4/kde4data.hxx>
-+#include <osl/thread.h>
-+#include <osl/process.h>
-+#include <osl/module.h>
-+
-+#include <tools/debug.hxx>
-+#include "i18n_im.hxx"
-+#include "i18n_xkb.hxx"
-+#include <vos/process.hxx>
-+#ifndef _VOS_MUTEX_HXX
-+#include <vos/mutex.hxx>
-+#endif
-+
-+/* #i59042# override KApplications method for session management
-+ * since it will interfere badly with our own.
-+ */
-+class VCLKDEApplication : public KApplication
-+{
-+    public:
-+		VCLKDEApplication() : 
-+			KApplication()
-+		{
-+			disp = 0;
-+		}
-+		
-+		virtual void commitData(QSessionManager &sm);
-+		
-+		virtual bool x11EventFilter(XEvent* event);
-+		
-+		SalKDEDisplay* disp;
-+};
-+
-+void VCLKDEApplication::commitData(QSessionManager&)
-+{
-+}
-+
-+bool VCLKDEApplication::x11EventFilter(XEvent* event)
-+{	
-+	//if we have a display and the display consumes the event
-+	//do not process the event in qt
-+	if (disp && disp->Dispatch(event) > 0)
-+	{
-+		return true;
-+	}
-+	
-+	return false;
-+}
-+
-+/***************************************************************************
-+ * class SalKDEDisplay                                                     *
-+ ***************************************************************************/
-+
-+SalKDEDisplay::SalKDEDisplay( Display* pDisp )
-+    : SalX11Display( pDisp )
-+{
-+}
-+
-+SalKDEDisplay::~SalKDEDisplay()
-+{
-+    // in case never a frame opened
-+    static_cast<KDEXLib*>(GetXLib())->doStartup();
-+    // clean up own members
-+    doDestruct();
-+    // prevent SalDisplay from closing KApplication's display
-+    pDisp_ = NULL;
-+}
-+
-+/***************************************************************************
-+ * class KDEXLib                                                           *
-+ ***************************************************************************/
-+
-+KDEXLib::~KDEXLib()
-+{
-+	delete (VCLKDEApplication*)m_pApplication;
-+	
-+    // free the faked cmdline arguments no longer needed by KApplication
-+    for( int i = 0; i < m_nFakeCmdLineArgs; i++ )
-+	{
-+        free( m_pFreeCmdLineArgs[i] );
-+	}
-+	
-+    delete [] m_pFreeCmdLineArgs;
-+    delete [] m_pAppCmdLineArgs;
-+}
-+
-+void KDEXLib::Init()
-+{
-+	SalI18N_InputMethod* pInputMethod = new SalI18N_InputMethod;
-+	pInputMethod->SetLocale();
-+	XrmInitialize();
-+
-+	KAboutData *kAboutData = new KAboutData( "OpenOffice.org",
-+			"OpenOffice.org",
-+			ki18n( "OpenOffice.org" ),
-+			"3.0.0",
-+			ki18n( "OpenOffice.org with KDE Native Widget Support." ),
-+			KAboutData::License_LGPL,
-+			ki18n( "Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008 Novell, Inc"),
-+			ki18n( "OpenOffice.org is an office suite.\n" ),
-+			"http://kde.openoffice.org/index.html",
-+			"dev at kde.openoffice.org" );
-+	kAboutData->addAuthor( ki18n( "Jan Holesovsky" ),
-+			ki18n( "Original author and maintainer of the KDE NWF." ),
-+			"kendy at artax.karlin.mff.cuni.cz",
-+			"http://artax.karlin.mff.cuni.cz/~kendy" );
-+	kAboutData->addAuthor( ki18n("Eric Bischoff"),
-+			ki18n( "Accessibility fixes, porting to KDE 4." ),
-+			"bischoff at kde.org" );
-+
-+    m_nFakeCmdLineArgs = 1;
-+	USHORT nIdx;
-+	vos::OExtCommandLine aCommandLine;
-+	int nParams = aCommandLine.getCommandArgCount();
-+	rtl::OString aDisplay;
-+	rtl::OUString aParam, aBin;
-+
-+	for ( nIdx = 0; nIdx < nParams; ++nIdx ) 
-+	{
-+		aCommandLine.getCommandArg( nIdx, aParam );
-+		if ( !m_pFreeCmdLineArgs && aParam.equalsAscii( "-display" ) && nIdx + 1 < nParams )
-+		{
-+			aCommandLine.getCommandArg( nIdx + 1, aParam );
-+			aDisplay = rtl::OUStringToOString( aParam, osl_getThreadTextEncoding() );
-+
-+			m_nFakeCmdLineArgs = 3;
-+			m_pFreeCmdLineArgs = new char*[ m_nFakeCmdLineArgs ];
-+			m_pFreeCmdLineArgs[ 1 ] = strdup( "-display" );
-+			m_pFreeCmdLineArgs[ 2 ] = strdup( aDisplay.getStr() );
-+		}
-+	}
-+	if ( !m_pFreeCmdLineArgs )
-+		m_pFreeCmdLineArgs = new char*[ m_nFakeCmdLineArgs ];
-+
-+    osl_getExecutableFile( &aParam.pData );
-+    osl_getSystemPathFromFileURL( aParam.pData, &aBin.pData );
-+    rtl::OString aExec = rtl::OUStringToOString( aBin, osl_getThreadTextEncoding() );
-+	m_pFreeCmdLineArgs[0] = strdup( aExec.getStr() );
-+
-+    // make a copy of the string list for freeing it since
-+    // KApplication manipulates the pointers inside the argument vector
-+    // note: KApplication bad !
-+    m_pAppCmdLineArgs = new char*[ m_nFakeCmdLineArgs ];
-+    for( int i = 0; i < m_nFakeCmdLineArgs; i++ )
-+        m_pAppCmdLineArgs[i] = m_pFreeCmdLineArgs[i];
-+
-+	KCmdLineArgs::init( m_nFakeCmdLineArgs, m_pAppCmdLineArgs, kAboutData );
-+	
-+	m_pApplication = new VCLKDEApplication();
-+	kapp->disableSessionManagement();
-+	
-+	Display* pDisp = QX11Info::display();
-+	SalKDEDisplay *pSalDisplay = new SalKDEDisplay(pDisp);
-+	
-+	((VCLKDEApplication*)m_pApplication)->disp = pSalDisplay;
-+
-+	XSetIOErrorHandler	  ( (XIOErrorHandler)X11SalData::XIOErrorHdl );
-+	XSetErrorHandler	  ( (XErrorHandler)X11SalData::XErrorHdl );
-+	
-+	pInputMethod->CreateMethod( pDisp );
-+	pInputMethod->AddConnectionWatch( pDisp, (void*)this );
-+	pSalDisplay->SetInputMethod( pInputMethod );
-+
-+    PushXErrorLevel( true );
-+	SalI18N_KeyboardExtension *pKbdExtension = new SalI18N_KeyboardExtension( pDisp );
-+	XSync( pDisp, False );
-+
-+	pKbdExtension->UseExtension( ! HasXErrorOccured() );
-+	PopXErrorLevel();
-+
-+	pSalDisplay->SetKbdExtension( pKbdExtension );
-+}
-+
-+void KDEXLib::doStartup()
-+{
-+    if( ! m_bStartupDone )
-+    {
-+        KStartupInfo::appStarted();
-+        m_bStartupDone = true;
-+        #if OSL_DEBUG_LEVEL > 1
-+        fprintf( stderr, "called KStartupInfo::appStarted()\n" );
-+        #endif
-+    }
-+}
-+
-+/**********************************************************************
-+ * class KDEData                                                      *
-+ **********************************************************************/
-+
-+KDEData::~KDEData()
-+{
-+}
-+
-+void KDEData::Init()
-+{
-+    pXLib_ = new KDEXLib();
-+    pXLib_->Init();
-+}
-+
-+/**********************************************************************
-+ * plugin entry point                                                 *
-+ **********************************************************************/
-+
-+extern "C" {
-+    VCL_DLLPUBLIC SalInstance* create_SalInstance( oslModule )
-+    {
-+#if QT_VERSION < 0x040000
-+	// Qt 3.x support needs >= 3.2.2 - any 4.x should be ok
-+        rtl::OString aVersion( qVersion() );
-+#if OSL_DEBUG_LEVEL > 1
-+        fprintf( stderr, "qt version string is \"%s\"\n", aVersion.getStr() );
-+#endif
-+        sal_Int32 nIndex = 0, nMajor = 0, nMinor = 0, nMicro = 0;
-+        nMajor = aVersion.getToken( 0, '.', nIndex ).toInt32();
-+        if( nIndex > 0 )
-+            nMinor = aVersion.getToken( 0, '.', nIndex ).toInt32();
-+        if( nIndex > 0 )
-+            nMicro = aVersion.getToken( 0, '.', nIndex ).toInt32();
-+        if( nMajor != 3 || nMinor < 2 || (nMinor == 2 && nMicro < 2) )
-+        {
-+#if OSL_DEBUG_LEVEL > 1
-+            fprintf( stderr, "unsuitable qt version %d.%d.%d\n", nMajor, nMinor, nMicro );
-+#endif
-+            return NULL;
-+        }
-+#endif
-+        
-+        KDESalInstance* pInstance = new KDESalInstance( new SalYieldMutex() );
-+#if OSL_DEBUG_LEVEL > 1
-+        fprintf( stderr, "created KDESalInstance 0x%p\n", pInstance );
-+#endif
-+
-+        // initialize SalData
-+        KDEData *pSalData = new KDEData();
-+        SetSalData( pSalData );
-+        pSalData->m_pInstance = pInstance;
-+        pSalData->Init();
-+        pSalData->initNWF();
-+
-+        return pInstance;
-+    }
-+}
-diff --git vcl/unx/kde4/makefile.mk vcl/unx/kde4/makefile.mk
-new file mode 100644
-index 0000000..fe78901
---- /dev/null
-+++ vcl/unx/kde4/makefile.mk
-@@ -0,0 +1,85 @@
-+#*************************************************************************
-+#
-+# 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=vcl
-+TARGET=kde4plug
-+.INCLUDE :  $(PRJ)$/util$/makefile.pmk
-+
-+# workaround for makedepend hang
-+MKDEPENDSOLVER=
-+
-+# --- Settings -----------------------------------------------------
-+
-+.INCLUDE :  settings.mk
-+.INCLUDE :  $(PRJ)$/util$/makefile2.pmk
-+
-+# For some of the included external KDE headers, GCC complains about shadowed
-+# symbols in instantiated template code only at the end of a compilation unit,
-+# so the only solution is to disable that warning here:
-+.IF "$(COM)" == "GCC"
-+CFLAGSCXX+=-Wno-shadow
-+.ENDIF
-+
-+# --- Files --------------------------------------------------------
-+
-+.IF "$(GUIBASE)"!="unx"
-+
-+dummy:
-+	@echo "Nothing to build for GUIBASE $(GUIBASE)"
-+
-+.ELSE		# "$(GUIBASE)"!="unx"
-+
-+.IF "$(ENABLE_KDE4)" != ""
-+
-+CFLAGS+=$(KDE4_CFLAGS)
-+
-+.IF "$(ENABLE_RANDR)" != ""
-+CDEFS+=-DUSE_RANDR
-+.ENDIF
-+
-+SLOFILES=\
-+	$(SLO)$/kde4data.obj	\
-+	$(SLO)$/salnativewidgets-kde4.obj
-+
-+.ELSE # "$(ENABLE_KDE4)" != ""
-+
-+dummy:
-+	@echo KDE disabled - nothing to build
-+.ENDIF
-+.ENDIF		# "$(GUIBASE)"!="unx"
-+
-+# --- Targets ------------------------------------------------------
-+
-+.INCLUDE :  target.mk
-+
-+.INCLUDE :  $(PRJ)$/util$/target.pmk
-diff --git vcl/unx/kde4/salnativewidgets-kde4.cxx vcl/unx/kde4/salnativewidgets-kde4.cxx
-new file mode 100644
-index 0000000..ac91b21
---- /dev/null
-+++ vcl/unx/kde4/salnativewidgets-kde4.cxx
-@@ -0,0 +1,1261 @@
-+/*************************************************************************
-+ *
-+ * 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: salnativewidgets-kde4.cxx,v $
-+ * $Revision: 1.26.86.1 $
-+ *
-+ * 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_vcl.hxx"
-+
-+#define _SV_SALNATIVEWIDGETS_KDE_CXX
-+#include "kde4_headers.h"
-+
-+#include <salunx.h>
-+#include <saldata.hxx>
-+#include <saldisp.hxx>
-+
-+#ifndef _SV_SALGDI_HXX
-+#include <salgdi.h>
-+#endif
-+
-+#ifndef _SV_SALGDI_HXX
-+#include <salframe.h>
-+#endif
-+#include <vcl/settings.hxx>
-+#include <rtl/ustrbuf.hxx>
-+#include <plugins/kde4/kde4data.hxx>
-+#include <iostream>
-+
-+#include <pspgraphics.h>
-+
-+using namespace ::rtl;
-+
-+/** 
-+  Conversion function between VCL ControlState together with
-+  ImplControlValue and Qt state flags.
-+  @param nControlState State of the widget (default, focused, ...) in Native Widget Framework.
-+  @param aValue Value held by the widget (on, off, ...)
-+*/
-+QStyle::State vclStateValue2StateFlag( ControlState nControlState,
-+	const ImplControlValue& aValue )
-+{
-+    QStyle::State nState =
-+		( (nControlState & CTRL_STATE_DEFAULT)?  QStyle::State_None:      QStyle::State_None ) |
-+		( (nControlState & CTRL_STATE_ENABLED)?  QStyle::State_Enabled:   QStyle::State_None ) |
-+		( (nControlState & CTRL_STATE_FOCUSED)?  QStyle::State_HasFocus:  QStyle::State_None ) |
-+		( (nControlState & CTRL_STATE_PRESSED)?  QStyle::State_Sunken:    QStyle::State_None ) |
-+		( (nControlState & CTRL_STATE_SELECTED)? QStyle::State_Selected : QStyle::State_None ) |
-+		( (nControlState & CTRL_STATE_ROLLOVER)? QStyle::State_MouseOver: QStyle::State_None );
-+		//TODO ( (nControlState & CTRL_STATE_HIDDEN)?   QStyle::State_:   QStyle::State_None ) |
-+
-+    switch ( aValue.getTristateVal() )
-+    {
-+		case BUTTONVALUE_ON:    nState |= QStyle::State_On;       break;
-+		case BUTTONVALUE_OFF:   nState |= QStyle::State_Off;      break;
-+		case BUTTONVALUE_MIXED: nState |= QStyle::State_NoChange; break;
-+		default: break;
-+    }
-+
-+    return nState;
-+}
-+
-+/** 
-+ Convert VCL Region to QRect.
-+ @param rControlRegion The region to convert.
-+ @return The bounding box of the region.
-+*/
-+QRect region2QRect( const Region& rControlRegion )
-+{
-+    Rectangle aRect = rControlRegion.GetBoundRect();
-+
-+    return QRect( QPoint( aRect.Left(), aRect.Top() ),
-+		  QPoint( aRect.Right(), aRect.Bottom() ) );
-+}
-+
-+/** handles graphics drawings requests and performs the needed drawing operations */
-+class KDESalGraphics : public X11SalGraphics
-+{
-+	public:
-+		KDESalGraphics() {}
-+		virtual ~KDESalGraphics() {}
-+		
-+		/**
-+			What widgets can be drawn the native way.
-+			@param type Type of the widget.
-+			@param part Specification of the widget's part if it consists of more than one.
-+			@return true if the platform supports native drawing of the widget type defined by part.
-+		*/
-+		virtual BOOL IsNativeControlSupported( ControlType type, ControlPart part );
-+		
-+		virtual BOOL hitTestNativeControl( ControlType type, ControlPart part,
-+										const Region& rControlRegion, const Point& aPos,
-+										SalControlHandle& rControlHandle, BOOL& rIsInside );
-+										
-+		virtual BOOL drawNativeControl( ControlType type, ControlPart part,
-+										const Region& rControlRegion, ControlState nControlState,
-+										const ImplControlValue& aValue, SalControlHandle& rControlHandle,
-+										const OUString& aCaption );
-+										
-+		
-+		/** Draw text on the widget.
-+			OPTIONAL. Draws the requested text for the control described by part/nControlState.
-+			Used if text is not drawn by DrawNativeControl().
-+		
-+			@param rControlRegion The bounding region of the complete control in VCL frame coordinates.
-+			@param aValue An optional value (tristate/numerical/string)
-+			@param rControlHandle Carries platform dependent data and is maintained by the SalFrame implementation.
-+			@param aCaption	A caption or title string (like button text etc.)
-+		*/
-+		virtual BOOL drawNativeControlText( ControlType type, ControlPart part,
-+											const Region& rControlRegion, ControlState nControlState,
-+											const ImplControlValue& aValue, SalControlHandle& rControlHandle,
-+											const OUString& aCaption ) { return false; }
-+											
-+		virtual BOOL getNativeControlRegion( ControlType type, ControlPart part,
-+											const Region& rControlRegion, ControlState nControlState,
-+											const ImplControlValue& aValue, SalControlHandle& rControlHandle,
-+											const OUString& aCaption,
-+											Region &rNativeBoundingRegion, Region &rNativeContentRegion );
-+};
-+
-+BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart part )
-+{
-+	if (type == CTRL_PUSHBUTTON) return true;
-+	
-+	if (type == CTRL_MENUBAR) return true;
-+	
-+	if (type == CTRL_MENU_POPUP) return true;
-+	
-+	//if ((type == CTRL_MENU_POPUP) && ((part == PART_MENU_ITEM) || (part == PART_ENTIRE_CONTROL))) return true;
-+
-+	if (type == CTRL_EDITBOX) return true;
-+	
-+	if (type == CTRL_COMBOBOX) return true;
-+	
-+	if (type == CTRL_TOOLBAR) return true;
-+	
-+	if (type == CTRL_CHECKBOX) return true;
-+	
-+	if (type == CTRL_LISTBOX) return true;
-+	
-+	if (type == CTRL_LISTNODE) return true;
-+	
-+	if (type == CTRL_FRAME) return true;
-+	
-+	if (type == CTRL_SCROLLBAR) return true;
-+	
-+	if (type == CTRL_WINDOW_BACKGROUND) return true;
-+	
-+	if (type == CTRL_SPINBOX) return true;
-+	
-+	if (type == CTRL_SPINBUTTONS) return true;
-+	
-+	if (type == CTRL_GROUPBOX) return true;
-+	
-+	if (type == CTRL_FIXEDLINE) return true;
-+	
-+	if (type == CTRL_FIXEDBORDER) return true;
-+	
-+	if (type == CTRL_TOOLTIP) return true;
-+	
-+	if (type == CTRL_RADIOBUTTON) return true;
-+	
-+	return false;
-+	
-+	if ( (type == CTRL_TAB_ITEM) && (part == PART_ENTIRE_CONTROL) ) return true;
-+	if ( (type == CTRL_TAB_PANE) && (part == PART_ENTIRE_CONTROL) ) return true;
-+	// no CTRL_TAB_BODY for KDE
-+	if ( (type == CTRL_PROGRESS)    && (part == PART_ENTIRE_CONTROL) ) return true;
-+		
-+	return false;
-+}
-+
-+
-+/** Test whether the position is in the native widget.
-+
-+    If the return value is TRUE, bIsInside contains information whether
-+    aPos was or was not inside the native widget specified by the
-+    type/part combination.
-+*/
-+BOOL KDESalGraphics::hitTestNativeControl( ControlType type, ControlPart part,
-+										   const Region& rControlRegion, const Point& rPos,
-+										   SalControlHandle&, BOOL& rIsInside )
-+{
-+    return FALSE;
-+}
-+
-+
-+/** Draw the requested control described by part/nControlState.
-+ 
-+    @param rControlRegion
-+    The bounding region of the complete control in VCL frame coordinates.
-+    
-+    @param aValue
-+    An optional value (tristate/numerical/string).
-+    
-+    @param rControlHandle
-+    Carries platform dependent data and is maintained by the SalFrame implementation.
-+    
-+    @param aCaption
-+    A caption or title string (like button text etc.)
-+*/
-+BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
-+										const Region& rControlRegion, ControlState nControlState,
-+										const ImplControlValue& value, SalControlHandle&,
-+										const OUString& )
-+{
-+    BOOL returnVal = true;
-+
-+    Display* dpy = GetXDisplay();
-+    XLIB_Window drawable = GetDrawable();
-+    GC gc = SelectPen();
-+	
-+	QRect widgetRect = region2QRect(rControlRegion);
-+	
-+	//draw right onto the window
-+	QPixmap pixmap(widgetRect.width(), widgetRect.height());
-+	
-+	if (pixmap.isNull())
-+	{
-+		return false;
-+	}
-+	
-+	QPainter painter(&pixmap);
-+	painter.setBackgroundMode(Qt::OpaqueMode);
-+	
-+	//copy previous screen contents for proper blending
-+	QPixmap screen = QPixmap::fromX11Pixmap(drawable);
-+	painter.drawPixmap(0,0, screen, widgetRect.left(), widgetRect.top(), widgetRect.width(), widgetRect.height());
-+	
-+    if (type == CTRL_PUSHBUTTON)
-+    {
-+		QStyleOptionButton styleOption;
-+		
-+		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+		styleOption.state =vclStateValue2StateFlag( nControlState, value );
-+		
-+		kapp->style()->drawControl( QStyle::CE_PushButton, &styleOption, &painter);
-+    }
-+	else if ( (type == CTRL_MENUBAR))
-+	{
-+		if (part == PART_MENU_ITEM) 
-+		{
-+			QStyleOptionMenuItem styleOption;
-+			
-+			styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+			styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+			
-+			kapp->style()->drawControl( QStyle::CE_MenuBarItem, &styleOption, &painter);
-+		}
-+		else
-+		{
-+			pixmap.fill(KApplication::palette().color(QPalette::Window));
-+		}
-+	}
-+	else if (type == CTRL_MENU_POPUP)
-+	{		
-+		if (part == PART_MENU_ITEM)
-+		{
-+			QStyleOptionMenuItem styleOption;
-+			
-+			styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+			styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+			
-+			kapp->style()->drawControl( QStyle::CE_MenuItem, &styleOption, &painter);
-+		}
-+		else if (part == PART_MENU_ITEM_CHECK_MARK)
-+		{
-+			QStyleOptionButton styleOption;
-+			
-+			styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+			styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+			
-+			if (nControlState & CTRL_STATE_PRESSED)
-+			{
-+				kapp->style()->drawPrimitive( QStyle::PE_IndicatorMenuCheckMark, &styleOption, &painter);
-+			}
-+		}
-+		else if (part == PART_MENU_ITEM_RADIO_MARK)
-+		{
-+			QStyleOptionButton styleOption;
-+			
-+			styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+			styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+			
-+			if (nControlState & CTRL_STATE_PRESSED)
-+			{
-+				kapp->style()->drawPrimitive( QStyle::PE_IndicatorRadioButton, &styleOption, &painter);
-+			}
-+		}
-+		else
-+		{
-+			pixmap.fill(KApplication::palette().color(QPalette::Window));
-+			
-+			QStyleOptionFrameV3 styleOption;
-+		
-+			styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+			styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+			styleOption.frameShape = QFrame::StyledPanel;
-+			
-+			kapp->style()->drawPrimitive( QStyle::PE_FrameMenu, &styleOption, &painter);
-+		}
-+	}
-+	else if ( (type == CTRL_TOOLBAR) && (part == PART_BUTTON) )
-+    {
-+		QStyleOptionToolButton styleOption;
-+		
-+		styleOption.arrowType = Qt::NoArrow;
-+		styleOption.subControls = QStyle::SC_ToolButton;
-+		
-+		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+		styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+		styleOption.state |= QStyle::State_Raised | QStyle::State_Enabled | QStyle::State_AutoRaise;
-+		
-+		kapp->style()->drawComplexControl( QStyle::CC_ToolButton, &styleOption, &painter);
-+    }
-+	else if ( (type == CTRL_TOOLBAR) && (part == PART_ENTIRE_CONTROL) )
-+    {
-+		QStyleOptionToolBar styleOption;
-+		
-+		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+		styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+		
-+		kapp->style()->drawControl( QStyle::CE_ToolBar, &styleOption, &painter);
-+    }
-+	else if ( (type == CTRL_TOOLBAR) && (part == PART_THUMB_VERT) )
-+    {
-+        QStyleOption styleOption;
-+		
-+		int width = kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent);
-+		
-+		styleOption.rect = QRect(0, 0, width, widgetRect.height());
-+		styleOption.state = QStyle::State_Horizontal;
-+		
-+		kapp->style()->drawPrimitive( QStyle::PE_IndicatorToolBarHandle, &styleOption, &painter);
-+    }
-+	else if (type == CTRL_EDITBOX)
-+	{
-+		pixmap.fill(KApplication::palette().color(QPalette::Window));
-+		
-+		//TODO hover?? OO does not seem to do this for line edits
-+		
-+		QStyleOptionFrameV3 styleOption;
-+		
-+		styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+		
-+		//TODO...how does the line edit draw itself internally??
-+		styleOption.rect = QRect(2, 2, widgetRect.width()-4, widgetRect.height()-4);
-+		kapp->style()->drawPrimitive( QStyle::PE_PanelLineEdit, &styleOption, &painter);
-+		
-+		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+		kapp->style()->drawPrimitive( QStyle::PE_FrameLineEdit, &styleOption, &painter);
-+	}
-+	else if (type == CTRL_COMBOBOX)
-+	{
-+		pixmap.fill(KApplication::palette().color(QPalette::Window));
-+		
-+		QStyleOptionComboBox styleOption;
-+		
-+		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+		styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+		
-+		styleOption.editable = true;
-+		
-+		kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter);
-+	}
-+	else if (type == CTRL_LISTBOX)
-+	{
-+		QStyleOptionComboBox styleOption;
-+		
-+		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+		styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+		
-+		if (part == PART_SUB_EDIT)
-+		{
-+			kapp->style()->drawControl(QStyle::CE_ComboBoxLabel, &styleOption, &painter);
-+		}
-+		else
-+		{
-+			kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter);
-+		}
-+	}
-+	else if (type == CTRL_LISTNODE)
-+	{
-+		QStyleOption styleOption;
-+		
-+		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+		styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+		
-+		styleOption.state |= QStyle::State_Item;
-+		styleOption.state |= QStyle::State_Children;
-+		
-+		if (nControlState & CTRL_STATE_PRESSED)
-+		{
-+			styleOption.state |= QStyle::State_Open;
-+		}
-+		
-+		kapp->style()->drawPrimitive(QStyle::PE_IndicatorBranch, &styleOption, &painter);
-+	}
-+	else if (type == CTRL_CHECKBOX)
-+	{	
-+		QStyleOptionButton styleOption;
-+		
-+		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+		styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+		
-+		kapp->style()->drawControl(QStyle::CE_CheckBox, &styleOption, &painter);
-+	}
-+	else if (type == CTRL_SCROLLBAR)
-+	{
-+		pixmap.fill(KApplication::palette().color(QPalette::Window));
-+		
-+		if ((part == PART_DRAW_BACKGROUND_VERT) || (part == PART_DRAW_BACKGROUND_HORZ))
-+		{
-+			ScrollbarValue* sbVal = static_cast<ScrollbarValue *> ( value.getOptionalVal() );
-+			
-+			QStyleOptionSlider styleOption;
-+			styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+			
-+			//if the scroll bar is active (aka not degenrate...allow for hover events
-+			if (sbVal->mnVisibleSize < sbVal->mnMax)
-+			{
-+				styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+				styleOption.state |= QStyle::State_MouseOver;
-+			}
-+			
-+			//horizontal or vertical
-+			if (part == PART_DRAW_BACKGROUND_VERT)
-+			{
-+				styleOption.orientation = Qt::Vertical;
-+			}
-+			else
-+			{
-+				styleOption.state |= QStyle::State_Horizontal;
-+			}
-+			
-+			//setup parameters from the OO values
-+			styleOption.minimum = sbVal->mnMin;
-+			styleOption.maximum = sbVal->mnMax - sbVal->mnVisibleSize;
-+			styleOption.sliderValue = sbVal->mnCur;
-+			styleOption.sliderPosition = sbVal->mnCur;
-+			styleOption.pageStep = sbVal->mnVisibleSize;
-+			
-+			//setup the active control...always the slider
-+			if (sbVal->mnThumbState & CTRL_STATE_ROLLOVER)
-+			{
-+				styleOption.activeSubControls = QStyle::SC_ScrollBarSlider;
-+			}
-+			
-+			kapp->style()->drawComplexControl(QStyle::CC_ScrollBar, &styleOption, &painter);
-+		}
-+	}
-+	else if (type == CTRL_SPINBOX)
-+	{
-+		pixmap.fill(KApplication::palette().color(QPalette::Window));
-+		//SpinbuttonValue* sbVal = static_cast<SpinbuttonValue *> ( value.getOptionalVal() );
-+		
-+		QStyleOptionSpinBox styleOption;
-+		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+		styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+		
-+		kapp->style()->drawComplexControl(QStyle::CC_SpinBox, &styleOption, &painter);
-+	}
-+	else if (type == CTRL_SPINBUTTONS)
-+	{
-+		pixmap.fill(KApplication::palette().color(QPalette::Window));
-+		
-+		QStyleOptionSpinBox styleOption;
-+		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+		styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+		
-+		styleOption.subControls = QStyle::SC_SpinBoxUp | QStyle::SC_SpinBoxDown;
-+		
-+		kapp->style()->drawComplexControl(QStyle::CC_SpinBox, &styleOption, &painter);
-+	}
-+	else if (type == CTRL_GROUPBOX)
-+	{
-+		QStyleOptionGroupBox styleOption;
-+		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+		styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+		
-+		kapp->style()->drawComplexControl(QStyle::CC_GroupBox, &styleOption, &painter);
-+	}
-+	else if (type == CTRL_RADIOBUTTON)
-+	{
-+		QStyleOptionButton styleOption;
-+		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+		styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+		
-+		kapp->style()->drawControl(QStyle::CE_RadioButton, &styleOption, &painter);
-+	}
-+	else if (type == CTRL_TOOLTIP)
-+	{
-+		QStyleOption styleOption;
-+		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+		styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+		
-+		kapp->style()->drawPrimitive(QStyle::PE_PanelTipLabel, &styleOption, &painter);
-+	}
-+	else if (type == CTRL_FRAME)
-+	{
-+		QStyleOptionFrameV3 styleOption;
-+		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+		styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+		styleOption.frameShape = QFrame::StyledPanel;
-+		
-+		kapp->style()->drawPrimitive(QStyle::PE_FrameWindow, &styleOption, &painter);
-+	}
-+	else if (type == CTRL_FIXEDBORDER)
-+	{
-+		QStyleOptionFrameV3 styleOption;
-+		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+		styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+		styleOption.frameShape = QFrame::StyledPanel;
-+		
-+		kapp->style()->drawPrimitive(QStyle::PE_FrameWindow, &styleOption, &painter);
-+	}
-+	else if (type == CTRL_WINDOW_BACKGROUND)
-+	{
-+		pixmap.fill(KApplication::palette().color(QPalette::Window));	
-+	}
-+	else if (type == CTRL_FIXEDLINE)
-+	{
-+		QStyleOptionMenuItem styleOption;
-+			
-+		styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
-+		styleOption.state = vclStateValue2StateFlag( nControlState, value );
-+		styleOption.menuItemType = QStyleOptionMenuItem::Separator;
-+		styleOption.state |= QStyle::State_Item;
-+		
-+		kapp->style()->drawControl( QStyle::CE_MenuItem, &styleOption, &painter);
-+	}
-+	else
-+	{
-+		returnVal = false;
-+	}
-+	
-+	if (returnVal)
-+	{
-+		X11SalGraphics::CopyScreenArea( dpy,
-+			pixmap.handle(), pixmap.x11Info().screen(), pixmap.x11Info().depth(),
-+			drawable, GetScreenNumber(), GetVisual().GetDepth(), gc,
-+			0, 0, widgetRect.width(), widgetRect.height(), widgetRect.left(), widgetRect.top() );
-+	}
-+	
-+	#if 0
-+    else if ( (type == CTRL_RADIOBUTTON) && (part == PART_ENTIRE_CONTROL) )
-+    {
-+		bReturn = pWidgetPainter->drawStyledWidget(
-+			pWidgetPainter->radioButton( rControlRegion ),
-+			nControlState, aValue,
-+			dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
-+    }
-+    else if ( (type==CTRL_TAB_ITEM) && (part == PART_ENTIRE_CONTROL) )
-+    {
-+		bReturn = pWidgetPainter->drawStyledWidget(
-+			pWidgetPainter->tabBar( rControlRegion ),
-+			nControlState, aValue,
-+			dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
-+    }
-+    else if ( (type==CTRL_TAB_PANE) && (part == PART_ENTIRE_CONTROL) )
-+    {
-+		bReturn = pWidgetPainter->drawStyledWidget(
-+			pWidgetPainter->tabWidget( rControlRegion ),
-+			nControlState, aValue,
-+			dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
-+    }
-+    else if ( (type == CTRL_PROGRESS) && (part == PART_ENTIRE_CONTROL) )
-+    {
-+        bReturn = pWidgetPainter->drawStyledWidget(
-+            pWidgetPainter->progressBar( rControlRegion ),
-+            nControlState, aValue,
-+            dpy, drawable, GetScreenNumber(), GetVisual().GetDepth(), gc );
-+    }
-+	#endif
-+
-+    return returnVal;
-+}
-+
-+
-+
-+/** Check if the bounding regions match.
-+
-+    If the return value is TRUE, rNativeBoundingRegion
-+    contains the true bounding region covered by the control
-+    including any adornment, while rNativeContentRegion contains the area
-+    within the control that can be safely drawn into without drawing over
-+    the borders of the control.
-+
-+    @param rControlRegion
-+    The bounding region of the control in VCL frame coordinates.
-+    
-+    @param aValue
-+    An optional value (tristate/numerical/string)
-+    
-+    @param rControlHandle
-+    Carries platform dependent data and is maintained by the SalFrame implementation.
-+    
-+    @param aCaption
-+    A caption or title string (like button text etc.)
-+*/
-+BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
-+											 const Region& controlRegion, ControlState controlState,
-+											 const ImplControlValue& val, SalControlHandle&,
-+											 const OUString&,
-+											 Region &nativeBoundingRegion, Region &nativeContentRegion )
-+{
-+    bool retVal = false;
-+	
-+    QRect boundingRect = region2QRect( controlRegion );
-+    QRect contentRect = boundingRect;
-+    QStyleOptionComplex styleOption;
-+	
-+    switch ( type )
-+    {
-+		// Metrics of the push button
-+		case CTRL_PUSHBUTTON:
-+			if (part == PART_ENTIRE_CONTROL)
-+			{
-+				styleOption.state = vclStateValue2StateFlag(controlState, val);
-+
-+				if ( controlState & CTRL_STATE_DEFAULT )
-+				{
-+					int size = kapp->style()->pixelMetric(
-+						QStyle::PM_ButtonDefaultIndicator, &styleOption );
-+					
-+					boundingRect.adjust( -size, -size, size, size );
-+					
-+					retVal = true;
-+				}
-+			}
-+			break;
-+		case CTRL_EDITBOX:
-+		{
-+			styleOption.rect = QRect(0, 0, contentRect.width(), contentRect.height());
-+			styleOption.state = vclStateValue2StateFlag(controlState, val);
-+
-+			int size = kapp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) - 1;
-+			
-+			contentRect.adjust( -size, -size, size, size);
-+			boundingRect = contentRect;
-+			
-+			retVal = true;
-+			
-+			break;
-+		}
-+		case CTRL_CHECKBOX:
-+			if (part == PART_ENTIRE_CONTROL)
-+			{
-+				styleOption.state = vclStateValue2StateFlag(controlState, val);
-+						
-+				contentRect.setWidth(kapp->style()->pixelMetric(
-+					QStyle::PM_IndicatorWidth, &styleOption));
-+				contentRect.setHeight(kapp->style()->pixelMetric(
-+					QStyle::PM_IndicatorHeight, &styleOption) + 5);
-+					
-+				contentRect.adjust(0, 10, 0, 0);
-+				
-+				boundingRect = contentRect;
-+					
-+				retVal = true;
-+				
-+				break;
-+			}
-+		case CTRL_COMBOBOX:
-+		case CTRL_LISTBOX:
-+		{
-+			QStyleOptionComboBox cbo;
-+			
-+			cbo.rect = QRect(0, 0, contentRect.width(), contentRect.height());
-+			cbo.state = vclStateValue2StateFlag(controlState, val);
-+			
-+			switch ( part )
-+			{
-+				case PART_ENTIRE_CONTROL:
-+				{
-+					int size = kapp->style()->pixelMetric(QStyle::PM_ComboBoxFrameWidth) - 2;
-+					contentRect.adjust(-size,-size,size,size);
-+					retVal = true;
-+					break;
-+				}
-+				case PART_BUTTON_DOWN:
-+					//the entire control can be used as the "down" button
-+					retVal = true;
-+					break;
-+				case PART_SUB_EDIT:
-+					contentRect = kapp->style()->subControlRect(
-+						QStyle::CC_ComboBox, &cbo, QStyle::SC_ComboBoxEditField );
-+						
-+					contentRect.translate( boundingRect.left(), boundingRect.top() );
-+					
-+					retVal = true;
-+					break;
-+			}
-+			break;
-+		}
-+		case CTRL_SPINBOX:
-+		{
-+			QStyleOptionSpinBox sbo;
-+
-+			sbo.rect = QRect(0, 0, contentRect.width(), contentRect.height());
-+			sbo.state = vclStateValue2StateFlag(controlState, val);
-+			
-+			switch ( part )
-+			{
-+				case PART_BUTTON_UP:
-+					contentRect = kapp->style()->subControlRect(
-+						QStyle::CC_SpinBox, &sbo, QStyle::SC_SpinBoxUp );
-+					contentRect.translate( boundingRect.left(), boundingRect.top() );
-+					retVal = true;
-+					boundingRect = QRect();
-+					break;
-+				
-+				case PART_BUTTON_DOWN:
-+					contentRect = kapp->style()->subControlRect(
-+						QStyle::CC_SpinBox, &sbo, QStyle::SC_SpinBoxDown );
-+					retVal = true;
-+					contentRect.translate( boundingRect.left(), boundingRect.top() );
-+					boundingRect = QRect();
-+					break;
-+
-+				case PART_SUB_EDIT:
-+					contentRect = kapp->style()->subControlRect(
-+						QStyle::CC_SpinBox, &sbo, QStyle::SC_SpinBoxEditField );
-+					retVal = true;
-+					contentRect.translate( boundingRect.left(), boundingRect.top() );
-+					break;
-+				default:
-+					retVal = true;
-+			}
-+			break;
-+		}
-+		case CTRL_MENU_POPUP:
-+			//just limit the widget of the menu items
-+			//OO isn't very flexible in all reguards with the menu
-+			//so we do the best we can
-+			if (part == PART_MENU_ITEM_CHECK_MARK)
-+			{
-+				contentRect.setWidth(contentRect.height());
-+				retVal = true;
-+			}
-+			else if (part == PART_MENU_ITEM_RADIO_MARK)
-+			{
-+				contentRect.setWidth(contentRect.height());
-+				retVal = true;
-+			}
-+			break;
-+		case CTRL_FRAME:
-+		{
-+			if (part == PART_BORDER)
-+			{
-+				int size = kapp->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
-+				//contentRect.adjust(size, size, size, size);
-+				boundingRect.adjust(-size, -size, size, size);
-+				retVal = true;
-+			}
-+			
-+			break;
-+		}
-+		case CTRL_RADIOBUTTON:
-+		{
-+			const int h = kapp->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorHeight);
-+			const int w = kapp->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth);
-+			
-+			contentRect = QRect(boundingRect.left(), boundingRect.top(), w, h);
-+			
-+			retVal = true;
-+		}
-+		default:
-+			break;
-+	}
-+#if 0
-+	
-+
-+		// Metrics of the scroll bar
-+		case CTRL_SCROLLBAR:
-+			//pWidget = pWidgetPainter->scrollBar( rControlRegion,
-+				//( part == PART_BUTTON_LEFT || part == PART_BUTTON_RIGHT ),
-+				//ImplControlValue() );
-+			//aStyleOption.initFrom( pWidget );
-+
-+			switch ( part )
-+			{
-+			case PART_BUTTON_LEFT:
-+			case PART_BUTTON_UP:
-+				qRect = kapp->style()->subControlRect(
-+					QStyle::CC_ScrollBar, &aStyleOption, QStyle::SC_ScrollBarSubLine );
-+
-+				// Workaround for Platinum style scroll bars. It makes the
-+				// left/up button invisible.
-+				if ( part == PART_BUTTON_LEFT )
-+				{
-+					if ( qRect.left() > kapp->style()->subControlRect(
-+						QStyle::CC_ScrollBar, &aStyleOption,
-+						QStyle::SC_ScrollBarSubPage ).left() )
-+					{
-+						qRect.setLeft( 0 );
-+						qRect.setRight( 0 );
-+					}
-+				}
-+				else
-+				{
-+					if ( qRect.top() > kapp->style()->subControlRect(
-+						QStyle::CC_ScrollBar, &aStyleOption,
-+						QStyle::SC_ScrollBarSubPage ).top() )
-+					{
-+						qRect.setTop( 0 );
-+						qRect.setBottom( 0 );
-+					}
-+				}
-+	
-+				qRect.translate( qBoundingRect.left(), qBoundingRect.top() );
-+
-+				bReturn = TRUE;
-+				break;
-+
-+			case PART_BUTTON_RIGHT:
-+			case PART_BUTTON_DOWN:
-+				qRect = kapp->style()->subControlRect(
-+					QStyle::CC_ScrollBar, &aStyleOption, QStyle::SC_ScrollBarAddLine );
-+
-+				// Workaround for Platinum and 3 button style scroll bars.
-+				// It makes the right/down button bigger.
-+				if ( part == PART_BUTTON_RIGHT )
-+					qRect.setLeft( kapp->style()->subControlRect(
-+						QStyle::CC_ScrollBar, &aStyleOption,
-+						QStyle::SC_ScrollBarAddPage ).right() + 1 );
-+				else
-+					qRect.setTop( kapp->style()->subControlRect(
-+						QStyle::CC_ScrollBar, &aStyleOption,
-+						QStyle::SC_ScrollBarAddPage ).bottom() + 1 );
-+
-+				qRect.translate( qBoundingRect.left(), qBoundingRect.top() );
-+
-+				bReturn = TRUE;
-+				break;
-+			}
-+			break;
-+    }
-+#endif
-+    
-+    if (retVal)
-+    {
-+		// Bounding region
-+		Point aBPoint( boundingRect.x(), boundingRect.y() );
-+		Size aBSize( boundingRect.width(), boundingRect.height() );
-+		nativeBoundingRegion = Region( Rectangle( aBPoint, aBSize ) );
-+
-+		// Region of the content
-+		Point aPoint( contentRect.x(), contentRect.y() );
-+		Size  aSize( contentRect.width(), contentRect.height() );
-+		nativeContentRegion = Region( Rectangle( aPoint, aSize ) );
-+    }
-+	
-+    return retVal;
-+}
-+
-+// -----------------------------------------------------------------------
-+// KDESalFrame implementation
-+// -----------------------------------------------------------------------
-+
-+KDESalFrame::KDESalFrame( SalFrame* pParent, ULONG nState ) :
-+    X11SalFrame( pParent, nState )
-+{
-+}
-+
-+void KDESalFrame::Show( BOOL bVisible, BOOL bNoActivate )
-+{
-+    if ( !GetParent() && ! (GetStyle() & SAL_FRAME_STYLE_INTRO) )
-+    {
-+        KDEXLib* pXLib = static_cast<KDEXLib*>(GetDisplay()->GetXLib());
-+        pXLib->doStartup();
-+    }
-+    X11SalFrame::Show( bVisible, bNoActivate );
-+}
-+
-+/** Helper function to convert colors.
-+*/
-+static Color toColor( const QColor &rColor )
-+{
-+    return Color( rColor.red(), rColor.green(), rColor.blue() );
-+}
-+
-+/** Helper function to read untranslated text entry from KConfig configuration repository.
-+*/
-+static OUString readEntryUntranslated( KConfigGroup *pGroup, const char *pKey )
-+{
-+    return OUString::createFromAscii( (const char *) pGroup->readEntryUntranslated( pKey ).toAscii() );
-+}
-+
-+/** Helper function to read color from KConfig configuration repository.
-+*/
-+static Color readColor( KConfigGroup *pGroup, const char *pKey )
-+{
-+    return toColor( pGroup->readEntry( pKey, QColor(Qt::white) ) );
-+}
-+
-+/** Helper function to add information to Font from QFont.
-+
-+    Mostly grabbed from the Gtk+ vclplug (salnativewidgets-gtk.cxx).
-+*/
-+static Font toFont( const QFont &rQFont, const ::com::sun::star::lang::Locale& rLocale )
-+{
-+    psp::FastPrintFontInfo aInfo;
-+    QFontInfo qFontInfo( rQFont );
-+    
-+    // set family name
-+    aInfo.m_aFamilyName = String( (const char *) rQFont.family().toUtf8(), RTL_TEXTENCODING_UTF8 );
-+
-+    // set italic
-+    aInfo.m_eItalic = ( qFontInfo.italic()? psp::italic::Italic: psp::italic::Upright );
-+    
-+    // set weight
-+    int nWeight = qFontInfo.weight();
-+    if ( nWeight <= QFont::Light )
-+        aInfo.m_eWeight = psp::weight::Light;
-+    else if ( nWeight <= QFont::Normal )
-+        aInfo.m_eWeight = psp::weight::Normal;
-+    else if ( nWeight <= QFont::DemiBold )
-+        aInfo.m_eWeight = psp::weight::SemiBold;
-+    else if ( nWeight <= QFont::Bold )
-+        aInfo.m_eWeight = psp::weight::Bold;
-+    else
-+        aInfo.m_eWeight = psp::weight::UltraBold;
-+    
-+    // set width
-+    int nStretch = rQFont.stretch();
-+    if ( nStretch <= QFont::UltraCondensed )
-+        aInfo.m_eWidth = psp::width::UltraCondensed;
-+    else if ( nStretch <= QFont::ExtraCondensed )
-+        aInfo.m_eWidth = psp::width::ExtraCondensed;
-+    else if ( nStretch <= QFont::Condensed )
-+        aInfo.m_eWidth = psp::width::Condensed;
-+    else if ( nStretch <= QFont::SemiCondensed )
-+        aInfo.m_eWidth = psp::width::SemiCondensed;
-+    else if ( nStretch <= QFont::Unstretched )
-+        aInfo.m_eWidth = psp::width::Normal;
-+    else if ( nStretch <= QFont::SemiExpanded )
-+        aInfo.m_eWidth = psp::width::SemiExpanded;
-+    else if ( nStretch <= QFont::Expanded )
-+        aInfo.m_eWidth = psp::width::Expanded;
-+    else if ( nStretch <= QFont::ExtraExpanded )
-+        aInfo.m_eWidth = psp::width::ExtraExpanded;
-+    else
-+        aInfo.m_eWidth = psp::width::UltraExpanded;
-+    
-+#if OSL_DEBUG_LEVEL > 1
-+    fprintf( stderr, "font name BEFORE system match: \"%s\"\n", OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
-+#endif
-+
-+    // match font to e.g. resolve "Sans"
-+    psp::PrintFontManager::get().matchFont( aInfo, rLocale );
-+
-+#if OSL_DEBUG_LEVEL > 1
-+    fprintf( stderr, "font match %s, name AFTER: \"%s\"\n",
-+             aInfo.m_nID != 0 ? "succeeded" : "failed",
-+             OUStringToOString( aInfo.m_aFamilyName, RTL_TEXTENCODING_ISO_8859_1 ).getStr() );
-+#endif
-+
-+    // font height
-+    int nPointHeight = qFontInfo.pointSize();
-+    if ( nPointHeight <= 0 )
-+        nPointHeight = rQFont.pointSize();
-+    
-+    // Create the font
-+    Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) );
-+    if( aInfo.m_eWeight != psp::weight::Unknown )
-+        aFont.SetWeight( PspGraphics::ToFontWeight( aInfo.m_eWeight ) );
-+    if( aInfo.m_eWidth != psp::width::Unknown )
-+        aFont.SetWidthType( PspGraphics::ToFontWidth( aInfo.m_eWidth ) );
-+    if( aInfo.m_eItalic != psp::italic::Unknown )
-+        aFont.SetItalic( PspGraphics::ToFontItalic( aInfo.m_eItalic ) );
-+    if( aInfo.m_ePitch != psp::pitch::Unknown )
-+        aFont.SetPitch( PspGraphics::ToFontPitch( aInfo.m_ePitch ) );
-+
-+    return aFont;
-+}
-+
-+/** Implementation of KDE integration's main method.
-+*/
-+void KDESalFrame::UpdateSettings( AllSettings& rSettings )
-+{
-+    StyleSettings style( rSettings.GetStyleSettings() );
-+	BOOL bSetTitleFont = false;
-+
-+	
-+	// General settings
-+    QPalette pal = kapp->palette();
-+	
-+	style.SetActiveColor(toColor(pal.color(QPalette::Active, QPalette::Window)));
-+	style.SetDeactiveColor(toColor(pal.color(QPalette::Inactive, QPalette::Window)));
-+	
-+	style.SetActiveColor2(toColor(pal.color(QPalette::Active, QPalette::Window)));
-+	style.SetDeactiveColor2(toColor(pal.color(QPalette::Inactive, QPalette::Window)));
-+	
-+	style.SetActiveTextColor(toColor(pal.color(QPalette::Active, QPalette::WindowText)));
-+	style.SetDeactiveTextColor(toColor(pal.color(QPalette::Inactive, QPalette::WindowText)));
-+	
-+    // WM settings
-+    KConfig *pConfig = KGlobal::config().data();
-+    if ( pConfig )
-+    {
-+        KConfigGroup aGroup = pConfig->group( "WM" );
-+        const char *pKey;
-+		
-+        pKey = "titleFont";
-+        if ( aGroup.hasKey( pKey ) )
-+        {
-+            Font aFont = toFont( aGroup.readEntry( pKey, QFont() ), rSettings.GetUILocale() );
-+            style.SetTitleFont( aFont );
-+			bSetTitleFont = true;
-+        }
-+		
-+        aGroup = pConfig->group( "Icons" );
-+
-+        pKey = "Theme";
-+        if ( aGroup.hasKey( pKey ) )
-+            style.SetPreferredSymbolsStyleName( readEntryUntranslated( &aGroup, pKey ) );
-+    }
-+	
-+    Color aFore = toColor( pal.color( QPalette::Active, QPalette::WindowText ) );
-+    Color aBack = toColor( pal.color( QPalette::Active, QPalette::Window ) );
-+    Color aText = toColor( pal.color( QPalette::Active, QPalette::Text ) );
-+    Color aBase = toColor( pal.color( QPalette::Active, QPalette::Base ) );
-+    Color aButn = toColor( pal.color( QPalette::Active, QPalette::ButtonText ) );
-+    Color aMid = toColor( pal.color( QPalette::Active, QPalette::Mid ) );
-+    Color aHigh = toColor( pal.color( QPalette::Active, QPalette::Highlight ) );
-+
-+    // Foreground
-+    style.SetRadioCheckTextColor( aFore );
-+    style.SetLabelTextColor( aFore );
-+    style.SetInfoTextColor( aFore );
-+    style.SetDialogTextColor( aFore );
-+    style.SetGroupTextColor( aFore );
-+
-+    // Text
-+    style.SetFieldTextColor( aText );
-+    style.SetFieldRolloverTextColor( aText );
-+    style.SetWindowTextColor( aText );
-+    style.SetHelpTextColor( aText );
-+
-+    // Base
-+    style.SetFieldColor( aBase );
-+    style.SetHelpColor( aBase );
-+    style.SetWindowColor( aBase );
-+    style.SetActiveTabColor( aBase );
-+    
-+    // Buttons
-+    style.SetButtonTextColor( aButn );
-+    style.SetButtonRolloverTextColor( aButn );
-+
-+    // Disable color
-+    style.SetDisableColor( aMid );
-+
-+    // Workspace
-+    style.SetWorkspaceColor( aMid );
-+
-+    // Background
-+    style.Set3DColors( aBack );
-+    style.SetFaceColor( aBack );
-+    style.SetInactiveTabColor( aBack );
-+    style.SetDialogColor( aBack );
-+	
-+    if( aBack == COL_LIGHTGRAY )
-+        style.SetCheckedColor( Color( 0xCC, 0xCC, 0xCC ) );
-+    else
-+    {
-+        Color aColor2 = style.GetLightColor();
-+        style.
-+            SetCheckedColor( Color( (BYTE)(((USHORT)aBack.GetRed()+(USHORT)aColor2.GetRed())/2),
-+                        (BYTE)(((USHORT)aBack.GetGreen()+(USHORT)aColor2.GetGreen())/2),
-+                        (BYTE)(((USHORT)aBack.GetBlue()+(USHORT)aColor2.GetBlue())/2)
-+                        ) );
-+    }
-+
-+    // Selection
-+    style.SetHighlightColor( aHigh );
-+    style.SetHighlightTextColor( toColor(pal.color( QPalette::HighlightedText))  );
-+
-+    // Font
-+    Font aFont = toFont( kapp->font(), rSettings.GetUILocale() );
-+	
-+    style.SetAppFont( aFont );
-+    style.SetHelpFont( aFont );
-+	
-+	if( !bSetTitleFont )
-+	{
-+		style.SetTitleFont( aFont );
-+	}
-+	
-+	style.SetFloatTitleFont( aFont );
-+    style.SetMenuFont( aFont ); // will be changed according to pMenuBar
-+    style.SetToolFont( aFont ); // will be changed according to pToolBar
-+    style.SetLabelFont( aFont );
-+    style.SetInfoFont( aFont );
-+    style.SetRadioCheckFont( aFont );
-+    style.SetPushButtonFont( aFont );
-+    style.SetFieldFont( aFont );
-+    style.SetIconFont( aFont );
-+    style.SetGroupFont( aFont );
-+	
-+    int flash_time = QApplication::cursorFlashTime();
-+    style.SetCursorBlinkTime( flash_time != 0 ? flash_time/2 : STYLE_CURSOR_NOBLINKTIME );
-+
-+    KMainWindow qMainWindow;
-+
-+    // Menu
-+    style.SetSkipDisabledInMenus( TRUE );
-+    KMenuBar *pMenuBar = qMainWindow.menuBar();
-+    if ( pMenuBar )
-+    {
-+        // Color
-+        QPalette qMenuCG = pMenuBar->palette();
-+        
-+        // Menu text and background color, theme specific
-+        Color aMenuFore = toColor( qMenuCG.color( QPalette::WindowText ) );
-+        Color aMenuBack = toColor( qMenuCG.color( QPalette::Window ) );
-+		
-+        aMenuFore = toColor( qMenuCG.color( QPalette::ButtonText ) );
-+        aMenuBack = toColor( qMenuCG.color( QPalette::Button ) );
-+        
-+        style.SetMenuTextColor( aMenuFore );
-+        style.SetMenuColor( aMenuBack );
-+        style.SetMenuBarColor( aMenuBack );
-+
-+        style.SetMenuHighlightColor( toColor ( qMenuCG.color( QPalette::Highlight ) ) );
-+
-+        style.SetMenuHighlightTextColor( aMenuFore );
-+        
-+        // set special menubar higlight text color
-+        if ( kapp->style()->inherits( "HighContrastStyle" ) )
-+            ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = toColor( qMenuCG.color( QPalette::HighlightedText ) );
-+        else
-+            ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor = aMenuFore;
-+
-+        // Font
-+        aFont = toFont( pMenuBar->font(), rSettings.GetUILocale() );
-+        style.SetMenuFont( aFont );
-+    }
-+
-+    // Tool bar
-+    KToolBar *pToolBar = qMainWindow.toolBar();
-+    if ( pToolBar )
-+    {
-+        aFont = toFont( pToolBar->font(), rSettings.GetUILocale() );
-+        style.SetToolFont( aFont );
-+    }
-+
-+    // Scroll bar size
-+    style.SetScrollBarSize( kapp->style()->pixelMetric( QStyle::PM_ScrollBarExtent ) );
-+    
-+    // #i59364# high contrast mode
-+    BOOL bHC = ( style.GetFaceColor().IsDark() ||
-+                 style.GetWindowColor().IsDark() );
-+    style.SetHighContrastMode( bHC );
-+
-+    rSettings.SetStyleSettings( style );
-+}
-+
-+SalGraphics* KDESalFrame::GetGraphics()
-+{
-+    if( GetWindow() )
-+    {
-+        for( int i = 0; i < nMaxGraphics; i++ )
-+        {
-+            if( ! m_aGraphics[i].bInUse )
-+            {
-+                m_aGraphics[i].bInUse = true;
-+                if( ! m_aGraphics[i].pGraphics )
-+                {
-+                    m_aGraphics[i].pGraphics = new KDESalGraphics();
-+                    m_aGraphics[i].pGraphics->Init( this, GetWindow(), GetScreenNumber() );
-+                }
-+                return m_aGraphics[i].pGraphics;
-+            }
-+        }
-+    }
-+    
-+    return NULL;
-+}
-+
-+void KDESalFrame::ReleaseGraphics( SalGraphics *pGraphics )
-+{
-+    for( int i = 0; i < nMaxGraphics; i++ )
-+    {
-+        if( m_aGraphics[i].pGraphics == pGraphics )
-+        {
-+            m_aGraphics[i].bInUse = false;
-+            break;
-+        }
-+    }
-+}
-+
-+void KDESalFrame::updateGraphics()
-+{
-+    for( int i = 0; i < nMaxGraphics; i++ )
-+    {
-+        if( m_aGraphics[i].bInUse )
-+            m_aGraphics[i].pGraphics->SetDrawable( GetWindow(), GetScreenNumber() );
-+    }
-+}
-+
-+KDESalFrame::~KDESalFrame()
-+{
-+}
-+
-+KDESalFrame::GraphicsHolder::~GraphicsHolder()
-+{
-+	delete pGraphics;
-+}
-+
-+// -----------------------------------------------------------------------
-+// KDESalInstance implementation
-+// -----------------------------------------------------------------------
-+
-+SalFrame *
-+KDESalInstance::CreateFrame( SalFrame *pParent, ULONG nState )
-+{
-+	return new KDESalFrame( pParent, nState );
-+}
-+
-+// -----------------------------------------------------------------------
-+// KDESalData pieces
-+// -----------------------------------------------------------------------
-+
-+// Create the widget painter so we have some control over
-+// the destruction sequence, so Qt doesn't die in action.
-+
-+void KDEData::initNWF()
-+{
-+    ImplSVData *pSVData = ImplGetSVData();
-+    // draw toolbars on separate lines
-+    pSVData->maNWFData.mbDockingAreaSeparateTB = true;
-+}
-+
-+void KDEData::deInitNWF()
-+{
-+}
-diff --git vcl/unx/inc/kde4_headers.h vcl/unx/inc/kde4_headers.h
-new file mode 100644
-index 0000000..e9b87d7
---- /dev/null
-+++ vcl/unx/inc/kde4_headers.h
-@@ -0,0 +1,102 @@
-+/*************************************************************************
-+ *
-+ * 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: kde_headers.h,v $
-+ * $Revision: 1.6 $
-+ *
-+ * 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 INCLUDED_VCL_KDE_HEADERS_H
-+#define INCLUDED_VCL_KDE_HEADERS_H
-+
-+/* ********* Suppress warnings if needed */
-+#include "sal/config.h"
-+
-+#if defined __GNUC__
-+#pragma GCC system_header
-+#endif
-+
-+
-+/* ********* Hack, but needed because of conflicting types... */
-+#define Region QtXRegion
-+
-+
-+/* ********* Qt headers */
-+#include <QtCore/qstring.h>
-+
-+#include <QtGui/qaccessible.h>
-+#include <QtGui/qcheckbox.h>
-+#include <QtGui/qcombobox.h>
-+#include <QtGui/qfont.h>
-+#include <QtGui/qframe.h>
-+#include <QtGui/qlineedit.h>
-+#include <QtGui/qlistview.h>
-+#include <QtGui/qmainwindow.h>
-+#include <QtGui/qmenudata.h>
-+#include <QtGui/qpaintdevice.h>
-+#include <QtGui/qpainter.h>
-+#include <QtGui/qpushbutton.h>
-+#include <QtGui/qradiobutton.h>
-+#include <QtGui/qscrollbar.h>
-+#include <QtGui/qspinbox.h>
-+#include <QtGui/qtabbar.h>
-+#include <QtGui/qtabwidget.h>
-+#include <QtGui/qtoolbar.h>
-+#include <QtGui/qtoolbutton.h>
-+#include <QtGui/qwidget.h>
-+#include <QtGui/qprogressbar.h>
-+
-+
-+/* ********* See hack on top of this file */
-+#undef Region
-+
-+
-+/* ********* KDE base headers */
-+#include <kaboutdata.h>
-+#include <kapplication.h>
-+#include <kcmdlineargs.h>
-+#include <kconfig.h>
-+#include <kconfiggroup.h>
-+#include <kdeversion.h>
-+#include <kemailsettings.h>
-+#include <kglobal.h>
-+#include <kglobalsettings.h>
-+#include <klocale.h>
-+#include <kmainwindow.h>
-+#include <kmenubar.h>
-+#include <kprotocolmanager.h>
-+#include <kstartupinfo.h>
-+#include <kstyle.h>
-+#include <ktoolbar.h>
-+
-+
-+/* ********* KDE address book connectivity headers */
-+//#include <kabc/addressbook.h>
-+//#include <kabc/addressee.h>
-+//#include <kabc/field.h>
-+//#include <kabc/stdaddressbook.h>
-+
-+
-+#endif
-diff --git vcl/unx/inc/plugins/kde4/kde4data.hxx vcl/unx/inc/plugins/kde4/kde4data.hxx
-new file mode 100644
-index 0000000..e25c97a
---- /dev/null
-+++ vcl/unx/inc/plugins/kde4/kde4data.hxx
-@@ -0,0 +1,115 @@
-+/*************************************************************************
-+ *
-+ * 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: kde4data.hxx,v $
-+ * $Revision: 1.8 $
-+ *
-+ * 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 _VCL_KDEDATA_HXX
-+#define _VCL_KDEDATA_HXX
-+
-+#include <saldisp.hxx>
-+#include <saldata.hxx>
-+#include <salframe.h>
-+
-+class KDEData : public X11SalData
-+{
-+public:
-+    KDEData() {}
-+    virtual ~KDEData();
-+    
-+    virtual void Init();
-+    virtual void initNWF();
-+    virtual void deInitNWF();
-+};
-+
-+class SalKDEDisplay : public SalX11Display
-+{
-+   public:
-+       SalKDEDisplay( Display* pDisp );
-+       virtual ~SalKDEDisplay();
-+   
-+   //virtual long Dispatch( XEvent *pEvent );
-+};
-+
-+class KDESalFrame : public X11SalFrame
-+{
-+    static const int nMaxGraphics = 2;
-+
-+    struct GraphicsHolder
-+    {
-+        X11SalGraphics*        pGraphics;
-+        bool               bInUse;
-+        GraphicsHolder() 
-+                : pGraphics( NULL ),
-+                  bInUse( false )
-+        {}
-+       ~GraphicsHolder();
-+    };
-+    GraphicsHolder m_aGraphics[ nMaxGraphics ];
-+
-+public:
-+   KDESalFrame( SalFrame* pParent, ULONG nStyle );
-+   virtual ~KDESalFrame();
-+
-+    virtual SalGraphics* GetGraphics();
-+   virtual void ReleaseGraphics( SalGraphics *pGraphics );
-+    virtual void updateGraphics();
-+    virtual void UpdateSettings( AllSettings& rSettings );
-+    virtual void Show( BOOL bVisible, BOOL bNoActivate );
-+};
-+
-+class KDESalInstance : public X11SalInstance
-+{
-+public:
-+    KDESalInstance( SalYieldMutex* pMutex ) 
-+            : X11SalInstance( pMutex ) {}
-+   virtual ~KDESalInstance() {}
-+    virtual SalFrame* CreateFrame( SalFrame* pParent, ULONG nStyle );
-+};
-+
-+class KDEXLib : public SalXLib
-+{
-+    bool            m_bStartupDone;
-+    void*           m_pApplication;
-+    char**          m_pFreeCmdLineArgs;
-+    char**          m_pAppCmdLineArgs;
-+    int             m_nFakeCmdLineArgs;
-+public:
-+   KDEXLib() : SalXLib(),
-+        m_bStartupDone( false ),
-+        m_pApplication( NULL ),
-+        m_pFreeCmdLineArgs( NULL ),
-+        m_pAppCmdLineArgs( NULL ),
-+        m_nFakeCmdLineArgs( 0 )
-+        {}
-+   virtual ~KDEXLib();
-+    virtual void Init();
-+    
-+    void doStartup();
-+};
-+
-+#endif // _VCL_KDEDATA_HXX
-diff --git vcl/util/makefile.mk vcl/util/makefile.mk
-index f41aae8..a842fa9 100644
---- vcl/util/makefile.mk
-+++ vcl/util/makefile.mk
-@@ -387,7 +387,7 @@ SHL5IMPLIB=ikde_plug_
- SHL5LIBS=$(LIB5TARGET)
- SHL5DEPN=$(SHL2TARGETN)
- # libs for KDE plugin
--SHL5STDLIBS=$(KDE_LIBS)
-+SHL5LINKFLAGS+=$(KDE_LIBS)
- SHL5STDLIBS+=-l$(SHL2TARGET)
- SHL5STDLIBS+=\
-         $(VCLLIB)       \
-@@ -404,6 +404,35 @@ SHL5STDLIBS+= $(XRANDR_LIBS)
- 
- .ENDIF # "$(ENABLE_KDE)" != ""
- 
-+# KDE4 plugin
-+.IF "$(ENABLE_KDE4)" != ""
-+.IF "$(KDE4_ROOT)"!=""
-+EXTRALIBPATHS+=-L$(KDE4_ROOT)$/lib
-+.ENDIF
-+LIB6TARGET=$(SLB)$/ikde4_plug_
-+LIB6FILES=$(SLB)$/kde4plug.lib
-+SHL6TARGET=vclplug_kde4$(DLLPOSTFIX)
-+SHL6IMPLIB=ikde4_plug_
-+SHL6LIBS=$(LIB6TARGET)
-+SHL6DEPN=$(SHL2TARGETN)
-+# libs for KDE4 plugin
-+SHL6LINKFLAGS+=$(KDE4_LIBS)
-+SHL6STDLIBS+=-l$(SHL2TARGET)
-+SHL6STDLIBS+=\
-+        $(VCLLIB)       \
-+        $(PSPLIB)	\
-+        $(TOOLSLIB)     \
-+        $(VOSLIB)       \
-+        $(SALLIB)
-+
-+.IF "$(ENABLE_RANDR)" != ""
-+.IF "$(XRANDR_DLOPEN)" == "FALSE"
-+SHL6STDLIBS+= $(XRANDR_LIBS)
-+.ENDIF
-+.ENDIF
-+
-+.ENDIF # "$(ENABLE_KDE4)" != ""
-+
- .ENDIF # UNX
- 
- # --- Allgemein ----------------------------------------------------------


More information about the ooo-build-commit mailing list