[Libreoffice-commits] .: 9 commits - bin/distro-install-file-lists cui/source fpicker/prj fpicker/source .gitignore postprocess/packcomponents scp2/source sfx2/inc sfx2/source vcl/AllLangResTarget_vcl.mk vcl/inc vcl/Library_vclplug_gtk3.mk vcl/Library_vclplug_gtk.mk vcl/source vcl/unx

Michael Meeks michael at kemper.freedesktop.org
Mon Nov 7 06:19:20 PST 2011


 .gitignore                                      |   17 
 bin/distro-install-file-lists                   |    3 
 cui/source/options/optgdlg.cxx                  |   25 
 fpicker/prj/build.lst                           |    3 
 fpicker/source/generic/fpicker.cxx              |  105 -
 fpicker/source/unx/gnome/FPServiceInfo.hxx      |   53 
 fpicker/source/unx/gnome/FPentry.cxx            |  141 -
 fpicker/source/unx/gnome/SalGtkFilePicker.cxx   | 2082 ------------------------
 fpicker/source/unx/gnome/SalGtkFilePicker.hxx   |  356 ----
 fpicker/source/unx/gnome/SalGtkFolderPicker.cxx |  253 --
 fpicker/source/unx/gnome/SalGtkFolderPicker.hxx |  127 -
 fpicker/source/unx/gnome/SalGtkPicker.cxx       |  313 ---
 fpicker/source/unx/gnome/SalGtkPicker.hxx       |  138 -
 fpicker/source/unx/gnome/eventnotification.hxx  |   54 
 fpicker/source/unx/gnome/fps_gnome.component    |   37 
 fpicker/source/unx/gnome/fps_gnome.xml          |   79 
 fpicker/source/unx/gnome/makefile.mk            |  106 -
 fpicker/source/unx/gnome/resourceprovider.cxx   |  229 --
 fpicker/source/unx/gnome/resourceprovider.hxx   |   69 
 postprocess/packcomponents/makefile.mk          |   11 
 scp2/source/ooo/file_library_ooo.scp            |   10 
 sfx2/inc/sfx2/filedlghelper.hxx                 |    1 
 sfx2/source/dialog/filedlghelper.cxx            |   10 
 vcl/AllLangResTarget_vcl.mk                     |    1 
 vcl/Library_vclplug_gtk.mk                      |    7 
 vcl/Library_vclplug_gtk3.mk                     |    4 
 vcl/inc/salinst.hxx                             |   14 
 vcl/inc/svdata.hxx                              |    2 
 vcl/inc/svids.hrc                               |   19 
 vcl/inc/unx/gtk/gtkframe.hxx                    |    5 
 vcl/inc/unx/gtk/gtkinst.hxx                     |    9 
 vcl/inc/vcl/svapp.hxx                           |   28 
 vcl/inc/vcl/window.hxx                          |    2 
 vcl/source/app/svapp.cxx                        |   21 
 vcl/source/src/fpicker.src                      |   92 +
 vcl/unx/gtk/a11y/atkutil.cxx                    |    3 
 vcl/unx/gtk/app/gtkinst.cxx                     |    2 
 vcl/unx/gtk/fpicker/FPServiceInfo.hxx           |   53 
 vcl/unx/gtk/fpicker/FPentry.cxx                 |  141 -
 vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx        |  203 --
 vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx        |   43 
 vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx      |   85 
 vcl/unx/gtk/fpicker/SalGtkFolderPicker.hxx      |   41 
 vcl/unx/gtk/fpicker/SalGtkPicker.cxx            |  106 -
 vcl/unx/gtk/fpicker/SalGtkPicker.hxx            |   25 
 vcl/unx/gtk/fpicker/fps_gnome.component         |   37 
 vcl/unx/gtk/fpicker/fps_gnome.xml               |   79 
 vcl/unx/gtk/fpicker/resourceprovider.cxx        |  210 --
 vcl/unx/gtk/fpicker/resourceprovider.hxx        |   69 
 vcl/unx/gtk/window/gtkframe.cxx                 |    4 
 vcl/unx/gtk3/app/gtk3fpicker.cxx                |   32 
 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx   |    3 
 52 files changed, 523 insertions(+), 5039 deletions(-)

New commits:
commit b123e4c42b2393ef359e0cc418961a4fa9ac5b36
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Mon Nov 7 14:17:02 2011 +0000

    gtk: fix issue with built-in file/folder picker settings

diff --git a/fpicker/source/generic/fpicker.cxx b/fpicker/source/generic/fpicker.cxx
index 845e775..5113018 100644
--- a/fpicker/source/generic/fpicker.cxx
+++ b/fpicker/source/generic/fpicker.cxx
@@ -85,9 +85,11 @@ static Reference< css::uno::XInterface > FilePicker_createInstance (
         return xResult;
 
     Reference< css::lang::XMultiComponentFactory > xFactory (rxContext->getServiceManager());
-    if (xFactory.is())
+    if (xFactory.is() && SvtMiscOptions().UseSystemFileDialog())
     {
-        if (SvtMiscOptions().UseSystemFileDialog())
+        xResult = Reference< css::uno::XInterface >( Application::createFilePicker( rxContext ) );
+
+        if (!xResult.is())
         {
             try
             {
@@ -102,8 +104,6 @@ static Reference< css::uno::XInterface > FilePicker_createInstance (
         }
     }
 
-    if (!xResult.is())
-        xResult = Reference< css::uno::XInterface >( Application::createFilePicker( rxContext ) );
 
     if (!xResult.is() && xFactory.is())
     {
@@ -162,9 +162,10 @@ static Reference< css::uno::XInterface > FolderPicker_createInstance (
         return xResult;
 
     Reference< css::lang::XMultiComponentFactory > xFactory (rxContext->getServiceManager());
-    if (xFactory.is())
+    if (xFactory.is() && SvtMiscOptions().UseSystemFileDialog())
     {
-        if (SvtMiscOptions().UseSystemFileDialog())
+        xResult = Reference< css::uno::XInterface >( Application::createFolderPicker( rxContext ) );
+        if (!xResult.is())
         {
             try
             {
@@ -178,8 +179,6 @@ static Reference< css::uno::XInterface > FolderPicker_createInstance (
             }
         }
     }
-    if (!xResult.is())
-        xResult = Reference< css::uno::XInterface >( Application::createFolderPicker( rxContext ) );
     if (!xResult.is() && xFactory.is() )
     {
         // Always fall back to OfficeFolderPicker.
commit 14f6de30ce3896704f06aa4259e6a0a2cc0895a8
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Mon Nov 7 14:04:58 2011 +0000

    gtk3: add run-time check for gtk >= 3.2.0

diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index 8068b22..4178b7e 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -153,7 +153,7 @@ extern "C"
             XInitThreads();
 
 #if GTK_CHECK_VERSION(3,0,0)
-        const gchar* pVersion = gtk_check_version( 3, 0, 0 );
+        const gchar* pVersion = gtk_check_version( 3, 2, 0 );
 #else
         const gchar* pVersion = gtk_check_version( 2, 2, 0 );
 #endif
commit 6de32a1afc947e71754f4266d5c167eccbc8f78b
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Mon Nov 7 14:01:16 2011 +0000

    gtk: cleanup resource provider and associated lifecycle issue

diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index e0a17d0..a527615 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -358,7 +358,7 @@ struct ImplSVData
     UnoWrapperBase*         mpUnoWrapper;
     Window*                 mpIntroWindow;      // the splash screen
     DockingManager*         mpDockingManager;
-    sal_Bool                    mbIsTestTool;
+    sal_Bool                mbIsTestTool;
 
     oslThreadIdentifier                     mnMainThreadId;
     rtl::Reference< vcl::DisplayConnection >            mxDisplayConnection;
diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index fb88175..8539316 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -56,7 +56,6 @@
 #include <set>
 #include <string.h>
 
-#include "gtk/fpicker/resourceprovider.hxx"
 #include "gtk/fpicker/SalGtkFilePicker.hxx"
 
 //------------------------------------------------------------------------
@@ -147,8 +146,7 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< uno::XComponentContext
         mbListVisibility[i] = false;
     }
 
-    CResourceProvider aResProvider;
-    OUString aFilePickerTitle = aResProvider.getResString( FILE_PICKER_TITLE_OPEN );
+    OUString aFilePickerTitle = getResString( FILE_PICKER_TITLE_OPEN );
 
     m_pDialog = gtk_file_chooser_dialog_new(
             OUStringToOString( aFilePickerTitle, RTL_TEXTENCODING_UTF8 ).getStr(),
@@ -182,7 +180,7 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< uno::XComponentContext
 
 #define LABEL_TOGGLE( elem ) \
         case elem : \
-            aLabel = aResProvider.getResString( CHECKBOX_##elem ); \
+            aLabel = getResString( CHECKBOX_##elem ); \
             setLabel( CHECKBOX_##elem, aLabel ); \
             break
 
@@ -222,7 +220,7 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< uno::XComponentContext
 
 #define LABEL_LIST( elem ) \
         case elem : \
-            aLabel = aResProvider.getResString( LISTBOX_##elem##_LABEL ); \
+            aLabel = getResString( LISTBOX_##elem##_LABEL ); \
             setLabel( LISTBOX_##elem##_LABEL, aLabel ); \
             break
 
@@ -244,7 +242,7 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< uno::XComponentContext
         gtk_box_pack_end( GTK_BOX( m_pVBox ), m_pHBoxs[i], sal_False, sal_False, 0 );
     }
 
-    aLabel = aResProvider.getResString( FILE_PICKER_FILE_TYPE );
+    aLabel = getResString( FILE_PICKER_FILE_TYPE );
     m_pFilterExpander = gtk_expander_new_with_mnemonic(
         OUStringToOString( aLabel, RTL_TEXTENCODING_UTF8 ).getStr());
 
@@ -1006,10 +1004,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
                         OString sFileName = unicodetouri( aPathSeq[0] );
                         if( g_file_test( g_filename_from_uri( sFileName.getStr(), NULL, NULL ), G_FILE_TEST_IS_REGULAR ) )
                         {
-                            CResourceProvider aResProvider;
                             GtkWidget *dlg;
-
-
                             INetURLObject aFileObj( sFileName );
 
                             OString baseName(
@@ -1024,7 +1019,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
                             );
                             OString aMsg(
                               OUStringToOString(
-                                aResProvider.getResString( FILE_PICKER_OVERWRITE ),
+                                getResString( FILE_PICKER_OVERWRITE ),
                                 RTL_TEXTENCODING_UTF8
                               )
                             );
@@ -1045,7 +1040,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
                             );
 
                             gtk_window_set_title( GTK_WINDOW( dlg ),
-                                OUStringToOString(aResProvider.getResString(FILE_PICKER_TITLE_SAVE ),
+                                OUStringToOString(getResString(FILE_PICKER_TITLE_SAVE ),
                                 RTL_TEXTENCODING_UTF8 ).getStr() );
 
                             RunDialog* pAnotherDialog = new RunDialog(dlg, xToolkit, xDesktop);
@@ -1486,8 +1481,7 @@ void SAL_CALL SalGtkFilePicker::setImage( sal_Int16 /*aImageFormat*/, const uno:
 
 void SalGtkFilePicker::implChangeType( GtkTreeSelection *selection )
 {
-    CResourceProvider aResProvider;
-    OUString aLabel = aResProvider.getResString( FILE_PICKER_FILE_TYPE );
+    OUString aLabel = getResString( FILE_PICKER_FILE_TYPE );
 
     GtkTreeIter iter;
     GtkTreeModel *model;
@@ -1734,8 +1728,7 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu
 
     if( GTK_FILE_CHOOSER_ACTION_SAVE == eAction )
     {
-        CResourceProvider aResProvider;
-        OUString aFilePickerTitle(aResProvider.getResString( FILE_PICKER_TITLE_SAVE ));
+        OUString aFilePickerTitle(getResString( FILE_PICKER_TITLE_SAVE ));
         gtk_window_set_title ( GTK_WINDOW( m_pDialog ),
             OUStringToOString( aFilePickerTitle, RTL_TEXTENCODING_UTF8 ).getStr() );
     }
@@ -1750,8 +1743,7 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu
 #ifdef GTK_STOCK_MEDIA_PLAY
             m_pButtons[ nTVIndex ] = gtk_dialog_add_button( GTK_DIALOG( m_pDialog ), GTK_STOCK_MEDIA_PLAY, 1 );
 #else
-            CResourceProvider aResProvider;
-            OString aPlay = OUStringToOString( aResProvider.getResString( PUSHBUTTON_PLAY ), RTL_TEXTENCODING_UTF8 );
+            OString aPlay = OUStringToOString( getResString( PUSHBUTTON_PLAY ), RTL_TEXTENCODING_UTF8 );
             m_pButtons[ nTVIndex ] = gtk_dialog_add_button( GTK_DIALOG( m_pDialog ), aPlay.getStr(), 1 );
 #endif
         }
@@ -1969,8 +1961,7 @@ void SalGtkFilePicker::SetFilters()
                     sAllFilter += OUString(sal_Unicode(';'));
                 sAllFilter += *aIter;
             }
-            CResourceProvider aResProvider;
-            sPseudoFilter = aResProvider.getResString(FILE_PICKER_ALLFORMATS);
+            sPseudoFilter = getResString(FILE_PICKER_ALLFORMATS);
             m_pPseudoFilter = implAddFilter( sPseudoFilter, sAllFilter );
         }
     }
diff --git a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
index f4e2476..e40101f 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
@@ -45,7 +45,6 @@
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
 #include "unx/gtk/gtkinst.hxx"
-#include "gtk/fpicker/resourceprovider.hxx"
 #include "gtk/fpicker/SalGtkFolderPicker.hxx"
 
 #include <string.h>
@@ -62,10 +61,8 @@ using namespace ::com::sun::star::uno;
 SalGtkFolderPicker::SalGtkFolderPicker( const uno::Reference< uno::XComponentContext >& xContext ) :
     SalGtkPicker( xContext )
 {
-    CResourceProvider aResProvider;
-
     m_pDialog = gtk_file_chooser_dialog_new(
-        OUStringToOString( aResProvider.getResString( FOLDERPICKER_TITLE ), RTL_TEXTENCODING_UTF8 ).getStr(),
+        OUStringToOString( getResString( FOLDERPICKER_TITLE ), RTL_TEXTENCODING_UTF8 ).getStr(),
         NULL, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
         GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, (char *)NULL );
 
diff --git a/vcl/unx/gtk/fpicker/SalGtkPicker.cxx b/vcl/unx/gtk/fpicker/SalGtkPicker.cxx
index 7146b99..dc951a5 100644
--- a/vcl/unx/gtk/fpicker/SalGtkPicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkPicker.cxx
@@ -57,10 +57,6 @@
 #include "unx/gtk/gtkframe.hxx"
 #include "gtk/fpicker/SalGtkPicker.hxx"
 
-//------------------------------------------------------------------------
-// namespace directives
-//------------------------------------------------------------------------
-
 using namespace ::rtl;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::lang;
@@ -203,29 +199,17 @@ void SalGtkPicker::setGtkLanguage()
     if (bSet)
         return;
 
-    OUString sUILocale;
-    try
-    {
-        uno::Reference<lang::XMultiComponentFactory> xConfigMgr(
-            createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider"))),
-            UNO_QUERY_THROW );
-
-        Sequence< Any > theArgs(1);
-        theArgs[ 0 ] <<= OUString(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Linguistic/General"));
-
-        uno::Reference< container::XNameAccess > xNameAccess =
-          uno::Reference< container::XNameAccess >(xConfigMgr->createInstanceWithArgumentsAndContext(
-                                                                                                                OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")), theArgs, m_xContext ), UNO_QUERY_THROW );
-
-        if (xNameAccess.is())
-            xNameAccess->getByName(OUString(RTL_CONSTASCII_USTRINGPARAM("UILocale"))) >>= sUILocale;
-    } catch (...) {}
+    ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
+    rtl::OUStringBuffer aBuffer;
+    aBuffer.append( aLocale.Language );
+    aBuffer.appendAscii( "_" );
+    aBuffer.append( aLocale.Country );
+    aBuffer.appendAscii( ".UTF-8" );
 
-    if (sUILocale.getLength())
+    if (aBuffer.getLength() > 8)
     {
-        sUILocale = sUILocale.replace('-', '_');
-        rtl::OUString envVar(RTL_CONSTASCII_USTRINGPARAM("LANGUAGE"));
-        osl_setEnvironment(envVar.pData, sUILocale.pData);
+        rtl::OUString envVar( RTL_CONSTASCII_USTRINGPARAM( "LANGUAGE" ) );
+        osl_setEnvironment( envVar.pData, aBuffer.makeStringAndClear().pData );
     }
     bSet = true;
 }
diff --git a/vcl/unx/gtk/fpicker/SalGtkPicker.hxx b/vcl/unx/gtk/fpicker/SalGtkPicker.hxx
index 760021d..a4fe68f 100644
--- a/vcl/unx/gtk/fpicker/SalGtkPicker.hxx
+++ b/vcl/unx/gtk/fpicker/SalGtkPicker.hxx
@@ -49,9 +49,13 @@
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
-//----------------------------------------------------------
-// class declaration
-//----------------------------------------------------------
+#define FOLDERPICKER_TITLE            500
+#define FOLDER_PICKER_DEF_DESCRIPTION 501
+#define FILE_PICKER_TITLE_OPEN        502
+#define FILE_PICKER_TITLE_SAVE        503
+#define FILE_PICKER_FILE_TYPE         504
+#define FILE_PICKER_OVERWRITE         505
+#define FILE_PICKER_ALLFORMATS        506
 
 class SalGtkPicker
 {
@@ -73,9 +77,11 @@ class SalGtkPicker
         rtl::OUString uritounicode(const gchar *pIn);
         rtl::OString unicodetouri(const rtl::OUString &rURL);
 
-        // to instanciate own services
+        // to instantiate own services
         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
         ::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > createInstance( const rtl::OUString &rName );
+
+        rtl::OUString getResString( sal_Int32 aId );
     private:
         void setGtkLanguage();
 };
diff --git a/vcl/unx/gtk/fpicker/resourceprovider.cxx b/vcl/unx/gtk/fpicker/resourceprovider.cxx
index 5d19d78..b12d4e1 100644
--- a/vcl/unx/gtk/fpicker/resourceprovider.cxx
+++ b/vcl/unx/gtk/fpicker/resourceprovider.cxx
@@ -27,7 +27,6 @@
  ************************************************************************/
 
 #include <osl/diagnose.h>
-#include "resourceprovider.hxx"
 #include <vcl/svapp.hxx>
 #include <tools/resmgr.hxx>
 #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
@@ -35,6 +34,7 @@
 
 #include "svids.hrc"
 #include "svdata.hxx"
+#include "gtk/fpicker/SalGtkPicker.hxx"
 
 using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds;
 using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds;
@@ -77,55 +77,19 @@ static sal_Int16 CtrlIdToResId( sal_Int32 aControlId )
     return -1;
 }
 
-class CResourceProvider_Impl
+rtl::OUString SalGtkPicker::getResString( sal_Int32 aId )
 {
-public:
-    CResourceProvider_Impl( )
+    rtl::OUString aResString;
+    try
     {
-        m_ResMgr = ImplGetResMgr();
+        // translate the control id to a resource id
+        sal_Int16 aResId = CtrlIdToResId( aId );
+        if ( aResId > -1 )
+            aResString = String( ResId( aResId, *ImplGetResMgr() ) );
     }
+    catch(...) { }
 
-    ~CResourceProvider_Impl( )
-    {
-        delete m_ResMgr;
-    }
-
-    rtl::OUString getResString( sal_Int16 aId )
-    {
-        OSL_ASSERT( m_ResMgr );
-
-        String aResString;
-        try
-        {
-            // translate the control id to a resource id
-            sal_Int16 aResId = CtrlIdToResId( aId );
-            if ( aResId > -1 )
-                aResString = String( ResId( aResId, *m_ResMgr ) );
-        }
-        catch(...)
-        {
-        }
-
-        return rtl::OUString( aResString );
-    }
-
-public:
-    ResMgr* m_ResMgr;
-};
-
-CResourceProvider::CResourceProvider( ) :
-    m_pImpl( new CResourceProvider_Impl() )
-{
-}
-
-CResourceProvider::~CResourceProvider( )
-{
-    delete m_pImpl;
-}
-
-rtl::OUString CResourceProvider::getResString( sal_Int32 aId )
-{
-   return m_pImpl->getResString( aId ).replace('~', '_');
+    return aResString.replace('~', '_');
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/fpicker/resourceprovider.hxx b/vcl/unx/gtk/fpicker/resourceprovider.hxx
deleted file mode 100644
index 5bbbbfd..0000000
--- a/vcl/unx/gtk/fpicker/resourceprovider.hxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#ifndef _RESOURCEPROVIDER_HXX_
-#define _RESOURCEPROVIDER_HXX_
-
-//------------------------------------------------------------------------
-// includes
-//------------------------------------------------------------------------
-
-#include <sal/types.h>
-
-#include <rtl/ustring.hxx>
-
-#define FOLDERPICKER_TITLE            500
-#define FOLDER_PICKER_DEF_DESCRIPTION 501
-#define FILE_PICKER_TITLE_OPEN        502
-#define FILE_PICKER_TITLE_SAVE        503
-#define FILE_PICKER_FILE_TYPE         504
-#define FILE_PICKER_OVERWRITE         505
-#define FILE_PICKER_ALLFORMATS        506
-
-//------------------------------------------------------------------------
-// deklarations
-//------------------------------------------------------------------------
-
-class CResourceProvider_Impl;
-
-class CResourceProvider
-{
-public:
-    CResourceProvider( );
-    ~CResourceProvider( );
-
-    rtl::OUString getResString( sal_Int32 aId );
-
-private:
-    CResourceProvider_Impl* m_pImpl;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 6aa51640706ca332e6439e6097cc81a2b1dbb275
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Fri Nov 4 22:32:52 2011 +0000

    gtk3: port file-picker, using more standard combobox APIs etc.

diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index 7ffcb69..fb88175 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -59,8 +59,6 @@
 #include "gtk/fpicker/resourceprovider.hxx"
 #include "gtk/fpicker/SalGtkFilePicker.hxx"
 
-#if !GTK_CHECK_VERSION(3,0,0)
-
 //------------------------------------------------------------------------
 // namespace directives
 //------------------------------------------------------------------------
@@ -211,7 +209,14 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< uno::XComponentContext
 
         m_pAligns[i] = gtk_alignment_new(0, 0, 0, 1);
 
-        m_pLists[i] = gtk_combo_box_new_text();
+        m_pListStores[i] = gtk_list_store_new (1, G_TYPE_STRING);
+        m_pLists[i] = gtk_combo_box_new_with_model(GTK_TREE_MODEL(m_pListStores[i]));
+        g_object_unref (m_pListStores[i]); // owned by the widget.
+        GtkCellRenderer *pCell = gtk_cell_renderer_text_new ();
+        gtk_cell_layout_pack_start(
+                GTK_CELL_LAYOUT(m_pLists[i]), pCell, TRUE);
+        gtk_cell_layout_set_attributes(
+            GTK_CELL_LAYOUT (m_pLists[i]), pCell, "text", 0, NULL);
 
         m_pListLabels[i] = gtk_label_new( "" );
 
@@ -497,8 +502,16 @@ dialog_remove_buttons( GtkDialog *pDialog )
 {
     g_return_if_fail( GTK_IS_DIALOG( pDialog ) );
 
+    GtkWidget *pActionArea;
+
+#if GTK_CHECK_VERSION(3,0,0)
+    pActionArea = gtk_dialog_get_action_area( pDialog );
+#else
+    pActionArea = pDialog->action_area;
+#endif
+
     GList *pChildren =
-        gtk_container_get_children( GTK_CONTAINER( pDialog->action_area ) );
+        gtk_container_get_children( GTK_CONTAINER( pActionArea ) );
 
     for( GList *p = pChildren; p; p = p->next )
         gtk_widget_destroy( GTK_WIDGET( p->data ) );
@@ -1136,14 +1149,20 @@ GtkWidget *SalGtkFilePicker::getWidget( sal_Int16 nControlId, GType *pType )
 //------------------------------------------------------------------------------------
 // XFilePickerControlAccess functions
 //------------------------------------------------------------------------------------
-namespace
+static void HackWidthToFirst(GtkComboBox *pWidget)
 {
-    void HackWidthToFirst(GtkComboBox *pWidget)
-    {
-        GtkRequisition requisition;
-        gtk_widget_size_request(GTK_WIDGET(pWidget), &requisition);
-        gtk_widget_set_size_request(GTK_WIDGET(pWidget), requisition.width, -1);
-    }
+    GtkRequisition requisition;
+    gtk_widget_size_request(GTK_WIDGET(pWidget), &requisition);
+    gtk_widget_set_size_request(GTK_WIDGET(pWidget), requisition.width, -1);
+}
+
+static void ComboBoxAppendText(GtkComboBox *pCombo, const rtl::OUString &rStr)
+{
+  GtkTreeIter aIter;
+  GtkListStore *pStore = GTK_LIST_STORE(gtk_combo_box_get_model(pCombo));
+  rtl::OString aStr = rtl::OUStringToOString(rStr, RTL_TEXTENCODING_UTF8);
+  gtk_list_store_append(pStore, &aIter);
+  gtk_list_store_set(pStore, &aIter, 0, aStr.getStr(), -1);
 }
 
 void SalGtkFilePicker::HandleSetListValue(GtkComboBox *pWidget, sal_Int16 nControlAction, const uno::Any& rValue)
@@ -1154,7 +1173,7 @@ void SalGtkFilePicker::HandleSetListValue(GtkComboBox *pWidget, sal_Int16 nContr
             {
                 OUString sItem;
                 rValue >>= sItem;
-                gtk_combo_box_append_text(pWidget, rtl::OUStringToOString(sItem, RTL_TEXTENCODING_UTF8).getStr());
+                ComboBoxAppendText(pWidget, sItem);
                 if (!bVersionWidthUnset)
                 {
                     HackWidthToFirst(pWidget);
@@ -1169,8 +1188,7 @@ void SalGtkFilePicker::HandleSetListValue(GtkComboBox *pWidget, sal_Int16 nContr
                 sal_Int32 nItemCount = aStringList.getLength();
                 for (sal_Int32 i = 0; i < nItemCount; ++i)
                 {
-                    gtk_combo_box_append_text(pWidget,
-                        rtl::OUStringToOString(aStringList[i], RTL_TEXTENCODING_UTF8).getStr());
+                    ComboBoxAppendText(pWidget,aStringList[i]);
                     if (!bVersionWidthUnset)
                     {
                         HackWidthToFirst(pWidget);
@@ -1183,22 +1201,20 @@ void SalGtkFilePicker::HandleSetListValue(GtkComboBox *pWidget, sal_Int16 nContr
             {
                 sal_Int32 nPos=0;
                 rValue >>= nPos;
-                gtk_combo_box_remove_text(pWidget, nPos);
+
+                GtkTreeIter aIter;
+                GtkListStore *pStore = GTK_LIST_STORE(
+                        gtk_combo_box_get_model(GTK_COMBO_BOX(pWidget)));
+                if(gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(pStore), &aIter, NULL, nPos))
+                    gtk_list_store_remove(pStore, &aIter);
             }
             break;
         case ControlActions::DELETE_ITEMS:
             {
                 gtk_combo_box_set_active(pWidget, -1);
-                gint nItems = 0;
-                do
-                {
-                        nItems =
-                                gtk_tree_model_iter_n_children(
-                                  gtk_combo_box_get_model(pWidget), NULL);
-                        for (gint nI = 0; nI < nItems; ++nI)
-                            gtk_combo_box_remove_text(pWidget, nI);
-                }
-                while (nItems);
+                GtkListStore *pStore = GTK_LIST_STORE(
+                        gtk_combo_box_get_model(GTK_COMBO_BOX(pWidget)));
+                gtk_list_store_clear(pStore);
             }
             break;
         case ControlActions::SET_SELECT_ITEM:
@@ -1587,7 +1603,7 @@ sal_Bool SAL_CALL SalGtkFilePicker::setShowState( sal_Bool bShowState ) throw( u
         }
 
         // also emit the signal
-        g_signal_emit_by_name( GTK_OBJECT( m_pDialog ), "update-preview" );
+        g_signal_emit_by_name( G_OBJECT( m_pDialog ), "update-preview" );
 
         mbPreviewState = bShowState;
     }
@@ -2018,23 +2034,15 @@ SalGtkFilePicker::~SalGtkFilePicker()
     gtk_widget_destroy( m_pVBox );
 }
 
-#endif
-
 using namespace ::com::sun::star;
 
 uno::Reference< ui::dialogs::XFilePicker2 >
 GtkInstance::createFilePicker( const com::sun::star::uno::Reference<
                                         com::sun::star::uno::XComponentContext > &xMSF )
 {
-#if GTK_CHECK_VERSION(3,0,0)
-    fprintf( stderr, "Create dummy gtk file picker\n" );
-    (void)xMSF;
-    return uno::Reference< ui::dialogs::XFilePicker2 >();
-#else
     fprintf( stderr, "Create gtk file picker\n" );
     return uno::Reference< ui::dialogs::XFilePicker2 >(
                 new SalGtkFilePicker( xMSF ) );
-#endif
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx
index aadff65..8d39e42 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.hxx
@@ -280,6 +280,7 @@ class SalGtkFilePicker :
         GtkWidget *m_pHBoxs[ LIST_LAST ];
         GtkWidget *m_pAligns[ LIST_LAST ];
         GtkWidget *m_pLists[ LIST_LAST ];
+        GtkListStore *m_pListStores[ LIST_LAST ];
         GtkWidget *m_pListLabels[ LIST_LAST ];
         bool mbListVisibility[ LIST_LAST ];
         bool mbButtonVisibility[ BUTTON_LAST ];
diff --git a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
index 07b6bb2..f4e2476 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
@@ -50,19 +50,12 @@
 
 #include <string.h>
 
-
-//------------------------------------------------------------------------
-// namespace directives
-//------------------------------------------------------------------------
-
 using namespace ::rtl;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::ui::dialogs;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::uno;
 
-#if !GTK_CHECK_VERSION(3,0,0)
-
 //-----------------------------------------------------------------------------------------
 // constructor
 //-----------------------------------------------------------------------------------------
@@ -133,8 +126,6 @@ void SAL_CALL SalGtkFolderPicker::setDescription( const rtl::OUString& rDescript
     ::rtl::OString aDescription = OUStringToOString( rDescription, RTL_TEXTENCODING_UTF8 );
 }
 
-
-
 //-----------------------------------------------------------------------------------------
 // XExecutableDialog functions
 //-----------------------------------------------------------------------------------------
@@ -186,7 +177,6 @@ sal_Int16 SAL_CALL SalGtkFolderPicker::execute() throw( uno::RuntimeException )
     return retVal;
 }
 
-
 //------------------------------------------------------------------------------------
 // XCancellable
 //------------------------------------------------------------------------------------
@@ -199,19 +189,13 @@ void SAL_CALL SalGtkFolderPicker::cancel() throw( uno::RuntimeException )
 
     // TODO m_pImpl->cancel();
 }
-#endif
 
 uno::Reference< ui::dialogs::XFolderPicker >
 GtkInstance::createFolderPicker( const uno::Reference< uno::XComponentContext > &xMSF )
 {
     fprintf( stderr, "Create gtk folder picker\n" );
-#if GTK_CHECK_VERSION(3,0,0)
-    (void)xMSF;
-    return uno::Reference< ui::dialogs::XFolderPicker >();
-#else
     return uno::Reference< ui::dialogs::XFolderPicker >(
                 new SalGtkFolderPicker( xMSF ) );
-#endif
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/gtk/fpicker/SalGtkPicker.cxx b/vcl/unx/gtk/fpicker/SalGtkPicker.cxx
index 0520f2a..7146b99 100644
--- a/vcl/unx/gtk/fpicker/SalGtkPicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkPicker.cxx
@@ -66,8 +66,6 @@ using namespace ::com::sun::star;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::uno;
 
-#if !GTK_CHECK_VERSION(3,0,0)
-
 rtl::OUString SalGtkPicker::uritounicode(const gchar* pIn)
 {
     if (!pIn)
@@ -92,7 +90,7 @@ rtl::OUString SalGtkPicker::uritounicode(const gchar* pIn)
         }
         else
         {
-            OUString aNewURL = Reference<uri::XExternalUriReferenceTranslator>(Reference<XMultiComponentFactory>(comphelper::getProcessServiceFactory(), UNO_QUERY_THROW)->createInstanceWithContext(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uri.ExternalUriReferenceTranslator")), m_xContext), UNO_QUERY_THROW)->translateToInternal(sURL);
+            OUString aNewURL = uno::Reference<uri::XExternalUriReferenceTranslator>(uno::Reference<XMultiComponentFactory>(comphelper::getProcessServiceFactory(), UNO_QUERY_THROW)->createInstanceWithContext(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uri.ExternalUriReferenceTranslator")), m_xContext), UNO_QUERY_THROW)->translateToInternal(sURL);
             if( aNewURL.getLength() )
                 sURL = aNewURL;
         }
@@ -108,7 +106,7 @@ rtl::OString SalGtkPicker::unicodetouri(const rtl::OUString &rURL)
     INetURLObject aURL(rURL);
     if (INET_PROT_FILE == aURL.GetProtocol())
     {
-        OUString aNewURL = Reference<uri::XExternalUriReferenceTranslator>(Reference<XMultiComponentFactory>(comphelper::getProcessServiceFactory(), UNO_QUERY_THROW)->createInstanceWithContext(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uri.ExternalUriReferenceTranslator")), m_xContext ), UNO_QUERY_THROW)->translateToExternal( rURL );
+        OUString aNewURL = uno::Reference<uri::XExternalUriReferenceTranslator>(uno::Reference<XMultiComponentFactory>(comphelper::getProcessServiceFactory(), UNO_QUERY_THROW)->createInstanceWithContext(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uri.ExternalUriReferenceTranslator")), m_xContext ), UNO_QUERY_THROW)->translateToExternal( rURL );
 
         if( aNewURL.getLength() )
         {
@@ -290,6 +288,4 @@ uno::Reference< uno::XInterface > SalGtkPicker::createInstance( const rtl::OUStr
     return m_xContext->getServiceManager()->createInstanceWithContext( rName, m_xContext );
 }
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit aeffd7f25f6bf664ee5536942bd48407447867f7
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Fri Nov 4 21:49:28 2011 +0000

    move required resources down from fpicker & svtools into vcl

diff --git a/vcl/AllLangResTarget_vcl.mk b/vcl/AllLangResTarget_vcl.mk
index b84b9aa..7534c26 100644
--- a/vcl/AllLangResTarget_vcl.mk
+++ b/vcl/AllLangResTarget_vcl.mk
@@ -49,6 +49,7 @@ $(eval $(call gb_SrsTarget_add_files,vcl/source/src,\
     vcl/source/src/print.src \
     vcl/source/src/stdtext.src \
     vcl/source/src/units.src \
+    vcl/source/src/fpicker.src \
 ))
 
 
diff --git a/vcl/inc/svids.hrc b/vcl/inc/svids.hrc
index bc76c70..dc16ab1 100644
--- a/vcl/inc/svids.hrc
+++ b/vcl/inc/svids.hrc
@@ -195,6 +195,25 @@
 #define SV_STDTEXT_ALLFILETYPES             10207
 #define SV_STDTEXT_LAST                     SV_STDTEXT_ALLFILETYPES
 
+#define STR_FPICKER_AUTO_EXTENSION                10300
+#define STR_FPICKER_PASSWORD                      10301
+#define STR_FPICKER_FILTER_OPTIONS                10302
+#define STR_FPICKER_READONLY                      10303
+#define STR_FPICKER_INSERT_AS_LINK                10304
+#define STR_FPICKER_SHOW_PREVIEW                  10305
+#define STR_FPICKER_PLAY                          10306
+#define STR_FPICKER_VERSION                       10307
+#define STR_FPICKER_TEMPLATES                     10308
+#define STR_FPICKER_IMAGE_TEMPLATE                10309
+#define STR_FPICKER_SELECTION                     10310
+#define STR_FPICKER_FOLDER_DEFAULT_TITLE          10311
+#define STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION    10312
+#define STR_FPICKER_ALREADYEXISTOVERWRITE         10313
+#define STR_FPICKER_ALLFORMATS                    10314
+#define STR_FPICKER_OPEN                          10315
+#define STR_FPICKER_SAVE                          10316
+#define STR_FPICKER_TYPE                          10317
+
 #define SV_ACCESSERROR_FIRST                SV_ACCESSERROR_WRONG_VERSION
 #define SV_ACCESSERROR_WRONG_VERSION        10500
 #define SV_ACCESSERROR_BRIDGE_MSG           10501
diff --git a/vcl/source/src/fpicker.src b/vcl/source/src/fpicker.src
new file mode 100644
index 0000000..ce66044
--- /dev/null
+++ b/vcl/source/src/fpicker.src
@@ -0,0 +1,92 @@
+#include <svids.hrc>
+
+String STR_FPICKER_AUTO_EXTENSION
+{
+    Text [ en-US ] = "~Automatic file name extension" ;
+};
+
+String STR_FPICKER_PASSWORD
+{
+    Text [ en-US ] = "Save with pass~word" ;
+};
+
+String STR_FPICKER_FILTER_OPTIONS
+{
+    Text [ en-US ] = "~Edit filter settings";
+};
+
+String STR_FPICKER_READONLY
+{
+    Text [ en-US ] = "~Read-only" ;
+};
+
+String STR_FPICKER_INSERT_AS_LINK
+{
+    Text [ en-US ] = "~Link" ;
+};
+
+String STR_FPICKER_SHOW_PREVIEW
+{
+    Text [ en-US ] = "Pr~eview" ;
+};
+
+String STR_FPICKER_PLAY
+{
+    Text [ en-US ] = "~Play" ;
+};
+
+String STR_FPICKER_VERSION
+{
+    Text [ en-US ] = "~Version:";
+};
+
+String STR_FPICKER_TEMPLATES
+{
+    Text [ en-US ] = "S~tyles:" ;
+};
+
+String STR_FPICKER_IMAGE_TEMPLATE
+{
+    Text [ en-US ] = "Style:";
+};
+
+String STR_FPICKER_SELECTION
+{
+    Text [ en-US ] = "~Selection" ;
+};
+
+String STR_FPICKER_FOLDER_DEFAULT_TITLE
+{
+    Text [ en-US ] = "Select Path" ;
+};
+
+String STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION
+{
+    Text [ en-US ] = "Please select a folder.";
+};
+
+String STR_FPICKER_ALREADYEXISTOVERWRITE
+{
+    Text [ en-US ] = "A file named \"$filename$\" already exists.\n\nDo you want to replace it?" ;
+};
+
+String STR_FPICKER_ALLFORMATS
+{
+    Text [ en-US ] = "All Formats" ;
+};
+
+String STR_FPICKER_OPEN
+{
+    Text [ en-US ] = "Open" ;
+};
+
+String STR_FPICKER_SAVE
+{
+    Text [ en-US ] = "Save" ;
+};
+
+String STR_FPICKER_TYPE
+{
+    Text [ en-US ] = "File ~type" ;
+};
+
diff --git a/vcl/unx/gtk/fpicker/resourceprovider.cxx b/vcl/unx/gtk/fpicker/resourceprovider.cxx
index 70a3e68..5d19d78 100644
--- a/vcl/unx/gtk/fpicker/resourceprovider.cxx
+++ b/vcl/unx/gtk/fpicker/resourceprovider.cxx
@@ -26,199 +26,104 @@
  *
  ************************************************************************/
 
-//------------------------------------------------------------------------
-// includes
-//------------------------------------------------------------------------
 #include <osl/diagnose.h>
-#include <rtl/ustrbuf.hxx>
 #include "resourceprovider.hxx"
-#include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
 #include <tools/resmgr.hxx>
 #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
 
-#include <svtools/svtools.hrc>
-#include <svtools/filedlg2.hrc>
+#include "svids.hrc"
+#include "svdata.hxx"
 
-//------------------------------------------------------------
-// namespace directives
-//------------------------------------------------------------
-
-using rtl::OUString;
 using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds;
 using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds;
 
-//------------------------------------------------------------
-//
-//------------------------------------------------------------
-
-static const char* RES_NAME = "fps_office";
-static const char* OTHER_RES_NAME = "svt";
-
-//------------------------------------------------------------
-// we have to translate control ids to resource ids
-//------------------------------------------------------------
-
-struct _Entry
+//---------------------------------------
+// translate control ids to resource ids
+//---------------------------------------
+static const struct
 {
     sal_Int32 ctrlId;
     sal_Int16 resId;
+} CtrlIdToResIdTable[] = {
+    { CHECKBOX_AUTOEXTENSION,                   STR_FPICKER_AUTO_EXTENSION },
+    { CHECKBOX_PASSWORD,                        STR_FPICKER_PASSWORD },
+    { CHECKBOX_FILTEROPTIONS,                   STR_FPICKER_FILTER_OPTIONS },
+    { CHECKBOX_READONLY,                        STR_FPICKER_READONLY },
+    { CHECKBOX_LINK,                            STR_FPICKER_INSERT_AS_LINK },
+    { CHECKBOX_PREVIEW,                         STR_FPICKER_SHOW_PREVIEW },
+    { PUSHBUTTON_PLAY,                          STR_FPICKER_PLAY },
+    { LISTBOX_VERSION_LABEL,                    STR_FPICKER_VERSION },
+    { LISTBOX_TEMPLATE_LABEL,                   STR_FPICKER_TEMPLATES },
+    { LISTBOX_IMAGE_TEMPLATE_LABEL,             STR_FPICKER_IMAGE_TEMPLATE },
+    { CHECKBOX_SELECTION,                       STR_FPICKER_SELECTION },
+    { FOLDERPICKER_TITLE,                       STR_FPICKER_FOLDER_DEFAULT_TITLE },
+    { FOLDER_PICKER_DEF_DESCRIPTION,            STR_FPICKER_FOLDER_DEFAULT_DESCRIPTION },
+    { FILE_PICKER_OVERWRITE,                    STR_FPICKER_ALREADYEXISTOVERWRITE },
+    { FILE_PICKER_ALLFORMATS,                   STR_FPICKER_ALLFORMATS },
+    { FILE_PICKER_TITLE_OPEN,                   STR_FPICKER_OPEN },
+    { FILE_PICKER_TITLE_SAVE,                   STR_FPICKER_SAVE },
+    { FILE_PICKER_FILE_TYPE,                    STR_FPICKER_TYPE }
 };
 
-_Entry CtrlIdToResIdTable[] = {
-    { CHECKBOX_AUTOEXTENSION,                   STR_SVT_FILEPICKER_AUTO_EXTENSION },
-    { CHECKBOX_PASSWORD,                        STR_SVT_FILEPICKER_PASSWORD },
-    { CHECKBOX_FILTEROPTIONS,                   STR_SVT_FILEPICKER_FILTER_OPTIONS },
-    { CHECKBOX_READONLY,                        STR_SVT_FILEPICKER_READONLY },
-    { CHECKBOX_LINK,                            STR_SVT_FILEPICKER_INSERT_AS_LINK },
-    { CHECKBOX_PREVIEW,                         STR_SVT_FILEPICKER_SHOW_PREVIEW },
-    { PUSHBUTTON_PLAY,                          STR_SVT_FILEPICKER_PLAY },
-    { LISTBOX_VERSION_LABEL,                    STR_SVT_FILEPICKER_VERSION },
-    { LISTBOX_TEMPLATE_LABEL,                   STR_SVT_FILEPICKER_TEMPLATES },
-    { LISTBOX_IMAGE_TEMPLATE_LABEL,             STR_SVT_FILEPICKER_IMAGE_TEMPLATE },
-    { CHECKBOX_SELECTION,                       STR_SVT_FILEPICKER_SELECTION },
-    { FOLDERPICKER_TITLE,                       STR_SVT_FOLDERPICKER_DEFAULT_TITLE },
-    { FOLDER_PICKER_DEF_DESCRIPTION,            STR_SVT_FOLDERPICKER_DEFAULT_DESCRIPTION },
-    { FILE_PICKER_OVERWRITE,                    STR_SVT_ALREADYEXISTOVERWRITE },
-    { FILE_PICKER_ALLFORMATS,                   STR_SVT_ALLFORMATS }
-};
-
-_Entry OtherCtrlIdToResIdTable[] = {
-    { FILE_PICKER_TITLE_OPEN,                   STR_FILEDLG_OPEN },
-    { FILE_PICKER_TITLE_SAVE,                   STR_FILEDLG_SAVE },
-    { FILE_PICKER_FILE_TYPE,                    STR_FILEDLG_TYPE },
-};
-
-
-const sal_Int32 SIZE_TABLE = SAL_N_ELEMENTS( CtrlIdToResIdTable );
-const sal_Int32 OTHER_SIZE_TABLE = SAL_N_ELEMENTS( OtherCtrlIdToResIdTable );
-
-//------------------------------------------------------------
-//
-//------------------------------------------------------------
-
-sal_Int16 CtrlIdToResId( sal_Int32 aControlId )
+static sal_Int16 CtrlIdToResId( sal_Int32 aControlId )
 {
-    sal_Int16 aResId = -1;
-
-    for ( sal_Int32 i = 0; i < SIZE_TABLE; i++ )
+    for ( size_t i = 0; i < SAL_N_ELEMENTS( CtrlIdToResIdTable ); i++ )
     {
         if ( CtrlIdToResIdTable[i].ctrlId == aControlId )
-        {
-            aResId = CtrlIdToResIdTable[i].resId;
-            break;
-        }
+            return CtrlIdToResIdTable[i].resId;
     }
-
-    return aResId;
+    return -1;
 }
 
-sal_Int16 OtherCtrlIdToResId( sal_Int32 aControlId )
-{
-    sal_Int16 aResId = -1;
-
-    for ( sal_Int32 i = 0; i < OTHER_SIZE_TABLE; i++ )
-    {
-        if ( OtherCtrlIdToResIdTable[i].ctrlId == aControlId )
-        {
-            aResId = OtherCtrlIdToResIdTable[i].resId;
-            break;
-        }
-    }
-
-    return aResId;
-}
-
-//------------------------------------------------------------
-//
-//------------------------------------------------------------
-
 class CResourceProvider_Impl
 {
 public:
-
-    //-------------------------------------
-    //
-    //-------------------------------------
-
     CResourceProvider_Impl( )
     {
-        m_ResMgr = ResMgr::CreateResMgr( RES_NAME );
-        m_OtherResMgr = ResMgr::CreateResMgr( OTHER_RES_NAME );
+        m_ResMgr = ImplGetResMgr();
     }
 
-    //-------------------------------------
-    //
-    //-------------------------------------
-
     ~CResourceProvider_Impl( )
     {
         delete m_ResMgr;
-        delete m_OtherResMgr;
     }
 
-    //-------------------------------------
-    //
-    //-------------------------------------
-
-    OUString getResString( sal_Int16 aId )
+    rtl::OUString getResString( sal_Int16 aId )
     {
-        String   aResString;
-        OUString aResOUString;
+        OSL_ASSERT( m_ResMgr );
 
+        String aResString;
         try
         {
-            OSL_ASSERT( m_ResMgr && m_OtherResMgr );
-
             // translate the control id to a resource id
             sal_Int16 aResId = CtrlIdToResId( aId );
             if ( aResId > -1 )
                 aResString = String( ResId( aResId, *m_ResMgr ) );
-        else
-        {
-                aResId = OtherCtrlIdToResId( aId );
-                if ( aResId > -1 )
-                    aResString = String( ResId( aResId, *m_OtherResMgr ) );
-        }
-        if ( aResId > -1 )
-                aResOUString = OUString( aResString );
         }
         catch(...)
         {
         }
 
-        return aResOUString;
+        return rtl::OUString( aResString );
     }
 
 public:
     ResMgr* m_ResMgr;
-    ResMgr* m_OtherResMgr;
 };
 
-//------------------------------------------------------------
-//
-//------------------------------------------------------------
-
 CResourceProvider::CResourceProvider( ) :
     m_pImpl( new CResourceProvider_Impl() )
 {
 }
 
-//------------------------------------------------------------
-//
-//------------------------------------------------------------
-
 CResourceProvider::~CResourceProvider( )
 {
     delete m_pImpl;
 }
 
-//------------------------------------------------------------
-//
-//------------------------------------------------------------
-
-OUString CResourceProvider::getResString( sal_Int32 aId )
+rtl::OUString CResourceProvider::getResString( sal_Int32 aId )
 {
    return m_pImpl->getResString( aId ).replace('~', '_');
 }
commit ea9915a550707dace8aaf8a5aab6c1c88918e8d5
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Fri Nov 4 21:10:42 2011 +0000

    hush more kinds of file types

diff --git a/.gitignore b/.gitignore
index e102c36..a97b2d3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
 # backup and temporary files
 *~
 .*.sw[op]
+\#*
 
 # python generated file
 *.pyc
@@ -58,6 +59,14 @@
 /bin/repo-list
 /src.downloaded
 /ooo.lst
+/intltool-extract.in
+/intltool-merge.in
+/intltool-update.in
+/NEWS
+/TODO
+/README
+/AUTHORS
+/MAINTAINERS
 
 # misc
 /file-lists
@@ -76,6 +85,7 @@
 /tags
 /docs
 /autogen.save
+TAGS
 
 /*/*.exe
 
@@ -106,5 +116,10 @@ test/user-template/user/psprint/pspfontcache
 # libxslt debug memdump
 .memdump
 
-#LibreOffice lock files
+# LibreOffice lock files
 .~lock.*#
+
+# Everyone loves patching
+*.patch
+*.orig
+*.rej
commit f1abe3035cc237609dc4d20f3dd9c6e2484ef7a8
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Fri Nov 4 21:04:18 2011 +0000

    gtk: cleanup to make the vcl file-picker interface work.

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index e08dcc7..72355b7 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -124,20 +124,11 @@ int OfaMiscTabPage::DeactivatePage( SfxItemSet* pSet_ )
 
 namespace
 {
-        ::rtl::OUString impl_SystemFileOpenServiceName()
+        static ::rtl::OUString impl_SystemFileOpenServiceName()
         {
-            const ::rtl::OUString &rDesktopEnvironment =
-                Application::GetDesktopEnvironment();
+            const ::rtl::OUString &rDesktopEnvironment = Application::GetDesktopEnvironment();
 
-            if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "gnome" ) )
-            {
-                #ifdef ENABLE_GTK
-                return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.GtkFilePicker") );
-                #else
-                return rtl::OUString();
-                #endif
-            }
-            else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) )
+            if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) )
             {
                 #ifdef ENABLE_KDE4
                 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.KDE4FilePicker") );
@@ -162,10 +153,14 @@ namespace
             #endif
         }
 
-        sal_Bool lcl_HasSystemFilePicker()
+        static bool lcl_HasSystemFilePicker()
         {
+            if( Application::hasNativeFileSelection() )
+                return true;
+
+            // Otherwise fall-back on querying services
+            bool bRet = false;
             Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
-            sal_Bool bRet = sal_False;
 
             Reference< XContentEnumerationAccess > xEnumAccess( xFactory, UNO_QUERY );
             Reference< XSet > xSet( xFactory, UNO_QUERY );
@@ -178,7 +173,7 @@ namespace
                 ::rtl::OUString aFileService = impl_SystemFileOpenServiceName();
                 Reference< XEnumeration > xEnum = xEnumAccess->createContentEnumeration( aFileService );
                 if ( xEnum.is() && xEnum->hasMoreElements() )
-                    bRet = sal_True;
+                    bRet = true;
             }
             catch (const IllegalArgumentException&)
             {
diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx
index 291897d..2157590 100644
--- a/sfx2/inc/sfx2/filedlghelper.hxx
+++ b/sfx2/inc/sfx2/filedlghelper.hxx
@@ -99,7 +99,6 @@ class Window;
 
 #define FILE_OPEN_SERVICE_NAME      "com.sun.star.ui.dialogs.FilePicker"
 #define FOLDER_PICKER_SERVICE_NAME  "com.sun.star.ui.dialogs.FolderPicker"
-#define FILE_OPEN_SERVICE_NAME_SYSTEM "com.sun.star.ui.dialogs.SystemFilePicker"
 #define FILE_OPEN_SERVICE_NAME_OOO   "com.sun.star.ui.dialogs.OfficeFilePicker"
 
 //-----------------------------------------------------------------------------
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 0a64768..56b0868 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -842,21 +842,21 @@ ErrCode FileDialogHelper_Impl::getGraphic( Graphic& rGraphic ) const
 }
 
 // ------------------------------------------------------------------------
-sal_Bool lcl_isSystemFilePicker( const uno::Reference< XFilePicker >& _rxFP )
+static bool lcl_isSystemFilePicker( const uno::Reference< XFilePicker >& _rxFP )
 {
     try
     {
         uno::Reference< XServiceInfo > xSI( _rxFP, UNO_QUERY );
-        if ( xSI.is() && xSI->supportsService( DEFINE_CONST_OUSTRING( "com.sun.star.ui.dialogs.SystemFilePicker" ) ) )
-            return sal_True;
+        if ( !xSI.is() )
+            return true;
+        return xSI->supportsService( DEFINE_CONST_OUSTRING( "com.sun.star.ui.dialogs.SystemFilePicker" ) );
     }
     catch( const Exception& )
     {
     }
-    return sal_False;
+    return false;
 }
 
-
 // ------------------------------------------------------------------------
 // -----------      FileDialogHelper_Impl       ---------------------------
 // ------------------------------------------------------------------------
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index e503fb4..67affdb 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -170,6 +170,8 @@ public:
     virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget();
     virtual void        AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType) = 0;
 
+    virtual bool hasNativeFileSelection() const { return false; }
+
     virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFilePicker2 >
         createFilePicker( const com::sun::star::uno::Reference<
                               com::sun::star::uno::XComponentContext >& )
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 55a1879..8b937a3 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -109,6 +109,8 @@ public:
 
     virtual GenPspGraphics     *CreatePrintGraphics();
 
+    virtual bool hasNativeFileSelection() const { return true; }
+
     virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFilePicker2 >
         createFilePicker( const com::sun::star::uno::Reference<
                               com::sun::star::uno::XComponentContext >& );
diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx
index 951f817..07782df 100644
--- a/vcl/inc/vcl/svapp.hxx
+++ b/vcl/inc/vcl/svapp.hxx
@@ -373,6 +373,10 @@ public:
     */
     static void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType);
 
+    /** Do we have a native / system file selector available ?
+     */
+    static bool hasNativeFileSelection();
+
     /** Create a platform specific file picker, if one is available,
         otherwise return an empty reference
     */
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index e144851..e23192c 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1895,6 +1895,12 @@ void Application::AppEvent( const ApplicationEvent& /*rAppEvent*/ )
 {
 }
 
+bool Application::hasNativeFileSelection()
+{
+    ImplSVData* pSVData = ImplGetSVData();
+    return pSVData->mpDefInst->hasNativeFileSelection();
+}
+
 Reference< ui::dialogs::XFilePicker2 >
 Application::createFilePicker( const Reference< uno::XComponentContext >& xSM )
 {
diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index b7caa0a..7ffcb69 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -972,7 +972,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
         UNO_QUERY_THROW );
 
     uno::Reference< frame::XDesktop > xDesktop(
-        createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")) ),
+        createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ),
         UNO_QUERY_THROW );
 
     RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit, xDesktop);
diff --git a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
index 923a7fe..07b6bb2 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
@@ -206,6 +206,7 @@ GtkInstance::createFolderPicker( const uno::Reference< uno::XComponentContext >
 {
     fprintf( stderr, "Create gtk folder picker\n" );
 #if GTK_CHECK_VERSION(3,0,0)
+    (void)xMSF;
     return uno::Reference< ui::dialogs::XFolderPicker >();
 #else
     return uno::Reference< ui::dialogs::XFolderPicker >(
commit 17084c750df84e0da377d716a4088f72bd25f972
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Fri Nov 4 14:40:18 2011 +0000

    gtk: move the file-picker into vcl/ and add Application:: factory hooks
    
    drop un-necessary uno service related fluff, and component instantiation.
    nominal move to XMultiComponentFactory from XMultiServiceFactory
    Include fpicker in compilation for gtk3, but more work required here
    Simplify setting up transient parents for picker dialogs

diff --git a/bin/distro-install-file-lists b/bin/distro-install-file-lists
index b233030..eaabf9c 100755
--- a/bin/distro-install-file-lists
+++ b/bin/distro-install-file-lists
@@ -220,7 +220,6 @@ if test "z$OOO_VENDOR" != "zDebian" ; then
     # gnome subpackage
     test -f $DESTDIR/gid_Module_Optional_Gnome && cp $DESTDIR/gid_Module_Optional_Gnome gnome_list.txt || :
     mv_file_between_flists gnome_list.txt common_list.txt $INSTALLDIR/basis$PRODUCTVERSION/program/libevoab2.so
-    mv_file_between_flists gnome_list.txt common_list.txt $INSTALLDIR/basis$PRODUCTVERSION/program/fps_gnome.uno.so
     mv_file_between_flists gnome_list.txt common_list.txt $INSTALLDIR/basis$PRODUCTVERSION/program/libvclplug_gtk[0-9]*l..so
     mv_file_between_flists common_list.txt gnome_list.txt $INSTALLDIR/basis$PRODUCTVERSION/program/ucpgvfs1.uno.so
     add_used_directories gnome_list.txt common_list.txt
@@ -341,9 +340,7 @@ if test "z$OOO_VENDOR" != "zDebian" ; then
 
         # Put gtk/gnome stuff into gnome package
         mv_file_between_flists gnome_list.txt core_list.txt $INSTALLDIR/basis$PRODUCTVERSION/program/gnome-open-url.bin
-        mv_file_between_flists gnome_list.txt core_list.txt $INSTALLDIR/basis$PRODUCTVERSION/program/fps_gnome.uno.so
         mv_file_between_flists gnome_list.txt core_list.txt $INSTALLDIR/basis$PRODUCTVERSION/program/ucpgvfs1.uno.so
-        mv_file_between_flists gnome_list.txt core_list.txt $INSTALLDIR/basis$PRODUCTVERSION/program/libeggtray680li.so
 
         # Ship ooqstart for gnome in gnome package
         mv_file_between_flists gnome_list.txt core_list.txt "$INSTALLDIR/program/libqstart_gtk680.*"
diff --git a/fpicker/prj/build.lst b/fpicker/prj/build.lst
index 114a301..4e74e59 100644
--- a/fpicker/prj/build.lst
+++ b/fpicker/prj/build.lst
@@ -3,7 +3,6 @@ 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\odma				nmake	-	w	fp_odma 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\unx\kde_unx			nmake	-	u	fp_unx_common fp_inc NULL
 fp	fpicker\source\unx\kde				nmake	-	u	fp_unx_kde_filepicker fp_inc NULL
@@ -11,4 +10,4 @@ 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
 fp  fpicker\source\win32\misc			nmake	-	w	fp_win32_misc fp_win32_filepicker.w fp_win32_folderpicker.w fp_inc NULL
-fp	fpicker\util				nmake	-	all	fp_util fp_gnome_filepicker.u fp_unx_common.u fp_unx_kde_filepicker.u fp_win32_filepicker.w fp_win32_misc.w fp_win32_folderpicker.w NULL
+fp	fpicker\util				nmake	-	all	fp_util fp_unx_common.u fp_unx_kde_filepicker.u fp_win32_filepicker.w fp_win32_misc.w fp_win32_folderpicker.w NULL
diff --git a/fpicker/source/generic/fpicker.cxx b/fpicker/source/generic/fpicker.cxx
index 1444fde..845e775 100644
--- a/fpicker/source/generic/fpicker.cxx
+++ b/fpicker/source/generic/fpicker.cxx
@@ -59,9 +59,7 @@ static OUString FilePicker_getSystemPickerServiceName()
 {
 #ifdef UNX
     OUString aDesktopEnvironment (Application::GetDesktopEnvironment());
-    if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("gnome"))
-        return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.GtkFilePicker"));
-    else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("kde"))
+    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"));
@@ -82,38 +80,43 @@ static Reference< css::uno::XInterface > FilePicker_createInstance (
     Reference< css::uno::XComponentContext > const & rxContext)
 {
     Reference< css::uno::XInterface > xResult;
-    if (rxContext.is())
+
+    if (!rxContext.is())
+        return xResult;
+
+    Reference< css::lang::XMultiComponentFactory > xFactory (rxContext->getServiceManager());
+    if (xFactory.is())
     {
-        Reference< css::lang::XMultiComponentFactory > xFactory (rxContext->getServiceManager());
-        if (xFactory.is())
+        if (SvtMiscOptions().UseSystemFileDialog())
         {
-            if (SvtMiscOptions().UseSystemFileDialog())
+            try
             {
-                try
-                {
-                    xResult = xFactory->createInstanceWithContext (
+                xResult = xFactory->createInstanceWithContext (
                         FilePicker_getSystemPickerServiceName(),
                         rxContext);
-                }
-                catch (css::uno::Exception const &)
-                {
-                    // Handled below (see @ fallback).
-                }
-            }
-            if (!xResult.is())
-            {
-                // Always fall back to OfficeFilePicker.
-                xResult = xFactory->createInstanceWithContext (
-                    OUString (RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.OfficeFilePicker")),
-                    rxContext);
             }
-            if (xResult.is())
+            catch (css::uno::Exception const &)
             {
-                // Add to FilePicker history.
-                svt::addFilePicker (xResult);
+                // Handled below (see @ fallback).
             }
         }
     }
+
+    if (!xResult.is())
+        xResult = Reference< css::uno::XInterface >( Application::createFilePicker( rxContext ) );
+
+    if (!xResult.is() && xFactory.is())
+    {
+        // Always fall back to OfficeFilePicker.
+        xResult = xFactory->createInstanceWithContext (
+                OUString (RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.OfficeFilePicker")),
+                rxContext);
+    }
+    if (xResult.is())
+    {
+        // Add to FilePicker history.
+        svt::addFilePicker (xResult);
+    }
     return xResult;
 }
 
@@ -137,9 +140,7 @@ static OUString FolderPicker_getSystemPickerServiceName()
 {
     OUString aDesktopEnvironment (Application::GetDesktopEnvironment());
 #ifdef UNX
-    if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("gnome"))
-        return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.GtkFolderPicker"));
-    else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("kde"))
+    if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("kde"))
         return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.KDEFolderPicker"));
     else if (aDesktopEnvironment.equalsIgnoreAsciiCaseAscii ("macosx"))
         return OUString (RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.ui.dialogs.AquaFolderPicker"));
@@ -156,38 +157,41 @@ static Reference< css::uno::XInterface > FolderPicker_createInstance (
     Reference< css::uno::XComponentContext > const & rxContext)
 {
     Reference< css::uno::XInterface > xResult;
-    if (rxContext.is())
+
+    if (!rxContext.is())
+        return xResult;
+
+    Reference< css::lang::XMultiComponentFactory > xFactory (rxContext->getServiceManager());
+    if (xFactory.is())
     {
-        Reference< css::lang::XMultiComponentFactory > xFactory (rxContext->getServiceManager());
-        if (xFactory.is())
+        if (SvtMiscOptions().UseSystemFileDialog())
         {
-            if (SvtMiscOptions().UseSystemFileDialog())
-            {
-                try
-                {
-                    xResult = xFactory->createInstanceWithContext (
-                        FolderPicker_getSystemPickerServiceName(),
-                        rxContext);
-                }
-                catch (css::uno::Exception const &)
-                {
-                    // Handled below (see @ fallback).
-                }
-            }
-            if (!xResult.is())
+            try
             {
-                // Always fall back to OfficeFolderPicker.
                 xResult = xFactory->createInstanceWithContext (
-                    OUString (RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.OfficeFolderPicker")),
-                    rxContext);
+                                FolderPicker_getSystemPickerServiceName(),
+                                rxContext);
             }
-            if (xResult.is())
+            catch (css::uno::Exception const &)
             {
-                // Add to FolderPicker history.
-                svt::addFolderPicker (xResult);
+                // Handled below (see @ fallback).
             }
         }
     }
+    if (!xResult.is())
+        xResult = Reference< css::uno::XInterface >( Application::createFolderPicker( rxContext ) );
+    if (!xResult.is() && xFactory.is() )
+    {
+        // Always fall back to OfficeFolderPicker.
+        xResult = xFactory->createInstanceWithContext (
+                OUString (RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.OfficeFolderPicker")),
+                rxContext);
+    }
+    if (xResult.is())
+    {
+        // Add to FolderPicker history.
+        svt::addFolderPicker (xResult);
+    }
     return xResult;
 }
 
diff --git a/fpicker/source/unx/gnome/FPServiceInfo.hxx b/fpicker/source/unx/gnome/FPServiceInfo.hxx
deleted file mode 100644
index c0352af..0000000
--- a/fpicker/source/unx/gnome/FPServiceInfo.hxx
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _FPSERVICEINFO_HXX_
-#define _FPSERVICEINFO_HXX_
-
-//------------------------------------------------------------------------
-// defines
-//------------------------------------------------------------------------
-
-// the service names
-#define FILE_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.GtkFilePicker"
-#define FOLDER_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.GtkFolderPicker"
-
-// the implementation names
-#define FILE_PICKER_IMPL_NAME    "com.sun.star.ui.dialogs.SalGtkFilePicker"
-#define FOLDER_PICKER_IMPL_NAME    "com.sun.star.ui.dialogs.SalGtkFolderPicker"
-
-// 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.SalGtkFilePicker/UNO/SERVICES/com.sun.star.ui.dialogs.GtkFilePicker"
-#define FOLDER_PICKER_REGKEY_NAME  "/com.sun.star.ui.dialogs.SalGtkFolderPicker/UNO/SERVICES/com.sun.star.ui.dialogs.GtkFolderPicker"
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/fpicker/source/unx/gnome/FPentry.cxx b/fpicker/source/unx/gnome/FPentry.cxx
deleted file mode 100644
index 0ea7fb4..0000000
--- a/fpicker/source/unx/gnome/FPentry.cxx
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_fpicker.hxx"
-
-#ifdef AIX
-#define _LINUX_SOURCE_COMPAT
-#include <sys/timer.h>
-#undef _LINUX_SOURCE_COMPAT
-#endif
-
-//----------------------------------------------
-//  includes of other projects
-//----------------------------------------------
-#include <cppuhelper/factory.hxx>
-#include <osl/diagnose.h>
-#include "SalGtkFilePicker.hxx"
-#include "SalGtkFolderPicker.hxx"
-#include "FPServiceInfo.hxx"
-
-#include <glib-object.h>
-
-extern      const guint gtk_major_version;
-extern      const guint gtk_minor_version;
-
-//-----------------------------------------------
-// namespace directives
-//-----------------------------------------------
-
-using namespace ::rtl;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
-using namespace ::cppu;
-using ::com::sun::star::ui::dialogs::XFilePicker2;
-using ::com::sun::star::ui::dialogs::XFolderPicker;
-
-//------------------------------------------------
-//
-//------------------------------------------------
-
-static Reference< XInterface > SAL_CALL createFileInstance(
-    const Reference< XMultiServiceFactory >& rServiceManager )
-{
-    return Reference< XInterface >(
-        static_cast< XFilePicker2* >(
-            new SalGtkFilePicker( rServiceManager ) ) );
-}
-
-static Reference< XInterface > SAL_CALL createFolderInstance(
-    const Reference< XMultiServiceFactory >& rServiceManager )
-{
-    return Reference< XInterface >(
-        static_cast< XFolderPicker* >(
-            new SalGtkFolderPicker( rServiceManager ) ) );
-}
-
-extern "C"
-{
-
-SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
-    const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* /*pRegistryKey*/ )
-{
-    void* pRet = 0;
-
-    if( pSrvManager )
-    {
-            if (
-                 /* crude gtkplug check */ !g_type_from_name( "GdkDisplay" ) ||
-                 /* old version */ !( gtk_major_version >= 2 && gtk_minor_version >= 4 )
-               )
-            {
-                    return 0;
-            }
-
-            Reference< XSingleServiceFactory > xFactory;
-
-            if (0 == rtl_str_compare(pImplName, FILE_PICKER_IMPL_NAME))
-            {
-                Sequence< OUString > aSNS( 1 );
-                aSNS.getArray( )[0] =
-                    OUString(RTL_CONSTASCII_USTRINGPARAM(FILE_PICKER_SERVICE_NAME));
-
-                xFactory = createSingleFactory(
-                    reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
-                    OUString::createFromAscii( pImplName ),
-                    createFileInstance,
-                    aSNS );
-            }
-            else if (0 == rtl_str_compare(pImplName, FOLDER_PICKER_IMPL_NAME))
-            {
-                Sequence< OUString > aSNS( 1 );
-                aSNS.getArray( )[0] =
-                    OUString(RTL_CONSTASCII_USTRINGPARAM(FOLDER_PICKER_SERVICE_NAME));
-
-                xFactory = createSingleFactory(
-                    reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
-                    OUString::createFromAscii( pImplName ),
-                    createFolderInstance,
-                    aSNS );
-            }
-
-            if ( xFactory.is() )
-            {
-                xFactory->acquire();
-                pRet = xFactory.get();
-            }
-    }
-
-    return pRet;
-}
-
-} // extern "C"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx b/fpicker/source/unx/gnome/SalGtkFilePicker.cxx
deleted file mode 100644
index 1cac989..0000000
--- a/fpicker/source/unx/gnome/SalGtkFilePicker.cxx
+++ /dev/null
@@ -1,2082 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_fpicker.hxx"
-
-#ifdef AIX
-#define _LINUX_SOURCE_COMPAT
-#include <sys/timer.h>
-#undef _LINUX_SOURCE_COMPAT
-#endif
-
-//------------------------------------------------------------------------
-// includes
-//------------------------------------------------------------------------
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
-#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
-#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
-#include <osl/diagnose.h>
-#include <osl/process.h>
-#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-#include <com/sun/star/ui/dialogs/ControlActions.hpp>
-#include <com/sun/star/uno/Any.hxx>
-#include <FPServiceInfo.hxx>
-#include <osl/mutex.hxx>
-#include <SalGtkFilePicker.hxx>
-
-#include <vcl/svapp.hxx>
-
-#include <tools/string.hxx>
-#include <tools/urlobj.hxx>
-
-#include <algorithm>
-#include <set>
-#include <string.h>
-#include "resourceprovider.hxx"
-
-//------------------------------------------------------------------------
-// namespace directives
-//------------------------------------------------------------------------
-
-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(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ));
-        aRet[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.SystemFilePicker" ));
-        aRet[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.GtkFilePicker" ));
-        return aRet;
-    }
-}
-
-//-----------------------------------------------------------------------------------------
-// constructor
-//-----------------------------------------------------------------------------------------
-
-static void expandexpanders(GtkContainer *pWidget)
-{
-    GList *pChildren = gtk_container_get_children(pWidget);
-    for( GList *p = pChildren; p; p = p->next )
-    {
-        if GTK_IS_CONTAINER(GTK_WIDGET(p->data))
-            expandexpanders(GTK_CONTAINER(GTK_WIDGET(p->data)));
-        if GTK_IS_EXPANDER(GTK_WIDGET(p->data))
-            gtk_expander_set_expanded(GTK_EXPANDER(GTK_WIDGET(p->data)), sal_True);
-    }
-    g_list_free(pChildren);
-}
-
-void SalGtkFilePicker::dialog_mapped_cb(GtkWidget *, SalGtkFilePicker *pobjFP)
-{
-    pobjFP->InitialMapping();
-}
-
-void SalGtkFilePicker::InitialMapping()
-{
-    if (!mbPreviewState )
-    {
-        gtk_widget_hide( m_pPreview );
-        gtk_file_chooser_set_preview_widget_active( GTK_FILE_CHOOSER( m_pDialog ), false);
-    }
-    gtk_widget_set_size_request (m_pPreview, -1, -1);
-}
-
-SalGtkFilePicker::SalGtkFilePicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr ) :
-    SalGtkPicker(xServiceMgr),
-    cppu::WeakComponentImplHelper10<
-        XFilterManager,
-            XFilterGroupManager,
-            XFilePickerControlAccess,
-        XFilePickerNotifier,
-            XFilePreview,
-            XFilePicker2,
-        lang::XInitialization,
-        util::XCancellable,
-        lang::XEventListener,
-        lang::XServiceInfo>( m_rbHelperMtx ),
-    m_xServiceMgr( xServiceMgr ),
-    m_pFilterList( NULL ),
-    m_pVBox ( NULL ),
-    mnHID_FolderChange( 0 ),
-    mnHID_SelectionChange( 0 ),
-    bVersionWidthUnset( false ),
-    mbPreviewState( sal_False ),
-    mHID_Preview( 0 ),
-    m_pPreview( NULL ),
-    m_pPseudoFilter( NULL ),
-    m_PreviewImageWidth( 256 ),
-    m_PreviewImageHeight( 256 )
-{
-    int i;
-
-    for( i = 0; i < TOGGLE_LAST; i++ )
-    {
-        m_pToggles[i] = NULL;
-        mbToggleVisibility[i] = false;
-    }
-
-    for( i = 0; i < BUTTON_LAST; i++ )
-    {
-        m_pButtons[i] = NULL;
-        mbButtonVisibility[i] = false;
-    }
-
-    for( i = 0; i < LIST_LAST; i++ )
-    {
-        m_pHBoxs[i] = NULL;
-        m_pAligns[i] = NULL;
-        m_pLists[i] = NULL;
-        m_pListLabels[i] = NULL;
-        mbListVisibility[i] = false;
-    }
-
-    CResourceProvider aResProvider;
-    OUString aFilePickerTitle = aResProvider.getResString( FILE_PICKER_TITLE_OPEN );
-
-    m_pDialog = gtk_file_chooser_dialog_new(
-            OUStringToOString( aFilePickerTitle, RTL_TEXTENCODING_UTF8 ).getStr(),
-            NULL,
-            GTK_FILE_CHOOSER_ACTION_OPEN,
-            GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-            GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
-            (char *)NULL );
-
-    gtk_dialog_set_default_response( GTK_DIALOG (m_pDialog), GTK_RESPONSE_ACCEPT );
-
-    gtk_file_chooser_set_local_only( GTK_FILE_CHOOSER( m_pDialog ), sal_False );
-    gtk_file_chooser_set_select_multiple( GTK_FILE_CHOOSER( m_pDialog ), sal_False );
-
-    m_pVBox = gtk_vbox_new( sal_False, 0 );
-
-    // We don't want clickable items to have a huge hit-area
-    GtkWidget *pHBox = gtk_hbox_new( sal_False, 0 );
-    GtkWidget *pThinVBox = gtk_vbox_new( sal_False, 0 );
-
-    gtk_box_pack_end (GTK_BOX( m_pVBox ), pHBox, sal_False, sal_False, 0);
-    gtk_box_pack_start (GTK_BOX( pHBox ), pThinVBox, sal_False, sal_False, 0);
-    gtk_widget_show( pHBox );
-    gtk_widget_show( pThinVBox );
-
-    OUString aLabel;
-
-    for( i = 0; i < TOGGLE_LAST; i++ )
-    {
-        m_pToggles[i] = gtk_check_button_new();
-
-#define LABEL_TOGGLE( elem ) \
-        case elem : \
-            aLabel = aResProvider.getResString( CHECKBOX_##elem ); \
-            setLabel( CHECKBOX_##elem, aLabel ); \
-            break
-
-          switch( i ) {
-
-        LABEL_TOGGLE( AUTOEXTENSION );
-        LABEL_TOGGLE( PASSWORD );
-        LABEL_TOGGLE( FILTEROPTIONS );
-        LABEL_TOGGLE( READONLY );
-        LABEL_TOGGLE( LINK );
-        LABEL_TOGGLE( PREVIEW );
-        LABEL_TOGGLE( SELECTION );
-            default:
-                OSL_TRACE("Handle unknown control %d", i);
-                break;
-        }
-
-        gtk_box_pack_end( GTK_BOX( pThinVBox ), m_pToggles[i], sal_False, sal_False, 0 );
-    }
-
-    for( i = 0; i < LIST_LAST; i++ )
-    {
-        m_pHBoxs[i] = gtk_hbox_new( sal_False, 0 );
-
-        m_pAligns[i] = gtk_alignment_new(0, 0, 0, 1);
-
-        m_pLists[i] = gtk_combo_box_new_text();
-
-        m_pListLabels[i] = gtk_label_new( "" );
-
-#define LABEL_LIST( elem ) \
-        case elem : \
-            aLabel = aResProvider.getResString( LISTBOX_##elem##_LABEL ); \
-            setLabel( LISTBOX_##elem##_LABEL, aLabel ); \
-            break
-
-          switch( i )
-        {
-            LABEL_LIST( VERSION );
-            LABEL_LIST( TEMPLATE );
-            LABEL_LIST( IMAGE_TEMPLATE );
-            default:
-                OSL_TRACE("Handle unknown control %d", i);
-                break;
-        }
-
-        gtk_container_add( GTK_CONTAINER( m_pAligns[i]), m_pLists[i] );
-        gtk_box_pack_end( GTK_BOX( m_pHBoxs[i] ), m_pAligns[i], sal_False, sal_False, 0 );
-
-        gtk_box_pack_end( GTK_BOX( m_pHBoxs[i] ), m_pListLabels[i], sal_False, sal_False, 0 );
-
-        gtk_box_pack_end( GTK_BOX( m_pVBox ), m_pHBoxs[i], sal_False, sal_False, 0 );
-    }
-
-    aLabel = aResProvider.getResString( FILE_PICKER_FILE_TYPE );
-    m_pFilterExpander = gtk_expander_new_with_mnemonic(
-        OUStringToOString( aLabel, RTL_TEXTENCODING_UTF8 ).getStr());
-
-    gtk_box_pack_end( GTK_BOX( m_pVBox ), m_pFilterExpander, sal_False, sal_True, 0 );
-
-    GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);
-    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
-        GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-    gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
-        GTK_SHADOW_IN);
-    gtk_container_add (GTK_CONTAINER (m_pFilterExpander), scrolled_window);
-    gtk_widget_show (scrolled_window);
-
-    rtl::OString sExpand(getenv("SAL_EXPANDFPICKER"));
-    sal_Int32 nExpand  = sExpand.toInt32();
-    switch (nExpand)
-    {
-        default:
-        case 0:
-            break;
-        case 1:
-            gtk_expander_set_expanded(GTK_EXPANDER(m_pFilterExpander), sal_True);
-            break;
-        case 2:
-            expandexpanders(GTK_CONTAINER(m_pDialog));
-            gtk_expander_set_expanded(GTK_EXPANDER(m_pFilterExpander), sal_True);
-            break;
-    }
-
-    m_pFilterStore = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING,
-        G_TYPE_STRING, G_TYPE_STRING);
-    m_pFilterView = gtk_tree_view_new_with_model (GTK_TREE_MODEL(m_pFilterStore));
-    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(m_pFilterView), false);
-    gtk_tree_view_set_rules_hint (GTK_TREE_VIEW(m_pFilterView), true);
-
-    GtkTreeViewColumn *column;
-    GtkCellRenderer *cell;
-
-    for (i = 0; i < 2; ++i)
-    {
-        column = gtk_tree_view_column_new ();
-        cell = gtk_cell_renderer_text_new ();
-        gtk_tree_view_column_set_expand (column, sal_True);
-        gtk_tree_view_column_pack_start (column, cell, sal_False);
-        gtk_tree_view_column_set_attributes (column, cell, "text", i, (char *)NULL);
-        gtk_tree_view_append_column (GTK_TREE_VIEW(m_pFilterView), column);
-    }
-
-    gtk_container_add (GTK_CONTAINER (scrolled_window), m_pFilterView);
-    gtk_widget_show (m_pFilterView);
-
-    gtk_file_chooser_set_extra_widget( GTK_FILE_CHOOSER( m_pDialog ), m_pVBox );
-
-    m_pPreview = gtk_image_new();
-    gtk_file_chooser_set_preview_widget( GTK_FILE_CHOOSER( m_pDialog ), m_pPreview );
-
-    g_signal_connect( G_OBJECT( m_pToggles[PREVIEW] ), "toggled",
-                      G_CALLBACK( preview_toggled_cb ), this );
-    g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW(m_pFilterView)), "changed",
-                      G_CALLBACK ( type_changed_cb ), this);
-    g_signal_connect( G_OBJECT( m_pDialog ), "notify::filter",
-                      G_CALLBACK( filter_changed_cb ), this);
-    g_signal_connect( G_OBJECT( m_pFilterExpander ), "activate",
-                      G_CALLBACK( expander_changed_cb ), this);
-    g_signal_connect (G_OBJECT( m_pDialog ), "map",
-                      G_CALLBACK (dialog_mapped_cb), this);
-
-    gtk_widget_show( m_pVBox );
-
-    PangoLayout  *layout = gtk_widget_create_pango_layout (m_pFilterView, NULL);
-    guint ypad;
-    PangoRectangle row_height;
-    pango_layout_set_markup (layout, "All Files", -1);
-    pango_layout_get_pixel_extents (layout, NULL, &row_height);
-    g_object_get (cell, "ypad", &ypad, (char *)NULL);
-    guint height = (row_height.height + 2*ypad) * 5;
-    gtk_widget_set_size_request (m_pFilterView, -1, height);
-    gtk_widget_set_size_request (m_pPreview, 1, height);
-
-    gtk_file_chooser_set_preview_widget_active( GTK_FILE_CHOOSER( m_pDialog ), true);
-}
-
-//------------------------------------------------------------------------------------
-// XFilePickerNotifier
-//------------------------------------------------------------------------------------
-
-void SAL_CALL SalGtkFilePicker::addFilePickerListener( const uno::Reference<XFilePickerListener>& xListener )
-    throw( uno::RuntimeException )
-{
-    SolarMutexGuard g;
-
-    OSL_ENSURE(!m_xListener.is(),
-            "SalGtkFilePicker only talks with one listener at a time...");
-    m_xListener = xListener;
-}
-
-void SAL_CALL SalGtkFilePicker::removeFilePickerListener( const uno::Reference<XFilePickerListener>& )
-    throw( uno::RuntimeException )
-{
-    SolarMutexGuard g;
-
-    m_xListener.clear();
-}
-
-// -------------------------------------------------
-// XEventListener
-// -------------------------------------------------
-
-void SAL_CALL SalGtkFilePicker::disposing( const lang::EventObject& aEvent ) throw( uno::RuntimeException )
-{
-    // no member access => no mutex needed
-
-    uno::Reference<XFilePickerListener> xFilePickerListener( aEvent.Source, ::com::sun::star::uno::UNO_QUERY );
-
-    if( xFilePickerListener.is() )
-        removeFilePickerListener( xFilePickerListener );
-}
-
-//-----------------------------------------------------------------------------------------
-// FilePicker Event functions
-//-----------------------------------------------------------------------------------------
-
-void SalGtkFilePicker::impl_fileSelectionChanged( FilePickerEvent aEvent )
-{
-    OSL_TRACE( "file selection changed");
-    if (m_xListener.is()) m_xListener->fileSelectionChanged( aEvent );
-}
-
-void SalGtkFilePicker::impl_directoryChanged( FilePickerEvent aEvent )
-{
-    OSL_TRACE("directory changed");
-    if (m_xListener.is()) m_xListener->directoryChanged( aEvent );
-}
-
-void SalGtkFilePicker::impl_controlStateChanged( FilePickerEvent aEvent )
-{
-    OSL_TRACE("control state changed");
-    if (m_xListener.is()) m_xListener->controlStateChanged( aEvent );
-}
-
-//=====================================================================
-
-struct FilterEntry
-{
-protected:
-    ::rtl::OUString     m_sTitle;
-    ::rtl::OUString     m_sFilter;
-
-    UnoFilterList       m_aSubFilters;
-
-public:
-    FilterEntry( const ::rtl::OUString& _rTitle, const ::rtl::OUString& _rFilter )
-        :m_sTitle( _rTitle )
-        ,m_sFilter( _rFilter )
-    {
-    }
-
-    FilterEntry( const ::rtl::OUString& _rTitle, const UnoFilterList& _rSubFilters );
-
-    ::rtl::OUString     getTitle() const { return m_sTitle; }
-    ::rtl::OUString     getFilter() const { return m_sFilter; }
-
-    /// determines if the filter has sub filter (i.e., the filter is a filter group in real)
-    sal_Bool        hasSubFilters( ) const;
-
-    /** retrieves the filters belonging to the entry
-    @return
-        the number of sub filters
-    */
-    sal_Int32       getSubFilters( UnoFilterList& _rSubFilterList );
-
-    // helpers for iterating the sub filters
-    const UnoFilterEntry*   beginSubFilters() const { return m_aSubFilters.getConstArray(); }
-    const UnoFilterEntry*   endSubFilters() const { return m_aSubFilters.getConstArray() + m_aSubFilters.getLength(); }
-};
-
-//=====================================================================
-
-//---------------------------------------------------------------------
-FilterEntry::FilterEntry( const ::rtl::OUString& _rTitle, const UnoFilterList& _rSubFilters )
-    :m_sTitle( _rTitle )
-    ,m_aSubFilters( _rSubFilters )
-{
-}
-
-//---------------------------------------------------------------------
-sal_Bool FilterEntry::hasSubFilters() const
-{
-    return( 0 < m_aSubFilters.getLength() );
-}
-
-//---------------------------------------------------------------------
-sal_Int32 FilterEntry::getSubFilters( UnoFilterList& _rSubFilterList )
-{
-    _rSubFilterList = m_aSubFilters;
-    return m_aSubFilters.getLength();
-}
-
-static bool
-isFilterString( const rtl::OUString &rFilterString, const char *pMatch )
-{
-        sal_Int32 nIndex = 0;
-        rtl::OUString aToken;
-        bool bIsFilter = true;
-
-        rtl::OUString aMatch(rtl::OUString::createFromAscii(pMatch));
-
-        do
-        {
-            aToken = rFilterString.getToken( 0, ';', nIndex );
-            if( !aToken.match( aMatch ) )
-            {
-                bIsFilter = false;
-                break;
-            }
-        }
-        while( nIndex >= 0 );
-
-        return bIsFilter;
-}
-
-static rtl::OUString
-shrinkFilterName( const rtl::OUString &rFilterName, bool bAllowNoStar = false )
-{
-    int i;
-    int nBracketLen = -1;
-    int nBracketEnd = -1;
-    const sal_Unicode *pStr = rFilterName.getStr();
-    OUString aRealName = rFilterName;
-
-    for( i = aRealName.getLength() - 1; i > 0; i-- )
-    {
-        if( pStr[i] == ')' )
-            nBracketEnd = i;
-        else if( pStr[i] == '(' )
-        {
-            nBracketLen = nBracketEnd - i;
-            if( nBracketEnd <= 0 )
-                continue;
-            if( isFilterString( rFilterName.copy( i + 1, nBracketLen - 1 ), "*." ) )
-                aRealName = aRealName.replaceAt( i, nBracketLen + 1, rtl::OUString() );
-            else if (bAllowNoStar)
-            {
-                if( isFilterString( rFilterName.copy( i + 1, nBracketLen - 1 ), ".") )
-                    aRealName = aRealName.replaceAt( i, nBracketLen + 1, rtl::OUString() );
-            }
-        }
-    }
-
-    return aRealName;
-}
-
-static void
-dialog_remove_buttons( GtkDialog *pDialog )
-{
-    g_return_if_fail( GTK_IS_DIALOG( pDialog ) );
-
-    GList *pChildren =
-        gtk_container_get_children( GTK_CONTAINER( pDialog->action_area ) );
-
-    for( GList *p = pChildren; p; p = p->next )
-        gtk_widget_destroy( GTK_WIDGET( p->data ) );
-
-    g_list_free( pChildren );
-}
-
-//------------------------------------------------------------------------------------
-namespace {
-    //................................................................................
-    struct FilterTitleMatch : public ::std::unary_function< FilterEntry, bool >
-    {
-    protected:
-        const ::rtl::OUString& rTitle;
-
-    public:
-        FilterTitleMatch( const ::rtl::OUString& _rTitle ) : rTitle( _rTitle ) { }
-
-        //............................................................................
-        bool operator () ( const FilterEntry& _rEntry )
-        {
-            sal_Bool bMatch;
-            if( !_rEntry.hasSubFilters() )
-                // a real filter
-                bMatch = ( _rEntry.getTitle() == rTitle );
-            else
-                // a filter group -> search the sub filters
-                bMatch =
-                    _rEntry.endSubFilters() != ::std::find_if(
-                        _rEntry.beginSubFilters(),
-                        _rEntry.endSubFilters(),
-                        *this
-                    );
-
-            return bMatch ? true : false;
-        }
-        bool operator () ( const UnoFilterEntry& _rEntry )
-        {
-            OUString aShrunkName = shrinkFilterName( _rEntry.First );
-            return aShrunkName == rTitle ? true : false;
-        }
-    };
-}
-
-
-//------------------------------------------------------------------------------------
-sal_Bool SalGtkFilePicker::FilterNameExists( const ::rtl::OUString& rTitle )
-{
-    sal_Bool bRet = sal_False;
-
-    if( m_pFilterList )
-        bRet =
-            m_pFilterList->end() != ::std::find_if(
-                m_pFilterList->begin(),
-                m_pFilterList->end(),
-                FilterTitleMatch( rTitle )
-            );
-
-    return bRet;
-}
-
-//------------------------------------------------------------------------------------
-sal_Bool SalGtkFilePicker::FilterNameExists( const UnoFilterList& _rGroupedFilters )
-{
-    sal_Bool bRet = sal_False;
-
-    if( m_pFilterList )
-    {
-        const UnoFilterEntry* pStart = _rGroupedFilters.getConstArray();
-        const UnoFilterEntry* pEnd = pStart + _rGroupedFilters.getLength();
-        for( ; pStart != pEnd; ++pStart )
-            if( m_pFilterList->end() != ::std::find_if(
-                        m_pFilterList->begin(),
-                        m_pFilterList->end(),
-                        FilterTitleMatch( pStart->First ) ) )
-                break;
-
-        bRet = pStart != pEnd;
-    }
-
-    return bRet;
-}
-
-//------------------------------------------------------------------------------------
-void SalGtkFilePicker::ensureFilterList( const ::rtl::OUString& _rInitialCurrentFilter )
-{
-    if( !m_pFilterList )
-    {
-        m_pFilterList = new FilterList;
-
-        // set the first filter to the current filter
-        if ( !m_aCurrentFilter.getLength() )
-            m_aCurrentFilter = _rInitialCurrentFilter;
-    }
-}
-
-
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-
-void SAL_CALL SalGtkFilePicker::appendFilter( const rtl::OUString& aTitle, const rtl::OUString& aFilter )
-    throw( lang::IllegalArgumentException, uno::RuntimeException )
-{
-    SolarMutexGuard g;
-
-    OSL_ASSERT( m_pDialog != NULL );
-
-    if( FilterNameExists( aTitle ) )
-            throw IllegalArgumentException();
-
-    // ensure that we have a filter list
-    ensureFilterList( aTitle );
-
-    // append the filter
-    m_pFilterList->insert( m_pFilterList->end(), FilterEntry( aTitle, aFilter ) );
-}
-
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-
-void SAL_CALL SalGtkFilePicker::setCurrentFilter( const rtl::OUString& aTitle )
-    throw( lang::IllegalArgumentException, uno::RuntimeException )
-{
-    SolarMutexGuard g;
-
-    OSL_ASSERT( m_pDialog != NULL );
-
-    OSL_TRACE( "Setting current filter to %s\n",
-        OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ).getStr() );
-
-    if( aTitle != m_aCurrentFilter )
-    {
-        m_aCurrentFilter = aTitle;
-        SetCurFilter( m_aCurrentFilter );
-        OSL_TRACE( "REALLY Setting current filter to %s\n",
-            OUStringToOString( aTitle, RTL_TEXTENCODING_UTF8 ).getStr() );
-
-    }
-
-    // TODO m_pImpl->setCurrentFilter( aTitle );
-}
-
-//-----------------------------------------------------------------------------------------
-//
-//-----------------------------------------------------------------------------------------
-
-void SalGtkFilePicker::updateCurrentFilterFromName(const gchar* filtername)
-{
-    OUString aFilterName(filtername, strlen(filtername), RTL_TEXTENCODING_UTF8);
-    FilterList::iterator aEnd = m_pFilterList->end();
-    for (FilterList::iterator aIter = m_pFilterList->begin(); aIter != aEnd; ++aIter)
-    {
-        if (aFilterName == shrinkFilterName( aIter->getTitle()))
-        {
-            m_aCurrentFilter = aIter->getTitle();
-            break;
-        }
-    }
-}
-
-void SalGtkFilePicker::UpdateFilterfromUI()
-{
-    // Update the filtername from the users selection if they have had a chance to do so.
-    // If the user explicitly sets a type then use that, if not then take the implicit type
-    // from the filter of the files glob on which he is currently searching
-    if (!mnHID_FolderChange || !mnHID_SelectionChange)
-        return;
-
-    GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(m_pFilterView));
-    GtkTreeIter iter;
-    GtkTreeModel *model;
-    if (gtk_tree_selection_get_selected (selection, &model, &iter))
-    {
-        gchar *title;
-        gtk_tree_model_get (model, &iter, 2, &title, -1);
-        updateCurrentFilterFromName(title);
-        g_free (title);
-    }
-    else if( GtkFileFilter *filter = gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(m_pDialog)))
-    {
-        if (m_pPseudoFilter != filter)
-            updateCurrentFilterFromName(gtk_file_filter_get_name( filter ));
-        else
-            updateCurrentFilterFromName(OUStringToOString( m_aInitialFilter, RTL_TEXTENCODING_UTF8 ).getStr());
-    }
-}
-
-rtl::OUString SAL_CALL SalGtkFilePicker::getCurrentFilter() throw( uno::RuntimeException )
-{
-    SolarMutexGuard g;
-
-    OSL_ASSERT( m_pDialog != NULL );
-
-    OSL_TRACE( "GetCURRENTfilter" );
-
-    UpdateFilterfromUI();
-
-    OSL_TRACE( "Returning current filter of %s\n",
-        OUStringToOString( m_aCurrentFilter, RTL_TEXTENCODING_UTF8 ).getStr() );
-
-    return m_aCurrentFilter;
-}
-
-//-----------------------------------------------------------------------------------------
-// XFilterGroupManager functions
-//-----------------------------------------------------------------------------------------
-
-void SAL_CALL SalGtkFilePicker::appendFilterGroup( const rtl::OUString& /*sGroupTitle*/, const uno::Sequence<beans::StringPair>& aFilters )
-    throw( lang::IllegalArgumentException, uno::RuntimeException )
-{
-    SolarMutexGuard g;
-
-    OSL_ASSERT( m_pDialog != NULL );
-
-    // TODO m_pImpl->appendFilterGroup( sGroupTitle, aFilters );
-    // check the names
-    if( FilterNameExists( aFilters ) )
-        // TODO: a more precise exception message
-            throw IllegalArgumentException();
-
-    // ensure that we have a filter list
-    ::rtl::OUString sInitialCurrentFilter;
-    if( aFilters.getLength() )
-        sInitialCurrentFilter = aFilters[0].First;
-
-    ensureFilterList( sInitialCurrentFilter );
-
-    // append the filter
-    const StringPair* pSubFilters   = aFilters.getConstArray();
-    const StringPair* pSubFiltersEnd = pSubFilters + aFilters.getLength();
-    for( ; pSubFilters != pSubFiltersEnd; ++pSubFilters )
-        m_pFilterList->insert( m_pFilterList->end(), FilterEntry( pSubFilters->First, pSubFilters->Second ) );
-
-}
-
-//-----------------------------------------------------------------------------------------
-// XFilePicker functions
-//-----------------------------------------------------------------------------------------
-
-void SAL_CALL SalGtkFilePicker::setMultiSelectionMode( sal_Bool bMode ) throw( uno::RuntimeException )
-{
-    SolarMutexGuard g;
-
-    OSL_ASSERT( m_pDialog != NULL );
-
-    gtk_file_chooser_set_select_multiple( GTK_FILE_CHOOSER(m_pDialog), bMode );
-}
-
-void SAL_CALL SalGtkFilePicker::setDefaultName( const rtl::OUString& aName )
-    throw( uno::RuntimeException )
-{
-    SolarMutexGuard g;
-
-    OSL_ASSERT( m_pDialog != NULL );
-
-    OString aStr = OUStringToOString( aName, RTL_TEXTENCODING_UTF8 );
-    GtkFileChooserAction eAction = gtk_file_chooser_get_action( GTK_FILE_CHOOSER( m_pDialog ) );
-
-    // set_current_name launches a Gtk critical error if called for other than save
-    if( GTK_FILE_CHOOSER_ACTION_SAVE == eAction )
-        gtk_file_chooser_set_current_name( GTK_FILE_CHOOSER( m_pDialog ), aStr.getStr() );
-}
-
-void SAL_CALL SalGtkFilePicker::setDisplayDirectory( const rtl::OUString& rDirectory )
-    throw( lang::IllegalArgumentException, uno::RuntimeException )
-{
-    SolarMutexGuard g;
-
-    implsetDisplayDirectory(rDirectory);
-}
-
-rtl::OUString SAL_CALL SalGtkFilePicker::getDisplayDirectory() throw( uno::RuntimeException )
-{
-    SolarMutexGuard g;
-
-    return implgetDisplayDirectory();
-}
-
-uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getFiles() throw( uno::RuntimeException )
-{
-    // no member access => no mutex needed
-
-    uno::Sequence< rtl::OUString > aFiles = getSelectedFiles();
-    /*
-      The previous multiselection API design was completely broken
-      and unimplementable for some hetrogenous pseudo-URIs eg. search://
-      Thus crop unconditionally to a single selection.
-    */
-    aFiles.realloc (1);
-    return aFiles;
-}
-
-uno::Sequence<rtl::OUString> SAL_CALL SalGtkFilePicker::getSelectedFiles() throw( uno::RuntimeException )
-{
-    SolarMutexGuard g;
-
-    OSL_ASSERT( m_pDialog != NULL );
-
-    GSList* pPathList = gtk_file_chooser_get_uris( GTK_FILE_CHOOSER(m_pDialog) );
-
-    int nCount = g_slist_length( pPathList );
-    int nIndex = 0;
-    OSL_TRACE( "GETFILES called %d files", nCount );
-
-    // get the current action setting
-    GtkFileChooserAction eAction = gtk_file_chooser_get_action(
-        GTK_FILE_CHOOSER( m_pDialog ));
-
-    uno::Sequence< rtl::OUString > aSelectedFiles(nCount);
-
-    // Convert to OOo
-    for( GSList *pElem = pPathList; pElem; pElem = pElem->next)
-    {
-        gchar *pURI = reinterpret_cast<gchar*>(pElem->data);
-        aSelectedFiles[ nIndex ] = uritounicode(pURI);
-
-        if( GTK_FILE_CHOOSER_ACTION_SAVE == eAction )
-        {
-            OUString sFilterName;
-            sal_Int32 nTokenIndex = 0;
-            bool bExtensionTypedIn = false;
-
-            GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(m_pFilterView));
-            GtkTreeIter iter;
-            GtkTreeModel *model;
-            if (gtk_tree_selection_get_selected (selection, &model, &iter))
-            {

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list