[ooo-build-commit] Branch 'ooo/master' - 2 commits - fpicker/prj fpicker/source linguistic/source shell/prj shell/source svx/source svx/util
Jan Holesovsky
kendy at kemper.freedesktop.org
Fri Aug 7 18:03:44 PDT 2009
fpicker/prj/build.lst | 1
fpicker/prj/d.lst | 1
fpicker/source/generic/fpicker.cxx | 2
fpicker/source/unx/kde4/FPServiceInfo.hxx | 74 ++
fpicker/source/unx/kde4/KDE4FPEntry.cxx | 136 ++++
fpicker/source/unx/kde4/KDE4FilePicker.cxx | 717 +++++++++++++++++++++++
fpicker/source/unx/kde4/KDE4FilePicker.hxx | 205 ++++++
fpicker/source/unx/kde4/fps-kde4-ucd.txt | 6
fpicker/source/unx/kde4/fps_kde4.xml | 51 +
fpicker/source/unx/kde4/makefile.mk | 117 +++
linguistic/source/gciterator.cxx | 38 -
shell/prj/build.lst | 1
shell/source/backends/kde4be/exports.map | 10
shell/source/backends/kde4be/kde4backend.cxx | 158 +++++
shell/source/backends/kde4be/kde4backend.hxx | 123 +++
shell/source/backends/kde4be/kde4be.xml | 35 +
shell/source/backends/kde4be/kde4be1-ucd.txt | 6
shell/source/backends/kde4be/kde4becdef.cxx | 143 ++++
shell/source/backends/kde4be/kde4commonlayer.cxx | 157 +++++
shell/source/backends/kde4be/kde4commonlayer.hxx | 51 +
shell/source/backends/kde4be/kde4inetlayer.cxx | 255 ++++++++
shell/source/backends/kde4be/kde4inetlayer.hxx | 59 +
shell/source/backends/kde4be/kde4pathslayer.cxx | 124 +++
shell/source/backends/kde4be/kde4pathslayer.hxx | 82 ++
shell/source/backends/kde4be/kde4vcllayer.cxx | 115 +++
shell/source/backends/kde4be/kde4vcllayer.hxx | 53 +
shell/source/backends/kde4be/makefile.mk | 94 +++
svx/source/cui/optgdlg.cxx | 32 -
svx/util/makefile.pmk | 8
29 files changed, 2834 insertions(+), 20 deletions(-)
New commits:
commit 6cdf425050de733e5490717eeaa715d0b2738c61
Author: Release Engineers <releng at openoffice.org>
Date: Fri Aug 7 13:32:06 2009 +0000
CWS-TOOLING: integrate CWS gciteratorfix_DEV300
2009-08-04 10:23:19 +0200 od r274608 : add missing patch flags for libaries swui, msword and xo
2009-08-03 16:42:48 +0200 mav r274586 : #i101899# workaround the wrong error code on MAC
2009-08-03 13:24:44 +0200 tl r274575 : #i103936# fix for grammar checking loop
2009-08-03 12:37:37 +0200 tl r274573 : #i103936# fix for grammar checking loop
2009-08-03 12:10:01 +0200 tl r274572 : #i103936# fix for grammar checking loop
2009-08-03 09:06:49 +0200 tl r274565 : #i103936# fix for grammar checking loop
2009-08-03 09:04:50 +0200 tl r274564 : #i103936# fix for grammar checking loop
2009-07-31 17:52:45 +0200 tl r274545 : #i103936# fix for grammar checking loop
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 4f555ae..94caf22 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -191,7 +191,7 @@ static sal_Int32 lcl_SkipWhiteSpaces( const OUString &rText, sal_Int32 nStartPos
static sal_Int32 lcl_BacktraceWhiteSpaces( const OUString &rText, sal_Int32 nStartPos )
{
- // note having nStartPos point right behind the string is OK since that one
+ // note: having nStartPos point right behind the string is OK since that one
// is a correct end-of-sentence position to be returned from a grammar checker...
const sal_Int32 nLen = rText.getLength();
@@ -215,14 +215,16 @@ static sal_Int32 lcl_BacktraceWhiteSpaces( const OUString &rText, sal_Int32 nSta
sal_Int32 nPosBefore = nStartPos - 1;
const sal_Unicode *pStart = rText.getStr();
if (0 <= nPosBefore && nPosBefore < nLen && lcl_IsWhiteSpace( pStart[ nPosBefore ] ))
- nStartPos = nPosBefore;
- if (0 <= nStartPos && nStartPos < nLen)
{
- const sal_Unicode *pText = rText.getStr() + nStartPos;
- while (pText > pStart && lcl_IsWhiteSpace( *pText ))
- --pText;
- // now add 1 since we wnat to point to the first char after the last char in the sentence...
- nRes = pText - pStart + 1;
+ nStartPos = nPosBefore;
+ if (0 <= nStartPos && nStartPos < nLen)
+ {
+ const sal_Unicode *pText = rText.getStr() + nStartPos;
+ while (pText > pStart && lcl_IsWhiteSpace( *pText ))
+ --pText;
+ // now add 1 since we want to point to the first char after the last char in the sentence...
+ nRes = pText - pStart + 1;
+ }
}
DBG_ASSERT( 0 <= nRes && nRes <= nLen, "lcl_BacktraceWhiteSpaces return value out of range" );
@@ -577,6 +579,7 @@ void GrammarCheckingIterator::DequeueAndCheck()
sal_Int32 nStartPos = aFPEntryItem.m_nStartIndex;
sal_Int32 nSuggestedEnd = GetSuggestedEndOfSentence( aCurTxt, nStartPos, aCurLocale );
+ DBG_ASSERT( nSuggestedEnd > nStartPos, "nSuggestedEndOfSentencePos calculation failed?" );
linguistic2::ProofreadingResult aRes;
@@ -586,6 +589,15 @@ void GrammarCheckingIterator::DequeueAndCheck()
aGuard.clear();
uno::Sequence< beans::PropertyValue > aEmptyProps;
aRes = xGC->doProofreading( aCurDocId, aCurTxt, aCurLocale, nStartPos, nSuggestedEnd, aEmptyProps );
+
+ //!! work-around to prevent looping if the grammar checker
+ //!! failed to properly identify the sentence end
+ if (aRes.nBehindEndOfSentencePosition <= nStartPos)
+ {
+ DBG_ASSERT( 0, "!! Grammarchecker failed to provide end of sentence !!" );
+ aRes.nBehindEndOfSentencePosition = nSuggestedEnd;
+ }
+
aRes.xFlatParagraph = xFlatPara;
aRes.nStartOfSentencePosition = nStartPos;
}
@@ -718,6 +730,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
::osl::ClearableGuard< ::osl::Mutex > aGuard( MyMutex::get() );
aDocId = GetOrCreateDocId( xComponent );
nSuggestedEndOfSentencePos = GetSuggestedEndOfSentence( rText, nStartPos, aCurLocale );
+ DBG_ASSERT( nSuggestedEndOfSentencePos > nStartPos, "nSuggestedEndOfSentencePos calculation failed?" );
xGC = GetGrammarChecker( aCurLocale );
}
@@ -727,6 +740,15 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
{
uno::Sequence< beans::PropertyValue > aEmptyProps;
aTmpRes = xGC->doProofreading( aDocId, rText, aCurLocale, nStartPos, nSuggestedEndOfSentencePos, aEmptyProps );
+
+ //!! work-around to prevent looping if the grammar checker
+ //!! failed to properly identify the sentence end
+ if (aTmpRes.nBehindEndOfSentencePosition <= nStartPos)
+ {
+ DBG_ASSERT( 0, "!! Grammarchecker failed to provide end of sentence !!" );
+ aTmpRes.nBehindEndOfSentencePosition = nSuggestedEndOfSentencePos;
+ }
+
aTmpRes.xFlatParagraph = xFlatPara;
aTmpRes.nStartOfSentencePosition = nStartPos;
nEndPos = aTmpRes.nBehindEndOfSentencePosition;
commit 008579d0fb386d42de50b23fd67e8d7192d50224
Author: Release Engineers <releng at openoffice.org>
Date: Fri Aug 7 10:16:34 2009 +0000
CWS-TOOLING: integrate CWS kde4int
2009-07-15 10:40:52 +0200 pl r273993 : #i103288# configure
2009-07-09 14:57:24 +0200 pl r273867 : #i103284# spin fields
2009-07-09 13:49:13 +0200 pl r273864 : #i103284# min size for dropdown comboboxes
2009-07-09 13:46:11 +0200 pl r273860 : #i103284# min size fro dropdown listboxes
2009-07-09 13:01:48 +0200 pl r273857 : #i103284# fix most radiobuttons and checboxes, also on tabpages
2009-07-08 19:38:12 +0200 pl r273847 : #i103290# clean up, enable KDE4 fpicker
2009-07-08 15:54:06 +0200 pl r273837 : #i103284# background mode opaque doesn't look that good
2009-07-07 19:29:01 +0200 pl r273814 : add kde4 directory and deliverables
2009-07-07 11:18:08 +0200 pl r273786 : make compile with Qt 4.1
2009-07-02 19:20:47 +0200 pl r273673 : #i103290# add: KDE4 file picker (thanks Roman Shtylman)
2009-07-02 19:16:07 +0200 pl r273672 : #i103289# add: KDE4integration (thanks Roman Shtylman)
2009-07-02 19:01:20 +0200 pl r273671 : #i103286# add: KDE4 checks (thanks Roman Shtylman)
2009-07-02 18:58:15 +0200 pl r273670 : #i103286# initial import for KDE4 backend (thanks Roman Shtylman)
2009-07-02 18:08:06 +0200 pl r273668 : #i103284# initial import for KDE4 plugin (thanks Roman Shtylman)
diff --git a/fpicker/prj/build.lst b/fpicker/prj/build.lst
index 87084f1..434f226 100644
--- a/fpicker/prj/build.lst
+++ b/fpicker/prj/build.lst
@@ -3,6 +3,7 @@ fp fpicker\inc nmake - all fp_inc NULL
fp fpicker\source\generic nmake - all fp_generic fp_inc NULL
fp fpicker\source\office nmake - all fp_office fp_inc NULL
fp fpicker\source\unx\gnome nmake - u fp_gnome_filepicker fp_inc NULL
+fp fpicker\source\unx\kde4 nmake - u fp_kde4_filepicker fp_inc NULL
fp fpicker\source\aqua nmake - u fp_macosx_filepicker NULL
fp fpicker\source\win32\filepicker nmake - w fp_win32_filepicker fp_inc NULL
fp fpicker\source\win32\folderpicker nmake - w fp_win32_folderpicker fp_inc NULL
diff --git a/fpicker/prj/d.lst b/fpicker/prj/d.lst
index 05ab72c..7c4e0bf 100644
--- a/fpicker/prj/d.lst
+++ b/fpicker/prj/d.lst
@@ -10,4 +10,5 @@ mkdir: %COMMON_DEST%\bin%_EXT%\hid
..\source\win32\filepicker\*.xml %_DEST%\xml%_EXT%\*.xml
..\source\win32\folderpicker\*.xml %_DEST%\xml%_EXT%\*.xml
..\source\unx\gnome\fps-gnome-ucd.txt %_DEST%\bin%_EXT%\fps-gnome-ucd.txt
+..\source\unx\kde4\fps-kde4-ucd.txt %_DEST%\bin%_EXT%\fps-kde4-ucd.txt
..\source\aqua\fps-aqua-ucd.txt %_DEST%\bin%_EXT%\fps-aqua-ucd.txt
diff --git a/fpicker/source/generic/fpicker.cxx b/fpicker/source/generic/fpicker.cxx
index 838f8cb..409e582 100644
--- a/fpicker/source/generic/fpicker.cxx
+++ b/fpicker/source/generic/fpicker.cxx
@@ -60,6 +60,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"));
else
diff --git a/fpicker/source/unx/kde4/FPServiceInfo.hxx b/fpicker/source/unx/kde4/FPServiceInfo.hxx
new file mode 100644
index 0000000..59804ea
--- /dev/null
+++ b/fpicker/source/unx/kde4/FPServiceInfo.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#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.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"
diff --git a/fpicker/source/unx/kde4/KDE4FPEntry.cxx b/fpicker/source/unx/kde4/KDE4FPEntry.cxx
new file mode 100644
index 0000000..f6c7b0e
--- /dev/null
+++ b/fpicker/source/unx/kde4/KDE4FPEntry.cxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <cppuhelper/factory.hxx>
+
+#include <com/sun/star/container/XSet.hpp>
+
+#include <osl/diagnose.h>
+
+#include "KDE4FilePicker.hxx"
+#include "FPServiceInfo.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+using namespace ::cppu;
+using ::com::sun::star::ui::dialogs::XFilePicker;
+
+static Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& serviceManager )
+{
+ 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;
+ }
+
+ 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;
+ }
+ }
+
+ return bRetVal;
+ }
+
+ 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();
+ }
+ }
+
+ return pRet;
+ }
+}
diff --git a/fpicker/source/unx/kde4/KDE4FilePicker.cxx b/fpicker/source/unx/kde4/KDE4FilePicker.cxx
new file mode 100644
index 0000000..40916c7
--- /dev/null
+++ b/fpicker/source/unx/kde4/KDE4FilePicker.cxx
@@ -0,0 +1,717 @@
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Jan Holesovsky <kendy at openoffice.org>
+ *
+ *
+ ************************************************************************/
+
+//////////////////////////////////////////////////////////////////////////
+// includes
+//////////////////////////////////////////////////////////////////////////
+
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <cppuhelper/interfacecontainer.h>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
+#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
+#include <com/sun/star/ui/dialogs/ControlActions.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+
+#include <svtools/svtools.hrc>
+
+#include <vos/mutex.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/sysdata.hxx>
+#include <vcl/syswin.hxx>
+
+#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
+
+using namespace ::com::sun::star;
+
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::ui::dialogs::TemplateDescription;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::ui::dialogs::TemplateDescription;
+using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds;
+using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+
+//////////////////////////////////////////////////////////////////////////
+// helper functions
+//////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+ // controling event notifications
+ const bool STARTUP_SUSPENDED = true;
+ const bool STARTUP_ALIVE = false;
+
+ uno::Sequence<rtl::OUString> SAL_CALL FilePicker_getSupportedServiceNames()
+ {
+ uno::Sequence<rtl::OUString> aRet(3);
+ aRet[0] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.FilePicker");
+ aRet[1] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.SystemFilePicker");
+ aRet[2] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.KDE4FilePicker");
+ return aRet;
+ }
+}
+
+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
+//////////////////////////////////////////////////////////////////////////
+
+KDE4FilePicker::KDE4FilePicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr )
+ : cppu::WeakComponentImplHelper8<
+ XFilterManager,
+ XFilterGroupManager,
+ XFilePickerControlAccess,
+ XFilePickerNotifier,
+// TODO XFilePreview,
+ lang::XInitialization,
+ util::XCancellable,
+ lang::XEventListener,
+ lang::XServiceInfo>( _helperMutex ),
+ m_xServiceMgr( xServiceMgr ),
+ _resMgr( CREATEVERSIONRESMGR( fps_office ) )
+{
+ _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;
+}
+
+void SAL_CALL KDE4FilePicker::addFilePickerListener( const uno::Reference<XFilePickerListener>& xListener )
+ throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ m_xListener = xListener;
+}
+
+void SAL_CALL KDE4FilePicker::removeFilePickerListener( const uno::Reference<XFilePickerListener>& )
+ throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ m_xListener.clear();
+}
+
+void SAL_CALL KDE4FilePicker::setTitle( const rtl::OUString &title )
+ throw( uno::RuntimeException )
+{
+ _dialog->setCaption(toQString(title));
+}
+
+sal_Int16 SAL_CALL KDE4FilePicker::execute()
+ throw( uno::RuntimeException )
+{
+ //get the window id of the main OO window to set it for the dialog as a parent
+ Window *pParentWin = Application::GetDefDialogParent();
+ if ( pParentWin )
+ {
+ const SystemEnvData* pSysData = ((SystemWindow *)pParentWin)->GetSystemData();
+ if ( pSysData )
+ {
+ KWindowSystem::setMainWindow( _dialog, pSysData->aWindow); // unx only
+ }
+ }
+
+ _dialog->setFilter(_filter);
+ _dialog->exec();
+
+ //nasty hack to get a local qt event loop going to process the dialog
+ //otherwise the dialog returns immediately
+ while (_dialog->isVisible())
+ {
+ kapp->processEvents(QEventLoop::WaitForMoreEvents);
+ }
+
+ //block and wait for user input
+ if (_dialog->result() == KFileDialog::Accepted)
+ {
+ return ExecutableDialogResults::OK;
+ }
+
+ return ExecutableDialogResults::CANCEL;
+}
+
+void SAL_CALL KDE4FilePicker::setMultiSelectionMode( sal_Bool multiSelect )
+ throw( uno::RuntimeException )
+{
+ if (multiSelect)
+ {
+ _dialog->setMode(KFile::Files | KFile::LocalOnly);
+ }
+ else
+ {
+ _dialog->setMode(KFile::File | KFile::LocalOnly);
+ }
+}
+
+void SAL_CALL KDE4FilePicker::setDefaultName( const ::rtl::OUString &name )
+ throw( uno::RuntimeException )
+{
+ const QString url = toQString(name);
+ _dialog->setSelection(url);
+}
+
+void SAL_CALL KDE4FilePicker::setDisplayDirectory( const rtl::OUString &dir )
+ throw( uno::RuntimeException )
+{
+ const QString url = toQString(dir);
+ _dialog->setStartDir(KUrl(url));
+}
+
+rtl::OUString SAL_CALL KDE4FilePicker::getDisplayDirectory()
+ throw( uno::RuntimeException )
+{
+ QString dir = _dialog->baseUrl().url();
+ return toOUString(dir);
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles()
+ throw( uno::RuntimeException )
+{
+ QStringList files = _dialog->selectedFiles();
+
+ uno::Sequence< ::rtl::OUString > seq(files.size());
+
+ for (int i=0 ; i<files.size() ; ++i)
+ {
+ const QString fileName = "file:" + files[i];
+ seq[i] = toOUString(fileName);
+ }
+
+ return seq;
+}
+
+void SAL_CALL KDE4FilePicker::appendFilter( const ::rtl::OUString &title, const ::rtl::OUString &filter )
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ 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 &title )
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ QString filter = toQString(title);
+ filter.replace("/", "\\/");
+ _dialog->filterWidget()->setCurrentFilter(filter);
+}
+
+rtl::OUString SAL_CALL KDE4FilePicker::getCurrentFilter()
+ throw( uno::RuntimeException )
+{
+ 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&, const uno::Sequence<beans::StringPair>& )
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ //TODO
+}
+
+void SAL_CALL KDE4FilePicker::setValue( sal_Int16 controlId, sal_Int16, const uno::Any &value )
+ throw( uno::RuntimeException )
+{
+ 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 controlId, sal_Int16 )
+ throw( uno::RuntimeException )
+{
+ 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 controlId, sal_Bool enable )
+ throw( uno::RuntimeException )
+{
+ QWidget* widget = _customWidgets[controlId];
+
+ if (widget)
+ {
+ widget->setEnabled(enable);
+ }
+}
+
+void SAL_CALL KDE4FilePicker::setLabel( sal_Int16 controlId, const ::rtl::OUString &label )
+ throw( uno::RuntimeException )
+{
+ 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 controlId)
+ throw ( uno::RuntimeException )
+{
+ 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 KDE4FilePicker::addCustomControl(sal_Int16 controlId)
+{
+ 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);
+ }
+}
+
+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 );
+ }
+
+ arg = args[0];
+
+ 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 );
+ }
+
+ 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 )
+{
+
+}
+
+void SAL_CALL KDE4FilePicker::disposing( const lang::EventObject &rEvent )
+ throw( uno::RuntimeException )
+{
+ uno::Reference<XFilePickerListener> xFilePickerListener( rEvent.Source, uno::UNO_QUERY );
+
+ if ( xFilePickerListener.is() )
+ {
+ removeFilePickerListener( xFilePickerListener );
+ }
+}
+
+rtl::OUString SAL_CALL KDE4FilePicker::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ return rtl::OUString::createFromAscii( FILE_PICKER_IMPL_NAME );
+}
+
+sal_Bool SAL_CALL KDE4FilePicker::supportsService( const rtl::OUString& ServiceName )
+ throw( uno::RuntimeException )
+{
+ uno::Sequence< ::rtl::OUString > SupportedServicesNames = FilePicker_getSupportedServiceNames();
+
+ for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
+ {
+ if ( SupportedServicesNames[n].compareTo( ServiceName ) == 0 )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+{
+ return FilePicker_getSupportedServiceNames();
+}
diff --git a/fpicker/source/unx/kde4/KDE4FilePicker.hxx b/fpicker/source/unx/kde4/KDE4FilePicker.hxx
new file mode 100644
index 0000000..291e6f7
--- /dev/null
+++ b/fpicker/source/unx/kde4/KDE4FilePicker.hxx
@@ -0,0 +1,205 @@
+/*************************************************************************
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): Jan Holesovsky <kendy at openoffice.org>
+ *
+ *
+ ************************************************************************/
+
+#pragma once
+
+#include <cppuhelper/compbase8.hxx>
+
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp>
+#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
+//#include <com/sun/star/ui/dialogs/XFilePreview.hpp>
+#include <com/sun/star/util/XCancellable.hpp>
+
+#include <osl/conditn.hxx>
+#include <osl/mutex.hxx>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <QString>
+#include <QHash>
+
+class KFileDialog;
+class QWidget;
+class QLayout;
+
+class ResMgr;
+
+class KDE4FilePicker :
+ public cppu::WeakComponentImplHelper8<
+ ::com::sun::star::ui::dialogs::XFilterManager,
+ ::com::sun::star::ui::dialogs::XFilterGroupManager,
+ ::com::sun::star::ui::dialogs::XFilePickerControlAccess,
+ ::com::sun::star::ui::dialogs::XFilePickerNotifier,
+// TODO ::com::sun::star::ui::dialogs::XFilePreview,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::util::XCancellable,
+ ::com::sun::star::lang::XEventListener,
+ ::com::sun::star::lang::XServiceInfo >
+{
+protected:
+ ::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 *_resMgr;
+
+ //the dialog to display
+ KFileDialog* _dialog;
+
+ 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 );
+ virtual ~KDE4FilePicker();
+
+ // 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 );
+
+ // 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 );
+
+ // 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 ::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 ::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);
+
+ // 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 ::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 ::rtl::OUString SAL_CALL getLabel( sal_Int16 nControlId ) throw (::com::sun::star::uno::RuntimeException);
+
+ /* TODO XFilePreview
+
+ virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getTargetColorDepth( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAvailableWidth( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAvailableHeight( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any &rImage ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getShowState( ) throw (::com::sun::star::uno::RuntimeException);
+ */
+
+ // 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 );
+
+ // XCancellable
+
+ 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 );
+
+ // 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 ::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& );
+
+ //add a custom control widget to the file dialog
+ void addCustomControl(sal_Int16 controlId);
+
+};
diff --git a/fpicker/source/unx/kde4/fps-kde4-ucd.txt b/fpicker/source/unx/kde4/fps-kde4-ucd.txt
new file mode 100644
index 0000000..8ecc4e0
--- /dev/null
+++ b/fpicker/source/unx/kde4/fps-kde4-ucd.txt
@@ -0,0 +1,6 @@
+[ComponentDescriptor]
+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 a/fpicker/source/unx/kde4/fps_kde4.xml b/fpicker/source/unx/kde4/fps_kde4.xml
new file mode 100644
index 0000000..b250c05
--- /dev/null
+++ b/fpicker/source/unx/kde4/fps_kde4.xml
@@ -0,0 +1,51 @@
+<?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>fps_kde4</module-name>
+ <component-description>
+ <author> Jan Holesovsky </author>
+ <name> com.sun.star.comp.ui.dialogs.FilePicker </name>
+ <description>
+ The KDE implementation of the FilePicker service.
+ </description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language> c++ </language>
+ <status value="beta"/>
+ <supported-service> com.sun.star.ui.dialogs.FilePicker </supported-service>
+ <service-dependency>...</service-dependency>
+ <type> com.sun.star.ui.dialogs.XExecutableDialog </type>
+ <type> com.sun.star.ui.dialogs.XFilePicker </type>
+ <type> com.sun.star.ui.dialogs.XFilterManager </type>
+ <type> com.sun.star.ui.dialogs.XFilterGroupManager </type>
+ <type> com.sun.star.ui.dialogs.XFilePickerListener </type>
+ <type> com.sun.star.ui.dialogs.ExecutableDialogException </type>
+ <type> com.sun.star.ui.dialogs.XFilePickerNotifier </type>
+ <type> com.sun.star.ui.dialogs.XFilePickerControlAccess </type>
+ <type> com.sun.star.ui.dialogs.XFilePreview </type>
+ <type> com.sun.star.ui.dialogs.ExtendedFilePickerElementIds </type>
+ <type> com.sun.star.ui.dialogs.ExecutableDialogResults </type>
+ <type> com.sun.star.ui.dialogs.FilePickerEvent </type>
+ <type> com.sun.star.ui.dialogs.CommonFilePickerElementIds </type>
+ <type> com.sun.star.ui.dialogs.ListboxControlActions </type>
+ <type> com.sun.star.ui.dialogs.TemplateDescription </type>
+ <type> com.sun.star.ui.dialogs.FilePreviewImageFormats </type>
+ <type> com.sun.star.util.XCancellable </type>
+ <type> com.sun.star.lang.XComponent </type>
+ <type> com.sun.star.lang.XMultiServiceFactory </type>
+ <type> com.sun.star.lang.XSingleServiceFactory </type>
+ <type> com.sun.star.lang.XServiceInfo </type>
+ <type> com.sun.star.lang.XTypeProvider </type>
+ <type> com.sun.star.lang.IllegalArgumentException </type>
+ <type> com.sun.star.uno.TypeClass </type>
+ <type> com.sun.star.uno.XWeak </type>
+ <type> com.sun.star.uno.XAggregation </type>
+ <type> com.sun.star.registry.XRegistryKey </type>
+ <type> com.sun.star.container.XSet </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> cppuhelper </runtime-module-dependency>
+ <runtime-module-dependency> cppu2 </runtime-module-dependency>
+ <runtime-module-dependency> sal2 </runtime-module-dependency>
+</module-description>
diff --git a/fpicker/source/unx/kde4/makefile.mk b/fpicker/source/unx/kde4/makefile.mk
new file mode 100644
index 0000000..6f9db77
--- /dev/null
+++ b/fpicker/source/unx/kde4/makefile.mk
@@ -0,0 +1,117 @@
+#*************************************************************************
+#
+#
+#
+#
+#
+#
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=fpicker
+TARGET=fps_kde4.uno
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+DLLPRE=
+
+# ------------------------------------------------------------------
+
+# Currently just KDE is supported...
+.IF "$(GUIBASE)" != "unx" || "$(ENABLE_KDE4)" != "TRUE"
+
+dummy:
+ @echo "Nothing to build. GUIBASE == $(GUIBASE), ENABLE_KDE4 is not set"
+
+.ELSE # we build for KDE
+
+CFLAGS+= $(KDE4_CFLAGS)
+
+# --- Files --------------------------------------------------------
+
+SLOFILES =\
+ $(SLO)$/KDE4FilePicker.obj \
+ $(SLO)$/KDE4FilePicker.moc.obj \
+ $(SLO)$/KDE4FPEntry.obj
+
+SHL1NOCHECK=TRUE
+SHL1TARGET=$(TARGET)
+SHL1STDLIBS=$(CPPULIB)\
+ $(CPPUHELPERLIB)\
+ $(SALLIB)\
+ $(VCLLIB)\
+ $(TOOLSLIB) \
+ $(KDE4_LIBS) -lkio -lkfile
+
+
+SHL1OBJS=$(SLOFILES)
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME=$(SHL1TARGET)
+DEF1VERSIONMAP=exports.map
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+$(MISC)$/KDE4FilePicker.moc.cxx : KDE4FilePicker.hxx
+ $(MOC4) $< -o $@
diff --git a/shell/prj/build.lst b/shell/prj/build.lst
index 01077cb..7a2e91f 100644
--- a/shell/prj/build.lst
+++ b/shell/prj/build.lst
@@ -31,6 +31,7 @@ sl shell\source\backends\wininetbe nmake - w sl_backends_w
sl shell\source\backends\macbe nmake - u sl_backends_macbe sl_inc NULL
sl shell\source\backends\gconfbe nmake - u sl_backends_gconfbe sl_inc NULL
sl shell\source\backends\kdebe nmake - u sl_backends_kdebe sl_inc NULL
+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
diff --git a/shell/source/backends/kde4be/exports.map b/shell/source/backends/kde4be/exports.map
new file mode 100644
index 0000000..ba501f9
--- /dev/null
+++ b/shell/source/backends/kde4be/exports.map
@@ -0,0 +1,10 @@
+UDK_3_0_0 {
+ global:
+ GetVersionInfo;
+ component_getImplementationEnvironment;
+ component_getFactory;
+ component_writeInfo;
+
+ local:
+ *;
+};
diff --git a/shell/source/backends/kde4be/kde4backend.cxx b/shell/source/backends/kde4be/kde4backend.cxx
new file mode 100644
index 0000000..3e0fadd
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4backend.cxx
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * 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: kde4backend.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * 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_shell.hxx"
+
+#include "kde4backend.hxx"
+#include "kde4commonlayer.hxx"
+#include "kde4inetlayer.hxx"
+#include "kde4vcllayer.hxx"
+#include "kde4pathslayer.hxx"
+
+//------------------------------------------------------------------------------
+
+KDEBackend* KDEBackend::mInstance= 0;
+
+KDEBackend* KDEBackend::createInstance(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ if (mInstance == 0)
+ {
+ mInstance = new KDEBackend (xContext);
+ }
+
+ return mInstance;
+}
+
+//------------------------------------------------------------------------------
+
+KDEBackend::KDEBackend(const uno::Reference<uno::XComponentContext>& xContext)
+ throw (backend::BackendAccessException)
+ : BackendBase(mMutex), m_xContext(xContext)
+{
+}
+
+//------------------------------------------------------------------------------
+
+KDEBackend::~KDEBackend(void)
+{
+}
+
+//------------------------------------------------------------------------------
+
+uno::Reference<backend::XLayer> SAL_CALL KDEBackend::getLayer(
+ const rtl::OUString& aComponent, const rtl::OUString& /* aTimestamp */)
+ throw (backend::BackendAccessException, lang::IllegalArgumentException)
+{
+ uno::Reference<backend::XLayer> xLayer;
+
+ if( aComponent.equalsAscii("org.openoffice.Office.Common" ) )
+ {
+ xLayer = new KDECommonLayer(m_xContext);
+ }
+ else if( aComponent.equalsAscii("org.openoffice.Inet" ) )
+ {
+ xLayer = new KDEInetLayer(m_xContext);
+ }
+ else if( aComponent.equalsAscii("org.openoffice.VCL" ) )
+ {
+ xLayer = new KDEVCLLayer(m_xContext);
+ }
+ else if( aComponent.equalsAscii("org.openoffice.Office.Paths" ) )
+ {
+ xLayer = new KDEPathsLayer(m_xContext);
+ }
+
+ return xLayer;
+}
+
+//------------------------------------------------------------------------------
+
+uno::Reference<backend::XUpdatableLayer> SAL_CALL
+KDEBackend::getUpdatableLayer(const rtl::OUString& /* aComponent */)
+ throw (backend::BackendAccessException,lang::NoSupportException,
+ lang::IllegalArgumentException)
+{
+ throw lang::NoSupportException( rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("KDEBackend: No Update Operation allowed, Read Only access") ),
+ *this) ;
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDEBackend::getBackendName(void)
+{
+ return rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.configuration.backend.KDE4Backend") );
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDEBackend::getImplementationName(void)
+ throw (uno::RuntimeException)
+{
+ return getBackendName() ;
+}
+
+//------------------------------------------------------------------------------
+
+uno::Sequence<rtl::OUString> SAL_CALL KDEBackend::getBackendServiceNames(void)
+{
+ uno::Sequence<rtl::OUString> aServices(1) ;
+ aServices[0] = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.backend.KDE4Backend")) ;
+
+ return aServices ;
+}
+
+//------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL KDEBackend::supportsService(const rtl::OUString& aServiceName)
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< rtl::OUString > const svc = getBackendServiceNames();
+
+ for(sal_Int32 i = 0; i < svc.getLength(); ++i )
+ if(svc[i] == aServiceName)
+ return true;
+
+ return false;
+}
+
+//------------------------------------------------------------------------------
+
+uno::Sequence<rtl::OUString>
+SAL_CALL KDEBackend::getSupportedServiceNames(void)
+ throw (uno::RuntimeException)
+{
+ return getBackendServiceNames() ;
+}
+
+// ---------------------------------------------------------------------------------------
diff --git a/shell/source/backends/kde4be/kde4backend.hxx b/shell/source/backends/kde4be/kde4backend.hxx
new file mode 100644
index 0000000..95f66f3
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4backend.hxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: kde4backend.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * 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 <com/sun/star/configuration/backend/XSingleLayerStratum.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/configuration/InvalidBootstrapFileException.hpp>
+#include <com/sun/star/configuration/backend/CannotConnectException.hpp>
+#include <cppuhelper/compbase2.hxx>
+
+#ifndef INCLUDED_MAP
+#include <map>
+#define INCLUDED_MAP
+#endif
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+
+
+//------------------------------------------------------------------------------
+typedef cppu::WeakComponentImplHelper2<backend::XSingleLayerStratum,
+ lang::XServiceInfo> BackendBase ;
+
+/**
+ Implements the SingleLayerStratum service for KDE access.
+ */
+class KDEBackend : public BackendBase {
+ public :
+
+ static KDEBackend* createInstance(const uno::Reference<uno::XComponentContext>& xContext);
+
+ // XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName( )
+ throw (uno::RuntimeException) ;
+
+ virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& aServiceName )
+ throw (uno::RuntimeException) ;
+
+ virtual uno::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames( )
+ throw (uno::RuntimeException) ;
+
+ /**
+ Provides the implementation name.
+
+ @return implementation name
+ */
+ static rtl::OUString SAL_CALL getBackendName(void) ;
+
+ /**
+ Provides the supported services names
+
+ @return service names
+ */
+ static uno::Sequence<rtl::OUString> SAL_CALL getBackendServiceNames(void) ;
+
+ //XSingleLayerStratum
+ virtual uno::Reference<backend::XLayer> SAL_CALL
+ getLayer( const rtl::OUString& aLayerId, const rtl::OUString& aTimestamp )
+ throw (backend::BackendAccessException, lang::IllegalArgumentException) ;
+
+ virtual uno::Reference<backend::XUpdatableLayer> SAL_CALL
+ getUpdatableLayer( const rtl::OUString& aLayerId )
+ throw (backend::BackendAccessException, lang::NoSupportException,
+ lang::IllegalArgumentException) ;
+
+ protected:
+ /**
+ Service constructor from a service factory.
+
+ @param xContext component context
+ */
+ KDEBackend(const uno::Reference<uno::XComponentContext>& xContext)
+ throw (backend::BackendAccessException);
+
+ /** Destructor */
+ ~KDEBackend(void) ;
+
+ private:
+
+ /** Build KDE/OO mapping table */
+ void initializeMappingTable ();
+
+
+ /** The component context */
+ uno::Reference<uno::XComponentContext> m_xContext;
+
+ /** Mutex for reOOurces protection */
+ osl::Mutex mMutex ;
+
+ static KDEBackend* mInstance;
+};
diff --git a/shell/source/backends/kde4be/kde4be.xml b/shell/source/backends/kde4be/kde4be.xml
new file mode 100644
index 0000000..9396167
--- /dev/null
+++ b/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 a/shell/source/backends/kde4be/kde4be1-ucd.txt b/shell/source/backends/kde4be/kde4be1-ucd.txt
new file mode 100644
index 0000000..9671199
--- /dev/null
+++ b/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 a/shell/source/backends/kde4be/kde4becdef.cxx b/shell/source/backends/kde4be/kde4becdef.cxx
new file mode 100644
index 0000000..277e391
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4becdef.cxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * 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: kde4becdef.cxx,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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+#include "kde4backend.hxx"
+
+#include <kapplication.h>
+
+#include <cppuhelper/implementationentry.hxx>
+
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include "uno/current_context.hxx"
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+
+//==============================================================================
+
+static uno::Reference<uno::XInterface> SAL_CALL createKDEBackend(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ try {
+ uno::Reference< uno::XCurrentContext > xCurrentContext(uno::getCurrentContext());
+
+ if (xCurrentContext.is())
+ {
+ uno::Any aValue = xCurrentContext->getValueByName(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "system.desktop-environment" ) ) );
+
+ rtl::OUString aDesktopEnvironment;
+ if ( (aValue >>= aDesktopEnvironment) && (aDesktopEnvironment.equalsAscii("KDE")) && (KApplication::kApplication() != NULL) )
+ return * KDEBackend::createInstance(xContext);
+ }
+
+ return uno::Reference<uno::XInterface>();
+
+ } catch (uno::RuntimeException e) {
+ return uno::Reference<uno::XInterface>();
+ }
+
+}
+
+//==============================================================================
+
+static const cppu::ImplementationEntry kImplementations_entries[] =
+{
+ {
+ createKDEBackend,
+ KDEBackend::getBackendName,
+ KDEBackend::getBackendServiceNames,
+ cppu::createSingleComponentFactory,
+ NULL,
+ 0
+ },
+ { NULL, NULL, NULL, NULL, NULL, 0 }
+} ;
+//------------------------------------------------------------------------------
+
+extern "C" void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char **aEnvTypeName,
+ uno_Environment **) {
+ *aEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
+}
+
+//------------------------------------------------------------------------------
+
+extern "C" sal_Bool SAL_CALL component_writeInfo(void *,
+ void *pRegistryKey) {
+
+ using namespace ::com::sun::star::registry;
+ if (pRegistryKey)
+ {
+ try
+ {
+ uno::Reference< XRegistryKey > xImplKey = static_cast< XRegistryKey* >( pRegistryKey )->createKey(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + KDEBackend::getBackendName()
+ );
+
+ // Register associated service names
+ uno::Reference< XRegistryKey > xServicesKey = xImplKey->createKey(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES") )
+ );
+
+ uno::Sequence<rtl::OUString> sServiceNames = KDEBackend::getBackendServiceNames();
+ for (sal_Int32 i = 0 ; i < sServiceNames.getLength() ; ++ i)
+ xServicesKey->createKey(sServiceNames[i]);
+
+ return sal_True;
+ }
+
+ catch( InvalidRegistryException& )
+ {
+ OSL_ENSURE(sal_False, "InvalidRegistryException caught");
+ }
+ }
+
+ return sal_False;
+}
+
+//------------------------------------------------------------------------------
+
+extern "C" void *component_getFactory(const sal_Char *aImplementationName,
+ void *aServiceManager,
+ void *aRegistryKey) {
+
+ return cppu::component_getFactoryHelper(
+ aImplementationName,
+ aServiceManager,
+ aRegistryKey,
+ kImplementations_entries) ;
+}
+//------------------------------------------------------------------------------
diff --git a/shell/source/backends/kde4be/kde4commonlayer.cxx b/shell/source/backends/kde4be/kde4commonlayer.cxx
new file mode 100644
index 0000000..6e718cb
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4commonlayer.cxx
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * 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: kde4commonlayer.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * 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_shell.hxx"
+
+#include "kde4commonlayer.hxx"
+
+#include <kemailsettings.h>
+#include <kglobalsettings.h>
+
+#include <QFont>
+
+#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#define SPACE ' '
+
+//==============================================================================
+
+KDECommonLayer::KDECommonLayer(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ //Create instance of LayerContentDescriber Service
+ rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.backend.LayerDescriber"));
+
+ typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber;
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
+ if( xServiceManager.is() )
+ {
+ m_xLayerContentDescriber = LayerDescriber::query(
+ xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext));
+ }
+ else
+ {
+ OSL_TRACE("Could not retrieve ServiceManager");
+ }
+}
+
+//------------------------------------------------------------------------------
+
+void SAL_CALL KDECommonLayer::readData( const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException, lang::NullPointerException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( ! m_xLayerContentDescriber.is() )
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service"
+ ) ), static_cast < backend::XLayer * > (this) );
+ }
+
+ uno::Sequence<backend::PropertyInfo> aPropInfoList(3);
+ sal_Int32 nProperties = 0;
+
+ // Email client settings
+ KEMailSettings aEmailSettings;
+ QString aClientProgram;
+ ::rtl::OUString sClientProgram;
+
+ aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram );
+ if ( aClientProgram.isEmpty() )
+ aClientProgram = "kmail";
+ else
+ aClientProgram = aClientProgram.section(SPACE, 0, 0);
+ sClientProgram = (const sal_Unicode *) aClientProgram.utf16();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/ExternalMailer/Program") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sClientProgram );
+
+ // Source code font settings
+ QFont aFixedFont;
+ QString aFontName;
+ :: rtl::OUString sFontName;
+ short nFontHeight;
+
+ aFixedFont = KGlobalSettings::fixedFont();
+ aFontName = aFixedFont.family();
+ sFontName = (const sal_Unicode *) aFontName.utf16();
+ nFontHeight = aFixedFont.pointSize();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/Font/SourceViewFont/FontName") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sFontName );
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/Font/SourceViewFont/FontHeight") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "short" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( nFontHeight );
+
+ if( nProperties > 0 )
+ {
+ aPropInfoList.realloc(nProperties);
+ m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList);
+ }
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDECommonLayer::getTimestamp(void)
+ throw (uno::RuntimeException)
+{
+ // Return the value as timestamp to avoid regenerating the binary cache
+ // on each office launch.
+
+ KEMailSettings aEmailSettings;
+ QString aClientProgram = aEmailSettings.getSetting( KEMailSettings::ClientProgram );
+ aClientProgram = aClientProgram.section(SPACE, 0, 0);
+
+ QString aFixedFont = KGlobalSettings::fixedFont().toString();
+
+ ::rtl::OUString sTimeStamp,
+ sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) );
+
+ sTimeStamp = (const sal_Unicode *) aClientProgram.utf16();
+ sTimeStamp += sep;
+ sTimeStamp += (const sal_Unicode *) aFixedFont.utf16();
+
+ return sTimeStamp;
+}
diff --git a/shell/source/backends/kde4be/kde4commonlayer.hxx b/shell/source/backends/kde4be/kde4commonlayer.hxx
new file mode 100644
index 0000000..d37bab8
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4commonlayer.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>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/util/XTimeStamped.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+namespace util = css::util ;
+
+/**
+ Implementation of the XLayer interface for the KDE values mapped into
+ the org.openoffice.Office.Common configuration component.
+ */
+class KDECommonLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped>
+{
+public :
+ /**
+ Constructor given the component context
+
+ @param xContext The component context
+ */
+
+ KDECommonLayer(const uno::Reference<uno::XComponentContext>& xContext);
+
+ // XLayer
+ virtual void SAL_CALL readData(
+ const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException,
+ lang::NullPointerException,
+ lang::WrappedTargetException,
+ uno::RuntimeException) ;
+
+ // XTimeStamped
+ virtual rtl::OUString SAL_CALL getTimestamp(void)
+ throw (uno::RuntimeException);
+
+ protected:
+
+ /** Destructor */
+ ~KDECommonLayer(void) {}
+
+ private :
+ uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ;
+};
diff --git a/shell/source/backends/kde4be/kde4inetlayer.cxx b/shell/source/backends/kde4be/kde4inetlayer.cxx
new file mode 100644
index 0000000..968121b
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4inetlayer.cxx
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * 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: kde4inetlayer.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * 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_shell.hxx"
+
+#include <kprotocolmanager.h>
+
+#include "kde4inetlayer.hxx"
+#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#define COMMA ','
+#define SEMI_COLON ';'
+
+//==============================================================================
+
+KDEInetLayer::KDEInetLayer(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ //Create instance of LayerContentDescriber Service
+ rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.backend.LayerDescriber"));
+
+ typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber;
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
+ if( xServiceManager.is() )
+ {
+ m_xLayerContentDescriber = LayerDescriber::query(
+ xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext));
+ }
+ else
+ {
+ OSL_TRACE("Could not retrieve ServiceManager");
+ }
+}
+
+//------------------------------------------------------------------------------
+
+void SAL_CALL KDEInetLayer::readData( const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException, lang::NullPointerException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( ! m_xLayerContentDescriber.is() )
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service"
+ ) ), static_cast < backend::XLayer * > (this) );
+ }
+
+ uno::Sequence<backend::PropertyInfo> aPropInfoList(8);
+ sal_Int32 nProperties = 0;
+
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy: // Proxies are manually configured
+ setProxy(aPropInfoList, nProperties, 1,
+ KProtocolManager::noProxyFor(),
+ KProtocolManager::proxyFor( "HTTP" ),
+ KProtocolManager::proxyFor( "FTP" ),
+ KProtocolManager::proxyFor( "HTTPS" ));
+ break;
+ case KProtocolManager::PACProxy: // A proxy configuration URL has been given
+ case KProtocolManager::WPADProxy: // A proxy should be automatically discovered
+ case KProtocolManager::EnvVarProxy: // Use the proxy values set through environment variables
+// In such cases, the proxy address is not stored in KDE, but determined dynamically.
+// The proxy address may depend on the requested address, on the time of the day, on the speed of the wind...
+// The best we can do here is to ask the current value for a given address.
+ setProxy(aPropInfoList, nProperties, 1,
+ KProtocolManager::noProxyFor(),
+ KProtocolManager::proxyForUrl( KUrl("http://www.openoffice.org") ),
+ KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") ),
+ KProtocolManager::proxyForUrl( KUrl("https://www.openoffice.org") ));
+ break;
+ default: // No proxy is used
+ setProxy(aPropInfoList, nProperties, 0);
+ }
+
+ if ( nProperties > 0 )
+ {
+ aPropInfoList.realloc(nProperties);
+ m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList);
+ }
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDEInetLayer::getTimestamp(void)
+ throw (uno::RuntimeException)
+{
+ // Return the value as timestamp to avoid regenerating the binary cache
+ // on each office launch.
+
+ QString aProxyType, aNoProxyFor, aHTTPProxy, aHTTPSProxy, aFTPProxy;
+
+ switch ( KProtocolManager::proxyType() )
+ {
+ case KProtocolManager::ManualProxy:
+ aProxyType = '1';
+ aNoProxyFor = KProtocolManager::noProxyFor();
+ aHTTPProxy = KProtocolManager::proxyFor( "HTTP" );
+ aHTTPProxy = KProtocolManager::proxyFor( "HTTPS" );
+ aFTPProxy = KProtocolManager::proxyFor( "FTP" );
+ break;
+ case KProtocolManager::PACProxy:
+ case KProtocolManager::WPADProxy:
+ case KProtocolManager::EnvVarProxy:
+ aProxyType = '1';
+ aNoProxyFor = KProtocolManager::noProxyFor();
+ aHTTPProxy = KProtocolManager::proxyForUrl( KUrl("http://www.openoffice.org") );
+ aHTTPSProxy = KProtocolManager::proxyForUrl( KUrl("https://www.openoffice.org") );
+ aFTPProxy = KProtocolManager::proxyForUrl( KUrl("ftp://ftp.openoffice.org") );
+ break;
+ default:
+ aProxyType = '0';
+ }
+
+ ::rtl::OUString sTimeStamp,
+ sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) );
+
+ sTimeStamp = (const sal_Unicode *) aProxyType.utf16();
+ sTimeStamp += sep;
+ sTimeStamp += (const sal_Unicode *) aNoProxyFor.utf16();
+ sTimeStamp += sep;
+ sTimeStamp += (const sal_Unicode *) aHTTPProxy.utf16();
+ sTimeStamp += sep;
+ sTimeStamp += (const sal_Unicode *) aHTTPSProxy.utf16();
+ sTimeStamp += sep;
+ sTimeStamp += (const sal_Unicode *) aFTPProxy.utf16();
+
+ return sTimeStamp;
+}
+
+//------------------------------------------------------------------------------
+
+void SAL_CALL KDEInetLayer::setProxy
+ (uno::Sequence<backend::PropertyInfo> &aPropInfoList, sal_Int32 &nProperties,
+ int nProxyType, const QString &aNoProxy, const QString &aHTTPProxy, const QString &aFTPProxy, const QString &aHTTPSProxy ) const
+{
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetProxyType") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "int" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( (sal_Int32) nProxyType );
+
+ if (nProxyType == 0) return;
+
+ if ( !aNoProxy.isEmpty() )
+ {
+ QString aNoProxyFor(aNoProxy);
+ ::rtl::OUString sNoProxyFor;
+
+ aNoProxyFor = aNoProxyFor.replace( COMMA, SEMI_COLON );
+ sNoProxyFor = (const sal_Unicode *) aNoProxyFor.utf16();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetNoProxy") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sNoProxyFor );
+ }
+
+ if ( !aHTTPProxy.isEmpty() )
+ {
+ KUrl aProxy(aHTTPProxy);
+ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+ sal_Int32 nPort = aProxy.port();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyName") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sProxy );
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPProxyPort") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "int" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( nPort );
+ }
+
+ if ( !aHTTPSProxy.isEmpty() )
+ {
+ KUrl aProxy(aHTTPSProxy);
+ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+ sal_Int32 nPort = aProxy.port();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyName") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sProxy );
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetHTTPSProxyPort") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "int" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( nPort );
+ }
+
+ if ( !aFTPProxy.isEmpty() )
+ {
+ KUrl aProxy(aFTPProxy);
+ ::rtl::OUString sProxy = (const sal_Unicode *) aProxy.host().utf16();
+ sal_Int32 nPort = aProxy.port();
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyName") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sProxy );
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Inet/Settings/ooInetFTPProxyPort") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "int" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( nPort );
+ }
+}
+
diff --git a/shell/source/backends/kde4be/kde4inetlayer.hxx b/shell/source/backends/kde4be/kde4inetlayer.hxx
new file mode 100644
index 0000000..1724628
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4inetlayer.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>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/util/XTimeStamped.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+namespace util = css::util ;
+
+/**
+ Implementation of the XLayer interface for the KDE values mapped into
+ the org.openoffice.Inet configuration component.
+ */
+class KDEInetLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped>
+{
+public :
+ /**
+ Constructor given the component context
+
+ @param xContext The component context
+ */
+
+ KDEInetLayer(const uno::Reference<uno::XComponentContext>& xContext);
+
+ // XLayer
+ virtual void SAL_CALL readData(
+ const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException,
+ lang::NullPointerException,
+ lang::WrappedTargetException,
+ uno::RuntimeException) ;
+
+ // XTimeStamped
+ virtual rtl::OUString SAL_CALL getTimestamp(void)
+ throw (uno::RuntimeException);
+
+ protected:
+
+ /** Destructor */
+ ~KDEInetLayer(void) {}
+
+private :
+ uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ;
+
+ void SAL_CALL setProxy
+ (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;
+};
diff --git a/shell/source/backends/kde4be/kde4pathslayer.cxx b/shell/source/backends/kde4be/kde4pathslayer.cxx
new file mode 100644
index 0000000..0791790
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4pathslayer.cxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * 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: kde4pathslayer.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+
+#include "kde4pathslayer.hxx"
+
+#include <QString>
+#include <kglobalsettings.h>
+
+#include <com/sun/star/configuration/backend/PropertyInfo.hpp>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+
+#include <osl/security.hxx>
+#include <osl/file.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#define SPACE ' '
+
+//==============================================================================
+
+KDEPathsLayer::KDEPathsLayer(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ //Create instance of LayerContentDescriber Service
+ rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.backend.LayerDescriber"));
+
+ typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber;
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
+ if( xServiceManager.is() )
+ {
+ m_xLayerContentDescriber = LayerDescriber::query(
+ xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext));
+ }
+ else
+ {
+ OSL_TRACE("Could not retrieve ServiceManager");
+ }
+}
+
+//------------------------------------------------------------------------------
+
+void SAL_CALL KDEPathsLayer::readData( const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException, lang::NullPointerException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( ! m_xLayerContentDescriber.is() )
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service"
+ ) ), static_cast < backend::XLayer * > (this) );
+ }
+
+ uno::Sequence<backend::PropertyInfo> aPropInfoList(1);
+ sal_Int32 nProperties = 0;
+
+ QString aDocumentsDir( KGlobalSettings::documentPath() );
+ rtl::OUString sDocumentsDir;
+ rtl::OUString sDocumentsURL;
+ if ( aDocumentsDir.endsWith(QChar('/')) )
+ aDocumentsDir.truncate ( aDocumentsDir.length() - 1 );
+ sDocumentsDir = (const sal_Unicode *) aDocumentsDir.utf16();
+ osl_getFileURLFromSystemPath( sDocumentsDir.pData, &sDocumentsURL.pData );
+
+ aPropInfoList[nProperties].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Paths/Variables/Work") );
+ aPropInfoList[nProperties].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[nProperties].Protected = sal_False;
+ aPropInfoList[nProperties++].Value = uno::makeAny( sDocumentsURL );
+
+ if( nProperties > 0 )
+ {
+ aPropInfoList.realloc(nProperties);
+ m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList);
+ }
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDEPathsLayer::getTimestamp(void)
+ throw (uno::RuntimeException)
+{
+ // Return the value as timestamp to avoid regenerating the binary cache
+ // on each office launch.
+
+ ::rtl::OUString sTimeStamp,
+ sep( RTL_CONSTASCII_USTRINGPARAM( "$" ) );
+
+ QString aDocumentsDir;
+ aDocumentsDir = KGlobalSettings::documentPath();
+
+ sTimeStamp += (const sal_Unicode *) aDocumentsDir.utf16();
+
+ return sTimeStamp;
+}
diff --git a/shell/source/backends/kde4be/kde4pathslayer.hxx b/shell/source/backends/kde4be/kde4pathslayer.hxx
new file mode 100644
index 0000000..e3fc4dc
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4pathslayer.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * 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: kde4pathslayer.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * 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 "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>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/util/XTimeStamped.hpp>
+
+#include <cppuhelper/implbase2.hxx>
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+namespace util = css::util ;
+
+/**
+ Implementation of the XLayer interface for the KDE values mapped into
+ the org.openoffice.Office.Paths configuration component.
+ */
+class KDEPathsLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped>
+{
+public :
+ /**
+ Constructor given the component context
+
+ @param xContext The component context
+ */
+
+ KDEPathsLayer(const uno::Reference<uno::XComponentContext>& xContext);
+
+ // XLayer
+ virtual void SAL_CALL readData(
+ const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException,
+ lang::NullPointerException,
+ lang::WrappedTargetException,
+ uno::RuntimeException) ;
+
+ // XTimeStamped
+ virtual rtl::OUString SAL_CALL getTimestamp(void)
+ throw (uno::RuntimeException);
+
+ protected:
+
+ /** Destructor */
+ ~KDEPathsLayer(void) {}
+
+ private :
+ uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ;
+};
diff --git a/shell/source/backends/kde4be/kde4vcllayer.cxx b/shell/source/backends/kde4be/kde4vcllayer.cxx
new file mode 100644
index 0000000..2705cb6
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4vcllayer.cxx
@@ -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: kde4vcllayer.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// 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>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+//==============================================================================
+
+KDEVCLLayer::KDEVCLLayer(const uno::Reference<uno::XComponentContext>& xContext)
+{
+ //Create instance of LayerContentDescriber Service
+ rtl::OUString const k_sLayerDescriberService(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.configuration.backend.LayerDescriber"));
+
+ typedef uno::Reference<backend::XLayerContentDescriber> LayerDescriber;
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
+ if( xServiceManager.is() )
+ {
+ m_xLayerContentDescriber = LayerDescriber::query(
+ xServiceManager->createInstanceWithContext(k_sLayerDescriberService, xContext));
+ }
+ else
+ {
+ OSL_TRACE("Could not retrieve ServiceManager");
+ }
+}
+
+//------------------------------------------------------------------------------
+
+void SAL_CALL KDEVCLLayer::readData( const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException, lang::NullPointerException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( ! m_xLayerContentDescriber.is() )
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Could not create com.sun.star.configuration.backend.LayerContentDescriber Service"
+ ) ), static_cast < backend::XLayer * > (this) );
+ }
+
+ uno::Sequence<backend::PropertyInfo> aPropInfoList(1);
+
+/*
+ Commenting out, does not make much sense without an accessibility bridge
+===========================================================================
+#if defined(QT_ACCESSIBILITY_SUPPORT)
+// Accessibility tools under Qt for UNIX are available starting with Qt 4.0
+ int nVersionMajor = 0;
+ const char *q = qVersion(); // "3.1.0" for example
+ while ('0' <= *q && *q <= '9')
+ nVersionMajor = nVersionMajor * 10 + *q++ - '0';
+ sal_Bool ATToolSupport = (sal_Bool) (nVersionMajor >= 4);
+#else
+ sal_Bool ATToolSupport = sal_False;
+#endif
+===========================================================================
+ End of commented out section
+*/ sal_Bool ATToolSupport = sal_False;
+
+ aPropInfoList[0].Name = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.VCL/Settings/Accessibility/EnableATToolSupport") );
+ aPropInfoList[0].Type = rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM( "string" ) );
+ aPropInfoList[0].Protected = sal_False;
+ aPropInfoList[0].Value = uno::makeAny( rtl::OUString::valueOf( ATToolSupport ) );
+
+ m_xLayerContentDescriber->describeLayer(xHandler, aPropInfoList);
+}
+
+//------------------------------------------------------------------------------
+
+rtl::OUString SAL_CALL KDEVCLLayer::getTimestamp(void)
+ throw (uno::RuntimeException)
+{
+ // Return the value as timestamp to avoid regenerating the binary cache
+ // on each office launch.
+
+ ::rtl::OUString sTimeStamp(
+ RTL_CONSTASCII_USTRINGPARAM( "FALSE" ) );
+
+ return sTimeStamp;
+}
diff --git a/shell/source/backends/kde4be/kde4vcllayer.hxx b/shell/source/backends/kde4be/kde4vcllayer.hxx
new file mode 100644
index 0000000..aeed4e6
--- /dev/null
+++ b/shell/source/backends/kde4be/kde4vcllayer.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>
+#include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
+#include <com/sun/star/util/XTimeStamped.hpp>
+
+#include <cppuhelper/implbase2.hxx>
+
+namespace css = com::sun::star ;
+namespace uno = css::uno ;
+namespace lang = css::lang ;
+namespace backend = css::configuration::backend ;
+namespace util = css::util ;
+
+/**
+ Implementation of the XLayer interface for the KDE values mapped into
+ the org.openoffice.VCL configuration component.
+ */
+class KDEVCLLayer : public cppu::WeakImplHelper2<backend::XLayer, util::XTimeStamped>
+{
+public :
+ /**
+ Constructor given the component context
+
+ @param xContext The component context
+ */
+
+ KDEVCLLayer(const uno::Reference<uno::XComponentContext>& xContext);
+
+ // XLayer
+ virtual void SAL_CALL readData(
+ const uno::Reference<backend::XLayerHandler>& xHandler)
+ throw ( backend::MalformedDataException,
+ lang::NullPointerException,
+ lang::WrappedTargetException,
+ uno::RuntimeException) ;
+
+ // XTimeStamped
+ virtual rtl::OUString SAL_CALL getTimestamp(void)
+ throw (uno::RuntimeException);
+
+ protected:
+
+ /** Destructor */
+ ~KDEVCLLayer(void) {}
+
+ private :
+ uno::Reference<backend::XLayerContentDescriber> m_xLayerContentDescriber ;
+};
diff --git a/shell/source/backends/kde4be/makefile.mk b/shell/source/backends/kde4be/makefile.mk
new file mode 100644
index 0000000..6f92762
--- /dev/null
+++ b/shell/source/backends/kde4be/makefile.mk
@@ -0,0 +1,94 @@
+#*************************************************************************
+#
+# 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.5 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..$/..$/..
+
+PRJNAME=shell
+TARGET=kde4be
+
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+COMP1TYPELIST=$(TARGET)
+COMPRDB=$(SOLARBINDIR)$/types.rdb
+UNOUCROUT=$(OUT)$/inc$/$(TARGET)
+INCPRE=$(UNOUCROUT)
+
+# --- Settings ---
+
+.INCLUDE : settings.mk
+
+# 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
+
+UNIXTEXT=$(MISC)/$(TARGET)1-ucd.txt
+
+# no "lib" prefix
+DLLPRE =
+
+.IF "$(ENABLE_KDE4)" == "TRUE"
+
+CFLAGS+=$(KDE4_CFLAGS)
+
+# --- Files ---
+
+SLOFILES=\
+ $(SLO)$/kde4backend.obj \
+ $(SLO)$/kde4commonlayer.obj \
+ $(SLO)$/kde4inetlayer.obj \
+ $(SLO)$/kde4vcllayer.obj \
+ $(SLO)$/kde4pathslayer.obj \
+ $(SLO)$/kde4becdef.obj
+
+SHL1NOCHECK=TRUE
+SHL1TARGET=$(TARGET)1.uno
+SHL1OBJS=$(SLOFILES)
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+
+SHL1IMPLIB=i$(SHL1TARGET)
+SHL1STDLIBS= \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB) \
+ $(KDE4_LIBS) -lkio
+
+SHL1VERSIONMAP=exports.map
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+
+.ENDIF
+
+# --- Targets ---
+
+.INCLUDE : target.mk
diff --git a/svx/source/cui/optgdlg.cxx b/svx/source/cui/optgdlg.cxx
index b4a642e..87add16 100644
--- a/svx/source/cui/optgdlg.cxx
+++ b/svx/source/cui/optgdlg.cxx
@@ -136,7 +136,6 @@ int OfaMiscTabPage::DeactivatePage( SfxItemSet* pSet_ )
return LEAVE_PAGE;
}
-# ifdef ENABLE_GTK
namespace
{
::rtl::OUString impl_SystemFileOpenServiceName()
@@ -146,13 +145,33 @@ namespace
if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "gnome" ) )
{
+ #ifdef ENABLE_GTK
return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.GtkFilePicker" );
+ #else
+ return rtl::OUString();
+ #endif
+ }
+ else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) )
+ {
+ #ifdef ENABLE_KDE4
+ return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.KDE4FilePicker" );
+ #else
+ return rtl::OUString();
+ #endif
}
else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde" ) )
{
+ #ifdef ENABLE_KDE
return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.KDEFilePicker" );
+ #else
+ return rtl::OUString();
+ #endif
}
+ #if defined WNT || (defined MACOSX && defined QUARTZ)
return ::rtl::OUString::createFromAscii( "com.sun.star.ui.dialogs.SystemFilePicker" );
+ #else
+ return rtl::OUString();
+ #endif
}
sal_Bool lcl_HasSystemFilePicker()
@@ -180,8 +199,6 @@ namespace
}
}
-#endif
-
// -----------------------------------------------------------------------
OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) :
@@ -210,20 +227,11 @@ OfaMiscTabPage::OfaMiscTabPage(Window* pParent, const SfxItemSet& rSet ) :
{
FreeResource();
- //system fileopen only available in Windows and with gtk vclplug based
- //picker and on MacOSX (aqua version)
-#if !defined( WNT ) && !defined( ENABLE_GTK ) && !(defined(MACOSX) && defined(QUARTZ))
- aFileDlgFL.Hide();
- aFileDlgCB.Hide();
-#else
-# ifdef ENABLE_GTK
if (!lcl_HasSystemFilePicker())
{
aFileDlgFL.Hide();
aFileDlgCB.Hide();
}
-# endif
-#endif
#if ! defined(QUARTZ)
aPrintDlgFL.Hide();
diff --git a/svx/util/makefile.pmk b/svx/util/makefile.pmk
index 27f185e..b2aae33 100644
--- a/svx/util/makefile.pmk
+++ b/svx/util/makefile.pmk
@@ -36,4 +36,12 @@ CDEFS += -DSVX_DLLIMPLEMENTATION
CFLAGS+=-DENABLE_GTK
.ENDIF
+.IF "$(ENABLE_KDE)" != ""
+CFLAGS+=-DENABLE_KDE
+.ENDIF
+
+.IF "$(ENABLE_KDE4)" != ""
+CFLAGS+=-DENABLE_KDE4
+.ENDIF
+
VISIBILITY_HIDDEN=TRUE
More information about the ooo-build-commit
mailing list