Commits

kso  committed f0e068c

#i115372# - PLaces. Initial implementation of backend components and prototype of user interface.

  • Participants
  • Parent commits 2618f19

Comments (0)

Files changed (15)

File fpicker/source/office/iodlg.cxx

 /*************************************************************************
  *
  * 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
 #include "svtools/inettbc.hxx"
 #include "unotools/syslocale.hxx"
 #include "svtools/QueryFolderName.hxx"
-#ifndef  _RTL_USTRING_HXX
-#include <rtl/ustring.hxx>
-#endif
+#include "rtl/ustring.hxx"
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/ucb/XContentProviderManager.hpp>
 #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
 #include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 
-#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
 #include <comphelper/processfactory.hxx>
-#endif
 #include <osl/file.h>
 #include <vcl/waitobj.hxx>
 
 #include <algorithm>
 #include <functional>
 
+#include "placeswin.hxx"
+
 //#define AUTOSELECT_USERFILTER
-	// define this for the experimental feature of user-filter auto selection
-	// means if the user enters e.g. *.doc<enter>, and there is a filter which is responsible for *.doc files (only),
-	// then this filter is selected automatically
+    // define this for the experimental feature of user-filter auto selection
+    // means if the user enters e.g. *.doc<enter>, and there is a filter which is responsible for *.doc files (only),
+    // then this filter is selected automatically
 
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::frame;
 using namespace CommonFilePickerElementIds;
 using namespace InternalFilePickerElementIds;
 
-#define IODLG_CONFIGNAME		String(RTL_CONSTASCII_USTRINGPARAM("FileDialog"))
-#define IMPGRF_CONFIGNAME		String(RTL_CONSTASCII_USTRINGPARAM("ImportGraphicDialog"))
+#define IODLG_CONFIGNAME  String(RTL_CONSTASCII_USTRINGPARAM("FileDialog"))
+#define IMPGRF_CONFIGNAME String(RTL_CONSTASCII_USTRINGPARAM("ImportGraphicDialog"))
 
 #define GET_DECODED_NAME(aObj) \
-	aObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET )
+    aObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET )
 
 // Zeit die beim Traveln in der Filterbox gewartet wird,
 // bis in der Browsebox gefiltert wird ( in ms ).
-#define TRAVELFILTER_TIMEOUT	750
-
-#define WIDTH_ADDITION	15
+#define TRAVELFILTER_TIMEOUT 750
+
+#define WIDTH_ADDITION 15
 
 // functions -------------------------------------------------------------
 
 namespace
 {
 
-	//-----------------------------------------------------------------------------
-	String getMostCurrentFilter( SvtExpFileDlg_Impl* pImpl )
-	{
-		DBG_ASSERT( pImpl, "invalid impl pointer" );
-		const SvtFileDialogFilter_Impl* pFilter = pImpl->_pUserFilter;
-
-		if ( !pFilter )
-			pFilter = pImpl->GetCurFilter();
-
-		// Filtern.
-		if ( !pFilter )
-			return String();
-
-		return pFilter->GetType();
-	}
-
-	//-----------------------------------------------------------------------------
-	sal_Bool restoreCurrentFilter( SvtExpFileDlg_Impl* _pImpl )
-	{
-		DBG_ASSERT( _pImpl->GetCurFilter(), "restoreCurrentFilter: no current filter!" );
-		DBG_ASSERT( _pImpl->GetCurFilterDisplayName().Len(), "restoreCurrentFilter: no current filter (no display name)!" );
-
-		_pImpl->SelectFilterListEntry( _pImpl->GetCurFilterDisplayName() );
+    //-----------------------------------------------------------------------------
+    String getMostCurrentFilter( SvtExpFileDlg_Impl* pImpl )
+    {
+        DBG_ASSERT( pImpl, "invalid impl pointer" );
+        const SvtFileDialogFilter_Impl* pFilter = pImpl->_pUserFilter;
+
+        if ( !pFilter )
+            pFilter = pImpl->GetCurFilter();
+
+        // Filtern.
+        if ( !pFilter )
+            return String();
+
+        return pFilter->GetType();
+    }
+
+    //-----------------------------------------------------------------------------
+    sal_Bool restoreCurrentFilter( SvtExpFileDlg_Impl* _pImpl )
+    {
+        DBG_ASSERT( _pImpl->GetCurFilter(), "restoreCurrentFilter: no current filter!" );
+        DBG_ASSERT( _pImpl->GetCurFilterDisplayName().Len(), "restoreCurrentFilter: no current filter (no display name)!" );
+
+        _pImpl->SelectFilterListEntry( _pImpl->GetCurFilterDisplayName() );
 
 #ifdef DBG_UTIL
-		String sSelectedDisplayName;
-		DBG_ASSERT(	( _pImpl->GetSelectedFilterEntry( sSelectedDisplayName ) == _pImpl->GetCurFilter() )
-				&&	( sSelectedDisplayName == _pImpl->GetCurFilterDisplayName() ),
-			"restoreCurrentFilter: inconsistence!" );
+        String sSelectedDisplayName;
+        DBG_ASSERT(( _pImpl->GetSelectedFilterEntry( sSelectedDisplayName ) == _pImpl->GetCurFilter() )
+                && ( sSelectedDisplayName == _pImpl->GetCurFilterDisplayName() ),
+            "restoreCurrentFilter: inconsistence!" );
 #endif
-		return _pImpl->m_bNeedDelayedFilterExecute;
-	}
-
-	//-----------------------------------------------------------------------------
+        return _pImpl->m_bNeedDelayedFilterExecute;
+    }
+
+    //-----------------------------------------------------------------------------
     String GetFsysExtension_Impl( const String& rFile, const String& rLastFilterExt )
-	{
+    {
         xub_StrLen nDotPos = rFile.SearchBackward( '.' );
         if ( nDotPos != STRING_NOTFOUND )
         {
             else
                 return String( rFile.Copy( nDotPos ) );
         }
-		return String();
-	}
-
-	//-----------------------------------------------------------------------------
-	void SetFsysExtension_Impl( String& rFile, const String& rExtension )
-	{
-		const sal_Unicode* p0 = rFile.GetBuffer();
-		const sal_Unicode* p1 = p0 + rFile.Len() - 1;
-		while ( p1 >= p0 && *p1 != sal_Unicode( '.' ) )
-			p1--;
-		if ( p1 >= p0 )
-			// remove old extension
-			rFile.Erase(
+        return String();
+    }
+
+    //-----------------------------------------------------------------------------
+    void SetFsysExtension_Impl( String& rFile, const String& rExtension )
+    {
+        const sal_Unicode* p0 = rFile.GetBuffer();
+        const sal_Unicode* p1 = p0 + rFile.Len() - 1;
+        while ( p1 >= p0 && *p1 != sal_Unicode( '.' ) )
+            p1--;
+        if ( p1 >= p0 )
+            // remove old extension
+            rFile.Erase(
                 sal::static_int_cast< xub_StrLen >(
                     p1 - p0 + 1 - ( rExtension.Len() > 0 ? 0 : 1 ) ) );
-		else if ( rExtension.Len() )
-			// no old extension
-			rFile += sal_Unicode( '.' );
-		rFile += rExtension;
-	}
-
-	//-----------------------------------------------------------------------------
-	// move the control with the given offset
-	void lcl_MoveControl( Control* _pControl, sal_Int32 _nDeltaX, sal_Int32 _nDeltaY, sal_Int32* _pMaxY = NULL )
-	{
-		if ( _pControl )
-		{
-			Point aNewPos = _pControl->GetPosPixel();
-
-			// adjust the vertical position
-			aNewPos.Y() += _nDeltaY;
-			if ( _pMaxY && ( aNewPos.Y() > *_pMaxY ) )
-				*_pMaxY = aNewPos.Y();
-
-			// adjust the horizontal position
-			aNewPos.X() += _nDeltaX;
-
-			_pControl->SetPosPixel( aNewPos );
-		}
-	}
+        else if ( rExtension.Len() )
+            // no old extension
+            rFile += sal_Unicode( '.' );
+        rFile += rExtension;
+    }
+
+    //-----------------------------------------------------------------------------
+    // move the control with the given offset
+    void lcl_MoveControl( Control* _pControl, sal_Int32 _nDeltaX, sal_Int32 _nDeltaY, sal_Int32* _pMaxY = NULL )
+    {
+        if ( _pControl )
+        {
+            Point aNewPos = _pControl->GetPosPixel();
+
+            // adjust the vertical position
+            aNewPos.Y() += _nDeltaY;
+            if ( _pMaxY && ( aNewPos.Y() > *_pMaxY ) )
+                *_pMaxY = aNewPos.Y();
+
+            // adjust the horizontal position
+            aNewPos.X() += _nDeltaX;
+
+            _pControl->SetPosPixel( aNewPos );
+        }
+    }
 
     //-------------------------------------------------------------------------
     void lcl_autoUpdateFileExtension( SvtFileDialog* _pDialog, const String& _rLastFilterExt )
-	{
-		// if auto extension is enabled ....
-		if ( _pDialog->isAutoExtensionEnabled() )
-		{
-			// automatically switch to the extension of the (maybe just newly selected) extension
-			String aNewFile = _pDialog->getCurrentFileText( );
+    {
+        // if auto extension is enabled ....
+        if ( _pDialog->isAutoExtensionEnabled() )
+        {
+            // automatically switch to the extension of the (maybe just newly selected) extension
+            String aNewFile = _pDialog->getCurrentFileText( );
             String aExt = GetFsysExtension_Impl( aNewFile, _rLastFilterExt );
 
-			// but only if there already is an extension
-			if ( aExt.Len() )
-			{
-				// check if it is a real file extension, and not only the "post-dot" part in
-				// a directory name
-				// 28.03.2002 - 98337 - fs@openoffice.org
-				sal_Bool bRealExtensions = sal_True;
-				if ( STRING_NOTFOUND != aExt.Search( '/' ) )
-					bRealExtensions = sal_False;
-				else if ( STRING_NOTFOUND != aExt.Search( '\\' ) )
-					bRealExtensions = sal_False;
-				else
-				{
-					// no easy way to tell, because the part containing the dot already is the last
-					// segment of the complete file name
-					// So we have to check if the file name denotes a folder or a file.
-					// For performance reasons, we do this for file urls only
-					INetURLObject aURL( aNewFile );
-					if ( INET_PROT_NOT_VALID == aURL.GetProtocol() )
-					{
-						String sURL;
-						if ( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aNewFile, sURL ) )
-							aURL = INetURLObject( sURL );
-					}
-					if ( INET_PROT_FILE == aURL.GetProtocol() )
-					{
-						// #97148# & #102204# -----
-						try
-						{
-							bRealExtensions = !_pDialog->ContentIsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) );
-						}
-						catch( ::com::sun::star::uno::Exception& )
-						{
-							DBG_WARNING( "Exception in lcl_autoUpdateFileExtension" );
-						}
-					}
-				}
-
-				if ( bRealExtensions )
-				{
-					SetFsysExtension_Impl( aNewFile, _pDialog->GetDefaultExt() );
-					_pDialog->setCurrentFileText( aNewFile );
-				}
-			}
-		}
-	}
-
-	//-------------------------------------------------------------------------
-	sal_Bool lcl_getHomeDirectory( const String& _rForURL, String& /* [out] */ _rHomeDir )
-	{
-		_rHomeDir.Erase();
-
-		// now ask the content broker for a provider for this scheme
+            // but only if there already is an extension
+            if ( aExt.Len() )
+            {
+                // check if it is a real file extension, and not only the "post-dot" part in
+                // a directory name
+                // 28.03.2002 - 98337 - fs@openoffice.org
+                sal_Bool bRealExtensions = sal_True;
+                if ( STRING_NOTFOUND != aExt.Search( '/' ) )
+                    bRealExtensions = sal_False;
+                else if ( STRING_NOTFOUND != aExt.Search( '\\' ) )
+                    bRealExtensions = sal_False;
+                else
+                {
+                    // no easy way to tell, because the part containing the dot already is the last
+                    // segment of the complete file name
+                    // So we have to check if the file name denotes a folder or a file.
+                    // For performance reasons, we do this for file urls only
+                    INetURLObject aURL( aNewFile );
+                    if ( INET_PROT_NOT_VALID == aURL.GetProtocol() )
+                    {
+                        String sURL;
+                        if ( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aNewFile, sURL ) )
+                            aURL = INetURLObject( sURL );
+                    }
+                    if ( INET_PROT_FILE == aURL.GetProtocol() )
+                    {
+                        // #97148# & #102204# -----
+                        try
+                        {
+                            bRealExtensions = !_pDialog->ContentIsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) );
+                        }
+                        catch( ::com::sun::star::uno::Exception& )
+                        {
+                            DBG_WARNING( "Exception in lcl_autoUpdateFileExtension" );
+                        }
+                    }
+                }
+
+                if ( bRealExtensions )
+                {
+                    SetFsysExtension_Impl( aNewFile, _pDialog->GetDefaultExt() );
+                    _pDialog->setCurrentFileText( aNewFile );
+                }
+            }
+        }
+    }
+
+    //-------------------------------------------------------------------------
+    sal_Bool lcl_getHomeDirectory( const String& _rForURL, String& /* [out] */ _rHomeDir )
+    {
+        _rHomeDir.Erase();
+
+        // now ask the content broker for a provider for this scheme
         //=================================================================
-		try
-		{
-			// get the content provider manager
-			::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
-			Reference< XContentProviderManager > xProviderManager;
-			if ( pBroker )
-				xProviderManager = pBroker->getContentProviderManagerInterface();
+        try
+        {
+            // get the content provider manager
+            ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
+            Reference< XContentProviderManager > xProviderManager;
+            if ( pBroker )
+                xProviderManager = pBroker->getContentProviderManagerInterface();
 
             //=================================================================
-			// get the provider for the current scheme
-			Reference< XContentProvider > xProvider;
-			if ( xProviderManager.is() )
-				xProvider = xProviderManager->queryContentProvider( _rForURL );
-
-			DBG_ASSERT( xProvider.is(), "lcl_getHomeDirectory: could not find a (valid) content provider for the current URL!" );
-			Reference< XPropertySet > xProviderProps( xProvider, UNO_QUERY );
-			if ( xProviderProps.is() )
-			{
-				Reference< XPropertySetInfo > xPropInfo = xProviderProps->getPropertySetInfo();
-				const ::rtl::OUString sHomeDirPropertyName( RTL_CONSTASCII_USTRINGPARAM( "HomeDirectory" ) );
-				if ( !xPropInfo.is() || xPropInfo->hasPropertyByName( sHomeDirPropertyName ) )
-				{
-					::rtl::OUString sHomeDirectory;
-					xProviderProps->getPropertyValue( sHomeDirPropertyName ) >>= sHomeDirectory;
-					_rHomeDir = sHomeDirectory;
-				}
-			}
-		}
-		catch( const Exception& )
-		{
-			DBG_ERROR( "lcl_getHomeDirectory: caught an exception!" );
-		}
-		return 0 < _rHomeDir.Len();
-	}
+            // get the provider for the current scheme
+            Reference< XContentProvider > xProvider;
+            if ( xProviderManager.is() )
+                xProvider = xProviderManager->queryContentProvider( _rForURL );
+
+            DBG_ASSERT( xProvider.is(), "lcl_getHomeDirectory: could not find a (valid) content provider for the current URL!" );
+            Reference< XPropertySet > xProviderProps( xProvider, UNO_QUERY );
+            if ( xProviderProps.is() )
+            {
+                Reference< XPropertySetInfo > xPropInfo = xProviderProps->getPropertySetInfo();
+                const ::rtl::OUString sHomeDirPropertyName( RTL_CONSTASCII_USTRINGPARAM( "HomeDirectory" ) );
+                if ( !xPropInfo.is() || xPropInfo->hasPropertyByName( sHomeDirPropertyName ) )
+                {
+                    ::rtl::OUString sHomeDirectory;
+                    xProviderProps->getPropertyValue( sHomeDirPropertyName ) >>= sHomeDirectory;
+                    _rHomeDir = sHomeDirectory;
+                }
+            }
+        }
+        catch( const Exception& )
+        {
+            DBG_ERROR( "lcl_getHomeDirectory: caught an exception!" );
+        }
+        return 0 < _rHomeDir.Len();
+    }
 
     //---------------------------------------------------------------------
-	static String lcl_ensureFinalSlash( const String& _rDir )
-	{
-		INetURLObject aWorkPathObj( _rDir, INET_PROT_FILE );
-		aWorkPathObj.setFinalSlash();
-		return  aWorkPathObj.GetMainURL( INetURLObject::NO_DECODE );
-	}
+    static String lcl_ensureFinalSlash( const String& _rDir )
+    {
+        INetURLObject aWorkPathObj( _rDir, INET_PROT_FILE );
+        aWorkPathObj.setFinalSlash();
+        return  aWorkPathObj.GetMainURL( INetURLObject::NO_DECODE );
+    }
 
     //---------------------------------------------------------------------
     void    convertStringListToUrls( const String& _rColonSeparatedList, ::std::vector< String >& _rTokens, bool _bFinalSlash )
 
 struct ControlChain_Impl
 {
-	Window* 		   _pControl;
-	ControlChain_Impl* _pNext;
-	BOOL			   _bHasOwnerShip;
-
-	ControlChain_Impl( Window* pControl, ControlChain_Impl* pNext );
-	~ControlChain_Impl();
+    Window*            _pControl;
+    ControlChain_Impl* _pNext;
+    BOOL               _bHasOwnerShip;
+
+    ControlChain_Impl( Window* pControl, ControlChain_Impl* pNext );
+    ~ControlChain_Impl();
 };
 
 //***************************************************************************
 
 ControlChain_Impl::ControlChain_Impl
 (
-	Window* pControl,
-	ControlChain_Impl* pNext
+    Window* pControl,
+    ControlChain_Impl* pNext
 )
-	: _pControl( pControl ),
-	  _pNext( pNext ),
-	  _bHasOwnerShip( TRUE )
+    : _pControl( pControl ),
+      _pNext( pNext ),
+      _bHasOwnerShip( TRUE )
 {
 }
 
 
 ControlChain_Impl::~ControlChain_Impl()
 {
-	if ( _bHasOwnerShip )
-	{
-		delete _pControl;
-	}
-	delete _pNext;
+    if ( _bHasOwnerShip )
+    {
+        delete _pControl;
+    }
+    delete _pNext;
 }
 
 //*****************************************************************************
 //*****************************************************************************
 namespace
 {
-	struct ResMgrHolder
-	{
-		ResMgr * operator ()()
-		{
-			return ResMgr::CreateResMgr (CREATEVERSIONRESMGR_NAME(fps_office));
-		}
-
-		static ResMgr * getOrCreate()
-		{
-			return rtl_Instance<
-				ResMgr, ResMgrHolder,
-				osl::MutexGuard, osl::GetGlobalMutex >::create (
-					ResMgrHolder(), osl::GetGlobalMutex());
-		}
-	};
-
-	struct SvtResId : public ResId
-	{
-		SvtResId (USHORT nId) : ResId (nId, *ResMgrHolder::getOrCreate()) {}
-	};
+    struct ResMgrHolder
+    {
+        ResMgr * operator ()()
+        {
+            return ResMgr::CreateResMgr (CREATEVERSIONRESMGR_NAME(fps_office));
+        }
+
+        static ResMgr * getOrCreate()
+        {
+            return rtl_Instance<
+                ResMgr, ResMgrHolder,
+                osl::MutexGuard, osl::GetGlobalMutex >::create (
+                    ResMgrHolder(), osl::GetGlobalMutex());
+        }
+    };
+
+    struct SvtResId : public ResId
+    {
+        SvtResId (USHORT nId) : ResId (nId, *ResMgrHolder::getOrCreate()) {}
+    };
 }
 
 //*****************************************************************************
 //*****************************************************************************
 SvtFileDialog::SvtFileDialog
 (
-	Window* _pParent,
-	WinBits nBits,
-	WinBits nExtraBits
+    Window* _pParent,
+    WinBits nBits,
+    WinBits nExtraBits
 ) :
-	ModalDialog( _pParent, SvtResId( DLG_SVT_EXPLORERFILE ) )
+    ModalDialog( _pParent, SvtResId( DLG_SVT_EXPLORERFILE ) )
 
     ,_pUserControls( NULL )
     ,_pCbReadOnly( NULL )
-	,_pCbLinkBox( NULL)
+    ,_pCbLinkBox( NULL)
     ,_pCbPreviewBox( NULL )
     ,_pCbSelection( NULL )
     ,_pPbPlay( NULL )
     ,_nExtraBits( nExtraBits )
     ,_bIsInExecute( FALSE )
     ,m_bInExecuteAsync( false )
-	,m_bHasFilename( false )
+    ,m_bHasFilename( false )
+    ,m_bHasPlaces( false )
 {
-	Init_Impl( nBits );
+    Init_Impl( nBits );
 }
 
 //*****************************************************************************
     :ModalDialog( _pParent, SvtResId( DLG_SVT_EXPLORERFILE ) )
     ,_pUserControls( NULL )
     ,_pCbReadOnly( NULL )
-	,_pCbLinkBox( NULL)
+    ,_pCbLinkBox( NULL)
     ,_pCbPreviewBox( NULL )
     ,_pCbSelection( NULL )
     ,_pPbPlay( NULL )
     ,_pImp( new SvtExpFileDlg_Impl( nBits ) )
     ,_nExtraBits( 0L )
     ,_bIsInExecute( FALSE )
-	,m_bHasFilename( false )
+    ,m_bHasFilename( false )
+    ,m_bHasPlaces( false )
 {
-	Init_Impl( nBits );
+    Init_Impl( nBits );
 }
 
 //*****************************************************************************
 
 SvtFileDialog::~SvtFileDialog()
 {
-	if ( _pImp->_aIniKey.Len() )
-	{
-		// save window state
-		SvtViewOptions aDlgOpt( E_DIALOG, _pImp->_aIniKey );
+    if ( _pImp->_aIniKey.Len() )
+    {
+        // save window state
+        SvtViewOptions aDlgOpt( E_DIALOG, _pImp->_aIniKey );
         aDlgOpt.SetWindowState( String( GetWindowState(), osl_getThreadTextEncoding() ) );
-		String sUserData = _pFileView->GetConfigString();
-		aDlgOpt.SetUserItem( ::rtl::OUString::createFromAscii( "UserData" ),
-							 makeAny( ::rtl::OUString( sUserData ) ) );
-	}
-
-	_pFileView->SetSelectHdl( Link() );
-
-	delete _pImp;
-	delete _pFileView;
-
-	delete _pCbReadOnly;
-	delete _pCbLinkBox;
+        String sUserData = _pFileView->GetConfigString();
+        aDlgOpt.SetUserItem( ::rtl::OUString::createFromAscii( "UserData" ),
+                             makeAny( ::rtl::OUString( sUserData ) ) );
+    }
+
+    _pFileView->SetSelectHdl( Link() );
+
+    delete _pImp;
+    delete _pFileView;
+
+    delete _pCbReadOnly;
+    delete _pCbLinkBox;
     delete _pCbPreviewBox;
     delete _pCbSelection;
     delete _pPbPlay;
     delete _pPrevWin;
     delete _pPrevBmp;
 
-	delete _pUserControls;
+    delete _pUserControls;
+
+    delete _pPlacesWin;
+}
+
+namespace
+{
+    void extendControlWidth( Control * pControl, long n )
+    {
+        pControl->SetSizePixel(
+            Size( pControl->GetSizePixel().Width() + n,
+                  pControl->GetSizePixel().Height() ) );
+    }
 }
 
 //*****************************************************************************
 
 void SvtFileDialog::Init_Impl
 (
-	WinBits nStyle
+    WinBits nStyle
 )
 {
-	sal_Bool bIsHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
-	m_aImages = ImageList( SvtResId( bIsHighContrast ? RID_FILEPICKER_IMAGES_HC : RID_FILEPICKER_IMAGES ) );
-
-	_pImp->_nStyle = nStyle;
-	_pImp->_a6Size = LogicToPixel( Size( 6, 6 ), MAP_APPFONT );
-	_pImp->_eMode = ( nStyle & WB_SAVEAS ) ? FILEDLG_MODE_SAVE : FILEDLG_MODE_OPEN;
-	_pImp->_eDlgType = FILEDLG_TYPE_FILEDLG;
-
-	if ( ( nStyle & SFXWB_PATHDIALOG ) == SFXWB_PATHDIALOG )
-		_pImp->_eDlgType = FILEDLG_TYPE_PATHDLG;
-
-	// Set the directory for the "back to the default dir" button
-	INetURLObject aStdDirObj( SvtPathOptions().GetWorkPath() );
-	SetStandardDir( aStdDirObj.GetMainURL( INetURLObject::NO_DECODE ) );
-
-	// Reichweite bestimmen.
-	if ( !( nStyle & SFXWB_NOREMOTE ) )
-	{
-		_pImp->_nState |= FILEDLG_STATE_REMOTE;
-	}
-
-	// Kontrollelement erzeugen, wobei die Reihenfolge die Tab-Steuerung
-	// bestimmt.
-	_pImp->_pFtFileName = new FixedText( this, SvtResId( FT_EXPLORERFILE_FILENAME ) );
+    sal_Bool bIsHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
+    m_aImages = ImageList( SvtResId( bIsHighContrast ? RID_FILEPICKER_IMAGES_HC : RID_FILEPICKER_IMAGES ) );
+
+    _pImp->_nStyle = nStyle;
+    _pImp->_a6Size = LogicToPixel( Size( 6, 6 ), MAP_APPFONT );
+    _pImp->_eMode = ( nStyle & WB_SAVEAS ) ? FILEDLG_MODE_SAVE : FILEDLG_MODE_OPEN;
+    _pImp->_eDlgType = FILEDLG_TYPE_FILEDLG;
+
+    if ( ( nStyle & SFXWB_PATHDIALOG ) == SFXWB_PATHDIALOG )
+        _pImp->_eDlgType = FILEDLG_TYPE_PATHDLG;
+
+    // Set the directory for the "back to the default dir" button
+    INetURLObject aStdDirObj( SvtPathOptions().GetWorkPath() );
+    SetStandardDir( aStdDirObj.GetMainURL( INetURLObject::NO_DECODE ) );
+
+    // Reichweite bestimmen.
+    if ( !( nStyle & SFXWB_NOREMOTE ) )
+    {
+        _pImp->_nState |= FILEDLG_STATE_REMOTE;
+    }
+
+    // Kontrollelement erzeugen, wobei die Reihenfolge die Tab-Steuerung
+    // bestimmt.
+    _pImp->_pFtFileName = new FixedText( this, SvtResId( FT_EXPLORERFILE_FILENAME ) );
 
     SvtURLBox* pURLBox = new SvtURLBox( this );
     pURLBox->SetUrlFilter( &m_aURLFilter );
     _pImp->_pEdFileName->SetHelpId( HID_FILEDLG_AUTOCOMPLETEBOX );
 
     _pImp->_pFtFileType = new FixedText( this, SvtResId( FT_EXPLORERFILE_FILETYPE ) );
-	_pImp->CreateFilterListControl( this, SvtResId( LB_EXPLORERFILE_FILETYPE ) );
-
-	// move the filter listbox to the space occupied by the version listbox
+    _pImp->CreateFilterListControl( this, SvtResId( LB_EXPLORERFILE_FILETYPE ) );
+
+    // move the filter listbox to the space occupied by the version listbox
     // if that box isn't needed
     if ( !( _nExtraBits & SFX_EXTRA_SHOWVERSIONS ) &&
          !( _nExtraBits & SFX_EXTRA_TEMPLATES ) &&
          !( _nExtraBits & SFX_EXTRA_IMAGE_TEMPLATE ) )
-	{
-		{
-			FixedText aSharedListBoxLabel( this, SvtResId( FT_EXPLORERFILE_SHARED_LISTBOX ) );
-			_pImp->_pFtFileType->SetPosPixel( aSharedListBoxLabel.GetPosPixel() );
-		}
-
-		{
-			ListBox aSharedListBox( this, SvtResId( LB_EXPLORERFILE_SHARED_LISTBOX ) );
-			_pImp->GetFilterListControl()->SetPosPixel( aSharedListBox.GetPosPixel() );
-		}
-	}
-
-	_pImp->_pFtCurrentPath = new FixedText( this, SvtResId( FT_EXPLORERFILE_CURRENTPATH ) );
+    {
+        {
+            FixedText aSharedListBoxLabel( this, SvtResId( FT_EXPLORERFILE_SHARED_LISTBOX ) );
+            _pImp->_pFtFileType->SetPosPixel( aSharedListBoxLabel.GetPosPixel() );
+        }
+
+        {
+            ListBox aSharedListBox( this, SvtResId( LB_EXPLORERFILE_SHARED_LISTBOX ) );
+            _pImp->GetFilterListControl()->SetPosPixel( aSharedListBox.GetPosPixel() );
+        }
+    }
+
+    _pImp->_pFtCurrentPath = new FixedText( this, SvtResId( FT_EXPLORERFILE_CURRENTPATH ) );
     WinBits nTmpStyle = _pImp->_pFtCurrentPath->GetStyle();
     nTmpStyle |= WB_PATHELLIPSIS;
     _pImp->_pFtCurrentPath->SetStyle( nTmpStyle );
 
     _pImp->_pBtnFileOpen = new PushButton( this, SvtResId( BTN_EXPLORERFILE_OPEN ) );
-	_pImp->_pBtnCancel = new CancelButton( this, SvtResId( BTN_EXPLORERFILE_CANCEL ) );
-	_pImp->_pBtnHelp = new HelpButton( this, SvtResId( BTN_EXPLORERFILE_HELP ) );
-
-	_pImp->_pBtnUp = new SvtUpButton_Impl( this, SvtResId( BTN_EXPLORERFILE_UP ) );
-	_pImp->_pBtnNewFolder = new ImageButton( this, SvtResId( BTN_EXPLORERFILE_NEWFOLDER ) );
-	_pImp->_pBtnNewFolder->SetStyle( _pImp->_pBtnNewFolder->GetStyle() | WB_NOPOINTERFOCUS );
+    _pImp->_pBtnCancel = new CancelButton( this, SvtResId( BTN_EXPLORERFILE_CANCEL ) );
+    _pImp->_pBtnHelp = new HelpButton( this, SvtResId( BTN_EXPLORERFILE_HELP ) );
+
+    _pImp->_pBtnUp = new SvtUpButton_Impl( this, SvtResId( BTN_EXPLORERFILE_UP ) );
+    _pImp->_pBtnNewFolder = new ImageButton( this, SvtResId( BTN_EXPLORERFILE_NEWFOLDER ) );
+    _pImp->_pBtnNewFolder->SetStyle( _pImp->_pBtnNewFolder->GetStyle() | WB_NOPOINTERFOCUS );
     _pImp->_pBtnStandard = new SvtTravelButton_Impl( this, SvtResId( BTN_EXPLORERFILE_STANDARD ) );
 
-	_pImp->_pBtnUp->SetAccessibleName( _pImp->_pBtnUp->GetQuickHelpText() );
-	_pImp->_pBtnNewFolder->SetAccessibleName( _pImp->_pBtnNewFolder->GetQuickHelpText() );
-	_pImp->_pBtnStandard->SetAccessibleName( _pImp->_pBtnStandard->GetQuickHelpText() );
-
-	if ( ( nStyle & SFXWB_MULTISELECTION ) == SFXWB_MULTISELECTION )
-		_pImp->_bMultiSelection = TRUE;
-
-	_pFileView = new SvtFileView( this, SvtResId( CTL_EXPLORERFILE_FILELIST ),
-									   FILEDLG_TYPE_PATHDLG == _pImp->_eDlgType,
-									   _pImp->_bMultiSelection );
+    _pImp->_pBtnUp->SetAccessibleName( _pImp->_pBtnUp->GetQuickHelpText() );
+    _pImp->_pBtnNewFolder->SetAccessibleName( _pImp->_pBtnNewFolder->GetQuickHelpText() );
+    _pImp->_pBtnStandard->SetAccessibleName( _pImp->_pBtnStandard->GetQuickHelpText() );
+
+    if ( ( nStyle & SFXWB_MULTISELECTION ) == SFXWB_MULTISELECTION )
+        _pImp->_bMultiSelection = TRUE;
+
+    _pFileView = new SvtFileView( this, SvtResId( CTL_EXPLORERFILE_FILELIST ),
+                                       FILEDLG_TYPE_PATHDLG == _pImp->_eDlgType,
+                                       _pImp->_bMultiSelection );
     _pFileView->SetUrlFilter( &m_aURLFilter );
-	_pFileView->EnableAutoResize();
-
-	_pFileView->SetHelpId( HID_FILEDLG_STANDARD );
-	_pFileView->SetStyle( _pFileView->GetStyle() | WB_TABSTOP );
-
-	// Positionen und Groessen der Knoepfe bestimmen.
-	Image aNewFolderImg( GetButtonImage( IMG_FILEDLG_CREATEFOLDER ) );
-	_pImp->_pBtnNewFolder->SetModeImage( aNewFolderImg );
-
-	Size aSize( aNewFolderImg.GetSizePixel() );
-	aSize.Width() += FILEDIALOG_DEF_IMAGEBORDER;
-	aSize.Height() += FILEDIALOG_DEF_IMAGEBORDER;
-	_pImp->_pBtnNewFolder->SetSizePixel( aSize );
-	_pImp->_pBtnUp->SetSizePixel( aSize );
-	_pImp->_pBtnStandard->SetSizePixel( aSize );
-
-	Size aDlgSize = GetOutputSizePixel();
-	long n6AppFontInPixel =
-			LogicToPixel( Size( 6, 0 ), MAP_APPFONT ).Width();
-	long n3AppFontInPixel =
-			LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width();
+    _pFileView->EnableAutoResize();
+
+    _pFileView->SetHelpId( HID_FILEDLG_STANDARD );
+    _pFileView->SetStyle( _pFileView->GetStyle() | WB_TABSTOP );
+
+    // Positionen und Groessen der Knoepfe bestimmen.
+    Image aNewFolderImg( GetButtonImage( IMG_FILEDLG_CREATEFOLDER ) );
+    _pImp->_pBtnNewFolder->SetModeImage( aNewFolderImg );
+
+    Size aSize( aNewFolderImg.GetSizePixel() );
+    aSize.Width() += FILEDIALOG_DEF_IMAGEBORDER;
+    aSize.Height() += FILEDIALOG_DEF_IMAGEBORDER;
+    _pImp->_pBtnNewFolder->SetSizePixel( aSize );
+    _pImp->_pBtnUp->SetSizePixel( aSize );
+    _pImp->_pBtnStandard->SetSizePixel( aSize );
+
+    Size aDlgSize = GetOutputSizePixel();
+    long n6AppFontInPixel =
+            LogicToPixel( Size( 6, 0 ), MAP_APPFONT ).Width();
+    long n3AppFontInPixel =
+            LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width();
 
     // calculate the length of all buttons
-	const USHORT nBtnCount = 3; // "previous level", "new folder" and "standard dir"
-	long nDelta = n6AppFontInPixel; // right border
-	nDelta += ( nBtnCount * aSize.Width() ); // button count * button width
-	nDelta += ( n3AppFontInPixel + n3AppFontInPixel / 2 ); // spacing 1*big 1*small
-
-    Point aPos(
-        aDlgSize.Width() - nDelta,
-        _pImp->_pBtnUp->GetPosPixel().Y()
-    );
-    Size aCurPathSize(
-        aPos.X() - n6AppFontInPixel,
-        _pImp->_pFtCurrentPath->GetOutputSizePixel().Height()
-    );
-	_pImp->_pFtCurrentPath->SetOutputSizePixel( aCurPathSize );
-	_pImp->_pBtnUp->SetPosPixel( aPos );
-	aPos.X() += aSize.Width();
-	aPos.X() += n3AppFontInPixel;
-	_pImp->_pBtnNewFolder->SetPosPixel( aPos );
-	aPos.X() += aSize.Width();
-	aPos.X() += n3AppFontInPixel / 2;
-	_pImp->_pBtnStandard->SetPosPixel( aPos );
-	nDelta = aSize.Height();
-	nDelta -= aCurPathSize.Height();
-	nDelta /= 2;
-	Point aCurPathPos = _pImp->_pFtCurrentPath->GetPosPixel();
-	aCurPathPos.Y() += nDelta;
-	_pImp->_pFtCurrentPath->SetPosPixel( aCurPathPos );
+    const USHORT nBtnCount = 3; // "previous level", "new folder" and "standard dir"
+    long nDelta = n6AppFontInPixel; // right border
+    nDelta += ( nBtnCount * aSize.Width() ); // button count * button width
+    nDelta += ( n3AppFontInPixel + n3AppFontInPixel / 2 ); // spacing 1*big 1*small
+
+    _pPlacesWin = new fpicker::office::PlacesWindow( this );
+    m_bHasPlaces = _pPlacesWin->GetEntryCount() > 0;
+
+    long nXOffset = 0;
+    long nXPlacesOffset = 0;
+
+    if ( m_bHasPlaces )
+    {
+        // @@@ KSO: hardcoded sizes etc.!!!
+        _pPlacesWin->SetSizePixel(
+            Size( 120,
+                  _pFileView->GetSizePixel().Height() ) );
+        _pPlacesWin->SetPosPixel(
+            Point( _pFileView->GetPosPixel().X() - 3,
+                   _pFileView->GetPosPixel().Y() - 3 ) );
+        _pPlacesWin->SetClickHdl(
+            LINK( this, SvtFileDialog, PlacesIconClickHdl_Impl ) );
+
+        nXPlacesOffset = _pPlacesWin->GetSizePixel().Width();
+
+        Size aNewDlgSize( GetOutputSizePixel() );
+        aNewDlgSize.Width() += nXOffset + nXPlacesOffset + 3;
+        SetOutputSizePixel( aNewDlgSize );
+    }
+
+    Point aPos( aDlgSize.Width() - nDelta + nXOffset,
+                _pImp->_pBtnUp->GetPosPixel().Y() );
+    Size aCurPathSize( aPos.X() - n6AppFontInPixel,
+                       _pImp->_pFtCurrentPath->GetOutputSizePixel().Height() );
+    aPos.X() += nXPlacesOffset;
+    _pImp->_pFtCurrentPath->SetOutputSizePixel( aCurPathSize );
+    _pImp->_pBtnUp->SetPosPixel( aPos );
+    aPos.X() += aSize.Width();
+    aPos.X() += n3AppFontInPixel;
+    _pImp->_pBtnNewFolder->SetPosPixel( aPos );
+    aPos.X() += aSize.Width();
+    aPos.X() += n3AppFontInPixel / 2;
+    _pImp->_pBtnStandard->SetPosPixel( aPos );
+    nDelta = aSize.Height();
+    nDelta -= aCurPathSize.Height();
+    nDelta /= 2;
+    Point aCurPathPos = _pImp->_pFtCurrentPath->GetPosPixel();
+    aCurPathPos.Y() += nDelta;
+    _pImp->_pFtCurrentPath->SetPosPixel( aCurPathPos );
 
     if ( nStyle & SFXWB_READONLY )
     {
 
     AddControls_Impl( );
 
-	// Zahl der Pixel bestimmen, um die die anderen Elemente in der Position
-	// Angepasst werden muessen.
-	aPos.Y() += aSize.Height();
-	aPos.Y() += LogicToPixel( Size( 0, 6 ), MAP_APPFONT ).Height();
-	long nYOffset = aPos.Y();
-	aPos = _pFileView->GetPosPixel();
-	nYOffset -= aPos.Y();
-
-	// Positionen der uebrigen Elemente anpassen.
-	aPos.Y() += nYOffset;
-	_pFileView->SetPosPixel( aPos );
-
-	lcl_MoveControl( _pImp->_pFtFileName, 0, nYOffset );
-	lcl_MoveControl( _pImp->_pEdFileName, 0, nYOffset );
-
-	lcl_MoveControl( _pImp->_pFtFileVersion, 0, nYOffset );
-	lcl_MoveControl( _pImp->_pLbFileVersion, 0, nYOffset );
-
-	lcl_MoveControl( _pImp->_pFtTemplates, 0, nYOffset );
-	lcl_MoveControl( _pImp->_pLbTemplates, 0, nYOffset );
-
-	lcl_MoveControl( _pImp->_pFtImageTemplates, 0, nYOffset );
-	lcl_MoveControl( _pImp->_pLbImageTemplates, 0, nYOffset );
-
-	lcl_MoveControl( _pImp->_pFtFileType, 0, nYOffset );
-	lcl_MoveControl( _pImp->GetFilterListControl(), 0, nYOffset );
-
-	lcl_MoveControl( _pImp->_pBtnFileOpen, 0, nYOffset );
-	lcl_MoveControl( _pImp->_pBtnCancel, 0, nYOffset );
-
-	lcl_MoveControl( _pImp->_pBtnHelp, 0, nYOffset + 3 );
-		// a little more spacing between Cancel- and HelpButton
-
-	// Groesse des Dialoges anpassen.
-	aSize = GetSizePixel();
-	aSize.Height() += nYOffset;
-	SetSizePixel( aSize );
-
-	// Beschriftungen dem Modus anpassen.
-	USHORT nResId = STR_EXPLORERFILE_OPEN;
-	USHORT nButtonResId = 0;
-
-	if ( nStyle & WB_SAVEAS )
-	{
-		nResId = STR_EXPLORERFILE_SAVE;
-		nButtonResId = STR_EXPLORERFILE_BUTTONSAVE;
-	}
-
-	if ( ( nStyle & SFXWB_PATHDIALOG ) == SFXWB_PATHDIALOG )
-	{
-		_pImp->_pFtFileName->SetText( SvtResId( STR_PATHNAME ) );
-		nResId = STR_PATHSELECT;
-		nButtonResId = STR_BUTTONSELECT;
-	}
-
-	SetText( SvtResId( nResId ) );
-
-	if ( nButtonResId )
-		_pImp->_pBtnFileOpen->SetText( SvtResId( nButtonResId ) );
-
-	if ( FILEDLG_TYPE_FILEDLG != _pImp->_eDlgType )
-	{
-		_pImp->_pFtFileType->Hide();
-		_pImp->GetFilterListControl()->Hide();
-	}
-
-	// Einstellungen der Steuerelemente vornehmen.
-	_pImp->_pBtnNewFolder->SetClickHdl( STATIC_LINK( this, SvtFileDialog, NewFolderHdl_Impl ) );
-	_pImp->_pBtnFileOpen->SetClickHdl( STATIC_LINK( this, SvtFileDialog, OpenHdl_Impl ) );
-	_pImp->_pBtnCancel->SetClickHdl( LINK( this, SvtFileDialog, CancelHdl_Impl ) );
-	_pImp->SetFilterListSelectHdl( STATIC_LINK( this, SvtFileDialog, FilterSelectHdl_Impl ) );
-	_pImp->_pEdFileName->SetGetFocusHdl( STATIC_LINK( this, SvtFileDialog, FileNameGetFocusHdl_Impl ) );
-	_pImp->_pEdFileName->SetModifyHdl( STATIC_LINK( this, SvtFileDialog, FileNameModifiedHdl_Impl ) );
-	_pFileView->SetSelectHdl( LINK( this, SvtFileDialog, SelectHdl_Impl ) );
-	_pFileView->SetDoubleClickHdl( LINK( this, SvtFileDialog, DblClickHdl_Impl ) );
-	_pFileView->SetOpenDoneHdl( LINK( this, SvtFileDialog, OpenDoneHdl_Impl ) );
-
-	// Resourcen freigeben.
-	FreeResource();
-
-	// Timer fuer Filterbox Travel setzen
-	_pImp->_aFilterTimer.SetTimeout( TRAVELFILTER_TIMEOUT );
-	_pImp->_aFilterTimer.SetTimeoutHdl( STATIC_LINK( this, SvtFileDialog, FilterSelectHdl_Impl ) );
-
-	if ( WB_SAVEAS & nStyle )
-	{
-		// different help ids if in save-as mode
-		// 90744 - 09.08.2001 - frank.schoenheit@sun.com
-		SetHelpId( HID_FILESAVE_DIALOG );
-
-		_pImp->_pEdFileName->SetHelpId( HID_FILESAVE_FILEURL );
-		_pImp->_pBtnFileOpen->SetHelpId( HID_FILESAVE_DOSAVE );
-		_pImp->_pBtnNewFolder->SetHelpId( HID_FILESAVE_CREATEDIRECTORY );
-		_pImp->_pBtnStandard->SetHelpId( HID_FILESAVE_DEFAULTDIRECTORY );
-		_pImp->_pBtnUp->SetHelpId( HID_FILESAVE_LEVELUP );
-		_pImp->GetFilterListControl()->SetHelpId( HID_FILESAVE_FILETYPE );
-		_pFileView->SetHelpId( HID_FILESAVE_FILEVIEW );
-
-		// formerly, there was only _pLbFileVersion, which was used for 3 different
-		// use cases. For reasons of maintainability, I introduced extra members (_pLbTemplates, _pLbImageTemplates)
-		// for the extra use cases, and separated _pLbFileVersion
-		// I did not find out in which cases the help ID is really needed HID_FILESAVE_TEMPLATE - all
-		// tests I made lead to a dialog where _no_ of the three list boxes was present.
-		// 96930 - 15.08.2002 - fs@openoffice.org
-		if ( _pImp->_pLbFileVersion )
-			_pImp->_pLbFileVersion->SetHelpId( HID_FILESAVE_TEMPLATE );
-		if ( _pImp->_pLbTemplates )
-			_pImp->_pLbTemplates->SetHelpId( HID_FILESAVE_TEMPLATE );
-		if ( _pImp->_pLbImageTemplates )
-			_pImp->_pLbImageTemplates->SetHelpId( HID_FILESAVE_TEMPLATE );
-
-		if ( _pImp->_pCbPassword ) _pImp->_pCbPassword->SetHelpId( HID_FILESAVE_SAVEWITHPASSWORD );
-		if ( _pImp->_pCbAutoExtension ) _pImp->_pCbAutoExtension->SetHelpId( HID_FILESAVE_AUTOEXTENSION );
-		if ( _pImp->_pCbOptions ) _pImp->_pCbOptions->SetHelpId( HID_FILESAVE_CUSTOMIZEFILTER );
-		if ( _pCbSelection ) _pCbSelection->SetHelpId( HID_FILESAVE_SELECTION );
-	}
-
-	// correct the z-order of the controls
-	implArrangeControls();
+    // Zahl der Pixel bestimmen, um die die anderen Elemente in der Position
+    // Angepasst werden muessen.
+    aPos.Y() += aSize.Height();
+    aPos.Y() += LogicToPixel( Size( 0, 6 ), MAP_APPFONT ).Height();
+    long nYOffset = aPos.Y();
+    aPos = _pFileView->GetPosPixel();
+    nYOffset -= aPos.Y();
+
+    // Positionen der uebrigen Elemente anpassen.
+    aPos.X() += nXOffset + nXPlacesOffset;
+    aPos.Y() += nYOffset;
+    _pFileView->SetPosPixel( aPos );
+
+    lcl_MoveControl( _pImp->_pFtFileName, nXOffset, nYOffset );
+    lcl_MoveControl( _pImp->_pEdFileName, nXOffset, nYOffset );
+
+    lcl_MoveControl( _pImp->_pFtFileVersion, nXOffset, nYOffset );
+    lcl_MoveControl( _pImp->_pLbFileVersion, nXOffset, nYOffset );
+
+    lcl_MoveControl( _pImp->_pFtTemplates, nXOffset, nYOffset );
+    lcl_MoveControl( _pImp->_pLbTemplates, nXOffset, nYOffset );
+
+    lcl_MoveControl( _pImp->_pFtImageTemplates, nXOffset, nYOffset );
+    lcl_MoveControl( _pImp->_pLbImageTemplates, nXOffset, nYOffset );
+
+    lcl_MoveControl( _pImp->_pFtFileType, nXOffset, nYOffset );
+    lcl_MoveControl( _pImp->GetFilterListControl(), nXOffset, nYOffset );
+
+    lcl_MoveControl( _pImp->_pBtnFileOpen, nXOffset, nYOffset );
+    lcl_MoveControl( _pImp->_pBtnCancel, nXOffset, nYOffset );
+
+    lcl_MoveControl( _pImp->_pBtnHelp, nXOffset, nYOffset + 3 );
+        // a little more spacing between Cancel- and HelpButton
+
+    // Groesse des Dialoges anpassen.
+    aSize = GetSizePixel();
+    aSize.Height() += nYOffset;
+    SetSizePixel( aSize );
+
+    // Beschriftungen dem Modus anpassen.
+    USHORT nResId = STR_EXPLORERFILE_OPEN;
+    USHORT nButtonResId = 0;
+
+    if ( nStyle & WB_SAVEAS )
+    {
+        nResId = STR_EXPLORERFILE_SAVE;
+        nButtonResId = STR_EXPLORERFILE_BUTTONSAVE;
+    }
+
+    if ( ( nStyle & SFXWB_PATHDIALOG ) == SFXWB_PATHDIALOG )
+    {
+        _pImp->_pFtFileName->SetText( SvtResId( STR_PATHNAME ) );
+        nResId = STR_PATHSELECT;
+        nButtonResId = STR_BUTTONSELECT;
+    }
+
+    SetText( SvtResId( nResId ) );
+
+    if ( nButtonResId )
+        _pImp->_pBtnFileOpen->SetText( SvtResId( nButtonResId ) );
+
+    if ( FILEDLG_TYPE_FILEDLG != _pImp->_eDlgType )
+    {
+        _pImp->_pFtFileType->Hide();
+        _pImp->GetFilterListControl()->Hide();
+    }
+
+    // Einstellungen der Steuerelemente vornehmen.
+    _pImp->_pBtnNewFolder->SetClickHdl( STATIC_LINK( this, SvtFileDialog, NewFolderHdl_Impl ) );
+    _pImp->_pBtnFileOpen->SetClickHdl( STATIC_LINK( this, SvtFileDialog, OpenHdl_Impl ) );
+    _pImp->_pBtnCancel->SetClickHdl( LINK( this, SvtFileDialog, CancelHdl_Impl ) );
+    _pImp->SetFilterListSelectHdl( STATIC_LINK( this, SvtFileDialog, FilterSelectHdl_Impl ) );
+    _pImp->_pEdFileName->SetGetFocusHdl( STATIC_LINK( this, SvtFileDialog, FileNameGetFocusHdl_Impl ) );
+    _pImp->_pEdFileName->SetModifyHdl( STATIC_LINK( this, SvtFileDialog, FileNameModifiedHdl_Impl ) );
+    _pFileView->SetSelectHdl( LINK( this, SvtFileDialog, SelectHdl_Impl ) );
+    _pFileView->SetDoubleClickHdl( LINK( this, SvtFileDialog, DblClickHdl_Impl ) );
+    _pFileView->SetOpenDoneHdl( LINK( this, SvtFileDialog, OpenDoneHdl_Impl ) );
+
+    // Resourcen freigeben.
+    FreeResource();
+
+    // Timer fuer Filterbox Travel setzen
+    _pImp->_aFilterTimer.SetTimeout( TRAVELFILTER_TIMEOUT );
+    _pImp->_aFilterTimer.SetTimeoutHdl( STATIC_LINK( this, SvtFileDialog, FilterSelectHdl_Impl ) );
+
+    if ( WB_SAVEAS & nStyle )
+    {
+        // different help ids if in save-as mode
+        // 90744 - 09.08.2001 - frank.schoenheit@sun.com
+        SetHelpId( HID_FILESAVE_DIALOG );
+
+        _pImp->_pEdFileName->SetHelpId( HID_FILESAVE_FILEURL );
+        _pImp->_pBtnFileOpen->SetHelpId( HID_FILESAVE_DOSAVE );
+        _pImp->_pBtnNewFolder->SetHelpId( HID_FILESAVE_CREATEDIRECTORY );
+        _pImp->_pBtnStandard->SetHelpId( HID_FILESAVE_DEFAULTDIRECTORY );
+        _pImp->_pBtnUp->SetHelpId( HID_FILESAVE_LEVELUP );
+        _pImp->GetFilterListControl()->SetHelpId( HID_FILESAVE_FILETYPE );
+        _pFileView->SetHelpId( HID_FILESAVE_FILEVIEW );
+
+        // formerly, there was only _pLbFileVersion, which was used for 3 different
+        // use cases. For reasons of maintainability, I introduced extra members (_pLbTemplates, _pLbImageTemplates)
+        // for the extra use cases, and separated _pLbFileVersion
+        // I did not find out in which cases the help ID is really needed HID_FILESAVE_TEMPLATE - all
+        // tests I made lead to a dialog where _no_ of the three list boxes was present.
+        // 96930 - 15.08.2002 - fs@openoffice.org
+        if ( _pImp->_pLbFileVersion )
+            _pImp->_pLbFileVersion->SetHelpId( HID_FILESAVE_TEMPLATE );
+        if ( _pImp->_pLbTemplates )
+            _pImp->_pLbTemplates->SetHelpId( HID_FILESAVE_TEMPLATE );
+        if ( _pImp->_pLbImageTemplates )
+            _pImp->_pLbImageTemplates->SetHelpId( HID_FILESAVE_TEMPLATE );
+
+        if ( _pImp->_pCbPassword ) _pImp->_pCbPassword->SetHelpId( HID_FILESAVE_SAVEWITHPASSWORD );
+        if ( _pImp->_pCbAutoExtension ) _pImp->_pCbAutoExtension->SetHelpId( HID_FILESAVE_AUTOEXTENSION );
+        if ( _pImp->_pCbOptions ) _pImp->_pCbOptions->SetHelpId( HID_FILESAVE_CUSTOMIZEFILTER );
+        if ( _pCbSelection ) _pCbSelection->SetHelpId( HID_FILESAVE_SELECTION );
+    }
+
+    if ( m_bHasPlaces )
+    {
+        // move, resize controls wrt places window
+        implChangeControlWidth( nXPlacesOffset );
+
+        lcl_MoveControl( _pImp->_pBtnFileOpen, nXPlacesOffset, 0 );
+        lcl_MoveControl( _pImp->_pBtnCancel, nXPlacesOffset, 0 );
+        lcl_MoveControl( _pImp->_pBtnHelp, nXPlacesOffset, 0 );
+
+        // show places window
+        _pPlacesWin->Show();
+    }
+
+    // correct the z-order of the controls
+    implArrangeControls();
 
     // special URLs, such as favourites and "restricted" paths
     implInitializeSpecialURLLists( );
     pThis->_pFileView->EndInplaceEditing( false );
 
     INetURLObject aObj( pThis->_pFileView->GetViewURL() );
-	String sFolderName = aObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET, RTL_TEXTENCODING_UTF8 );
+    String sFolderName = aObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET, RTL_TEXTENCODING_UTF8 );
     svtools::QueryFolderNameDialog aDlg( pThis, sFolderName, String( SvtResId( STR_SVT_NEW_FOLDER ) ) );
     sal_Bool bHandled = sal_False;
 
-	while ( !bHandled )
-	{
-		if ( aDlg.Execute() == RET_OK )
-			bHandled = pThis->_pFileView->CreateNewFolder( aDlg.GetName() );
-		else
-			bHandled = sal_True;
-	}
-
-	return 0;
+    while ( !bHandled )
+    {
+        if ( aDlg.Execute() == RET_OK )
+            bHandled = pThis->_pFileView->CreateNewFolder( aDlg.GetName() );
+        else
+            bHandled = sal_True;
+    }
+
+    return 0;
 }
 
 //*****************************************************************************
 
 IMPL_STATIC_LINK_NOINSTANCE( SvtFileDialog, ViewHdl_Impl, ImageButton*, EMPTYARG )
 {
-	return 0;
+    return 0;
 }
 
 //*****************************************************************************
 //-----------------------------------------------------------------------------
 sal_Bool SvtFileDialog::createNewUserFilter( const String& _rNewFilter, sal_Bool _bAllowUserDefExt )
 {
-	// delete the old user filter and create a new one
-	DELETEZ( _pImp->_pUserFilter );
-	_pImp->_pUserFilter = new SvtFileDialogFilter_Impl( _rNewFilter, _rNewFilter );
-
-	// remember the extension
-	sal_Bool bIsAllFiles = _rNewFilter.EqualsAscii( FILEDIALOG_FILTER_ALL );
-	if ( bIsAllFiles )
-		EraseDefaultExt();
-	else
-		SetDefaultExt( _rNewFilter.Copy( 2 ) );
-		// TODO: this is nonsense. In the whole file there are a lotta places where we assume that a user filter
-		// is always "*.<something>". But changing this would take some more time than I have now ...
-		// 05.12.2001 - 95486 - fs@openoffice.org
-
-	// now, the default extension is set to the one of the user filter (or empty)
-	// if the former is not allowed (_bAllowUserDefExt = <FALSE/>), we have to use the ext of the current filter
-	// (if possible)
-	sal_Bool bUseCurFilterExt = sal_True;
-	String sUserFilter = _pImp->_pUserFilter->GetType();
-	xub_StrLen nSepPos = sUserFilter.SearchBackward( '.' );
-	if ( STRING_NOTFOUND != nSepPos )
-	{
-		String sUserExt = sUserFilter.Copy( nSepPos + 1 );
-		if	(	( STRING_NOTFOUND == sUserExt.Search( '*' ) )
-			&&	( STRING_NOTFOUND == sUserExt.Search( '?' ) )
-			)
-			bUseCurFilterExt = sal_False;
-	}
-
-	if ( !_bAllowUserDefExt || bUseCurFilterExt )
-	{
-		if ( _pImp->GetCurFilter( ) )
+    // delete the old user filter and create a new one
+    DELETEZ( _pImp->_pUserFilter );
+    _pImp->_pUserFilter = new SvtFileDialogFilter_Impl( _rNewFilter, _rNewFilter );
+
+    // remember the extension
+    sal_Bool bIsAllFiles = _rNewFilter.EqualsAscii( FILEDIALOG_FILTER_ALL );
+    if ( bIsAllFiles )
+        EraseDefaultExt();
+    else
+        SetDefaultExt( _rNewFilter.Copy( 2 ) );
+        // TODO: this is nonsense. In the whole file there are a lotta places where we assume that a user filter
+        // is always "*.<something>". But changing this would take some more time than I have now ...
+        // 05.12.2001 - 95486 - fs@openoffice.org
+
+    // now, the default extension is set to the one of the user filter (or empty)
+    // if the former is not allowed (_bAllowUserDefExt = <FALSE/>), we have to use the ext of the current filter
+    // (if possible)
+    sal_Bool bUseCurFilterExt = sal_True;
+    String sUserFilter = _pImp->_pUserFilter->GetType();
+    xub_StrLen nSepPos = sUserFilter.SearchBackward( '.' );
+    if ( STRING_NOTFOUND != nSepPos )
+    {
+        String sUserExt = sUserFilter.Copy( nSepPos + 1 );
+        if ( ( STRING_NOTFOUND == sUserExt.Search( '*' ) )
+            && ( STRING_NOTFOUND == sUserExt.Search( '?' ) )
+            )
+            bUseCurFilterExt = sal_False;
+    }
+
+    if ( !_bAllowUserDefExt || bUseCurFilterExt )
+    {
+        if ( _pImp->GetCurFilter( ) )
             SetDefaultExt( _pImp->GetCurFilter( )->GetExtension() );
-		else
-			EraseDefaultExt();
-	}
-
-	// outta here
-	return bIsAllFiles;
+        else
+            EraseDefaultExt();
+    }
+
+    // outta here
+    return bIsAllFiles;
 }
 
 //-----------------------------------------------------------------------------
-#define FLT_NONEMPTY		0x0001
-#define FLT_CHANGED			0x0002
-#define FLT_USERFILTER		0x0004
-#define FLT_ALLFILESFILTER	0x0008
+#define FLT_NONEMPTY       0x0001
+#define FLT_CHANGED        0x0002
+#define FLT_USERFILTER     0x0004
+#define FLT_ALLFILESFILTER 0x0008
 
 //-----------------------------------------------------------------------------
 sal_uInt16 SvtFileDialog::adjustFilter( const String& _rFilter )
 {
-	sal_uInt16 nReturn = 0;
-
-	const sal_Bool bNonEmpty = ( _rFilter.Len() != 0 );
-	if ( bNonEmpty )
-	{
-		nReturn |= FLT_NONEMPTY;
-
-		sal_Bool bFilterChanged = sal_True;
-
-		// search for a corresponding filter
-		SvtFileDialogFilter_Impl* pFilter = FindFilter_Impl( _rFilter, FALSE, bFilterChanged );
+    sal_uInt16 nReturn = 0;
+
+    const sal_Bool bNonEmpty = ( _rFilter.Len() != 0 );
+    if ( bNonEmpty )
+    {
+        nReturn |= FLT_NONEMPTY;
+
+        sal_Bool bFilterChanged = sal_True;
+
+        // search for a corresponding filter
+        SvtFileDialogFilter_Impl* pFilter = FindFilter_Impl( _rFilter, FALSE, bFilterChanged );
 
 #ifdef AUTOSELECT_USERFILTER
-		// if we found a filter which without allowing multi-extensions -> select it
-		if ( pFilter )
-		{
-			_pImp->SelectFilterListEntry( pFilter->GetName() );
-			_pImp->SetCurFilter( pFilter );
-		}
+        // if we found a filter which without allowing multi-extensions -> select it
+        if ( pFilter )
+        {
+            _pImp->SelectFilterListEntry( pFilter->GetName() );
+            _pImp->SetCurFilter( pFilter );
+        }
 #endif // AUTOSELECT_USERFILTER
 
-		// look for multi-ext filters if necessary
-		if ( !pFilter )
-			pFilter = FindFilter_Impl( _rFilter, TRUE, bFilterChanged );
-
-		if ( bFilterChanged )
-			nReturn |= FLT_CHANGED;
-
-		if ( !pFilter )
-		{
-			nReturn |= FLT_USERFILTER;
-			// no filter found : use it as user defined filter
+        // look for multi-ext filters if necessary
+        if ( !pFilter )
+            pFilter = FindFilter_Impl( _rFilter, TRUE, bFilterChanged );
+
+        if ( bFilterChanged )
+            nReturn |= FLT_CHANGED;
+
+        if ( !pFilter )
+        {
+            nReturn |= FLT_USERFILTER;
+            // no filter found : use it as user defined filter
 #ifdef AUTOSELECT_USERFILTER
-			if ( createNewUserFilter( _rFilter, sal_True ) )
+            if ( createNewUserFilter( _rFilter, sal_True ) )
 #else
-			if ( createNewUserFilter( _rFilter, sal_False ) )
+            if ( createNewUserFilter( _rFilter, sal_False ) )
 #endif
-			{	// it's the "all files" filter
-				nReturn |= FLT_ALLFILESFILTER;
+            { // it's the "all files" filter
+                nReturn |= FLT_ALLFILESFILTER;
 
 #ifdef AUTOSELECT_USERFILTER
-				// select the "all files" entry
-				String sAllFilesFilter( SvtResId( STR_FILTERNAME_ALL ) );
-				if ( _pImp->HasFilterListEntry( sAllFilesFilter ) )
-				{
-					_pImp->SelectFilterListEntry( sAllFilesFilter );
-					_pImp->SetCurFilter( _pImp->GetSelectedFilterEntry( sAllFilesFilter ) );
-				}
-				else
-					_pImp->SetNoFilterListSelection( );	// there is no "all files" entry
+                // select the "all files" entry
+                String sAllFilesFilter( SvtResId( STR_FILTERNAME_ALL ) );
+                if ( _pImp->HasFilterListEntry( sAllFilesFilter ) )
+                {
+                    _pImp->SelectFilterListEntry( sAllFilesFilter );
+                    _pImp->SetCurFilter( _pImp->GetSelectedFilterEntry( sAllFilesFilter ) );
+                }
+                else
+                    _pImp->SetNoFilterListSelection( ); // there is no "all files" entry
 #endif // AUTOSELECT_USERFILTER
-			}
+            }
 #ifdef AUTOSELECT_USERFILTER
-			else
-				_pImp->SetNoFilterListSelection( );
+            else
+                _pImp->SetNoFilterListSelection( );
 #endif // AUTOSELECT_USERFILTER
-		}
-	}
-
-	return nReturn;
+        }
+    }
+
+    return nReturn;
 }
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 IMPL_STATIC_LINK( SvtFileDialog, OpenHdl_Impl, void*, pVoid )
 {
-	if ( pThis->_pImp->_bMultiSelection && pThis->_pFileView->GetSelectionCount() > 1 )
-	{
-		// bei Multiselektion spezielles Open
-		pThis->OpenMultiSelection_Impl();
-		return 0;
-	}
-
-	String aFileName;
+    if ( pThis->_pImp->_bMultiSelection && pThis->_pFileView->GetSelectionCount() > 1 )
+    {
+        // bei Multiselektion spezielles Open
+        pThis->OpenMultiSelection_Impl();
+        return 0;
+    }
+
+    String aFileName;
     String aOldPath( pThis->_pFileView->GetViewURL() );
-	if ( pThis->_pImp->_bDoubleClick || pThis->_pFileView->HasChildPathFocus() )
-		// Selection done by doubleclicking in the view, get filename from the view
-		aFileName = pThis->_pFileView->GetCurrentURL();
-
-	if ( !aFileName.Len() )
-	{
-		// if an entry is selected in the view ....
-		if ( pThis->_pFileView->GetSelectionCount() )
-		{	// -> use this one. This will allow us to step down this folder
-			// #i8928# - 2002-12-20 - fs@openoffice.org
-			aFileName = pThis->_pFileView->GetCurrentURL();
-		}
-	}
-
-	if ( !aFileName.Len() )
-	{
-		if ( pThis->_pImp->_eMode == FILEDLG_MODE_OPEN && pThis->_pImp->_pEdFileName->IsTravelSelect() )
-			// OpenHdl called from URLBox; travelling through the list of URLs should not cause an opening
-			return 0;		            // MBA->PB: seems to be called never ?!
-
-		// get the URL from from the edit field ( if not empty )
-		if ( pThis->_pImp->_pEdFileName->GetText().Len() )
-		{
-			String aText = pThis->_pImp->_pEdFileName->GetText();
-
-			// did we reach the root?
-			if ( !INetURLObject( aOldPath ).getSegmentCount() )
-			{
-				if ( ( aText.Len() == 2 && aText.EqualsAscii( ".." ) ) ||
-					 ( aText.Len() == 3 && ( aText.EqualsAscii( "..\\" ) || aText.EqualsAscii( "../" ) ) ) )
-					// don't go higher than the root
-					return 0;
-			}
+    if ( pThis->_pImp->_bDoubleClick || pThis->_pFileView->HasChildPathFocus() )
+        // Selection done by doubleclicking in the view, get filename from the view
+        aFileName = pThis->_pFileView->GetCurrentURL();
+
+    if ( !aFileName.Len() )
+    {
+        // if an entry is selected in the view ....
+        if ( pThis->_pFileView->GetSelectionCount() )
+        {   // -> use this one. This will allow us to step down this folder
+            // #i8928# - 2002-12-20 - fs@openoffice.org
+            aFileName = pThis->_pFileView->GetCurrentURL();
+        }
+    }
+
+    if ( !aFileName.Len() )
+    {
+        if ( pThis->_pImp->_eMode == FILEDLG_MODE_OPEN && pThis->_pImp->_pEdFileName->IsTravelSelect() )
+            // OpenHdl called from URLBox; travelling through the list of URLs should not cause an opening
+            return 0;             // MBA->PB: seems to be called never ?!
+
+        // get the URL from from the edit field ( if not empty )
+        if ( pThis->_pImp->_pEdFileName->GetText().Len() )
+        {
+            String aText = pThis->_pImp->_pEdFileName->GetText();
+
+            // did we reach the root?
+            if ( !INetURLObject( aOldPath ).getSegmentCount() )
+            {
+                if ( ( aText.Len() == 2 && aText.EqualsAscii( ".." ) ) ||
+                     ( aText.Len() == 3 && ( aText.EqualsAscii( "..\\" ) || aText.EqualsAscii( "../" ) ) ) )
+                    // don't go higher than the root
+                    return 0;
+            }
 
 #if defined( UNX ) || defined( FS_PRIV_DEBUG )
-			if ( ( 1 == aText.Len() ) && ( '~' == aText.GetBuffer()[0] ) )
-			{
-				// go to the home directory
-				if ( lcl_getHomeDirectory( pThis->_pFileView->GetViewURL(), aFileName ) )
-					// in case we got a home dir, reset the text of the edit
-					pThis->_pImp->_pEdFileName->SetText( String() );
-			}
-			if ( !aFileName.Len() )
+            if ( ( 1 == aText.Len() ) && ( '~' == aText.GetBuffer()[0] ) )
+            {
+                // go to the home directory
+                if ( lcl_getHomeDirectory( pThis->_pFileView->GetViewURL(), aFileName ) )
+                    // in case we got a home dir, reset the text of the edit
+                    pThis->_pImp->_pEdFileName->SetText( String() );
+            }
+            if ( !aFileName.Len() )
 #endif
-			{
-				// get url from autocomplete edit
-        		aFileName = pThis->_pImp->_pEdFileName->GetURL();
-			}
-		}
-		else if ( pVoid == pThis->_pImp->_pBtnFileOpen )
-			// OpenHdl was called for the "Open" Button; if edit field is empty, use selected element in the view
-			aFileName = pThis->_pFileView->GetCurrentURL();
-	}
-
-	// MBA->PB: ?!
-	if ( !aFileName.Len() && pVoid == pThis->_pImp->_pEdFileName && pThis->_pImp->_pUserFilter )
-	{
-		DELETEZ( pThis->_pImp->_pUserFilter );
-		return 0;
-	}
-
-	USHORT nLen = aFileName.Len();
-	if ( !nLen )
-	{
-		// if the dialog was opened to select a folder, the last selected folder should be selected
-		if( pThis->_pImp->_eDlgType == FILEDLG_TYPE_PATHDLG )
-		{
-			aFileName =	pThis->_pImp->_pFtCurrentPath->GetText();
-			nLen = aFileName.Len();
-		}
-		else
-			// no file selected !
-			return 0;
-	}
-
-	// mark input as selected
-	pThis->_pImp->_pEdFileName->SetSelection( Selection( 0, nLen ) );
-
-	// if a path with wildcards is given, divide the string into path and wildcards
-	String aFilter;
-	if ( !pThis->IsolateFilterFromPath_Impl( aFileName, aFilter ) )
-		return 0;
-
-	// if a filter was retrieved, there were wildcards !
-	sal_uInt16 nNewFilterFlags = pThis->adjustFilter( aFilter );
-	if ( nNewFilterFlags & FLT_CHANGED )
-	{
-		// cut off all text before wildcard in edit and select wildcard
-		pThis->_pImp->_pEdFileName->SetText( aFilter );
-		pThis->_pImp->_pEdFileName->SetSelection( Selection( 0, aFilter.Len() ) );
-	}
-
+            {
+                // get url from autocomplete edit
+                aFileName = pThis->_pImp->_pEdFileName->GetURL();
+            }
+        }
+        else if ( pVoid == pThis->_pImp->_pBtnFileOpen )
+            // OpenHdl was called for the "Open" Button; if edit field is empty, use selected element in the view
+            aFileName = pThis->_pFileView->GetCurrentURL();
+    }
+
+    // MBA->PB: ?!
+    if ( !aFileName.Len() && pVoid == pThis->_pImp->_pEdFileName && pThis->_pImp->_pUserFilter )
     {
-	    INetURLObject aFileObject( aFileName );
-	    if ( ( aFileObject.GetProtocol() == INET_PROT_NOT_VALID ) && aFileName.Len() )
-	    {
-		    String sCompleted = SvtURLBox::ParseSmart( aFileName, pThis->_pFileView->GetViewURL(), SvtPathOptions().GetWorkPath() );
-		    if ( sCompleted.Len() )
-			    aFileName = sCompleted;
-	    }
+        DELETEZ( pThis->_pImp->_pUserFilter );
+        return 0;
     }
 
-	// Pr"ufen, ob es sich um einen Ordner handelt.
+    USHORT nLen = aFileName.Len();
+    if ( !nLen )
+    {
+        // if the dialog was opened to select a folder, the last selected folder should be selected
+        if( pThis->_pImp->_eDlgType == FILEDLG_TYPE_PATHDLG )
+        {
+            aFileName = pThis->_pImp->_pFtCurrentPath->GetText();
+            nLen = aFileName.Len();
+        }
+        else
+            // no file selected !
+            return 0;
+    }
+
+    // mark input as selected
+    pThis->_pImp->_pEdFileName->SetSelection( Selection( 0, nLen ) );
+
+    // if a path with wildcards is given, divide the string into path and wildcards
+    String aFilter;
+    if ( !pThis->IsolateFilterFromPath_Impl( aFileName, aFilter ) )
+        return 0;
+
+    // if a filter was retrieved, there were wildcards !
+    sal_uInt16 nNewFilterFlags = pThis->adjustFilter( aFilter );
+    if ( nNewFilterFlags & FLT_CHANGED )
+    {
+        // cut off all text before wildcard in edit and select wildcard
+        pThis->_pImp->_pEdFileName->SetText( aFilter );
+        pThis->_pImp->_pEdFileName->SetSelection( Selection( 0, aFilter.Len() ) );
+    }
+
+    {
+        INetURLObject aFileObject( aFileName );
+        if ( ( aFileObject.GetProtocol() == INET_PROT_NOT_VALID ) && aFileName.Len() )
+        {
+            String sCompleted = SvtURLBox::ParseSmart( aFileName, pThis->_pFileView->GetViewURL(), SvtPathOptions().GetWorkPath() );
+            if ( sCompleted.Len() )
+                aFileName = sCompleted;
+        }
+    }
+
+    // Pr"ufen, ob es sich um einen Ordner handelt.
     BOOL bIsFolder = FALSE;
 
     // first thing before doing anyhing with the content: Reset it. When the user presses "open" (or "save" or "export",
     pThis->m_aContent.bindTo( ::rtl::OUString( ) );
 
     // #97148# & #102204# ---------
-	if ( aFileName.Len() )
-	{
+    if ( aFileName.Len() )
+    {
         // Make sure we have own Interaction Handler in place. We do not need
         // to intercept interactions here, but to record the fact that there
         // was an interaction.
             pThis->m_aContent.enableOwnInteractionHandler(
                 OFilePickerInteractionHandler::E_NOINTERCEPTION );
 
-		bIsFolder = pThis->m_aContent.isFolder( aFileName );
+        bIsFolder = pThis->m_aContent.isFolder( aFileName );
 
         // access denied to the given resource - and interaction was already
         // used => break following operations
         if ( pHandler->wasAccessDenied() )
             return 0;
 
-		if ( pThis->m_aContent.isInvalid() &&
+        if ( pThis->m_aContent.isInvalid() &&
              ( pThis->_pImp->_eMode == FILEDLG_MODE_OPEN ) )
         {
             if ( !pHandler->wasUsed() )
                 ErrorHandler::HandleError( ERRCODE_IO_NOTEXISTS );
 
-			return 0;
+            return 0;
         }
 
         // restore previous Interaction Handler
             pThis->m_aContent.disableInteractionHandler();
         else if ( eInterActionHandlerType == SmartContent::IHT_DEFAULT )
             pThis->m_aContent.enableDefaultInteractionHandler();
- 	}
-
-    if  (   !bIsFolder                                      // no existent folder
-		&&	pThis->_pImp->_pCbAutoExtension					// auto extension is enabled in general
-		&&	pThis->_pImp->_pCbAutoExtension->IsChecked()	// auto extension is really to be used
-		&&	pThis->GetDefaultExt().Len()					// there is a default extension
-		&&	pThis->GetDefaultExt() != '*'					// the default extension is not "all"
+    }
+
+    if  (   !bIsFolder                                          // no existent folder
+        &&  pThis->_pImp->_pCbAutoExtension                     // auto extension is enabled in general
+        &&  pThis->_pImp->_pCbAutoExtension->IsChecked()        // auto extension is really to be used
+        &&  pThis->GetDefaultExt().Len()                        // there is a default extension
+        &&  pThis->GetDefaultExt() != '*'                       // the default extension is not "all"
         && !(   FILEDLG_MODE_SAVE == pThis->_pImp->_eMode       // we're saving a file
             &&  pThis->_pFileView->GetSelectionCount()          // there is a selected file in the file view -> it will later on
             )                                                   //    (in SvtFileDialog::GetPathList) be taken as file to save to
                                                                 // (#114818# - 2004-03-17 - fs@openoffice.org)
         && FILEDLG_MODE_OPEN != pThis->_pImp->_eMode // pb: #i83408# don't append extension on open
         )
-	{
+    {
         // check extension and append the default extension if necessary
         appendDefaultExtension(aFileName,
                                pThis->GetDefaultExt(),
                                pThis->_pImp->GetCurFilter()->GetType());
-	}
-
-	BOOL bOpenFolder = ( FILEDLG_TYPE_PATHDLG == pThis->_pImp->_eDlgType ) &&
-					   !pThis->_pImp->_bDoubleClick && pVoid != pThis->_pImp->_pEdFileName;
-	if ( bIsFolder )
-	{
-		if ( bOpenFolder )
-		{
-			pThis->_aPath = aFileName;
-		}
+    }
+
+    BOOL bOpenFolder = ( FILEDLG_TYPE_PATHDLG == pThis->_pImp->_eDlgType ) &&
+                       !pThis->_pImp->_bDoubleClick && pVoid != pThis->_pImp->_pEdFileName;
+    if ( bIsFolder )
+    {
+        if ( bOpenFolder )
+        {
+            pThis->_aPath = aFileName;
+        }
         else
         {
-		    if ( aFileName != pThis->_pFileView->GetViewURL() )
-		    {
+            if ( aFileName != pThis->_pFileView->GetViewURL() )
+            {
                 if ( !pThis->m_aURLFilter.isUrlAllowed( aFileName ) )
                 {
                     pThis->simulateAccessDenied( aFileName );
-    			    return 0;
+                    return 0;
                 }
 
                 pThis->OpenURL_Impl( aFileName );
-		    }
-		    else
+            }
+            else
             {
                 if ( nNewFilterFlags & FLT_CHANGED )
                     pThis->ExecuteFilter();
 
             return 0;
         }
-	}
+    }
     else if ( !( nNewFilterFlags & FLT_NONEMPTY ) )
-	{
-		// Ggf. URL speichern.
+    {
+        // Ggf. URL speichern.
         pThis->_aPath = aFileName;
-	}
-	else
-	{
-		// Ggf. neu filtern.
-		if ( nNewFilterFlags & FLT_CHANGED )
-			pThis->ExecuteFilter();
-		return 0;
-	}
+    }
+    else
+    {
+        // Ggf. neu filtern.
+        if ( nNewFilterFlags & FLT_CHANGED )
+            pThis->ExecuteFilter();
+        return 0;
+    }
 
     INetURLObject aFileObj( aFileName );
     if ( aFileObj.HasError() )
         return 0;
     }
 
-	switch ( pThis->_pImp->_eMode )
-	{
-		case FILEDLG_MODE_SAVE:
-		{
-			if ( ::utl::UCBContentHelper::Exists( aFileObj.GetMainURL( INetURLObject::NO_DECODE ) ) )
-			{
-				QueryBox aBox( pThis, WB_YES_NO, SvtResId( STR_SVT_ALREADYEXISTOVERWRITE ) );
-				if ( aBox.Execute() != RET_YES )
-					return 0;
-			}
-			else
-			{
-				String aCurPath;
-				if ( ::utl::LocalFileHelper::ConvertURLToSystemPath( aFileName, aCurPath ) )
-				{
-					// if content does not exist: at least its path must exist
-					INetURLObject aPathObj = aFileObj;
-					aPathObj.removeSegment();
-					// #97148# & #102204# ------------
-					BOOL bFolder = pThis->m_aContent.isFolder( aPathObj.GetMainURL( INetURLObject::NO_DECODE ) );
-					if ( !bFolder )
-					{
-						ErrorHandler::HandleError( ERRCODE_IO_NOTEXISTSPATH );
-						return 0;
-					}
-				}
-			}
-		}
-		break;
-
-		case FILEDLG_MODE_OPEN:
-		{
-			// do an existence check herein, again
-			// 16.11.2001 - 93107 - frank.schoenheit@sun.com
-
-			if ( INET_PROT_FILE == aFileObj.GetProtocol( ) )
-			{
-				sal_Bool bExists = sal_False;
-				// #102204# --------------
-				bExists = pThis->m_aContent.is( aFileObj.GetMainURL( INetURLObject::NO_DECODE ) );
-
-
-				if ( !bExists )
-				{
-					String sError( SvtResId( RID_FILEOPEN_NOTEXISTENTFILE ) );
-
-					String sInvalidFile( aFileObj.GetMainURL( INetURLObject::DECODE_TO_IURI ) );
-					if ( INET_PROT_FILE == aFileObj.GetProtocol() )
-					{	// if it's a file URL, transform the URL into system notation
-						::rtl::OUString sURL( sInvalidFile );
-						::rtl::OUString sSystem;
-						osl_getSystemPathFromFileURL( sURL.pData, &sSystem.pData );
-						sInvalidFile = sSystem;
-					}
-					sError.SearchAndReplaceAscii( "$name$", sInvalidFile );
-
-					ErrorBox aError( pThis, WB_OK, sError );
-					aError.Execute();
-					return 0;
-				}
-			}
-		}
-		break;
-
-		default:
-			DBG_ERROR("SvtFileDialog, OpenHdl_Impl: invalid mode!");
-	}
-
-	// Interessenten benachrichtigen.
-	long nRet;
-
-	if ( pThis->_aOKHdl.IsSet() )
-		nRet = pThis->_aOKHdl.Call( pThis );
-	else
-		nRet = pThis->OK();
-
-	if ( nRet )
-	{
-		pThis->EndDialog( TRUE );
-	}
-
-	return nRet;
+    switch ( pThis->_pImp->_eMode )
+    {
+        case FILEDLG_MODE_SAVE:
+        {
+            if ( ::utl::UCBContentHelper::Exists( aFileObj.GetMainURL( INetURLObject::NO_DECODE ) ) )
+            {
+                QueryBox aBox( pThis, WB_YES_NO, SvtResId( STR_SVT_ALREADYEXISTOVERWRITE ) );
+                if ( aBox.Execute() != RET_YES )
+                    return 0;
+            }
+            else
+            {
+                String aCurPath;
+                if ( ::utl::LocalFileHelper::ConvertURLToSystemPath( aFileName, aCurPath ) )
+                {
+                    // if content does not exist: at least its path must exist
+                    INetURLObject aPathObj = aFileObj;
+                    aPathObj.removeSegment();
+                    // #97148# & #102204# ------------
+                    BOOL bFolder = pThis->m_aContent.isFolder( aPathObj.GetMainURL( INetURLObject::NO_DECODE ) );
+                    if ( !bFolder )
+                    {
+                        ErrorHandler::HandleError( ERRCODE_IO_NOTEXISTSPATH );
+                        return 0;
+                    }
+                }
+            }
+        }
+        break;
+
+        case FILEDLG_MODE_OPEN:
+        {
+            // do an existence check herein, again
+            // 16.11.2001 - 93107 - frank.schoenheit@sun.com
+
+            if ( INET_PROT_FILE == aFileObj.GetProtocol( ) )
+            {
+                sal_Bool bExists = sal_False;
+                // #102204# --------------
+                bExists = pThis->m_aContent.is( aFileObj.GetMainURL( INetURLObject::NO_DECODE ) );
+
+
+                if ( !bExists )
+                {
+                    String sError( SvtResId( RID_FILEOPEN_NOTEXISTENTFILE ) );
+
+                    String sInvalidFile( aFileObj.GetMainURL( INetURLObject::DECODE_TO_IURI ) );
+                    if ( INET_PROT_FILE == aFileObj.GetProtocol() )
+                    { // if it's a file URL, transform the URL into system notation
+                        ::rtl::OUString sURL( sInvalidFile );
+                        ::rtl::OUString sSystem;
+                        osl_getSystemPathFromFileURL( sURL.pData, &sSystem.pData );
+                        sInvalidFile = sSystem;
+                    }
+                    sError.SearchAndReplaceAscii( "$name$", sInvalidFile );
+
+                    ErrorBox aError( pThis, WB_OK, sError );
+                    aError.Execute();
+                    return 0;
+                }
+            }
+        }
+        break;
+
+        default:
+            DBG_ERROR("SvtFileDialog, OpenHdl_Impl: invalid mode!");
+    }
+
+    // Interessenten benachrichtigen.
+    long nRet;
+
+    if ( pThis->_aOKHdl.IsSet() )
+        nRet = pThis->_aOKHdl.Call( pThis );
+    else
+        nRet = pThis->OK();
+
+    if ( nRet )
+    {
+        pThis->EndDialog( TRUE );
+    }
+
+    return nRet;
 }
 
 //*****************************************************************************
 
 IMPL_STATIC_LINK( SvtFileDialog, FilterSelectHdl_Impl, ListBox*, pBox )
 {
-	DBG_ASSERT( pBox, "SvtFileDialog:keine Instanz" );
-
-	// wurde der Handler vom Travel-Timer gefeuert?
-	if ( pBox == (ListBox*)&pThis->_pImp->_aFilterTimer )
-	{
-		// Anzeige erneut filtern.
-		pThis->ExecuteFilter();
-		return 0;
-	}
-
-	String sSelectedFilterDisplayName;
-	SvtFileDialogFilter_Impl* pSelectedFilter = pThis->_pImp->GetSelectedFilterEntry( sSelectedFilterDisplayName );
-	if ( !pSelectedFilter )
-	{	// there is no current selection. This happens if for instance the user selects a group separator using
-		// the keyboard, and then presses enter: When the selection happens, we immediately deselect the entry,
-		// so in this situation there is no current selection.
-		if ( restoreCurrentFilter( pThis->_pImp ) )
-			pThis->ExecuteFilter();
-	}
-	else
-	{
-		if ( pSelectedFilter->isGroupSeparator() )
-		{	// group separators can't be selected
-			// return to the previously selected entry
-			if ( pThis->_pImp->IsFilterListTravelSelect() )
-			{
-				pThis->_pImp->SetNoFilterListSelection( );
-
-				// stop the timer for executing the filter
-				if ( pThis->_pImp->_aFilterTimer.IsActive() )
-					pThis->_pImp->m_bNeedDelayedFilterExecute = sal_True;
-				pThis->_pImp->_aFilterTimer.Stop();
-			}
-			else
-			{
-				if ( restoreCurrentFilter( pThis->_pImp ) )
-					pThis->ExecuteFilter();
-			}
-		}
-		else if	(	( pSelectedFilter != pThis->_pImp->GetCurFilter() )
-				||	pThis->_pImp->_pUserFilter
-				)
-		{
+    DBG_ASSERT( pBox, "SvtFileDialog:keine Instanz" );
+
+    // wurde der Handler vom Travel-Timer gefeuert?
+    if ( pBox == (ListBox*)&pThis->_pImp->_aFilterTimer )
+    {
+        // Anzeige erneut filtern.
+        pThis->ExecuteFilter();
+        return 0;
+    }
+
+    String sSelectedFilterDisplayName;
+    SvtFileDialogFilter_Impl* pSelectedFilter = pThis->_pImp->GetSelectedFilterEntry( sSelectedFilterDisplayName );
+    if ( !pSelectedFilter )
+    {   // there is no current selection. This happens if for instance the user selects a group separator using
+        // the keyboard, and then presses enter: When the selection happens, we immediately deselect the entry,
+        // so in this situation there is no current selection.
+        if ( restoreCurrentFilter( pThis->_pImp ) )
+            pThis->ExecuteFilter();
+    }
+    else
+    {
+        if ( pSelectedFilter->isGroupSeparator() )
+        {   // group separators can't be selected
+            // return to the previously selected entry
+            if ( pThis->_pImp->IsFilterListTravelSelect() )
+            {
+                pThis->_pImp->SetNoFilterListSelection( );
+
+                // stop the timer for executing the filter
+                if ( pThis->_pImp->_aFilterTimer.IsActive() )
+                    pThis->_pImp->m_bNeedDelayedFilterExecute = sal_True;
+                pThis->_pImp->_aFilterTimer.Stop();
+            }
+            else
+            {
+                if ( restoreCurrentFilter( pThis->_pImp ) )
+                    pThis->ExecuteFilter();
+            }
+        }
+        else if ( ( pSelectedFilter != pThis->_pImp->GetCurFilter() )